@wdslib/go-utils 0.5.2 → 0.5.3
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 +1 -1
- package/dist/types/tool/index.d.ts +1 -0
- package/package.json +1 -1
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 n(e,t,o,r){return new(o||(o=Promise))((function(i,n){function a(e){try{l(r.next(e))}catch(e){n(e)}}function s(e){try{l(r.throw(e))}catch(e){n(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(a,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const a=3e4,s=3e4,l=(t="",o)=>{let r=e.create({baseURL:t,timeout:a,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 n(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="jspaths",o)=>n(void 0,void 0,void 0,(function*(){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="jspaths")=>n(void 0,void 0,void 0,(function*(){const o="fonts"===t?d:c;yield Promise.all(e.map((e=>o(e))))})),h=e=>n(void 0,void 0,void 0,(function*(){e.fonts&&e.fonts.length&&(yield u(e.fonts,"fonts"))})),p=({jspaths:e=[],csspaths:o=[],fonts:r=[]})=>n(void 0,void 0,void 0,(function*(){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(/>/g,">").replace(/</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,n;if(e)for(const a of e){const e=null===(n=null===(i=null===(r=null==a?void 0:a.tmpData)||void 0===r?void 0:r.source)||void 0===i?void 0:i.converse)||void 0===n?void 0:n.data;(null==e?void 0:e.length)&&D(e),t(a),a.children?o(a.children):a.dynamicChildren?N(a.dynamicChildren,o):a.stateChildren&&o(a.stateChildren)}};o(e)},S=(e,t)=>n(void 0,void 0,void 0,(function*(){const o=e=>n(void 0,void 0,void 0,(function*(){var r,i,n,a;for(const s of e){(null===(a=null===(n=null===(i=null===(r=null==s?void 0:s.tmpData)||void 0===r?void 0:r.source)||void 0===i?void 0:i.converse)||void 0===n?void 0:n.data)||void 0===a?void 0:a.length)&&(yield D(s.tmpData.source.converse.data)),yield t(s);const e=[s.children,s.dynamicChildren?yield N(s.dynamicChildren,o):null,s.stateChildren].filter(Boolean);for(const t of e)yield o(t)}}));yield o(e)})),A=(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 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))&&(i=A(a.inputSql||a.url||(null===(r=a.headers)||void 0===r?void 0:r.value)||a.params,o)),i},I=(e,o,r=!1)=>{let i=null;const n=e=>{for(const a of e){if(a.cid===o){i=a,r&&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),i},O=(e,o,r)=>{let i=!1;const n=e=>{for(let a=0;a<e.length;a++){if(e[a].cid==o){i=e[a],r&&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),i||!1};function T(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 V(e,o,r){let i=t.cloneDeep(o);const n={};r&&r.forEach((e=>{(null==e?void 0:e.name)&&(n[e.name]=e.value||e.originvalue)}));try{return new Function("data","vars",e)(i,n)}catch(e){return console.error(e),i}}const F=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)},E=e=>{let t=window.goFetchList;t&&t[e]&&delete t[e]};function j(e){const t=e.match(/\.([^\/\\]+)$/);return t?t[1].toLowerCase():void 0}const P=e=>{const t=[];let o=function(e){return e.endsWith("/")?e.slice(0,-1):e}(window.baseUrl);return k(e,(e=>{var r,i,n,a,s,l,d,c,u;if("AnDeckHeader3"==e.viewComName&&(null===(n=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===n?void 0:n.path)){let r=j(e.tmpData.option.bgImage.path);t.push({type:r,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 r=j(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};function $(e,t){const o=M();return($=function(e,t){return o[e-=261]})(e,t)}const R=$;function M(){const e=["7UPegPt","helloX","101103gTMnwz","anov@2019:","149enyQdW","45665RoGNCN","anov@2020:","8508599uBIQaP","426790LJjXRf","188usEQPq","8726DMTNEL","1936DnLjOl","3080442wFrdqQ","8649UPqoeO"];return(M=function(){return e})()}!function(){const e=$,t=M();for(;;)try{if(348208===-parseInt(e(263))/1*(parseInt(e(269))/2)+parseInt(e(261))/3+parseInt(e(268))/4*(parseInt(e(264))/5)+-parseInt(e(271))/6*(parseInt(e(273))/7)+-parseInt(e(270))/8*(-parseInt(e(272))/9)+parseInt(e(267))/10+parseInt(e(266))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();var U={key:R(262)+R(274),vi:R(265)+R(274)};const B={key:U.key,iv:U.vi};function q(e){let t=r.enc.Utf8.parse(B.key),o=r.enc.Utf8.parse(B.iv);return r.AES.encrypt(e,t,{iv:o,mode:r.mode.CBC,padding:r.pad.Pkcs7}).toString()}function L(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 H=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"]),z=URL.createObjectURL(H);function J(e,t,o={},r="worker"){return n(this,void 0,void 0,(function*(){try{if("window"==r){if("string"==typeof t)try{t=JSON.parse(t)}catch(e){console.log("转换失败!")}let[r,i]=[["data"],[t]];"object"==typeof o&&Object.keys(o).forEach((e=>{r.push(e),i.push(o[e])}));const n=new Function(...r,e)(...i);return console.log(n,"result"),{success:!0,data:n}}{let[r,i,a]=[t,o,""];"object"==typeof r&&(r=JSON.stringify(t)),"object"==typeof o&&(i=JSON.stringify(o)),Object.keys(o).forEach((e=>a+=`${e},`));let s=`let data=eval(${r}); \n let app=${JSON.stringify({})};`;s+=a?`let {${a}} = eval(${i}); `:"",s+=`${e}`;let l=yield function(e,t=5e3){return n(this,void 0,void 0,(function*(){let o=new Worker(z);return new Promise(((r,i)=>{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?r(o):i(a)};o.postMessage({code:e}),o.addEventListener("message",a);let s=setTimeout((()=>{n(),i("timeout")}),t)}))}))}(s);return{success:!0,data:l}}}catch(e){return{success:!1,error:e,data:t}}}))}var G,_,W,Q;!function(e){e.StaticFile="staticFile",e.DataSource="datasource"}(G||(G={})),function(e){e.json="application/json;charset=UTF-8",e.form="application/x-www-form-urlencoded; charset=UTF-8"}(_||(_={})),function(e){e.get="GET",e.post="POST",e.put="PUT",e.patch="PATCH",e.delete="DELETE"}(W||(W={}));class X{constructor(e){this.db=null,this.dbName=e.databaseName,this.tableName=e.tableName,this.keyPath=e.keyPath}static getInstance(e){return X.instance||(X.instance=new X(e)),X.instance}init(){return n(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 n(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 n(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 n(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 n(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 n(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)}}))}))}}X.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"}(Q||(Q={}));const K={databaseName:"GODB",tableName:"go-log",keyPath:"time"};class Y{constructor(){this.logLevel=Q.INFO,this.indexedDBInstance=X.getInstance(K);try{this.indexedDBInstance.init(),console.log("IndexedDB 初始化成功。")}catch(e){console.error("初始化 IndexedDB 时出错:",e)}}static getInstance(){return Y.instance||(Y.instance=new Y),Y.instance}setLogLevel(e){this.logLevel=e}getColor(e){switch(e){case Q.FATAL:return"[31;1m";case Q.ERROR:return"[31m";case Q.WARN:return"[33m";case Q.INFO:return"[32m";case Q.DEBUG:return"[36m";case Q.TRACE:return"[34m";default:return"[0m"}}log(e,t){if(t<=this.logLevel){const o=(new Date).toISOString(),r=`[${o}] [${Q[t]}]`,i=this.getColor(t);if(null===window||void 0===window?void 0:window.goDev)console.log(`${i}${r} ${e}[0m`);else{let t=w("anov-go-userInfo"),n=w("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(`${i}${r} ${a} ${e}[0m`)}}}fatal(e){this.log(e,Q.FATAL)}error(e){this.log(e,Q.ERROR)}warn(e){this.log(e,Q.WARN)}info(e){this.log(e,Q.INFO)}debug(e){this.log(e,Q.DEBUG)}trace(e){this.log(e,Q.TRACE)}}const Z=Y.getInstance(),ee=(e,t)=>"string"!=typeof e?Promise.reject(new Error("URL should be a string")):l(e,t),te=l();let oe=l();function re(e,o="get",r={},i={},a){return n(this,void 0,void 0,(function*(){try{const l={method:W[o],url:e,headers:i,timeout:s};let d;["post","put"].includes(o.toLowerCase())?l.data=t.cloneDeep(r):l.params=t.cloneDeep(d),a&&(l.headers.sponsor=a);return/.json$/.test(e)?function(e){return n(this,void 0,void 0,(function*(){try{return yield te({method:"get",url:e})}catch(e){throw console.error("JSON 数据请求:",e),e}}))}(e):function(e){return n(this,void 0,void 0,(function*(){try{return{code:2e4,data:(yield te(e)).data}}catch(e){throw console.error("请求数据发生错误-Error:",e),e}}))}(l)}catch(e){throw console.error("获取数据:Error:",e),e}}))}function ie(e,t,o,r,i){return n(this,void 0,void 0,(function*(){try{const n=window.anUrl||"",a=n+(window.agentPath||"/ds/v1/api-proxy/v1/query"),s=v(o,!0);return yield te({url:a,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 ne(e,t,o,r,i,a){return n(this,void 0,void 0,(function*(){return i?ie(t,e,o,r,a):re(e,t,o,r,a)}))}function ae(e,t="",o){var r,i,n,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===(n=ye("YZH_EXCHANGE_TOKEN"))||void 0===n?void 0:n.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 te({method:"POST",url:l,data:{headers:o,param:d},timeout:a})}function se(e="",t,o){const r=`${null===window||void 0===window?void 0:window.BaseUrl}/ds/v1/data-views/query/v1/${o}`;let i={};try{i=e?JSON.parse(e):{}}catch(t){i=e||{}}return te({method:"POST",url:r,data:{headers:t,param:i},timeout:a})}const le=(e,t)=>n(void 0,void 0,void 0,(function*(){const o=window.BaseUrl,{dateType:r="",endPeriod:i="",metricsName:n=e,startPeriod:s=""}=t;return oe({method:"GET",url:`${o}ds/v1/metrics/v1/data-alarm?dateType=${r}&endPeriod=${i}&metricsName=${n}&startPeriod=${s}`,timeout:a})})),de=(e,t,o)=>n(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 n={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(!n)throw new Error("Invalid data type provided");return te(Object.assign({timeout:a},n))})),ce=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")})),ue=(e,t,o)=>{try{let r;switch(t){case"api":{let t=Se(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=De(e.inputSql,o);return{dsName:e.dsName,dsType:"1",sql:q(t),filter:e.sqlFilter}}case"staticFile":return{dsName:e.dsName,dsType:e.dsType,sql:""};case"indicator":return r=Ae(e,o),{zbId:e.zbId,params:De(r.params,o),headers:De(r.headers,o)};case"dataSet":return{params:De(e.params,o),headers:De(e.headers,o),value:e.value};case"indicatorCQ":return{zbName:e.zbName,params:De(e.params,o)};case"packData":return{};default:throw new Error("Invalid type")}}catch(t){console.log("准备请求数据发生错误",t,e)}},he=(e,t,o)=>n(void 0,void 0,void 0,(function*(){try{switch(t){case"api":return yield ne(e.url,e.requestType,e.params,e.headers,e.agency,o);case"static":return yield ce(e.data);case"datasource":return yield de(e.dsName,{dsType:e.dsType,sql:e.sql,filter:e.filter},"datasource");case"staticFile":return yield de(e.dsName,{dsType:e.dsType,sql:e.sql},"staticFile");case"indicator":return yield ae(e.zbId,e.params,e.headers);case"dataSet":return yield se(e.params,e.headers,e.value);case"indicatorCQ":return yield le(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})}))}})),pe=(e,t,o,r=[],i=!1)=>n(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=r.find((e=>e.key===a.id||e.key===a.key)),t=w(a.id);if(t&&!i)return t.data;if(e){let t=yield me(e,o),r={key:a.id,data:t};return b(a.id,r),t}return}const s=ue(a,n,o),l=yield he(s,n,e.cid?e.cid:"");return(null==l?void 0:l.data)?l.data:l})),me=(e,t)=>n(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],n=ue(i,r,t),a=yield he(n,r);return yield fe(a.data,o,!0,t)})),fe=(e,o,r=!0,i)=>n(void 0,void 0,void 0,(function*(){try{const{converse:a,mapFields:s}=o.tmpData.source;if(a&&a.use&&r){const o=yield function(e,o,r,i){return n(this,void 0,void 0,(function*(){let r,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={};i&&a&&o&&o.length&&o.map((e=>{let o=t.cloneDeep(i).filter((t=>{let o=t.mapField==e;return o&&(a[e]=t.value),o}));o&&0!=o.length||(a[e]="")})),r=yield J(s[e].code,n,a,s[e].mode?s[e].mode:"worker"),n=r.data}return n}))}(t.cloneDeep(e),a,0,i);return o}return e}catch(t){return console.error("执行过滤器发生错误:",t),e}})),ge=(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},ve=(e,t,o=[],r,i,a)=>n(void 0,void 0,void 0,(function*(){try{let n=e.tmpData.source.type,s=yield pe(e,n,o,r,a||!1);if(null==s||!s)return i&&i({error:!0}),Promise.resolve({error:!0});let l=yield fe(s,e,t,o);return yield ge(e,l),i&&i(l),(null==e?void 0:e.cid)&&E(e.cid),Promise.resolve(l)}catch(t){return i&&i(t),Z.error("Error in updateComData"),console.error("Error in updateComData:",t,e),Promise.reject(t)}})),ye=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},be=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}},we=(e,t)=>{if(!t)return be(e);if("string"==typeof e){if(""===e.trim())return"";const o=e.replace(/{{(\w+)}}/g,((e,o)=>{const r=t.find((e=>e.mapField===o));if(r){const e=r.value||r.originalValue||"";if("string"==typeof e)return/^[0-9]+$/.test(e)?e:`"${e}"`;if("number"==typeof e||"boolean"==typeof e)return e}return e}));return be(o)}if(Array.isArray(e))return e.map((e=>De(e,t)));if("object"==typeof e&&null!==e){const o={};for(const r in e)o[r]=De(e[r],t);return be(o)}return be(e)},De=(e,t)=>{if(!t)return be(e);if("string"==typeof e){if(/{{\w+}}/.test(e)){const o=e.replace(/{{(\w+)}}/g,((e,o)=>{const r=t.find((e=>e.mapField===o));return r?String(r.value||r.originalValue||""):e}));return be(o)}return e}if(Array.isArray(e))return e.map((e=>De(e,t)));if("object"==typeof e&&null!==e){const o={};for(const r in e)o[r]=De(e[r],t);return o}return e},Ne=(e,t)=>{if(!t)return be(e);if("string"==typeof e){if(""===e.trim())return"";console.log(e,"value");const o=e.replace(/{{(\w+)}}/g,((e,o)=>{const r=t.find((e=>e.mapField===o));if(r){const e=r.value||r.originalValue||"";return"number"==typeof e||"boolean"==typeof e?e:`${String(e)}`}return e}));return console.log(o,"replacedValue"),be(o)}if(Array.isArray(e))return e.map((e=>De(e,t)));if("object"==typeof e&&null!==e){const o={};for(const r in e)o[r]=De(e[r],t);return be(o)}return be(e)},ke=(e,t)=>{if(!t)return be(e);if("string"==typeof e){if(""===e.trim())return"";try{if("string"!=typeof JSON.parse(e))return"number"==typeof JSON.parse(e)?e:De(JSON.parse(e),t);{let o=e.replace(/@(\w+)|{{(\w+)}}/g,((e,o,r)=>{const i=o||r,n=t.find((e=>e.mapField===i));if(n){const e=n.value||n.originalValue;return console.log(e,"123123131"),"number"==typeof e?e:String(e)}return e}));return be(o)}}catch(o){let r=e.replace(/@(\w+)|{{(\w+)}}/g,((e,o,r)=>{const i=o||r,n=t.find((e=>e.mapField===i));if(n){const e=n.value;return console.log(e,"value"),"number"==typeof e?e:String(e)}return e}));return be(r)}}else{if(Array.isArray(e))return e.map((e=>De(e,t)));if("object"==typeof e&&null!==e){const o={};for(let r in e)o[r]=De(e[r],t);return be(o)}}return be(e)},Se=(e,t)=>{const o=e.agency,r=e,{url:i=null,headers:n,params:a,requestType:s}=r,l=i?De(i,t):void 0,d=n&&n.use?De(n.value,t):{};return{url:l,requestType:s,params:a?De(a,t):{},headers:d,agency:o}},Ae=(e,t)=>{const{headers:o,params:r}=e,i=o&&o.use?De(o.value,t):{};return{params:r?De(r,t):{},headers:i}},xe=(e,t,o,r,i)=>n(void 0,void 0,void 0,(function*(){if(e&&e.length)for(const n of e){C(t,n.value,o)&&(yield ve({tmpData:{source:{type:"globalData",globalData:{id:n.key}}}},!0,o,e,(e=>{console.log("数据更新成功-变量改变全局数据跟新")}),!0),k(r,(t=>{var r,a,s;if("globalData"===(null===(a=null===(r=null==t?void 0:t.tmpData)||void 0===r?void 0:r.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&&ve(t,!0,o,e,(e=>{i(t,e)}),!1)}})))}})),Ce=(e,t,o,r,i)=>n(void 0,void 0,void 0,(function*(){e&&(yield ve({tmpData:{source:{type:"globalData",globalData:{id:e.key}}}},!0,t,o,(e=>{console.log("数据更新成功")}),!0),k(r,(r=>{var n,a,s;if("globalData"===(null===(a=null===(n=null==r?void 0:r.tmpData)||void 0===n?void 0:n.source)||void 0===a?void 0:a.type)){(null===(s=null==r?void 0:r.tmpData)||void 0===s?void 0:s.source.globalData).id===e.key&&ve(r,!0,t,o,(e=>{i(r,e)}),!1)}})))}));class Ie{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 V(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,i.field&&(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 Ie(e,t)}}class Oe{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 Oe.instance||(Oe.instance=new Oe),Oe.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=Ie.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: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!==r&&(v.id=r),void 0!==i&&(v.key=i),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 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 e?(this.addUrlParamsToGlobalVars(),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)}))}}Oe.instance=null;const Te=Oe.getInstance(),Ve=(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))),Fe=(e,t,o,r)=>{const i=((e,t,o,r)=>{var i;let n;if(Ve(e,null==t?void 0:t.field)||Ve(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(Ve(e.data,null==t?void 0:t.field)||Ve(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,r),a=(null===(i=null==e?void 0:e.tmpData)||void 0===i?void 0:i.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,r);return void 0!==i?i:t.value},Ee=(e,t,o,r,i,n,a,s,l)=>{var d;switch(e.type){case"link":let c=De(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],r=n.find((e=>e.mapField==o.mapField));r&&(o.value=r.value)}l&&l(e);break;case"dynamic":((e,t,o,r,i)=>{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||!r||e.index===t.index-1,i({cid:n.cid,flag:a.visible}))}})(e,t,o,r,i);break;case"toggle":((e,t,o,r,i)=>{const n=e.children||[];for(const o of n){const n=o.visible&&(!r||e.index===t.index-1);i({cid:o.cid,flag:n})}})(e,t,0,r,i);break;case"update":((e,t,o,r,i)=>{const n=e.children||[];for(const e of n){const n=I(t,e.cid);n&&ve(n,!0,o,r,(e=>{i({cid:n.cid,data:e})}))}})(e,o,n,a,s)}},je=(e,o,r,i,n,a,s,l,d,c)=>{const{cid:u,actions:h,index:p}=n,{eventName:m,mode:f}=h,g=2===f;((e,o,r,i,n,a)=>{let s=Te.getVariableForId(o.cid);if(null==s?void 0:s.length)for(const l of s)if(l.type==e){let e=Fe(o,l,r,i);Te.editVariableForValue(l.mapField,e,(()=>{let e=n[l.mapField]||[],o=Te.getForkList(l.mapField);if(o)for(const r of o){let o=n[r.mapField];e=t.concat(e,o)}a&&a(l,t.uniq(e))}))}})(m,n,i,u,r,((e,t)=>{if(xe(d,e.mapField,Te.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=I(i,o);!(null==e?void 0:e.delayUpdate)&&t&&ve(t,!0,Te.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)Ee(e,n,i,g,a,Te.getAllVariables(),d,s,l)};function Pe(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=Pe(e[r],t[r]);null!==i&&Object.keys(i).length>0&&(o[r]=i)}return Object.keys(o).length>0?o:null}function $e(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]=$e(o[e],t[e]));return o}const Re=(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},Me=(e,o)=>{let{option:r,actions:i,data:n,optionDes:a,actionsDes:s,source:l,theme:d}=((e,o)=>{let{option:r,actions:i,data:n,optionDes:a,actionsDes:s,source:l,theme:d}=t.cloneDeep(o[e]);return{option:r,actions:i,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:r,source:Re(n,l),actions:i},baseData:Be(),dynamic:null,filePath:"",origin:"anov-ui",name:"",componentType:"",viewComName:e,optionComName:"AnOptionPanel",dataComName:"AnSourcePanel",eventComName:"AnActionsPanel",assemblyDeveloper:"",devEmail:"",version:"",devDept:""}},Ue=(e,o,r)=>{let i=Me(e,o);return r?t.merge(i,r):i},Be=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 qe{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,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=r<l&&i>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,r=e[0].left+e[0].width,i=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),r=Math.max(r,a.left+a.width),i=Math.max(i,a.top+a.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)),n=Math.max(0,Math.min(o.top+o.height,r.top+r.height)-Math.max(o.top,r.top));return i>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: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 n of e){const e=n.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 n=[];for(const e of o){const t=Math.max(...e);n.push(t)}return n}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,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||r&&r.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,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 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<i&&o<a.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 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<i&&o<a.width&&t.top-a.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 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<i&&o<a.width&&t.top-a.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,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||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<n&&(n=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,n,a,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))&&(n=i[0],a=i[1]),t.remove(this.list,(t=>t.cid==e.cid))}let l=Ue("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:n,unit:a},l.tmpData.source.static.originData={text:r,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 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 n=e[i];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,r);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,r=[]){const i=e;let n=this.findNearestTitleForPoint(t.cloneDeep(o),i);return n?n.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 Le=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)]}},He=()=>{const e=[],t=Le.pick([!0,!1]);let o=Le.randomNum(3,20);const r=Le.pick([null,null,null,{}]);let i=Le.pick(["asc","desc",void 0,void 0,void 0]);for(let n=0;n<Le.randomNum(1,9);n++)e.push({data:Le.generateRandomIntArray(o,0,300,i),type:"line",smooth:t,symbolSize:Le.randomNum(1,10),lineStyle:{width:Le.randomNum(1,4)},areaStyle:r});return{xAxis:{type:"category",show:!1,boundaryGap:!1,data:Le.generateRandomNameArray(o,3,6)},grid:{left:0,top:0,bottom:0,right:0},yAxis:{show:!1,type:"value"},series:e}},ze=(e,t)=>{let o={type:e,show:!1};return"category"===e&&(o.data=Le.generateRandomNameArray(t,3,6)),o},Je=()=>{const e=[],t=Le.pick([!0,!1]);let o=Le.randomNum(3,20);const r=Le.pick([null,null,null,{}]);let i=Le.pick(["asc","desc",void 0,void 0,void 0]),n=Le.randomNum(1,9),a=Le.pick([!0,!1]);for(let s=0;s<n;s++){let n={data:Le.generateRandomIntArray(o,0,300,i),type:"bar",smooth:t,stack:a,areaStyle:r};e.push(n)}let s=Le.pick(["value","category"]),l=Le.pick(["value","category"],s);return{xAxis:ze(s,o),grid:{left:0,top:0,bottom:0,right:0},yAxis:ze(l,o),series:e}},Ge=()=>{const e=[];let t=Le.randomNum(3,20);Le.pick([null,null,null,{}]);let o=Le.pick(["asc","desc",void 0,void 0,void 0]),r=Le.pick([1,2]),i=[Le.pick(["10%","20%","30%","40%","50%","60%","70%","80%"]),Le.pick(["90%","100%"])];return e.push({data:Le.generateRandomIntArray(t,3,20,o),type:"pie",radius:1==r?"100%":i,roseType:1==r?Le.pick(["area",null,null]):null,padAngle:1==r?0:Le.randomNum(1,5),startAngle:1==r?Le.pick([0,180]):0,endAngle:360,label:{show:!1},itemStyle:{borderRadius:3}}),{grid:{left:0,top:0,bottom:0,right:0},series:e}},_e=()=>{const e=[];Le.pick([!0,!1]),Le.randomNum(3,20),Le.pick([null,null,null,{}]),Le.pick(["asc","desc",void 0,void 0,void 0]);for(let t=0;t<Le.randomNum(1,20);t++){let t=Le.randomNum(3,Le.randomNum(3,20)),o=[];for(let e=0;e<t;e++){let e=[];for(let t=0;t<2;t++)e.push(Le.randomNum(1,30));o.push(e)}e.push({type:"scatter",symbolSize:Le.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}},We=()=>{const e=[],t=Le.pick(["polygon","circle"]);let o=Le.randomNum(1e4,99999),r=Le.randomNum(3,10),i=[];for(let e=0;e<r;e++)i.push({name:Le.randomString(4,8),max:o});for(let t=0;t<Le.randomNum(2,10);t++)e.push({value:Le.generateRandomIntArray(r,1e4,o),name:Le.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}]}},Qe=()=>{const e=[];for(let t=0;t<Le.randomNum(4,15);t++)e.push({value:Le.randomNum(1,100),name:Le.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:Le.pick(["descending","ascending"]),gap:2,lineStyle:{width:1},data:e}]}};let Xe=Le.randomNum(5,20);const Ke={width:Xe};Le.pick([!0,!1])&&(Ke.color=[[.3,"#67e0e3"],[.7,"#37a2da"],[1,"#fd666d"]]);class Ye{constructor(){this.names=["line","bar","pie","scatter","radar","funnel","gauge"]}static getInstance(){return Ye.instance||(Ye.instance=new Ye),Ye.instance}createLine(){switch(Le.pick(this.names)){case"line":return{type:"line",typeNum:1,option:He()};case"bar":return{type:"bar",typeNum:2,option:Je()};case"pie":return{type:"pie",typeNum:3,option:Ge()};case"scatter":return{type:"scatter",typeNum:4,option:_e()};case"radar":return{type:"radar",typeNum:5,option:We()};case"funnel":return{type:"funnel",typeNum:6,option:Qe()};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:Le.pick([!0,!1]),width:Xe},axisLine:{lineStyle:Ke},data:[{value:Le.randomNum(1,100),name:"SCORE"}]}]}}}}}Ye.instance=null;const Ze=Ye.getInstance();const et=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 n=L(this.directions);n&&(this.direction=n);let a=[];if("row"===this.direction){let e=L([3,4]);a=this.simulateRandomSegments(24,4,12,e)}else{let e=L([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:r,hStep:i});else{let t=s[e-1].x;s.push({x:a[e-1]+t,y:0,w:a[e],h:24,i:e,wStep:r,hStep:i})}let e=L([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:r,hStep:i})}}}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:r,hStep:i});else{let t=s[e-1].y;s.push({x:0,y:a[e-1]+t,w:24,h:a[e],i:e,wStep:r,hStep:i})}for(let e=0;e<s.length;e++){const t=s[e];let o=L([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: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=a[o-1].x;a.push({x:n[o-1]+d,y:t.y,w:s,h:t.h,i:10*e+o,wStep:r,hStep:i}),l.push({x:n[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}=Ze.createLine(),i=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==r||5==r||7==r){let e=Math.min(a,s);a=e,s=e}let l=e.wrapWidth,d=e.wrapHeight;return t.chartsOption=o,t.typeNum=r,t.txt=r+" "+i/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,r){const i=[];let n=e,a=r;for(;a>0;)if(1===a)i.push(n),a--;else{const e=Math.min(o,n-t*(a-1)),r=Math.floor(Math.random()*(e-t+1))+t;i.push(r),n-=r,a--}return i}simulateRandomSegments2(e,t,o,r){const i=[];let n=e,a=r;for(;a>0;)if(1==a){const t=e-i.reduce(((e,t)=>e+t),0);i.push(t),a--}else{let e=Math.floor(Math.random()*o),r=Math.max(t,e),s=n-t*a;const l=Math.min(r,s);i.push(l),n-=l,a--}return i}},tt=e=>{try{return JSON.parse(e)}catch(t){return e}};const ot=new class{constructor(){this.requested=new Set,this.dbName="go-db",this.storeName="store",this.init()}init(){return n(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 n(this,void 0,void 0,(function*(){if(!(yield this.isExist(e))){t.caseDetailData&&(t.caseDetailData="string"==typeof t.caseDetailData?tt(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 n(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=tt(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 n(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 n(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 n(this,void 0,void 0,(function*(){if(yield this.isExist(e)){const o=yield this.get(e),r=tt(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 n(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 n(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 n(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 n(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 rt(e){!function(e,t){e.depends?i(e):it(e,t)}(e,!1)}function it(e,t=!0){let{theme:o,option:r,optionDes:i}=e;r&&i&&o&&Object.keys(i).forEach((n=>{"conditionSeries"!==i[n].type&&"tabs"!==i[n].type||!r[n]?i[n].theme?r.hasOwnProperty(n)&&function({theme:e,option:t,optionDes:o},r,i){let n;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:a,degree:s,type:l,opacity:d}=o[r].theme;if(a){s||(s=90),l||(l="linear");let o=`${l}-gradient(${s}deg`,i=100/(a.length-1),c=[];a.forEach(((t,r)=>{n=nt(e,t),o+=`,${at(n,t.opacity)} ${i*r}%`;let{red:a,green:s,blue:l,alpha:u}=st(n,d);c.push({red:a,green:s,blue:l,alpha:u,left:i*r})})),o+=")",t[r].style=o,t[r].degree=s,t[r].flag=a.length?3:2,t[r].points=c,t[r].type=l}else i&&(n=nt(e,o[r].theme),t[r]=Object.assign(Object.assign({},st(n,d)),{style:at(n,d)}))}}else{let{opacity:i}=o[r].theme;n=nt(e,o[r].theme),t[r]=at(n,i)}}(e,n,t):i[n].hasOwnProperty("type")&&"slot"!=i[n].type&&"textStyle"!=i[n].type&&"sheet"!=i[n].type||i[n].constructor!=Object||it({option:r[n],optionDes:i[n],theme:o},t):function(e,t,o,r,i,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],it({option:t,optionDes:o,theme:r},i)}else{let e=s.length;for(let t=0;t<e;t++){let e;e=n?s[t].form:s[t],it({option:e,optionDes:a,theme:r},i)}}}(r[n],i[n],0,o,t,"conditionSeries"===i[n].type)}))}function nt(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]:(lt(`属性${o}不存在,获取主题颜色错误,将使用默认主题色`),e.color)))}return lt(`属性${t.key}不存在,获取主题颜色错误,将使用默认主题色`),e.color}function at(e,t){let{red:o,green:r,blue:i,alpha:n}=st(e,t);return`rgba(${o},${r},${i},${n})`}function st(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 lt(e){console.warn(e)}class dt{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 n(this,void 0,void 0,(function*(){return yield new Promise(((e,t)=>{e("Hardware is not available")}))}))}checkSecurity(e){return n(this,void 0,void 0,(function*(){return yield new Promise(((t,o)=>{"preview"==this.environment?t(0):this.getShareForRelease(e).then((e=>{53107==e.code&&t(1),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 n(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 n(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 n(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 n(this,void 0,void 0,(function*(){if("local"==this.fetchMode){const o=yield ot.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,r=""){return n(this,void 0,void 0,(function*(){return yield this.findById(e,t,o,r)}))}updataPageData(e,t){var o;return n(this,void 0,void 0,(function*(){const r=this.getPageId(t,this.projectInfo.details);let i=yield this.getPageDataForID(e,r);if(null==i?void 0:i.data){let e=yield this.pageInit(i.data);return null===(o=null==this?void 0:this.lifecycleHooks)||void 0===o||o.onPageDataReady(e),e}return this.lifecycleHooks.validateError("请求页面数据失败"),console.error("请求数据发生错误!",i.msg),{type:"error",error:i.msg}}))}getPageDataForID(e,t,o){return n(this,void 0,void 0,(function*(){const r=this.getPageId(t,this.projectInfo.details);if(this.processedIds.has(r)&&"local"==this.fetchMode){console.log(`ID ${r} has already been processed.`);const t=yield ot.get(e+"_"+r);if(t||null==t)return{data:t}}const i=this.getPageData(e,r);this.processedIds.add(r),o&&o.length&&o.map((t=>n(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);ot.add(e+"_"+t,o.data),this.processedIds.add(t)}catch(e){console.error(`Error processing ID ${t}: ${e}`)}}))));const a=yield i;return ot.add(e+"_"+r,a.data),a}))}fetchPageDataForId(e,t="",o=0,r=""){return n(this,void 0,void 0,(function*(){return yield this.findById(e,t,o,r)}))}setTheme(){console.log("设置主题")}setBackground(){console.log("设置背景信息")}updateVariables(){console.log("更新变量信息")}beforeRender(e){}renderComponents(){return n(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,n=null===(r=this.staticComponentData[t.viewComName])||void 0===r?void 0:r.theme;return rt({theme:e,option:t.tmpData.option,optionDes:i,depends:n}),t}getComData(e,t,o,r){return n(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{if(e.tmpData&&e.tmpData.source)try{ve(e,!0,t,o,(t=>{e.source=t,r(1)}))}catch(e){r(e)}else r("")}))}))}processingData(e){return n(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){return n(this,void 0,void 0,(function*(){try{let t=null==e?void 0:e.caseDetailData,o=this.defaultTheme;(null==t?void 0:t.theme)&&(o=t.theme),this.setGlobalThemeVars(o),Te.clearVars(),Te.addVariables(t.globalVars);Te.getAllVariables();return t}catch(t){return console.warn("页面初始化发生错误:",t),(null==e?void 0:e.data)?e.data:e}}))}validate(e,t,o){return n(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{((e,o)=>{n(this,void 0,void 0,(function*(){let i=yield this.validateAccess(e,o),n=(null==i?void 0:i.pwd)?i.pwd:"",a=(null==i?void 0:i.mode)?i.mode:this.mode,s=(null==i?void 0:i.token)?i.token:"",l=yield this.fetchProjectForId(t,n,a,s);2e4==(null==l?void 0:l.code)&&(null==l?void 0:l.data)?(this.projectInfo=l.data,console.log("验证成功!"),this.lifecycleHooks.message("验证成功!"),r(!0)):(this.lifecycleHooks.validateError(l),this.lifecycleHooks.message(l.msg,"warning"))}))})(e,o)}))}))}init(e){var t;return n(this,void 0,void 0,(function*(){try{this.lifecycleHooks=e,yield this.checkHardware();let o=yield this.fetchCaseId(this.caseId,this.mode),r=yield this.checkSecurity(o),i=e.onValidateAccess||(()=>{}),n=yield this.validate(r,o,i);(n||0==n)&&e.onCaseReady(this.projectInfo);let a=(null===(t=this.projectInfo)||void 0===t?void 0:t.details).map((e=>e.id)),s=this.getPageId(this.pageId,this.projectInfo.details),l=yield this.getPageDataForID(o,s||a[0],a);if(53105===l.code){const t="访问权限不足";return e.onPageDataReady(t),{currentData:this.projectInfo,currentPageData:t}}let d=(null==l?void 0:l.data)?l.data:null;const c=yield this.pageInit(d);return e.onPageDataReady(c),{currentData:this.projectInfo,currentPageData:c}}catch(e){console.error("加载页面时出错:",e)}}))}}export{qe as ConfigOptimizer,Oe as GlobalVariables,ee as Http,Z as Log,dt as PageLoader,f as addPreloadLink,ie as agentData,$e as applyDiff,S as asyncRecursion,E as delFetchStatus,Pe as diffObjects,et as displayGenerator,ge as editItem,je as emitEvent,me as fetchDataByGlobal,pe as fetchDataByType,fe as filterData,I as findItemDeep,O as findItemDeep2,re as getData,ne as getDataForApi,se as getDataForDataSet,de as getDataForSource,ce as getDataForStatic,ae as getDataForZb,le as getDataForZbCQ,P as getResourceForComponent,w as getSessionData,v as getStandardData,A as getStringVars,g as getUrlParams,Fe as getVarDefaultVal,Te 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,De as replaceVariable,ke as replaceVariable2,Ne as replaceVariable3,we as replaceVariable4,T as safeEval,V as safeEvalForCode,F as setFetchStatus,b as setSessionData,xe as updataGlobalDataSourceForVar,ve as updateComData,Ce as updateGlobalDataSource};
|
|
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="jspaths",o)=>a(void 0,void 0,void 0,(function*(){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="jspaths")=>a(void 0,void 0,void 0,(function*(){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=({jspaths:e=[],csspaths:o=[],fonts:r=[]})=>a(void 0,void 0,void 0,(function*(){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(/>/g,">").replace(/</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)=>a(void 0,void 0,void 0,(function*(){const o=e=>a(void 0,void 0,void 0,(function*(){var r,i,a,n;for(const s of e){(null===(n=null===(a=null===(i=null===(r=null==s?void 0:s.tmpData)||void 0===r?void 0:r.source)||void 0===i?void 0:i.converse)||void 0===a?void 0:a.data)||void 0===n?void 0:n.length)&&(yield D(s.tmpData.source.converse.data)),yield t(s);const e=[s.children,s.dynamicChildren?yield N(s.dynamicChildren,o):null,s.stateChildren].filter(Boolean);for(const t of e)yield o(t)}}));yield o(e)})),A=(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&&C(r,i,o.cid),!0}return!1},x=(e,t)=>{const o=e.match(/{{\w+}}|@\w+/g);return!!o&&o.map((e=>e.replace(/{{|}}|@/g,""))).includes(t)},C=(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)},I=(e,t,o)=>{var r,i;let a=!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 console.log(332211),!0;const s=null==t?void 0:t[null==t?void 0:t.type];return((null==s?void 0:s.inputSql)||(null==s?void 0:s.url)||(null==s?void 0:s.headers)||(null==s?void 0:s.params))&&(a=x(s.inputSql||s.url||(null===(r=s.headers)||void 0===r?void 0:r.value)||s.params,e),A(s.inputSql||s.url||(null===(i=s.headers)||void 0===i?void 0:i.value)||s.params,o)),a},O=(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},T=(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 V(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 F(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 E=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)},j=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 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=P(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=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: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};function R(e,t){const o=U();return(R=function(e,t){return o[e-=261]})(e,t)}const M=R;function U(){const e=["7UPegPt","helloX","101103gTMnwz","anov@2019:","149enyQdW","45665RoGNCN","anov@2020:","8508599uBIQaP","426790LJjXRf","188usEQPq","8726DMTNEL","1936DnLjOl","3080442wFrdqQ","8649UPqoeO"];return(U=function(){return e})()}!function(){const e=R,t=U();for(;;)try{if(348208===-parseInt(e(263))/1*(parseInt(e(269))/2)+parseInt(e(261))/3+parseInt(e(268))/4*(parseInt(e(264))/5)+-parseInt(e(271))/6*(parseInt(e(273))/7)+-parseInt(e(270))/8*(-parseInt(e(272))/9)+parseInt(e(267))/10+parseInt(e(266))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();var B={key:M(262)+M(274),vi:M(265)+M(274)};const q={key:B.key,iv:B.vi};function L(e){let t=r.enc.Utf8.parse(q.key),o=r.enc.Utf8.parse(q.iv);return r.AES.encrypt(e,t,{iv:o,mode:r.mode.CBC,padding:r.pad.Pkcs7}).toString()}function H(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 z=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"]),J=URL.createObjectURL(z);function G(e,t,o={},r="worker"){return a(this,void 0,void 0,(function*(){try{if("window"==r){if("string"==typeof t)try{t=JSON.parse(t)}catch(e){console.log("转换失败!")}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)(...i);return console.log(a,"result"),{success:!0,data:a}}{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,t=5e3){return a(this,void 0,void 0,(function*(){let o=new Worker(J);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 _,W,Q,X;!function(e){e.StaticFile="staticFile",e.DataSource="datasource"}(_||(_={})),function(e){e.json="application/json;charset=UTF-8",e.form="application/x-www-form-urlencoded; charset=UTF-8"}(W||(W={})),function(e){e.get="GET",e.post="POST",e.put="PUT",e.patch="PATCH",e.delete="DELETE"}(Q||(Q={}));class K{constructor(e){this.db=null,this.dbName=e.databaseName,this.tableName=e.tableName,this.keyPath=e.keyPath}static getInstance(e){return K.instance||(K.instance=new K(e)),K.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)}}))}))}}K.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"}(X||(X={}));const Y={databaseName:"GODB",tableName:"go-log",keyPath:"time"};class Z{constructor(){this.logLevel=X.INFO,this.indexedDBInstance=K.getInstance(Y);try{this.indexedDBInstance.init(),console.log("IndexedDB 初始化成功。")}catch(e){console.error("初始化 IndexedDB 时出错:",e)}}static getInstance(){return Z.instance||(Z.instance=new Z),Z.instance}setLogLevel(e){this.logLevel=e}getColor(e){switch(e){case X.FATAL:return"[31;1m";case X.ERROR:return"[31m";case X.WARN:return"[33m";case X.INFO:return"[32m";case X.DEBUG:return"[36m";case X.TRACE:return"[34m";default:return"[0m"}}log(e,t){if(t<=this.logLevel){const o=(new Date).toISOString(),r=`[${o}] [${X[t]}]`,i=this.getColor(t);if(null===window||void 0===window?void 0:window.goDev)console.log(`${i}${r} ${e}[0m`);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}[0m`)}}}fatal(e){this.log(e,X.FATAL)}error(e){this.log(e,X.ERROR)}warn(e){this.log(e,X.WARN)}info(e){this.log(e,X.INFO)}debug(e){this.log(e,X.DEBUG)}trace(e){this.log(e,X.TRACE)}}const ee=Z.getInstance(),te=(e,t)=>"string"!=typeof e?Promise.reject(new Error("URL should be a string")):l(e,t),oe=l();let re=l();function ie(e,o="get",r={},i={},n){return a(this,void 0,void 0,(function*(){try{const l={method:Q[o],url:e,headers:i,timeout:s};let d;["post","put"].includes(o.toLowerCase())?l.data=t.cloneDeep(r):l.params=t.cloneDeep(d),n&&(l.headers.sponsor=n);return/.json$/.test(e)?function(e){return a(this,void 0,void 0,(function*(){try{return yield oe({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 oe(e)).data}}catch(e){throw console.error("请求数据发生错误-Error:",e),e}}))}(l)}catch(e){throw console.error("获取数据:Error:",e),e}}))}function ae(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 oe({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 ne(e,t,o,r,i,n){return a(this,void 0,void 0,(function*(){return i?ae(t,e,o,r,n):ie(e,t,o,r,n)}))}function se(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=be("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 oe({method:"POST",url:l,data:{headers:o,param:d},timeout:n})}function le(e="",t,o){const r=`${null===window||void 0===window?void 0:window.BaseUrl}/ds/v1/data-views/query/v1/${o}`;let i={};try{i=e?JSON.parse(e):{}}catch(t){i=e||{}}return oe({method:"POST",url:r,data:{headers:t,param:i},timeout:n})}const de=(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 re({method:"GET",url:`${o}ds/v1/metrics/v1/data-alarm?dateType=${r}&endPeriod=${i}&metricsName=${a}&startPeriod=${s}`,timeout:n})})),ce=(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 oe(Object.assign({timeout:n},a))})),ue=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")})),he=(e,t,o)=>{try{let r;switch(t){case"api":{let t=Ae(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=Ne(e.inputSql,o);return{dsName:e.dsName,dsType:"1",sql:L(t),filter:e.sqlFilter}}case"staticFile":return{dsName:e.dsName,dsType:e.dsType,sql:""};case"indicator":return r=xe(e,o),{zbId:e.zbId,params:Ne(r.params,o),headers:Ne(r.headers,o)};case"dataSet":return{params:Ne(e.params,o),headers:Ne(e.headers,o),value:e.value};case"indicatorCQ":return{zbName:e.zbName,params:Ne(e.params,o)};case"packData":return{};default:throw new Error("Invalid type")}}catch(t){console.log("准备请求数据发生错误",t,e)}},pe=(e,t,o)=>a(void 0,void 0,void 0,(function*(){try{switch(t){case"api":return yield ne(e.url,e.requestType,e.params,e.headers,e.agency,o);case"static":return yield ue(e.data);case"datasource":return yield ce(e.dsName,{dsType:e.dsType,sql:e.sql,filter:e.filter},"datasource");case"staticFile":return yield ce(e.dsName,{dsType:e.dsType,sql:e.sql},"staticFile");case"indicator":return yield se(e.zbId,e.params,e.headers);case"dataSet":return yield le(e.params,e.headers,e.value);case"indicatorCQ":return yield de(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})}))}})),me=(e,t,o,r=[],i=!1)=>a(void 0,void 0,void 0,(function*(){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 fe(e,o),r={key:n.id,data:t};return b(n.id,r),t}return}const s=he(n,a,o),l=yield pe(s,a,e.cid?e.cid:"");return(null==l?void 0:l.data)?l.data:l})),fe=(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=he(i,r,t),n=yield pe(a,r);return yield ge(n.data,o,!0,t)})),ge=(e,o,r=!0,i)=>a(void 0,void 0,void 0,(function*(){try{const{converse:n,mapFields:s}=o.tmpData.source;if(n&&n.use&&r){const o=yield function(e,o,r,i){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 G(s[e].code,a,n,s[e].mode?s[e].mode:"worker"),a=r.data}return a}))}(t.cloneDeep(e),n,0,i);return o}return e}catch(t){return console.error("执行过滤器发生错误:",t),e}})),ve=(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},ye=(e,t,o=[],r,i,n)=>a(void 0,void 0,void 0,(function*(){try{let a=e.tmpData.source.type,s=yield me(e,a,o,r,n||!1);if(null==s||!s)return i&&i({error:!0}),Promise.resolve({error:!0});let l=yield ge(s,e,t,o);return yield ve(e,l),i&&i(l),(null==e?void 0:e.cid)&&j(e.cid),Promise.resolve(l)}catch(t){return i&&i(t),ee.error("Error in updateComData"),console.error("Error in updateComData:",t,e),Promise.reject(t)}})),be=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},we=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}},De=(e,t)=>{if(!t)return we(e);if("string"==typeof e){if(""===e.trim())return"";const o=e.replace(/{{(\w+)}}/g,((e,o)=>{const r=t.find((e=>e.mapField===o));if(r){const e=r.value||r.originalValue||"";if("string"==typeof e)return/^[0-9]+$/.test(e)?e:`"${e}"`;if("number"==typeof e||"boolean"==typeof e)return e}return e}));return we(o)}if(Array.isArray(e))return e.map((e=>Ne(e,t)));if("object"==typeof e&&null!==e){const o={};for(const r in e)o[r]=Ne(e[r],t);return we(o)}return we(e)},Ne=(e,t)=>{if(!t)return we(e);if("string"==typeof e){if(/{{\w+}}/.test(e)){const o=e.replace(/{{(\w+)}}/g,((e,o)=>{const r=t.find((e=>e.mapField===o));return r?String(r.value||r.originalValue||""):e}));return we(o)}return e}if(Array.isArray(e))return e.map((e=>Ne(e,t)));if("object"==typeof e&&null!==e){const o={};for(const r in e)o[r]=Ne(e[r],t);return o}return e},ke=(e,t)=>{if(!t)return we(e);if("string"==typeof e){if(""===e.trim())return"";console.log(e,"value");const o=e.replace(/{{(\w+)}}/g,((e,o)=>{const r=t.find((e=>e.mapField===o));if(r){const e=r.value||r.originalValue||"";return"number"==typeof e||"boolean"==typeof e?e:`${String(e)}`}return e}));return console.log(o,"replacedValue"),we(o)}if(Array.isArray(e))return e.map((e=>Ne(e,t)));if("object"==typeof e&&null!==e){const o={};for(const r in e)o[r]=Ne(e[r],t);return we(o)}return we(e)},Se=(e,t)=>{if(!t)return we(e);if("string"==typeof e){if(""===e.trim())return"";try{if("string"!=typeof JSON.parse(e))return"number"==typeof JSON.parse(e)?e:Ne(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));if(a){const e=a.value||a.originalValue;return console.log(e,"123123131"),"number"==typeof e?e:String(e)}return e}));return we(o)}}catch(o){let r=e.replace(/@(\w+)|{{(\w+)}}/g,((e,o,r)=>{const i=o||r,a=t.find((e=>e.mapField===i));if(a){const e=a.value;return console.log(e,"value"),"number"==typeof e?e:String(e)}return e}));return we(r)}}else{if(Array.isArray(e))return e.map((e=>Ne(e,t)));if("object"==typeof e&&null!==e){const o={};for(let r in e)o[r]=Ne(e[r],t);return we(o)}}return we(e)},Ae=(e,t)=>{const o=e.agency,r=e,{url:i=null,headers:a,params:n,requestType:s}=r,l=i?Ne(i,t):void 0,d=a&&a.use?Ne(a.value,t):{};return{url:l,requestType:s,params:n?Ne(n,t):{},headers:d,agency:o}},xe=(e,t)=>{const{headers:o,params:r}=e,i=o&&o.use?Ne(o.value,t):{};return{params:r?Ne(r,t):{},headers:i}},Ce=(e,t,o,r,i)=>a(void 0,void 0,void 0,(function*(){if(e&&e.length)for(const a of e){I(t,a.value,o)&&(yield ye({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&&ye(t,!0,o,e,(e=>{i(t,e)}),!1)}})))}})),Ie=(e,t,o,r,i)=>a(void 0,void 0,void 0,(function*(){e&&(yield ye({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&&ye(r,!0,t,o,(e=>{i(r,e)}),!1)}})))}));class Oe{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 F(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,i.field&&(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 Oe(e,t)}}class Te{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 Te.instance||(Te.instance=new Te),Te.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=Oe.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 e?(this.addUrlParamsToGlobalVars(),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)}))}}Te.instance=null;const Ve=Te.getInstance(),Fe=(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))),Ee=(e,t,o,r)=>{const i=((e,t,o,r)=>{var i;let a;if(Fe(e,null==t?void 0:t.field)||Fe(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(Fe(e.data,null==t?void 0:t.field)||Fe(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=O(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},je=(e,t,o,r,i,a,n,s,l)=>{var d;switch(e.type){case"link":let c=Ne(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=O(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=O(t,e.cid);a&&ye(a,!0,o,r,(e=>{i({cid:a.cid,data:e})}))}})(e,o,a,n,s)}},Pe=(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=Ve.getVariableForId(o.cid);if(null==s?void 0:s.length)for(const l of s)if(l.type==e){let e=Ee(o,l,r,i);Ve.editVariableForValue(l.mapField,e,(()=>{let e=a[l.mapField]||[],o=Ve.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(Ce(d,e.mapField,Ve.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=O(i,o);!(null==e?void 0:e.delayUpdate)&&t&&ye(t,!0,Ve.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)je(e,a,i,g,n,Ve.getAllVariables(),d,s,l)};function $e(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=$e(e[r],t[r]);null!==i&&Object.keys(i).length>0&&(o[r]=i)}return Object.keys(o).length>0?o:null}function Re(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]=Re(o[e],t[e]));return o}const Me=(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},Ue=(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:Me(a,l),actions:i},baseData:qe(),dynamic:null,filePath:"",origin:"anov-ui",name:"",componentType:"",viewComName:e,optionComName:"AnOptionPanel",dataComName:"AnSourcePanel",eventComName:"AnActionsPanel",assemblyDeveloper:"",devEmail:"",version:"",devDept:""}},Be=(e,o,r)=>{let i=Ue(e,o);return r?t.merge(i,r):i},qe=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 Le{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=Be("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 He=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)]}},ze=()=>{const e=[],t=He.pick([!0,!1]);let o=He.randomNum(3,20);const r=He.pick([null,null,null,{}]);let i=He.pick(["asc","desc",void 0,void 0,void 0]);for(let a=0;a<He.randomNum(1,9);a++)e.push({data:He.generateRandomIntArray(o,0,300,i),type:"line",smooth:t,symbolSize:He.randomNum(1,10),lineStyle:{width:He.randomNum(1,4)},areaStyle:r});return{xAxis:{type:"category",show:!1,boundaryGap:!1,data:He.generateRandomNameArray(o,3,6)},grid:{left:0,top:0,bottom:0,right:0},yAxis:{show:!1,type:"value"},series:e}},Je=(e,t)=>{let o={type:e,show:!1};return"category"===e&&(o.data=He.generateRandomNameArray(t,3,6)),o},Ge=()=>{const e=[],t=He.pick([!0,!1]);let o=He.randomNum(3,20);const r=He.pick([null,null,null,{}]);let i=He.pick(["asc","desc",void 0,void 0,void 0]),a=He.randomNum(1,9),n=He.pick([!0,!1]);for(let s=0;s<a;s++){let a={data:He.generateRandomIntArray(o,0,300,i),type:"bar",smooth:t,stack:n,areaStyle:r};e.push(a)}let s=He.pick(["value","category"]),l=He.pick(["value","category"],s);return{xAxis:Je(s,o),grid:{left:0,top:0,bottom:0,right:0},yAxis:Je(l,o),series:e}},_e=()=>{const e=[];let t=He.randomNum(3,20);He.pick([null,null,null,{}]);let o=He.pick(["asc","desc",void 0,void 0,void 0]),r=He.pick([1,2]),i=[He.pick(["10%","20%","30%","40%","50%","60%","70%","80%"]),He.pick(["90%","100%"])];return e.push({data:He.generateRandomIntArray(t,3,20,o),type:"pie",radius:1==r?"100%":i,roseType:1==r?He.pick(["area",null,null]):null,padAngle:1==r?0:He.randomNum(1,5),startAngle:1==r?He.pick([0,180]):0,endAngle:360,label:{show:!1},itemStyle:{borderRadius:3}}),{grid:{left:0,top:0,bottom:0,right:0},series:e}},We=()=>{const e=[];He.pick([!0,!1]),He.randomNum(3,20),He.pick([null,null,null,{}]),He.pick(["asc","desc",void 0,void 0,void 0]);for(let t=0;t<He.randomNum(1,20);t++){let t=He.randomNum(3,He.randomNum(3,20)),o=[];for(let e=0;e<t;e++){let e=[];for(let t=0;t<2;t++)e.push(He.randomNum(1,30));o.push(e)}e.push({type:"scatter",symbolSize:He.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=He.pick(["polygon","circle"]);let o=He.randomNum(1e4,99999),r=He.randomNum(3,10),i=[];for(let e=0;e<r;e++)i.push({name:He.randomString(4,8),max:o});for(let t=0;t<He.randomNum(2,10);t++)e.push({value:He.generateRandomIntArray(r,1e4,o),name:He.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}]}},Xe=()=>{const e=[];for(let t=0;t<He.randomNum(4,15);t++)e.push({value:He.randomNum(1,100),name:He.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:He.pick(["descending","ascending"]),gap:2,lineStyle:{width:1},data:e}]}};let Ke=He.randomNum(5,20);const Ye={width:Ke};He.pick([!0,!1])&&(Ye.color=[[.3,"#67e0e3"],[.7,"#37a2da"],[1,"#fd666d"]]);class Ze{constructor(){this.names=["line","bar","pie","scatter","radar","funnel","gauge"]}static getInstance(){return Ze.instance||(Ze.instance=new Ze),Ze.instance}createLine(){switch(He.pick(this.names)){case"line":return{type:"line",typeNum:1,option:ze()};case"bar":return{type:"bar",typeNum:2,option:Ge()};case"pie":return{type:"pie",typeNum:3,option:_e()};case"scatter":return{type:"scatter",typeNum:4,option:We()};case"radar":return{type:"radar",typeNum:5,option:Qe()};case"funnel":return{type:"funnel",typeNum:6,option:Xe()};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:He.pick([!0,!1]),width:Ke},axisLine:{lineStyle:Ye},data:[{value:He.randomNum(1,100),name:"SCORE"}]}]}}}}}Ze.instance=null;const et=Ze.getInstance();const tt=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=H(this.directions);a&&(this.direction=a);let n=[];if("row"===this.direction){let e=H([3,4]);n=this.simulateRandomSegments(24,4,12,e)}else{let e=H([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=H([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=H([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}=et.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}},ot=e=>{try{return JSON.parse(e)}catch(t){return e}};const rt=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?ot(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=ot(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=ot(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 it(e){!function(e,t){e.depends?i(e):at(e,t)}(e,!1)}function at(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=nt(e,t),o+=`,${st(a,t.opacity)} ${i*r}%`;let{red:n,green:s,blue:l,alpha:u}=lt(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=nt(e,o[r].theme),t[r]=Object.assign(Object.assign({},lt(a,d)),{style:st(a,d)}))}}else{let{opacity:i}=o[r].theme;a=nt(e,o[r].theme),t[r]=st(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||at({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],at({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],at({option:e,optionDes:n,theme:r},i)}}}(r[a],i[a],0,o,t,"conditionSeries"===i[a].type)}))}function nt(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]:(dt(`属性${o}不存在,获取主题颜色错误,将使用默认主题色`),e.color)))}return dt(`属性${t.key}不存在,获取主题颜色错误,将使用默认主题色`),e.color}function st(e,t){let{red:o,green:r,blue:i,alpha:a}=lt(e,t);return`rgba(${o},${r},${i},${a})`}function lt(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 dt(e){console.warn(e)}class ct{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=>{53107==e.code&&t(1),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*(){if("local"==this.fetchMode){const o=yield rt.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,r=""){return a(this,void 0,void 0,(function*(){return yield this.findById(e,t,o,r)}))}updataPageData(e,t){var o;return a(this,void 0,void 0,(function*(){const r=this.getPageId(t,this.projectInfo.details);let i=yield this.getPageDataForID(e,r);if(null==i?void 0:i.data){let e=yield this.pageInit(i.data);return null===(o=null==this?void 0:this.lifecycleHooks)||void 0===o||o.onPageDataReady(e),e}return this.lifecycleHooks.validateError("请求页面数据失败"),console.error("请求数据发生错误!",i.msg),{type:"error",error:i.msg}}))}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)&&"local"==this.fetchMode){console.log(`ID ${r} has already been processed.`);const t=yield rt.get(e+"_"+r);if(t||null==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);rt.add(e+"_"+t,o.data),this.processedIds.add(t)}catch(e){console.error(`Error processing ID ${t}: ${e}`)}}))));const n=yield i;return rt.add(e+"_"+r,n.data),n}))}fetchPageDataForId(e,t="",o=0,r=""){return a(this,void 0,void 0,(function*(){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 it({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(((r,i)=>{if(e.tmpData&&e.tmpData.source)try{ye(e,!0,t,o,(t=>{e.source=t,r(1)}))}catch(e){r(e)}else r("")}))}))}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){return a(this,void 0,void 0,(function*(){try{let t=null==e?void 0:e.caseDetailData,o=this.defaultTheme;(null==t?void 0:t.theme)&&(o=t.theme),this.setGlobalThemeVars(o),Ve.clearVars(),Ve.addVariables(t.globalVars);Ve.getAllVariables();return t}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)=>{((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:"",n=(null==i?void 0:i.mode)?i.mode:this.mode,s=(null==i?void 0:i.token)?i.token:"",l=yield this.fetchProjectForId(t,a,n,s);2e4==(null==l?void 0:l.code)&&(null==l?void 0:l.data)?(this.projectInfo=l.data,console.log("验证成功!"),this.lifecycleHooks.message("验证成功!"),r(!0)):(this.lifecycleHooks.validateError(l),this.lifecycleHooks.message(l.msg,"warning"))}))})(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),r=yield this.checkSecurity(o),i=e.onValidateAccess||(()=>{}),a=yield this.validate(r,o,i);(a||0==a)&&e.onCaseReady(this.projectInfo);let n=(null===(t=this.projectInfo)||void 0===t?void 0:t.details).map((e=>e.id)),s=this.getPageId(this.pageId,this.projectInfo.details),l=yield this.getPageDataForID(o,s||n[0],n);if(53105===l.code){const t="访问权限不足";return e.onPageDataReady(t),{currentData:this.projectInfo,currentPageData:t}}let d=(null==l?void 0:l.data)?l.data:null;const c=yield this.pageInit(d);return e.onPageDataReady(c),{currentData:this.projectInfo,currentPageData:c}}catch(e){console.error("加载页面时出错:",e)}}))}}export{Le as ConfigOptimizer,Te as GlobalVariables,te as Http,ee as Log,ct as PageLoader,f as addPreloadLink,ae as agentData,Re as applyDiff,S as asyncRecursion,j as delFetchStatus,$e as diffObjects,tt as displayGenerator,ve as editItem,Pe as emitEvent,fe as fetchDataByGlobal,me as fetchDataByType,ge as filterData,O as findItemDeep,T as findItemDeep2,ie as getData,ne as getDataForApi,le as getDataForDataSet,ce as getDataForSource,ue as getDataForStatic,se as getDataForZb,de as getDataForZbCQ,$ as getResourceForComponent,w as getSessionData,v as getStandardData,A as getStringVars,x as getStringVars2,g as getUrlParams,Ee as getVarDefaultVal,Ve as globalVars,I as hasVar,y as isJSON,h as loadFont,d as loadFontResource,c as loadScript,p as loadTag,k as recursion,m as removeTag,Ne as replaceVariable,Se as replaceVariable2,ke as replaceVariable3,De as replaceVariable4,V as safeEval,F as safeEvalForCode,E as setFetchStatus,b as setSessionData,Ce as updataGlobalDataSourceForVar,ye as updateComData,Ie as updateGlobalDataSource};
|
|
@@ -48,6 +48,7 @@ export declare const asyncRecursion: (array: GoComponent[], callback: (args: any
|
|
|
48
48
|
* @returns 是否包含变量
|
|
49
49
|
*/
|
|
50
50
|
export declare const getStringVars: (url: string, globalVars: any, item?: any, shareVariableTree?: any) => boolean;
|
|
51
|
+
export declare const getStringVars2: (url: string, mapField: string) => boolean;
|
|
51
52
|
/**
|
|
52
53
|
* 判断数据源是否包含该变量
|
|
53
54
|
* @param _varName - 变量名称
|