@ibiz-template/runtime 0.5.7-alpha.7 → 0.5.7-alpha.8
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.esm.js +22 -3
- package/dist/index.system.min.js +1 -1
- package/out/application.d.ts.map +1 -1
- package/out/application.js +1 -0
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +1 -1
- package/out/install.d.ts.map +1 -1
- package/out/install.js +2 -5
- package/out/interface/service/service/i-mark-open-data.service.d.ts +13 -0
- package/out/interface/service/service/i-mark-open-data.service.d.ts.map +1 -0
- package/out/interface/service/service/i-mark-open-data.service.js +1 -0
- package/out/interface/service/service/index.d.ts +1 -0
- package/out/interface/service/service/index.d.ts.map +1 -1
- package/out/service/service/index.d.ts +1 -0
- package/out/service/service/index.d.ts.map +1 -1
- package/out/service/service/index.js +1 -0
- package/out/service/service/mark-open-data/mark-open-data.service.d.ts +12 -0
- package/out/service/service/mark-open-data/mark-open-data.service.d.ts.map +1 -0
- package/out/service/service/mark-open-data/mark-open-data.service.js +14 -0
- package/out/types.d.ts +8 -17
- package/out/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/application.ts +2 -0
- package/src/controller/control/search-bar/search-bar.controller.ts +1 -1
- package/src/install.ts +2 -6
- package/src/interface/service/service/i-mark-open-data.service.ts +18 -0
- package/src/interface/service/service/index.ts +4 -0
- package/src/service/service/index.ts +1 -0
- package/src/service/service/mark-open-data/mark-open-data.service.ts +25 -0
- package/src/types.ts +9 -20
package/dist/index.system.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var a,i,s,n,o,r,c,d,l,h,u,p,m,f,g,w,E,v,y,I,D,C,A,b,P,T,x,N,S,L,R,M,O,_,V,F,k,W,U,z,B,G,j,K,X,H,Y,q,Q,J,$,Z,tt,et,at,it,st,nt,ot,rt,ct,dt,lt,ht,ut,pt,mt,ft,gt,wt,Et,vt;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,n=t.NoticeError,o=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,d=t.IBizContext,l=t.DataTypes,h=t.clone,u=t.CoreConst,p=t.HttpResponse,m=t.updateKeyDefine,f=t.Net,g=t.getToken,w=t.NOOP,E=t.IBizParams,v=t.isElementSame,y=t.findRecursiveChild,I=t.StringUtil,D=t.debounceAndAsyncMerge,C=t.isOverlap,A=t.BitMask,b=t.mergeInLeft,P=t.awaitTimeout,T=t.mergeDefaultInLeft,x=t.plus,N=t.toNumberOrNil},function(t){S=t.isEmpty,L=t.isString,R=t.isArray,M=t.isObject,O=t.isNil,_=t.debounce,V=t.camelCase,F=t.eq,k=t.gt,W=t.gte,U=t.findIndex,z=t.lt,B=t.lte,G=t.upperFirst,j=t.snakeCase,K=t.kebabCase,X=t.isFunction,H=t.isNumber},function(t){Y=t.notNilEmpty,q=t.isNilOrEmpty,Q=t.AsyncSeriesHook,J=t.createUUID,$=t.QXEvent,Z=t.isArray,tt=t.getCookie,et=t.setCookie,at=t.clearCookie,it=t.ascSort,st=t.descSort,nt=t.clearAll,ot=t.isNumber},function(t){rt=t.default},function(t){ct=t.isNil,dt=t.mergeRight,lt=t.isEmpty,ht=t.clone,ut=t.equals,pt=t.where,mt=t.mergeLeft,ft=t.isNotNil,gt=t.mergeDeepRight},function(t){wt=t.default},function(t){Et=t.default},function(t){vt=t.default}],execute:function(){t({asyncImportData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(Qo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const n=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(o=n.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(o!==i)return;const s=a.data.actionstate;30!==s&&40!==s||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED");var o},calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t;let i;if(e||a){switch(i={display:"flex"},e){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(a){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:we,calcDynaClass:me,calcDynaSysParams:async function(t,e,a={}){const i=a.appId||e.srfappid,s=a.viewParams||{},n={},o=await ibiz.hub.getAppDataEntity(t,i);if(s.srfkey)n.srfkey=s.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(n.srfkey=t)}if(s.srfparentkey&&s.srfparentdeanme)n.srfparentkey=s.srfparentkey,n.srfparentdeanme=s.srfparentdeanme;else{const t=Qs(e,o);if(t&&t.keys.length>1){const a=t.keys[t.keys.length-2];n.srfparentkey=s.srfparentkey||e[a],n.srfparentdeanme=s.srfparentdeanme||a}}return n},calcFilterModelBySchema:Yc,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:l(a,i),sm:l(s,n),md:l(o,r),lg:l(c,d)}},calcLayoutHeightWidth:pe,calcMainStateOPPrivsStrs:ge,calcNavParams:ce,calcResPath:Js,calcSearchConds:$c,compare:Ue,compareNumber:ze,contains:Be,convertNavData:se,convertNavDataByArray:oe,convertObjectToNavParams:ie,execDELogic:Gn,execDELogicAction:Kn,execDELogicById:jn,execFieldLogics:Hn,execUILogic:Jr,exportData:$o,fieldValueToBoolean:Zs,filterFieldLogics:ye,filterValueRules:ua,findChildFormDetails:Te,findDELogic:ve,findEditItem:Pe,findFieldById:Ie,findModelChild:de,formatFilters:Qc,formatMultiData:re,generateEditorRules:Ho,generateRules:Xo,getAllPanelField:_e,getAppCounterProvider:Hi,getAppMenuItemProvider:ks,getAppViewRef:function(t,e){var a,i;let s=t.appViewRefs||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(a=t.actiontype||"DEFAULT",ibiz.register.get("".concat(ys,"_").concat(a)));var a;if(e)return e;throw new o("找不异步操作类型".concat(t.actiontype,"对应的适配器"))},getChildNodeRSs:be,getControl:le,getControlPanel:ue,getControlProvider:Qi,getControlsByView:Ne,getDEMethodProvider:Rs,getDERedirectToView:ke,getDeACMode:async function(t,e,a){var i;const s=await ibiz.hub.getAppDataEntity(e,a);return null==(i=s.appDEACModes)?void 0:i.find((e=>e.id===t))},getDefaultValue:qo,getEditorProvider:Zi,getEntitySchema:Zo,getFormDetailProvider:as,getGridColumnProvider:ns,getInternalMessageProvider:function(t){const e=(a=t.content_type||"DEFAULT",ibiz.register.get("".concat(Ws,"_").concat(a)));var a;if(e)return e;throw new o("找不站内信类型".concat(t.content_type,"对应的适配器"))},getMatchResPath:Qs,getOriginData:Ko,getOriginFilterNodes:qc,getPFPlugin:function(t,e){const i=ibiz.hub.getApp(e);if(!i)throw new a(i,"未找到应用");const{model:s}=i;if(!s.appPFPluginRefs)throw new a(s,"应用未配置插件");const n=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!n)throw new Error("未找到插件".concat(t));return n},getPanelItemProvider:cs,getPlatformProvider:xs,getPlatformType:As,getPortletProvider:hs,getRootNode:Ce,getTreeGridExColumnProvider:_s,getTreeNode:Ae,getUIActionById:De,getUIActionItemsByActionLevel:function(t,e){const a=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const i=t;i.actionLevel===e&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),a},getUIActionProvider:fs,getUILogicNodeProvider:ws,getViewEngines:Le,getViewLogics:Se,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=vs(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=vs("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=vs(a));e||(e=vs("DEFAULT"));return e},getWFContext:$e,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:n}=e,o=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:s),c=null==o?void 0:o.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:ya,hasDeCodeName:Ee,hasSubRoute:Go,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(Jo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));return(await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}})).data},install:function(){const{ibiz:t}=window;t.util=new bd,t.hub=new Dd,t.register=new Rt,t.config=new Lt,t.auth=new gn,t.asyncAction=new wn,t.internalMessage=new to,t.engine=new Cd,t.uiDomainManager=new wa,Ao(),nc(),Zn(),Gs(),ibiz.scheduler=new Od,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Fd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Fd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Fd(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new kd(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Vd(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new Ud(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new zd(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new xd(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Nd(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Nd(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Wd(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new Bd(t,e))),function(){const t=new Ds;Ps("Browser",(()=>t))}(),t.platform=xs()},installCommand:Ao,isDataContainer:Re,isFormDataContainer:xe,isValueChange:jo,matchMainState:fe,openRedirectView:Ve,parseFilters:Jc,parseUserParams:he,presetAppCounterProvider:Gs,presetDEMethodProvider:Zn,presetUIActionProvider:nc,registerAppCounterProvider:Ki,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Vs,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ys,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(Yi,"_").concat(t),e)},registerDEMethodProvider:Ss,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Ji,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(ts,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(is,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Ws,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(os,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:Ps,registerPortletProvider:function(t,e){ibiz.register.register("".concat(ds,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(Ms,"_").concat(t),e)},registerUIActionProvider:ps,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(gs,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(Es,"_").concat(t),e)},strContain:Ge,testCond:We,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await Fe(t,e,a);await ibiz.commands.execute(Io.TAG,i.viewId,i.context,i.params,i.opts)},verifyDeRules:He,verifyFormGroupLogic:qe,verifyPanelGroupLogic:Qe});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function yt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var It={exports:{}};!function(t,e){t.exports=function(t,e,a){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var a;1===e.length&&e[0].length>0&&(e=e[0]),a=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](a)||(a=e[i]);return a};a.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},a.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}}}(It);var Dt=yt(It.exports),Ct={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(Ct);var At=yt(Ct.exports),bt={exports:{}};!function(t,e){var a,i;t.exports=(a="month",i="quarter",function(t,e){var s=e.prototype;s.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var n=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):n.bind(this)(t,e)};var o=s.startOf;s.startOf=function(t,e){var s=this.$utils(),n=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return n?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return o.bind(this)(t,e)}})}(bt);var Pt=yt(bt.exports),Tt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var n=e.prototype;n.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var n=s(this).startOf(i).add(1,i).date(e),o=s(this).endOf(a);if(n.isBefore(o))return 1}var r=s(this).startOf(i).date(e).startOf(a).subtract(1,"millisecond"),c=this.diff(r,a,!0);return c<0?s(this).startOf("week").week():Math.ceil(c)},n.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Tt);var xt=yt(Tt.exports),Nt={exports:{}};!function(t,e){var a;t.exports=(a="day",function(t,e,i){var s=function(t){return t.add(4-t.isoWeekday(),a)},n=e.prototype;n.isoWeekYear=function(){return s(this).year()},n.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,n,o,r=s(this),c=(e=this.isoWeekYear(),o=4-(n=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,a));return r.diff(c,"week")+1},n.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var o=n.startOf;n.startOf=function(t,e){var a=this.$utils(),i=!!a.u(e)||e;return"isoweek"===a.p(t)?i?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):o.bind(this)(t,e)}})}(Nt);var St=yt(Nt.exports),Lt=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0}}},Rt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Mt=t("DefaultErrorHandler",class{handle(t){return t instanceof a||t instanceof i?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error("没有注册无权限错误处理器"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof n?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof o&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Ot=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error("没有找到能处理该错误的处理器",t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),_t=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};_t.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var Vt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Ft=class extends Vt{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const a=t.filter((t=>!!t)).length===t.length;return _t.handleJudgmentExecute(this,a,e)}},kt=class extends Vt{constructor(t){super(t,"camelCase")}onExecute(t){return t?V(t):""}},Wt=class extends Vt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Ut=class extends Vt{constructor(t){super(t,"eq")}onExecute(t,e,a){const i=F(t,e);return _t.handleJudgmentExecute(this,i,a)}},zt=class extends Vt{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return _t.handleJudgmentExecute(this,i,a)}},Bt=class extends Vt{constructor(t){super(t,"gte")}onExecute(t,e,a){const i=W(t,e);return _t.handleJudgmentExecute(this,i,a)}},Gt=class extends Vt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,i){let s=!1;return s=R(t)?!F(U(t,(t=>F(t[e],a))),-1):t.hasOwnProperty(e)&&(s=F(t[e],a)),_t.handleJudgmentExecute(this,s,i)}},jt=class extends Vt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},Kt=class extends Vt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Xt=class extends Vt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Ht=class extends Vt{constructor(t){super(t,"lt")}onExecute(t,e,a){const i=z(t,e);return _t.handleJudgmentExecute(this,i,a)}},Yt=class extends Vt{constructor(t){super(t,"lte")}onExecute(t,e,a){const i=B(t,e);return _t.handleJudgmentExecute(this,i,a)}},qt=class extends Vt{constructor(t){super(t,"neq")}onExecute(t,e,a){const i=!F(t,e);return _t.handleJudgmentExecute(this,i,a)}},Qt=class extends Vt{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return _t.handleJudgmentExecute(this,a,e)}},Jt=class extends Vt{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const i=t.find((t=>!!t));if(a.fn){const t=(null==(e=a.data)?void 0:e.root)||{};return i?a.fn(t):a.inverse(t)}return i||""}},$t=class extends Vt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},Zt=class extends Vt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?j(t):""}},te=class extends Vt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?K(t):""}},ee=class extends Vt{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var ae=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var a;return this.hsb=t.default||t,this.p=null,a=this.hsb,new Ft(a),new kt(a),new Wt(a),new Ut(a),new zt(a),new Bt(a),new jt(a),new Kt(a),new Xt(a),new Ht(a),new Yt(a),new qt(a),new Qt(a),new Jt(a),new $t(a),new Zt(a),new te(a),new ee(a),new Gt(a),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function ie(t){const e=[],a=/^%(.+)%$/;for(const i in t){let s=!0,n=t[i];Y(t[i])&&a.test(t[i])&&(s=!1,n=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:n})}return e}function se(t,...e){if(!t||S(t))return{};return oe(Array.isArray(t)?t:ie(t),...e)}function ne(t,e){const a=t.find((t=>!q(t)&&(t[e]||Object.prototype.hasOwnProperty.call(t,e))));return{find:!!a,value:null==a?void 0:a[e]}}function oe(t,...e){const a=/\$\{[^}]*\}/g,i={};for(const s of t)if(s.rawValue)i[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(a);if(null!==t){let a=s.value;t.forEach((t=>{const{find:i,value:s}=ne(e,t.slice(2,-1).toLowerCase());i&&(a=a.replace(t,"".concat(s)))})),i[s.key.toLowerCase()]=a}else{const{find:t,value:a}=ne(e,s.value.toLowerCase());t&&(i[s.key.toLowerCase()]=a)}}return i}function re(t,e){const a={};if(!t)return a;const i=Array.isArray(t)?t:ie(t),s=e[0];return i.forEach((t=>{const{rawValue:i,value:n}=t;!i&&n&&Object.prototype.hasOwnProperty.call(s,n)&&(a[n]=e.map((t=>t[n])).join(";"))})),a}function ce(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:n,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(a&&(h[a]=p),i&&(u[i]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=se(n,d,c,r),f=se(o,d,c,r);return Object.assign(h,m),Object.assign(u,f),{resultContext:h,resultParams:u}}function de(t,e){if(t&&e){const a=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(a)return a}return null}function le(t,e){var a,i;let s=t.controls||[];return(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.controls)),s.find((t=>t.name===e||t.codeName===e||t.id===e))}function he(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const n=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:e,navigateParams:a,other:i}}function ue(t){let e;if(t.controlRenders){const a=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==a?void 0:a.layoutPanel}return e}function pe(t){const{width:e,height:a,widthMode:i,heightMode:s}=t,n={width:"",height:""};return"FULL"===i?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?n.height="100%":a&&a>0&&(n.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),n}function me(t,e){const a=[],i=Xe.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return L(i)?a.push(i):R(i)?a.push(...i):M(i)&&Object.keys(i).forEach((t=>{i[t]&&a.push(t)})),a}function fe(t,e){const{mainStateAppDEFieldIds:a,demainStates:i}=t;if(a&&i){const t=[];return a.forEach((a=>{t.push(e[a])})),i.find((e=>{const{stateValue:a,state2Value:i,state3Value:s}=e;let n=!0;const o=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function ge(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,n=(null==i?void 0:i.map((t=>t.name)))||[];let o=[];if(s)o=n;else{o=[...a.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function we(t){return t.split(".").pop()}function Ee(t,e){const a=we(e);return Y(t[a])}function ve(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function ye(t,e){var a,i;const s=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?s.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?s.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&s.push(t.defaultValueAppDEFLogicId)})),(null==(i=t.appDELogics)?void 0:i.filter((t=>s.includes(t.id))))||[]}function Ie(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function De(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Ce(t){return t.detreeNodes.find((t=>t.rootNode))}function Ae(t,e){return t.detreeNodes.find((t=>t.id===e))}function be(t,e){const a=e.parentId||Ce(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(i=t.searchMode,s=e.hasQuery,3===i||(s?1===i:2===i));var i,s}))}function Pe(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function Te(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function xe(t){return"MDCTRL"===t.detailType}function Ne(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function Se(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function Le(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn("未支持的引擎分类:".concat(t.engineType)),!1)))}function Re(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Me=["panelItems","panelTabPages","rootPanelItems"];function Oe(t){let e=[];for(const a of Me)if(t[a]){e=t[a];break}const a=[];return e.length&&(a.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Re(t)||a.push(...Oe(t))}))),a}function _e(t){return Oe(t)}async function Ve(t,e,a={},i={}){return async function(t,e,a={},i={}){let s;try{s=await ke(t,e,a,i)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const a=window.open(t,"_blank");a&&(a.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Io.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,a,i)}async function Fe(t,e,a={}){const i=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(i+1,e.length)),n=rt.parse(s,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new o("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o("未找到指定实体的codeName: ".concat(r));n[c.toLowerCase()]=n[r.toLowerCase()];const d="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(d);if(delete n.srfdename,"undo"!==n.srfwf){const t=n.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=a}return n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),{context:t,params:n,opts:a,viewId:l.id}}async function ke(t,e,i={},s={}){var n;const r=se(t.appViewNavContexts||[],i,e);e=Object.assign(e.clone(),r);const c=se(t.appViewNavParams||[],i,e);Object.assign(i,c);const d=t.appDataEntityId,l=we(d);let h=(null==(n=s.data)?void 0:n[0])||{};e[l]=h[l]||e[l]||i[l];const u=t.getDataAppDEActionId,p=ibiz.hub.getApp(t.appId),m=await p.deService.getService(e,d);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,i);if(t.ok){h=t.data;let a=h.linkurl;if(a){if(e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://"))return{type:"url",url:a};if(a.startsWith("appredirectview?")){return{type:"view",...await Fe(e,a,s)}}throw new o("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(d,t.appId),g=await async function(t,e,a,i){let s="";const n=e.typeAppDEFieldId;if(n){const{codeName:a}=Ie(t,n),s=i[a.toLowerCase()];if(Y(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(n,"]值为空"),i)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(Y(r))return Y(a.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=Ie(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(q(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Ie(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=Y(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return s}(f,t,i,h);let w="";if(!g.startsWith("view://")){const n=g.split(":"),o=2===n.length?g:n.slice(0,2).join(":"),r="".concat(f.name.toUpperCase(),":").concat(g),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const d=c.find((t=>{const e=t.name||t.id;return e===r||e===g||e===o}));if(d){if(w=d.refAppViewId,w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(d,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(g,"]或[").concat(r,"]或工作流[").concat(o,"]对应视图"))}{const t=new URL(g);t.searchParams.size>0&&t.searchParams.forEach(((t,e)=>{i[e]=t}));const e=t.pathname.replace("//","").split("/"),[a,s]=e;w=s||a}if(w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(t,"标识[".concat(g,"]未匹配到实际引用视图"))}function We(t,e,a){if(Object.is(e,"IN"))return Be(t,a);if(Object.is(e,"NOTIN"))return!Be(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return Ue(t,a)<0;case"LTANDEQ":return Ue(t,a)<=0;case"GT":return Ue(t,a)>0;case"GTANDEQ":return Ue(t,a)>=0;case"ISNULL":return q(t);case"ISNOTNULL":return Y(t);case"TESTNULL":return ct(t);case"IN":return Be(t,a);case"NOTIN":return!Be(t,a);case"LIKE":return Ge(t,a);case"LEFTLIKE":return Ge(t,a,"start");case"RIGHTLIKE":return Ge(t,a,"end");default:throw new o("值操作:".concat(e,",暂未支持"))}}function Ue(t,e){const a=Number(t),i=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(i))return ze(a,i);const s=new Date(t).getTime(),n=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(n))return ze(s,n);throw new o("".concat(t," 和 ").concat(e," 无法比较大小"))}function ze(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Be(t,e){if(!e||"string"!=typeof e)throw new o("范围比较的条件值不存或者不是字符串");if(t){return e.split(",").includes("".concat(t))}return!1}function Ge(t,e,a){if(!t||!e)return!1;const i="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),n=i.indexOf(s);switch(a){case"start":return 0===n;case"end":return n+s.length===i.length;default:return-1!==n}}var je={singleRowReturn:!1,isAsync:!0},Ke=t("ScriptFunction",class{constructor(t,e,a=je){this.argKeys=[],this.options=a;const i=this.formatCode(e,a);this.calcArgKeys(t,a);const s=new Function(...this.argKeys,i);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error("报错脚本",i),t}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?dt(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const i=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),i.push(a[t])})),i}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),Xe=t("ScriptFactory",class{static createScriptFn(t,e,a){return new Ke(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function He(t,e,a){const i={isPast:!0,infoMessage:a.ruleInfo};if(function(t){return"GROUP"===t.condType}(a)){const s=a.conds;s&&s.length>0&&(i.isPast=function(t,e,a="AND",i=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===a;for(let i=0,n=t.length;i<n;i++){const n=e(t[i],i);if("AND"===a){if(!n){s=!1;break}}else if("OR"===a&&n){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:n}=He(t,e,a);return i.infoMessage=n,s}),a.condOp,!!a.notMode),!i.isPast&&("AND"===a.condOp&&a.notMode||"OR"===a.condOp&&!a.notMode)&&(i.infoMessage=a.ruleInfo))}else{t=(null==a?void 0:a.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=n[a=a?a.toLowerCase():""]?n[a]:a}(ct(i)||lt(i))&&(i="内容必须符合值规则");const c=We(t,e,a);if(!c&&r)throw new o(i);return!c}(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){q(n)&&(n="值必须符合值范围规则");if(q(t)){if(r)throw new o("值为空");return n="值为空",!0}if(Ye(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!=i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"REGEX"===t.condType}(a))i.isPast=!Ye(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){q(n)&&(n="内容长度必须符合范围规则");if(q(t)){if(r)throw new o("值为空");return n="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!==i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(a)&&(null==a?void 0:a.sysValueRule)){const{ruleType:s,regExCode:n,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!Ye(e[t],n,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:n}=function(t,e,a,i,s){q(i)&&(i="值必须符合脚本规则");const n=e;let r="",c=!0;const d=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=Xe.execScriptFn({value:t,data:n},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(i="",!c&&s)throw new o(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=n||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=a.notMode?!i.isPast:i.isPast}return i}function Ye(t,e,a,i){q(a)&&(a="值必须符合正则规则");if(q(t)){if(i)throw new o("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new o(a);return!0}return a="",!1}function qe(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.defdlogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!qe(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>qe(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return We(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}function Qe(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.panelItemLogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!Qe(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>Qe(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return We(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}var Je=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=ht(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:i,mainMenuAlign:s}=t;let n="";i?n="BLANK_MODE":s&&(n=s.toUpperCase());let o="";return o=""!==n?"".concat(e,"_").concat(a,"_").concat(n):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function $e(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var Ze=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))(Ze||{})),ta=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(ta||{})),ea=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(ea||{})),aa=t("StudioViewEvents",class{});aa.onViewMounted="onMounted",aa.onViewDestroyed="onDestroyed";var ia=t("StudioPanelEvents",class{});ia.onClick="onClick",ia.onChange="onChange",ia.onEnter="onEnter",ia.onLeave="onLeave";var sa=t("StudioControlEvents",class{});sa.onBeforeLoad="onBeforeLoad",sa.onLoadSuccess="onLoadSuccess",sa.onLoadError="onLoadError",sa.onBeforeLoadDraft="onBeforeLoadDraft",sa.onLoadDraftSuccess="onLoadDraftSuccess",sa.onLoadDraftError="onLoadDraftError",sa.onBeforeSave="onBeforeSave",sa.onSaveSuccess="onSaveSuccess",sa.onSaveError="onSaveError",sa.onBeforeRemove="onBeforeRemove",sa.onRemoveSuccess="onRemoveSuccess",sa.onRemoveError="onRemoveError",sa.CLICK="onClick";var na=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(na||{})),oa=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(oa||{})),ra=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(ra||{})),ca=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(ca||{})),da=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))(da||{})),la=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(la||{})),ha=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new Q,beforeDismiss:new Q},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function ua(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var pa=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),ma=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=ht(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let a=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];a+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}a+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=a,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),fa=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn("事务已经开启, 单个界面域只能开启一个事务"):this.state.isOpen=!0}change(t,e){this.state.isChange=!0,this.commitQueue.set(t,e)}commit(){const t=Array.from(this.commitQueue.values()).reverse();for(const e of t)e();this.commitQueue.clear(),this.state.isChange=!1}rollback(){this.commitQueue.clear(),this.state.isChange=!1}close(){if(this.state.isChange)throw new Error("当前事务未提交,不可以直接关闭事务");this.state.isOpen=!1}},ga=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new fa,this.id=t||J()}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}getDERConfigByMajor(t){return this.rs2Map.has(t)?this.rs2Map.get(t):[]}calcParentRs(){this.rs2Map.clear(),this.rsMap.forEach(((t,e)=>{t.forEach((t=>{t.minorAppDataEntityId=e;const a=t.majorAppDataEntityId;this.rs2Map.has(a)||this.rs2Map.set(a,[]),this.rs2Map.get(a).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),wa=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new ga(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error("无效的界面域标识[".concat(t,"]"))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),Ea=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}}),va=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new $}add(t,e){this.stack.push(e),this.stackMap.set(t,e),this.recalculateActiveStack(),this.evt.emit("add",e),this.evt.emit("change",{type:"add",view:e})}remove(t){const e=this.stackMap.get(t);e&&(this.stack.splice(this.stack.indexOf(e),1),this.stackMap.delete(t),this.recalculateActiveStack(),this.evt.emit("remove",e),this.evt.emit("change",{type:"remove",view:e}))}getActives(){return this.activeStack}active(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("active",e),this.evt.emit("change",{type:"active",view:e}))}deactivate(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("deactivate",e),this.evt.emit("change",{type:"deactivate",view:e}))}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function ya(t,e=!0){const a=await Promise.allSettled(t),i=[],s=[];if(a.forEach((t=>{"fulfilled"===t.status?i.push(t.value):s.push(t.reason)})),s.length>0){const t=1===s.length?s[0]:s;if(e)throw t;ibiz.util.error.handle(t)}return i}var Ia={position:"fixed",zIndex:"10000"};function Da(t,e=document.body,a=!0){const i=Aa(t);if(null==i)throw new Error("Cannot clone a null or undefined element.");const s=i.cloneNode(!0);if(a)for(;s.firstChild;)s.removeChild(s.firstChild);return function(t,{width:e,height:a,boundingLeft:i,boundingTop:s}){t.style.left="".concat(i,"px"),t.style.top="".concat(s,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(a,"px"),Object.assign(t.style,Ia)}(s,Ca(i)),e.appendChild(s),s}function Ca(t){const e=t.offsetWidth,a=t.offsetHeight,i=window.getComputedStyle(t),s=parseFloat(i.padding),{left:n,top:o}=t.getBoundingClientRect();return{width:e,height:a,padding:s,boundingLeft:n,boundingTop:o}}function Aa(t){return"string"==typeof t?document.querySelector(t):t}var ba={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Pa={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Ta=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],xa={CSS:{},springs:{}};function Na(t,e,a){return Math.min(Math.max(t,e),a)}function Sa(t,e){return t.indexOf(e)>-1}function La(t,e){return t.apply(null,e)}var Ra={arr:function(t){return Array.isArray(t)},obj:function(t){return Sa(Object.prototype.toString.call(t),"Object")},pth:function(t){return Ra.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||Ra.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return Ra.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return Ra.hex(t)||Ra.rgb(t)||Ra.hsl(t)},key:function(t){return!ba.hasOwnProperty(t)&&!Pa.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function Ma(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Oa(t,e){var a=Ma(t),i=Na(Ra.und(a[0])?1:a[0],.1,100),s=Na(Ra.und(a[1])?100:a[1],.1,100),n=Na(Ra.und(a[2])?10:a[2],.1,100),o=Na(Ra.und(a[3])?0:a[3],.1,100),r=Math.sqrt(s/i),c=n/(2*Math.sqrt(s*i)),d=c<1?r*Math.sqrt(1-c*c):0,l=1,h=c<1?(c*r-o)/d:-o+r;function u(t){var a=e?e*t/1e3:t;return a=c<1?Math.exp(-a*c*r)*(l*Math.cos(d*a)+h*Math.sin(d*a)):(l+h*a)*Math.exp(-a*r),0===t||1===t?t:1-a}return e?u:function(){var e=xa.springs[t];if(e)return e;for(var a=1/6,i=0,s=0;;)if(1===u(i+=a)){if(++s>=16)break}else s=0;var n=i*a*1e3;return xa.springs[t]=n,n}}function _a(t){return void 0===t&&(t=10),function(e){return Math.ceil(Na(e,1e-6,1)*t)*(1/t)}}var Va,Fa,ka=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function a(t,e){return 3*e-6*t}function i(t){return 3*t}function s(t,s,n){return((e(s,n)*t+a(s,n))*t+i(s))*t}function n(t,s,n){return 3*e(s,n)*t*t+2*a(s,n)*t+i(s)}return function(e,a,i,o){if(0<=e&&e<=1&&0<=i&&i<=1){var r=new Float32Array(11);if(e!==a||i!==o)for(var c=0;c<11;++c)r[c]=s(c*t,e,i);return function(t){return e===a&&i===o||0===t||1===t?t:s(d(t),a,o)}}function d(a){for(var o=0,c=1;10!==c&&r[c]<=a;++c)o+=t;--c;var d=o+(a-r[c])/(r[c+1]-r[c])*t,l=n(d,e,i);return l>=.001?function(t,e,a,i){for(var o=0;o<4;++o){var r=n(e,a,i);if(0===r)return e;e-=(s(e,a,i)-t)/r}return e}(a,d,e,i):0===l?d:function(t,e,a,i,n){var o,r,c=0;do{(o=s(r=e+(a-e)/2,i,n)-t)>0?a=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(a,o,o+t,e,i)}}}(),Wa=(Va={linear:function(){return function(t){return t}}},Fa={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Expo:function(){return function(t){return t?Math.pow(2,10*t-10):0}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,a=4;t<((e=Math.pow(2,--a))-1)/11;);return 1/Math.pow(4,3-a)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var a=Na(t,1,10),i=Na(e,.1,2);return function(t){return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/i)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Fa[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Fa).forEach((function(t){var e=Fa[t];Va["easeIn"+t]=e,Va["easeOut"+t]=function(t,a){return function(i){return 1-e(t,a)(1-i)}},Va["easeInOut"+t]=function(t,a){return function(i){return i<.5?e(t,a)(2*i)/2:1-e(t,a)(-2*i+2)/2}},Va["easeOutIn"+t]=function(t,a){return function(i){return i<.5?(1-e(t,a)(1-2*i))/2:(e(t,a)(2*i-1)+1)/2}}})),Va);function Ua(t,e){if(Ra.fnc(t))return t;var a=t.split("(")[0],i=Wa[a],s=Ma(t);switch(a){case"spring":return Oa(t,e);case"cubicBezier":return La(ka,s);case"steps":return La(_a,s);default:return La(i,s)}}function za(t){try{return document.querySelectorAll(t)}catch(t){return}}function Ba(t,e){for(var a=t.length,i=arguments.length>=2?arguments[1]:void 0,s=[],n=0;n<a;n++)if(n in t){var o=t[n];e.call(i,o,n,t)&&s.push(o)}return s}function Ga(t){return t.reduce((function(t,e){return t.concat(Ra.arr(e)?Ga(e):e)}),[])}function ja(t){return Ra.arr(t)?t:(Ra.str(t)&&(t=za(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Ka(t,e){return t.some((function(t){return t===e}))}function Xa(t){var e={};for(var a in t)e[a]=t[a];return e}function Ha(t,e){var a=Xa(t);for(var i in t)a[i]=e.hasOwnProperty(i)?e[i]:t[i];return a}function Ya(t,e){var a=Xa(t);for(var i in e)a[i]=Ra.und(t[i])?e[i]:t[i];return a}function qa(t){return Ra.rgb(t)?(a=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+a[1]+",1)":e:Ra.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,a,i){return e+e+a+a+i+i})),a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(a[1],16)+","+parseInt(a[2],16)+","+parseInt(a[3],16)+",1)"}(t):Ra.hsl(t)?function(t){var e,a,i,s=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),n=parseInt(s[1],10)/360,o=parseInt(s[2],10)/100,r=parseInt(s[3],10)/100,c=s[4]||1;function d(t,e,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?t+6*(e-t)*a:a<.5?e:a<2/3?t+(e-t)*(2/3-a)*6:t}if(0==o)e=a=i=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,n+1/3),a=d(h,l,n),i=d(h,l,n-1/3)}return"rgba("+255*e+","+255*a+","+255*i+","+c+")"}(t):void 0;var e,a}function Qa(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function Ja(t,e){return Ra.fnc(t)?t(e.target,e.id,e.total):t}function $a(t,e){return t.getAttribute(e)}function Za(t,e,a){if(Ka([a,"deg","rad","turn"],Qa(e)))return e;var i=xa.CSS[e+a];if(!Ra.und(i))return i;var s=document.createElement(t.tagName),n=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;n.appendChild(s),s.style.position="absolute",s.style.width=100+a;var o=100/s.offsetWidth;n.removeChild(s);var r=o*parseFloat(e);return xa.CSS[e+a]=r,r}function ti(t,e,a){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return a?Za(t,s,a):s}}function ei(t,e){return Ra.dom(t)&&!Ra.inp(t)&&(!Ra.nil($a(t,e))||Ra.svg(t)&&t[e])?"attribute":Ra.dom(t)&&Ka(Ta,e)?"transform":Ra.dom(t)&&"transform"!==e&&ti(t,e)?"css":null!=t[e]?"object":void 0}function ai(t){if(Ra.dom(t)){for(var e,a=t.style.transform||"",i=/(\w+)\(([^)]*)\)/g,s=new Map;e=i.exec(a);)s.set(e[1],e[2]);return s}}function ii(t,e,a,i){var s=Sa(e,"scale")?1:0+function(t){return Sa(t,"translate")||"perspective"===t?"px":Sa(t,"rotate")||Sa(t,"skew")?"deg":void 0}(e),n=ai(t).get(e)||s;return a&&(a.transforms.list.set(e,n),a.transforms.last=e),i?Za(t,n,i):n}function si(t,e,a,i){switch(ei(t,e)){case"transform":return ii(t,e,i,a);case"css":return ti(t,e,a);case"attribute":return $a(t,e);default:return t[e]||0}}function ni(t,e){var a=/^(\*=|\+=|-=)/.exec(t);if(!a)return t;var i=Qa(t)||0,s=parseFloat(e),n=parseFloat(t.replace(a[0],""));switch(a[0][0]){case"+":return s+n+i;case"-":return s-n+i;case"*":return s*n+i}}function oi(t,e){if(Ra.col(t))return qa(t);if(/\s/g.test(t))return t;var a=Qa(t),i=a?t.substr(0,t.length-a.length):t;return e?i+e:i}function ri(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ci(t){for(var e,a=t.points,i=0,s=0;s<a.numberOfItems;s++){var n=a.getItem(s);s>0&&(i+=ri(e,n)),e=n}return i}function di(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*$a(t,"r")}(t);case"rect":return function(t){return 2*$a(t,"width")+2*$a(t,"height")}(t);case"line":return function(t){return ri({x:$a(t,"x1"),y:$a(t,"y1")},{x:$a(t,"x2"),y:$a(t,"y2")})}(t);case"polyline":return ci(t);case"polygon":return function(t){var e=t.points;return ci(t)+ri(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function li(t,e){var a=e||{},i=a.el||function(t){for(var e=t.parentNode;Ra.svg(e)&&Ra.svg(e.parentNode);)e=e.parentNode;return e}(t),s=i.getBoundingClientRect(),n=$a(i,"viewBox"),o=s.width,r=s.height,c=a.viewBox||(n?n.split(" "):[0,0,o,r]);return{el:i,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function hi(t,e,a){function i(a){void 0===a&&(a=0);var i=e+a>=1?e+a:0;return t.el.getPointAtLength(i)}var s=li(t.el,t.svg),n=i(),o=i(-1),r=i(1),c=a?1:s.w/s.vW,d=a?1:s.h/s.vH;switch(t.property){case"x":return(n.x-s.x)*c;case"y":return(n.y-s.y)*d;case"angle":return 180*Math.atan2(r.y-o.y,r.x-o.x)/Math.PI}}function ui(t,e){var a=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,i=oi(Ra.pth(t)?t.totalLength:t,e)+"";return{original:i,numbers:i.match(a)?i.match(a).map(Number):[0],strings:Ra.str(t)||e?i.split(a):[]}}function pi(t){return Ba(t?Ga(Ra.arr(t)?t.map(ja):ja(t)):[],(function(t,e,a){return a.indexOf(t)===e}))}function mi(t){var e=pi(t);return e.map((function(t,a){return{target:t,id:a,total:e.length,transforms:{list:ai(t)}}}))}function fi(t,e){var a=Xa(e);if(/^spring/.test(a.easing)&&(a.duration=Oa(a.easing)),Ra.arr(t)){var i=t.length;2===i&&!Ra.obj(t[0])?t={value:t}:Ra.fnc(e.duration)||(a.duration=e.duration/i)}var s=Ra.arr(t)?t:[t];return s.map((function(t,a){var i=Ra.obj(t)&&!Ra.pth(t)?t:{value:t};return Ra.und(i.delay)&&(i.delay=a?0:e.delay),Ra.und(i.endDelay)&&(i.endDelay=a===s.length-1?e.endDelay:0),i})).map((function(t){return Ya(t,a)}))}function gi(t,e){var a=[],i=e.keyframes;for(var s in i&&(e=Ya(function(t){for(var e=Ba(Ga(t.map((function(t){return Object.keys(t)}))),(function(t){return Ra.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),a={},i=function(i){var s=e[i];a[s]=t.map((function(t){var e={};for(var a in t)Ra.key(a)?a==s&&(e.value=t[a]):e[a]=t[a];return e}))},s=0;s<e.length;s++)i(s);return a}(i),e)),e)Ra.key(s)&&a.push({name:s,tweens:fi(e[s],t)});return a}function wi(t,e){var a;return t.tweens.map((function(i){var s=function(t,e){var a={};for(var i in t){var s=Ja(t[i],e);Ra.arr(s)&&1===(s=s.map((function(t){return Ja(t,e)}))).length&&(s=s[0]),a[i]=s}return a.duration=parseFloat(a.duration),a.delay=parseFloat(a.delay),a}(i,e),n=s.value,o=Ra.arr(n)?n[1]:n,r=Qa(o),c=si(e.target,t.name,r,e),d=a?a.to.original:c,l=Ra.arr(n)?n[0]:d,h=Qa(l)||Qa(c),u=r||h;return Ra.und(o)&&(o=d),s.from=ui(l,u),s.to=ui(ni(o,l),u),s.start=a?a.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=Ua(s.easing,s.duration),s.isPath=Ra.pth(n),s.isPathTargetInsideSVG=s.isPath&&Ra.svg(e.target),s.isColor=Ra.col(s.from.original),s.isColor&&(s.round=1),a=s,s}))}var Ei={css:function(t,e,a){return t.style[e]=a},attribute:function(t,e,a){return t.setAttribute(e,a)},object:function(t,e,a){return t[e]=a},transform:function(t,e,a,i,s){if(i.list.set(e,a),e===i.last||s){var n="";i.list.forEach((function(t,e){n+=e+"("+t+") "})),t.style.transform=n}}};function vi(t,e){mi(t).forEach((function(t){for(var a in e){var i=Ja(e[a],t),s=t.target,n=Qa(i),o=si(s,a,n,t),r=ni(oi(i,n||Qa(o)),o),c=ei(s,a);Ei[c](s,a,r,t.transforms,!0)}}))}function yi(t,e){return Ba(Ga(t.map((function(t){return e.map((function(e){return function(t,e){var a=ei(t.target,e.name);if(a){var i=wi(e,t),s=i[i.length-1];return{type:a,property:e.name,animatable:t,tweens:i,duration:s.end,delay:i[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!Ra.und(t)}))}function Ii(t,e){var a=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=a?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,s.delay=a?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,s.endDelay=a?s.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,s}var Di=0;var Ci=[],Ai=function(){var t;function e(a){for(var i=Ci.length,s=0;s<i;){var n=Ci[s];n.paused?(Ci.splice(s,1),i--):(n.tick(a),s++)}t=s>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Pi.suspendWhenDocumentHidden&&(bi()?t=cancelAnimationFrame(t):(Ci.forEach((function(t){return t._onDocumentVisibility()})),Ai()))})),function(){t||bi()&&Pi.suspendWhenDocumentHidden||!(Ci.length>0)||(t=requestAnimationFrame(e))}}();function bi(){return!!document&&document.hidden}function Pi(t){void 0===t&&(t={});var e,a=0,i=0,s=0,n=0,o=null;function r(t){var e=window.Promise&&new Promise((function(t){return o=t}));return t.finished=e,e}var c=function(t){var e=Ha(ba,t),a=Ha(Pa,t),i=gi(a,t),s=mi(t.targets),n=yi(s,i),o=Ii(n,a),r=Di;return Di++,Ya(e,{id:r,children:[],animatables:s,animations:n,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function d(){var t=c.direction;"alternate"!==t&&(c.direction="normal"!==t?"normal":"reverse"),c.reversed=!c.reversed,e.forEach((function(t){return t.reversed=c.reversed}))}function l(t){return c.reversed?c.duration-t:t}function h(){a=0,i=l(c.currentTime)*(1/Pi.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,a=c.animations,i=a.length;e<i;){var s=a[e],n=s.animatable,o=s.tweens,r=o.length-1,d=o[r];r&&(d=Ba(o,(function(e){return t<e.end}))[0]||d);for(var l=Na(t-d.start-d.delay,0,d.duration)/d.duration,h=isNaN(l)?1:d.easing(l),u=d.to.strings,p=d.round,m=[],f=d.to.numbers.length,g=void 0,w=0;w<f;w++){var E=void 0,v=d.to.numbers[w],y=d.from.numbers[w]||0;E=d.isPath?hi(d.value,h*v,d.isPathTargetInsideSVG):y+h*(v-y),p&&(d.isColor&&w>2||(E=Math.round(E*p)/p)),m.push(E)}var I=u.length;if(I){g=u[0];for(var D=0;D<I;D++){u[D];var C=u[D+1],A=m[D];isNaN(A)||(g+=C?A+C:A+" ")}}else g=m[0];Ei[s.type](n.target,s.property,g,n.transforms),s.currentValue=g,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function f(t){var h=c.duration,f=c.delay,g=h-c.endDelay,w=l(t);c.progress=Na(w/h*100,0,100),c.reversePlayback=w<c.currentTime,e&&function(t){if(c.reversePlayback)for(var a=n;a--;)u(t,e[a]);else for(var i=0;i<n;i++)u(t,e[i])}(w),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),w<=f&&0!==c.currentTime&&p(0),(w>=g&&c.currentTime!==h||!h)&&p(h),w>f&&w<g?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(w)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Na(w,0,h),c.began&&m("update"),t>=h&&(i=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(a=s,m("loopComplete"),c.loopBegan=!1,"alternate"===c.direction&&d()):(c.paused=!0,c.completed||(c.completed=!0,m("loopComplete"),m("complete"),!c.passThrough&&"Promise"in window&&(o(),r(c)))))}return r(c),c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.loopBegan=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var a=n=e.length;a--;)c.children[a].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,p(c.reversed?c.duration:0)},c._onDocumentVisibility=h,c.set=function(t,e){return vi(t,e),c},c.tick=function(t){s=t,a||(a=s),f((s+(i-a))*Pi.speed)},c.seek=function(t){f(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,Ci.push(c),h(),Ai())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){xi(pi(t),c)},c.reset(),c.autoplay&&c.play(),c}function Ti(t,e){for(var a=e.length;a--;)Ka(t,e[a].animatable.target)&&e.splice(a,1)}function xi(t,e){var a=e.animations,i=e.children;Ti(t,a);for(var s=i.length;s--;){var n=i[s],o=n.animations;Ti(t,o),o.length||n.children.length||i.splice(s,1)}a.length||i.length||e.pause()}Pi.version="3.2.1",Pi.speed=1,Pi.suspendWhenDocumentHidden=!0,Pi.running=Ci,Pi.remove=function(t){for(var e=pi(t),a=Ci.length;a--;){xi(e,Ci[a])}},Pi.get=si,Pi.set=vi,Pi.convertPx=Za,Pi.path=function(t,e){var a=Ra.str(t)?za(t)[0]:t,i=e||100;return function(t){return{property:t,el:a,svg:li(a),totalLength:di(a)*(i/100)}}},Pi.setDashoffset=function(t){var e=di(t);return t.setAttribute("stroke-dasharray",e),e},Pi.stagger=function(t,e){void 0===e&&(e={});var a=e.direction||"normal",i=e.easing?Ua(e.easing):null,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Ra.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=Qa(l?t[1]:t)||0,m=e.start||0+(l?h:0),f=[],g=0;return function(t,e,w){if(r&&(o=0),c&&(o=(w-1)/2),d&&(o=w-1),!f.length){for(var E=0;E<w;E++){if(s){var v=c?(s[0]-1)/2:o%s[0],y=c?(s[1]-1)/2:Math.floor(o/s[0]),I=v-E%s[0],D=y-Math.floor(E/s[0]),C=Math.sqrt(I*I+D*D);"x"===n&&(C=-I),"y"===n&&(C=-D),f.push(C)}else f.push(Math.abs(o-E));g=Math.max.apply(Math,f)}i&&(f=f.map((function(t){return i(t/g)*g}))),"reverse"===a&&(f=f.map((function(t){return n?t<0?-1*t:-t:Math.abs(g-t)})))}return m+(l?(u-h)/g:h)*(Math.round(100*f[e])/100)+p}},Pi.timeline=function(t){void 0===t&&(t={});var e=Pi(t);return e.duration=0,e.add=function(a,i){var s=Ci.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&Ci.splice(s,1);for(var r=0;r<n.length;r++)o(n[r]);var c=Ya(a,Ha(Pa,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Ra.und(i)?d:ni(i,d),o(e),e.seek(c.timelineOffset);var l=Pi(c);o(l),n.push(l);var h=Ii(n,t);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Pi.easing=Ua,Pi.penner=Wa,Pi.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var Ni=Pi,Si={duration:1e3,loop:!1,easing:"easeInOutSine"};function Li(t,e){const a={};if(e.complete&&t.complete){const i=e.complete,s=t.complete;a.complete=t=>{i(t),s(t)}}return{...t,...e,...a}}function Ri(t,e,a={}){const{left:i,top:s}=t.getBoundingClientRect(),{left:n,top:o}=e.getBoundingClientRect(),r=n-i,c=o-s;return new Promise((e=>{const i=Li({targets:t,translateX:r,translateY:c,...Si,complete:()=>{e(!0)}},a);Ni(i)}))}var Mi=t("AnimeUtil",class{async movePoint(t,e,a={}){const i=Aa(e);if(!i)return ibiz.log.debug("终点元素不存在"),!1;const s=Da(t,document.body);if(!s)return ibiz.log.debug("动画元素不存在"),!1;const{padding:n,width:o,height:r}=Ca(s),c={borderRadius:["0%","50%"],maxWidth:[o,"6px"],maxHeight:[r,"6px"],minWidth:[o,"6px"],minHeight:[r,"6px"],padding:[n,"6px"],duration:700};Object.assign(c,a);const d=await Ri(s,i,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,a={}){return Ri(t,e,a)}resize(t,e={}){return function(t,e={}){return new Promise((a=>{const i=Li({scale:[1,.8,1],targets:t,...Si,complete:()=>{a(!0)}},e);Ni(i)}))}(t,e)}async moveAndResize(t,e,a={}){const i=await this.movePoint(t,e,a);return i&&await this.resize(e,{duration:500}),i}}),Oi=t("FileUtil",class{calcOSSCatUrl(t,e,a){var i;let s="".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId).concat(t);const n=ibiz.hub.getApp(e.srfappid),o=a||n.model.defaultOSSCat||(null==(i=n.model.userParam)?void 0:i.DefaultOSSCat);return s=s.replace("/{cat}",o?"/".concat(o):""),s}calcFileUpDownUrl(t,e,a={},i={}){const{uploadParams:s,exportParams:n,osscat:o}=i;let r=this.calcOSSCatUrl(ibiz.env.uploadFileUrl,t,o),c=this.calcOSSCatUrl("".concat(ibiz.env.downloadFileUrl,"/%fileId%"),t,o),d={},l={};return s&&(d=se(s,a,e,t)),n&&(l=se(n,a,e,t)),r+=rt.stringify(d,{addQueryPrefix:!0}),c+=rt.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o("下载文件失败");if(!a.data)throw new o("文件流数据不存在");{const t=e;c(a.data,t)}}async fileUpload(t,e,a){const i=new FormData;i.append("file",e);const s=await ibiz.net.axios({url:t,method:"post",headers:a,data:i});if(200!==s.status)throw new o("文件上传失败");return s.data}}),_i=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){if(null==e||null==a)return!1;let i=-1;if(e==a?i=0:e>a&&(i=1),"EQ"===t||"ABSEQ"===t)return 0===i;if("GT"===t)return i>0;if("GTANDEQ"===t)return i>=0;if("LT"===t)return i<0;if("LTANDEQ"===t)return i<=0;if("NOTEQ"===t)return 0!==i}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Vi=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Fi=class extends Vi{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let n=0;n<e;n++)if(a){const e=t[n];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[n];this.setParam(e),i=!1,s=!0}else if(s){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},ki=class t extends Vi{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,n=!1;for(let r=0;r<a;r++){if(i&&s){if("!"===e[r]){this.setNotMode(!0),i=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,i=!1,n=!0}else if(n){const a=e[r];if(!(a instanceof Array))throw new o("值必须为数组");a.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new Fi;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Wi=class extends ki{},Ui=class extends Fi{},zi=class t extends _i{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof ki){const t=e.getChildPSModelCondBases();if(null==t||lt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let n=s;for(let e=0;e<t.length;e++){const o=t[e];if(this.testCond(o,a,i)){if(!s){n=!0;break}}else if(s){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Fi){lt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||lt(o)?n=e.getValue():(lt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===o?n=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,n)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Ui}createPSModelGroupCond(){return new Wi}};zi.PARAMTYPE_DATACONTEXT="DATACONTEXT",zi.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Bi=t("PSDEDQCondEngine",zi);async function Gi(t,e){var a;const i=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(i)return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode);ibiz.log.error("未匹配到插件[".concat(t,"]模型"))}var ji=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Ki(t,e){ibiz.register.register("".concat(ji,"_").concat(t),e)}function Xi(t){return ibiz.register.get("".concat(ji,"_").concat(t))}async function Hi(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=Xi(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Xi(a),e)return e;throw new o("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Xi(i),e)return e;throw new o("找不系统计数器类型".concat(i,"对应的适配器"))}var Yi=t("CONTROL_PROVIDER_PREFIX","CONTROL");function qi(t){return ibiz.register.get("".concat(Yi,"_").concat(t))}async function Qi(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=qi(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=qi("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=qi(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var Ji=t("EDITOR_PROVIDER_PREFIX","EDITOR");function $i(t){return ibiz.register.get("".concat(Ji,"_").concat(t))}async function Zi(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Gi(n,o);if(t&&(e=$i(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=$i("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let n="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(n+="_".concat(i)),e=$i(n),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=$i(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var ts=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function es(t){return ibiz.register.get("".concat(ts,"_").concat(t))}async function as(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Gi(i,s);if(t&&(e=es(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=es(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var is=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function ss(t){return ibiz.register.get("".concat(is,"_").concat(t))}async function ns(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=ss(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const o=i?"".concat(a,"_EDIT"):a;if(e=ss(o),e)return e;ibiz.log.error("找不到表格列类型".concat(o,"对应的适配器"))}var os=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function rs(t){return ibiz.register.get("".concat(os,"_").concat(t.toUpperCase()))}async function cs(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:n,controlRenders:o}=t;if(s){const t=await Gi(s,n);if(t&&(a=rs(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if(o&&o.length>0)a=rs("PREDEFINE_RENDER");else{if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=rs(i),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器,注册key为").concat(i))}if("RAWITEM"===i){const i=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT",s="RAWITEM_".concat(i);if(a=rs(s),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器,注册key为").concat(s))}if("FIELD"===i){const{editor:e}=t;if(e&&e.predefinedType){if(a=rs("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}a=rs(i)}if(a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var ds=t("PORTLET_PROVIDER_PREFIX","PORTLET");function ls(t){return ibiz.register.get("".concat(ds,"_").concat(t))}async function hs(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Gi(i,s);if(t&&(e=ls(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=ls(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var us=t("UIACTION_PROVIDER_PREFIX","UIACTION");function ps(t,e){ibiz.register.register("".concat(us,"_").concat(t),e)}function ms(t){return ibiz.register.get("".concat(us,"_").concat(t))}async function fs(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:n}=t;if(i){const t=await Gi(i,s);if(t&&(e=ms(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=ms("".concat(a,"_").concat(n)),e)return e;if(e=ms(a),e)return e;throw new o("找不界面行为模式".concat(a,"对应的适配器"))}var gs=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function ws(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Gi(a,i);if(s){if(e=ibiz.register.get("".concat(gs,"_").concat(s)),e)return e;throw new o("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var Es=t("VIEW_PROVIDER_PREFIX","VIEW");function vs(t){return ibiz.register.get("".concat(Es,"_").concat(t))}var ys=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var Is=t("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new o("文件流数据不存在")}}),Ds=t("BrowserPlatformProvider",class extends Is{});var Cs=window.navigator.userAgent.toLowerCase();function As(){return/Android|Adr/i.test(Cs)?"Android":/iPhone|iPod|iPad/i.test(Cs)?"IOS":/MicroMessenger/i.test(Cs)?"WeChat":/DingTalk/i.test(Cs)?"DingTalk":/miniProgram/i.test(Cs)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var bs=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function Ps(t,e){ibiz.register.register("".concat(bs,"_").concat(t),e)}function Ts(t){return ibiz.register.get("".concat(bs,"_").concat(t))}function xs(){const t=Ts(As());return t||Ts("Browser")}var Ns=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ss(t,e){ibiz.register.register("".concat(Ns,"_").concat(t),e)}function Ls(t){return ibiz.register.get("".concat(Ns,"_").concat(t))}async function Rs(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Gi(i,s);if(t&&(e=Ls(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=Ls(a),e)return e;throw new o("找不实体行为方法类型为".concat(a,"的适配器"))}var Ms=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Os(t){return ibiz.register.get("".concat(Ms,"_").concat(t))}async function _s(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Gi(s,i);if(t&&(e=Os(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=Os(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var Vs=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Fs(t){return ibiz.register.get("".concat(Vs,"_").concat(t))}async function ks(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Gi(a,i);if(t&&(e=Fs(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}return e=Fs(s),e}var Ws=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var Us=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new $,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=ht(t)),e&&(this.params=ht(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&Y(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),zs=t("AppDECounter",class extends Us{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new a(this.model,"未找到获取计数器行为!");this.action=i,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),Bs=t("AppDECounterProvider",class{createCounter(t){return new zs(t)}});function Gs(){Ki("DEDR",(()=>new Bs))}var js=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Bi;return 1===e.length?a.parse(this.calcCond(e)[0]):e.length>1&&a.parse(["AND",this.calcCond(e)][0]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const i=e.dedqconditions;if(i){const t=this.calcCond(i);a.push(t)}}else{if("SINGLE"!==t.condType)throw new i(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.condOp),a.push(e.fieldName),e.condValue?e.vartypeId?a.push({type:e.vartypeId,value:e.condValue}):a.push(e.condValue):a.push("")}}e.push(a)})),e}});js.map=new WeakMap;var Ks=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new i(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:i,iconClsAppDEFieldId:s,iconClsXAppDEFieldId:n,iconPathAppDEFieldId:o,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:d,clsAppDEFieldId:l,colorAppDEFieldId:h}=this.codeList,u=a?t[a]:t.srfkey;if(e.id=u,e.value=u,e.text=i?t[i]:t.srfmajortext,(s||n||o||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),n&&(e.sysImage.cssClassX=t[n]),o&&(e.sysImage.imagePath=t[o]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Zs(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=Xe.execSingleLine(t[d])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:n,minorSortAppDEFieldId:o,minorSortDir:r,pvalueAppDEFieldId:c,customCond:d}=this.codeList,l={...e};if(o&&r&&Object.assign(l,{sort:"".concat(o.toLowerCase(),",").concat(r.toLowerCase())}),d){const e=se(Xe.execSingleLine(d),l,t);Object.assign(l,e)}if(l.size||(l.size=1e4),this.isPredefined&&this.codeList.codeName){let t=this.codeList.codeName;if("OPERATOR"===this.codeList.predefinedType){const e=this.codeList.codeName.indexOf("__");t=-1!==e?this.codeList.codeName.substring(e+2):this.codeList.codeName}const e=await i.net.get("/dictionaries/codelist/".concat(t),l);return Object.freeze(e.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!n)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,n,t,void 0,l);let u=[];if(h.data.length)if(c){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach((t=>{u.push(this.convertData(t))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:a}=this.codeList,i={},s=[];return t.forEach((t=>{i[t[e]]=this.convertData(t)})),t.forEach((t=>{const n=i[t[a]];n?(n.children=n.children||[],n.children.push(i[t[e]])):s.push(i[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const i=this.load(t,e),{cacheTimeout:s}=this.codeList,n=-1===s||ct(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(a,o);const r=await i;return o.items=r,delete o.promise,r}});function Xs(t,e){if(null!=e){const{srfkey:t}=e;if(!ct(t)&&!lt(t))return!0}throw new o("执行「".concat(t,"」不存在「srfkey」无法处理"))}function Hs(t,e){const{srfsessionid:a}=e;if(!ct(a)&&!lt(a))return!0;throw new o("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Ys=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const a=this.cacheMap.get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,ht(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new o("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Hs("add",t),(ct(e.srfkey)||lt(e.srfkey))&&(e.srfkey=J()),e.srftempdate=(new Date).getTime();const a=()=>{this.cacheMap.set(e.srfkey,ht(e)),ibiz.log.warn("add",e.srfkey,e)},i=this.getTransaction(t);return i?i.change(e.srfkey,(()=>{a()})):a(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Hs("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),ht(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Hs("update",t),Xs("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i){const s=ht(i);s.assign(e);const n=()=>{i.assign(e),a!==e.srfkey&&this.cacheMap.delete(a),this.cacheMap.set(e.srfkey,i),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{n()})):n(),s}throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Hs("delete",t);const a=e;if(this.cacheMap.has(a)){const e=this.cacheMap.get(a),i=()=>{this.cacheMap.delete(a),ibiz.log.warn("delete",a)},s=this.getTransaction(t);return s?s.change(a,(()=>{i()})):i(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Hs("add",t);const a=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},i=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(ct(s.srfkey)||lt(s.srfkey))&&(s.srfkey=J()),s.srftempdate=(new Date).getTime();const n=ht(s);i?i.change(n.srfkey,(()=>{a(n)})):a(n)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Hs("update",t);const a=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},i=this.getTransaction(t);for(let s=0;s<e.length;s++){const n=e[s];Xs("update",n);const r=n.srfkey;if(this.isUnionKey&&(this.calcUnionKey(n),r!==n.srfkey&&this.checkData(t,n.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(n.srfkey,"的数据"));n.srftempdate=(new Date).getTime();const c=this.cacheMap.get(n.srfkey);if(!c)throw new Error("数据[".concat(n.srfdename,"-").concat(n.srfmajortext,"(").concat(n.srfkey,")]不存在,无法更新!"));{const t=ht(c);t.assign(n),e[s]=t,i?i.change(n.srfkey,(()=>{c.assign(n),a(c,r)})):(c.assign(n),a(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Hs("delete",t)}catch(t){return ibiz.log.error(t),e}const a=[];for(let t=0;t<e.length;t++){const i=e[t];this.cacheMap.has(i)||a.push(i)}if(a.length>0)throw new Error("未找到以下数据「".concat(a.join("、"),"」,无法删除!"));const i=t=>{this.cacheMap.delete(t),ibiz.log.warn("delete",t)},s=this.getTransaction(t);for(let t=0;t<e.length;t++){const a=e[t];s?s.change(a,(()=>{i(a)})):i(a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ut(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const i=t[a];e[a]=ut(i)}return pt(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>de(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>ct(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}getTransaction(t){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&!0===e.transaction.state.isOpen?e.transaction:null}}),qs=/\$\{(.*?)\}/g;function Qs(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(qs);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,i)=>i===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function Js(t,e){const a=Qs(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((i,s)=>{e=s===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):e.replace("${".concat(i,"}"),t[i])})),e}return a.path}return""}var $s=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(ct(e.page)||lt(e.page)||(this.page=e.page),ct(e.size)||lt(e.size)||(this.size=e.size),ct(e.query)||lt(e.query)||(this.query=e.query),!ct(e.sort)&&!lt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Zs(t){return[1,"1",!0,"true"].includes(t)}var tn=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let i=[];return(null==a?void 0:a.length)&&(i=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(i)),i}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var a;let i=t.text;t.textLanguageRes&&(i=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:s}=t;t.tooltipLanguageRes&&(s=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const n={text:i,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?Xe.execSingleLine(t.data):void 0,sysImage:t.sysImage};return(null==(a=t.codeItems)?void 0:a.length)&&(n.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(n)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new Ks(t),this.cache.set(s,i),await i.init()),i.get(e,a)}async get(t,e,a){const i=this.allCodeLists.get(t);if(!i)throw new o("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),en=t("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),an=t("CounterService",class{static async getCounter(t,e,a){const i=t.id;if(this.counterMap.has(i)){const t=this.counterMap.get(i);if(!1===t.isDestroyed)return t;this.counterMap.delete(i)}const s=(await Hi(t)).createCounter(t);return await s.init(e,a),this.counterMap.set(i,s),s}static async getCounterByRef(t,e,i){const{appCounter:s}=t;if(!s)throw new a(t,"未配置应用计数器!");return this.getCounter(s,e,i)}});an.counterMap=new Map;var sn=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},i={}){switch(t){case"wfstart":return this.wfStart(e,a,i);case"wfsubmit":return this.wfSubmit(e,a,i);case"reassign":return this.wfReassign(e,a,i);case"addstepbefore":return this.wfAddStepBefore(e,a,i);case"addstepafter":return this.wfAddStepAfter(e,a,i);case"sendback":return this.wfSendBack(e,a,i);case"sendcopy":return this.wfSendCopy(e,a,i);default:throw new o("「".concat(t,"」未实现"))}}}),nn=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Js(a,this.model),n="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}},on=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(on||{})),rn=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:ht(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=de(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const s=de(e.appDEFields||[],e.majorAppDEFieldId);if(s){const t=s.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:ct(this.srfkey)?J():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:a}=this,i={};Object.keys(e).forEach((t=>{i[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();i[s]={enumerable:!0,set(i){e[s]=a(i,t.stdDataType)},get:()=>e[s]},e[s]=a(e[s],t.stdDataType)})),Object.defineProperties(this,i)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return a=e instanceof t?e._data:e,Object.keys(a).forEach((t=>{void 0===a[t]&&delete a[t]})),Object.assign(this._data,a),this}convertVal(t,e){if(null==t)return t;if(ct(e))return t;if(l.isNumber(e)){const e=ct(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),cn=t("MethodDto",class{constructor(t,e,a,i){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.dtoMap=new Map,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,a)=>{e[a+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((a=>{const i=parseInt(a,10);e[i-1]=t[i]})),e}async get(t,e,s=!1){const n={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],d=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[d]&&(n[d]=0===e[d].length?null:this.convertArrayToListMap(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const i=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=i.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const a=ht(t);a[this.entity.codeName.toLowerCase()]=e.srfkey;const i={};h.parentAppDEFieldId&&(i[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,a,i)}else{if(r.entity.id===this.entity.id)throw new a(c,"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!");u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,a=[];for(let i=0;i<e.length;i++)a.push(await r.get(t,e[i],!0));n[d]=a}}break;default:throw new i(c,"未支持的应用实体方法输入属性类型: ".concat(c.type))}}return{...e,...n}}async sets(t,e){const a=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const i=this.fields.filter((t=>"DTOS"===t.type)).map((async i=>{const s=i.codeName.toLowerCase();if(i.listMap&&"object"==typeof e[s])e[s]=this.convertListMapToArray(e[s]);else{if(!i.refAppDataEntityId)return;const n=a.getDERConfig(i.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,i);n||o.service.local.clear();const r=e[s];if(r&&r.length>0){const a=e[this.entity.keyAppDEFieldId];i.refPickupAppDEFieldId&&r.forEach((t=>{t[i.refPickupAppDEFieldId]=a})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<i.length;t++)await i[t];const s=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,s),s})))}async calcRs(t,e=0){if(e>10)return;e+=1;const a=ibiz.uiDomainManager.get(t.srfsessionid),i=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<i.length;s++){const n=i[s];if(!n.refAppDataEntityId)continue;if(0===a.getDERConfig(n.refAppDataEntityId).length){const i=await this.getFieldDto(t,n);i.entity.minorAppDERSs&&a.setDERConfig(n.refAppDataEntityId,i.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await i.calcRs(t,e)}}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),i=de(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,a.id);s.isLocalMode=!0;const n=s.createMethodDto(i,{isLocalMode:!0});return this.dtoMap.set(e.codeName,n),n}}),dn=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Ys(e),this.configCache=new en(e.appId,"PSAppDataEntity",e.codeName),this.wf=new sn(e),this.file=new nn(e)}async getMethod(t,e=!1){const s=e?"ac-".concat(t):t;if(this.methodMap.has(s))return this.methodMap.get(s);const n=de(this.model.appDEMethods,t);if(!n)throw new a(this.model,"未找到服务方法: ".concat(t));const o=await Rs(n);if(!o)throw new i(n,"未支持的服务方法类型: ".concat(n.methodType));const r=o.create(this,this.model,n,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(s,r),r}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(e);return new Promise(((e,o)=>{s.net.sse("/".concat(n),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),onmessage:e=>{if(e.data){const a=JSON.parse(e.data);t(a)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},a={}){const i=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return i.net.post(s,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],i="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return Js(t,this.model)+i}newEntity(t){return t instanceof rn?t.clone():new rn(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new cn(this,this.model,null==e?void 0:e.isLocalMode,t)}}),ln=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],hn=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:ct(this.srfkey)?J():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a){const i=!a||a.isOriginField;ln.includes(t)||(i||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=ht(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),un=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,i){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,i)}handleResponse(t){return h(t)}toUIData(t){return new hn(t,this.dataUIMap)}}),pn=t("MDControlService",class extends un{async fetch(t,e={}){var a;const i=(null==(a=this.model.fetchControlAction)?void 0:a.appDEMethodId)||"fetchdefault";let s=await this.exec(i,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var a;const i=(null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var a;const i=(null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var a;const i=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(i,t,void 0,e)}async create(t,e){var a;const i=(null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,a={}){throw new o("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&(Z(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),mn=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,i);const s=fe(i,e);if(s){ibiz.log.debug("匹配主状态",s);const e=ge(s,i);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),fn=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new mn(e),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),gn=t("V7AuthService",class{get isAnonymous(){return"1"===tt(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error("未找到匿名登录配置用户名或密码"),!1;const a=await this.login(t,e);if(a){et(u.IS_ANONYMOUS,"1",0,!0);const t=tt(u.TOKEN),e=tt(u.TOKEN_EXPIRES),a=tt(u.TOKEN_REMEMBER),i=tt(u.REFRESH_TOKEN);et(u.TOKEN,t,0,!0),et(u.TOKEN_EXPIRES,e,0,!0),et(u.TOKEN_REMEMBER,a,0,!0),i&&et(u.REFRESH_TOKEN,i,0,!0)}return a}async login(t,e,a){try{const i=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:s}=i;if(s&&s.token){const t=a?7:0;a&&et(u.TOKEN_REMEMBER,"1",t,!0),et(u.TOKEN,s.token,t,!0);const e=(new Date).getTime()+1e3*(s.expirein||7199);et(u.TOKEN_EXPIRES,"".concat(e),t,!0),s.refresh_token&&et(u.REFRESH_TOKEN,s.refresh_token,t,!0),at(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),at(u.TOKEN),at(u.TOKEN_EXPIRES),at(u.TOKEN_REMEMBER),at(u.REFRESH_TOKEN),at(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0,!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=tt(u.TOKEN),e=tt(u.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const a=3e5;t=t>a?t-a:0,setTimeout((async()=>{const t=tt(u.TOKEN_REMEMBER),e=tt(u.REFRESH_TOKEN),a=t?7:0;let i;if(i=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),i.ok){et(u.TOKEN,i.data.token,a,!0);const t=(new Date).getTime()+1e3*(i.data.expirein||7199);et(u.TOKEN_EXPIRES,"".concat(t),a,!0),i.data.refresh_token&&et(u.REFRESH_TOKEN,i.data.refresh_token,a,!0),await this.loadAppData(),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}getAuthInfo(){const t=tt(u.TOKEN),e=!!tt(u.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}async loadAppData(){const t=await ibiz.net.get("/appdata");t.ok&&(ibiz.appData=t.data)}}),wn=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return ct(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),En=t("MethodInput",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodInput;if(s){const a=de(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),vn=t("MethodReturn",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodReturn;if(s){const a=de(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const a=ibiz.hub.getApp(this.entity.appId),i=ibiz.uiDomainManager.get(t.srfsessionid);i&&!0!==i.state.rsInit&&(await this.dto.calcRs(t),i.calcParentRs(),i.state.rsInit=!0),a.deService.clearTempCacheByRs({srfappid:a.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return q(e)&&(e={}),new rn(this.entity,e)}}),yn=t("Method",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i,this.app=ibiz.hub.getApp(e.appId),this.input=new En(t,e,a),this.result=new vn(t,e,a)}async request(t,e,i,s){const{actionType:n,requestMethod:o}=this.method;if("REMOTE"===n){const e=this.method.codeName.toLowerCase();let n=null;switch(o){case"POST":n=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":n=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":n=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":n=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,o?"未支持的请求方式: ".concat(o):"未配置请求方式")}return n}throw new a(this.method,"未支持的行为类型[".concat(n,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Js(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),In=class{constructor(t,e,a,i){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:R(a)?a:[a],params:i}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},Dn=class{},Cn=class extends Dn{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return We(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return We(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return We(n[this.dstField],this.op,this.value)}}},An=class t extends Dn{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Cn(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},bn=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new An(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},Pn=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new bn(t)))}},Tn=class extends Pn{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},xn=class extends Pn{async exec(t){}},Nn=class extends Pn{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function Sn(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:n,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[a],t.isEntityParam(a)&&(d=null==d?void 0:d.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=ht(ibiz.env);break;case"EXPRESSION":if(!o)throw new i(e,"表达式为空");c=Xe.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new i(e,"暂未支持源值类型".concat(r))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:Xe.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(d,"报错,源参数:"),c),t}return c}var Ln=class extends Pn{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new i(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,i=Sn(e,t);e.params[a]=ht(i)}bindParam(t,e){const a=Sn(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:i}=t;let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=Sn(e,t);s?e.params[i][s]=n:e.params[i]=n}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=Sn(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Rn=class extends Pn{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,n=t.params[i],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(a,e,t.context,n);r.ok&&(t.params[s]=r.data)}},Mn=class extends Pn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Sn(t,this.model);t.params[e]=s}},On=class extends Pn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},_n=class extends Pn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Vn=class extends Pn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Sn(t,this.model);t.params[e]=ht(s)}},Fn=class extends Pn{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},kn=class extends Pn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Sn(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},Wn=class extends Pn{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},Un=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=ht(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=ht(t.data||{});else{if(a.envParam)throw new i(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new i(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new i(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new i(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new i(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new i(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new i(a,"未支持的逻辑参数类型: 操作会话变量")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},zn=class{constructor(t){var e,s;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new a(t,"脚本代码模式没有配置脚本代码");this.scriptFn=Xe.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new xn(t);break;case"END":a=new Nn(t);break;case"DEACTION":a=new Tn(t);break;case"PREPAREPARAM":a=new Ln(t);break;case"DEDATASET":a=new Rn(t);break;case"THROWEXCEPTION":a=new Wn(t);break;case"BINDPARAM":a=new Mn(t);break;case"RESETPARAM":a=new On(t);break;case"COPYPARAM":a=new Vn(t);break;case"RENEWPARAM":a=new _n(t);break;case"APPENDPARAM":a=new kn(t);break;case"SORTPARAM":a=new Fn(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new Un(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,i){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:i});const s=new In(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(n);await this.deepExec(t,s)}return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Bn=new Map;async function Gn(t,e,a={},i={}){Bn.has(t)||Bn.set(t,new zn(t));return Bn.get(t).exec(e,a,i)}async function jn(t,e,a,i,s){const n=await async function(t,e,a){return ve(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!n)throw new o("".concat(e,"找不到实体逻辑").concat(t));return Gn(n,a,i,s)}async function Kn(t,e,a,i){const n=ht(e),o=a?ht(a):a,r=i?ht(i):i;try{const e=await Gn(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function Xn(t,e,a,i,s){const n=ye(t,e);if(n.length){(await Promise.all(n.map((t=>Gn(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function Hn(t,e,a,i,s={}){if(i){if(!R(i))return Xn(t,e,a,i,s);await Promise.all(i.map((i=>Xn(t,e,a,i,s))))}}var Yn=t("DEActionMethod",class extends yn{async inputHandle(t,e){return R(e)?e:this.input.handle(t,e)}async exec(t,e,i){let s;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await Hn(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const n=ve(this.method.appDELogicId,this.entity);if(!n)throw new a(this.method,"缺少实体处理逻辑");s=await Kn(n,t,e,i)}else switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),this.method.codeName){case"Create":s=await this.create(t,e,i||{});break;case"Get":s=await this.get(t,i);break;case"GetDraft":s=await this.getDraft(t,i);break;case"Remove":s=await this.remove(t,i);break;case"Update":s=await this.update(t,e,i);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,i);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);if(this.method.needResourceKey){let i=t[this.entity.codeName.toLowerCase()];O(i)&&(i=R(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),a="".concat(a,"/").concat(i)}const n=await this.request(a,t,e,i);n.data=await this.result.handle(t,n.data),s=n}}return s.data&&await Hn(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new o("create行为没有传data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.post(i,e,a);return s.data=await this.result.handle(t,s.data),s}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new o("update行为没有传data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.put("".concat(i,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return s.data=await this.result.handle(t,s.data),s}async get(t,e={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e);return i.data=await this.result.handle(t,i.data),i}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/getdraft"),e);return i.data=await this.result.handle(t,i.data),i}async createTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,a)),new p(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new p(t):new p(t,500)}catch(t){return new p(t,500)}}async removeTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(a,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const i=this.service.local.delete(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,i){const s=ibiz.uiDomainManager.get(e.srfsessionid),n=s.transaction;let o=!1;!1===n.state.isOpen&&(n.open(),o=!0);try{let i=s.getDERConfigByMajor(this.entity.id);if(i.length>0){const s=this.service.local.get(e,t);i=it(i,"removeOrder");for(const n of i){if("DER1N"!==n.rstype)throw new a(n,"目前只支持[DER1N]关系类型关联删除删除");const{removeActionType:i,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=n,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=ht(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(i){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const a=await l.remove(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 2:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey,e[n.parentAppDEFieldId.toLowerCase()]=void 0;const a=await l.updateTemp(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e="无法删除[".concat(this.entity.logicName,"-").concat(s.srfmajortext,"], 数据被[").concat(l.model.logicName,"-").concat(t,"]引用");throw new Error(o||e)}}}}o&&n.state.isOpen&&n.commit()}catch(t){throw o&&n.state.isOpen&&n.rollback(),t}finally{o&&n.state.isOpen&&n.close()}}async updateTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,a)),i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=this.service.local.get(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new p(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{if(a.parentAppDEFieldId){const{majorAppDataEntityId:i,parentAppDEFieldId:s}=a,n=we(i),o=s.toLowerCase(),r=t[n];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),qn=class{create(t,e,a,i){return new Yn(t,e,a,i.localMode)}},Qn=t("FetchMethod",class extends yn{async exec(t,e,a){const s=e&&!R(e)?e:a||{};let n;if(this.isLocalMode){const e=js.getCond(this.method),a=new $s(t,s),i=await this.searchLocal(e,a);n=new p(i,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":n=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);n=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const o=n.data||[];n.data=o.map((t=>this.createEntity(t)))}return n.data&&await Hn(this.entity,"compute",t,n.data,s),n}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=this.service.local.getList();t?i.length>0&&(i=i.filter((a=>t.test(a,e)))):i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const i=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const s=t[a[e]];if(i.test(s))return!0}return!1}))),ct(e.sortField)||lt(e.sortField)||(i="DESC"===e.sortMode?st(i,e.sortField):it(i,e.sortField));const{page:s,size:n}=e,o=s*n,r=(s+1)*n-1;return i.slice(o,r).map((t=>ht(t)))}async fetchCodeListSet(t,e){const{appCodeListId:i}=this.method;if(!i)throw new a(this.method,"没有指定数据来源代码表");const s=await this.app.codeList.get(i,t,e),{keyAppDEFieldId:n,majorAppDEFieldId:o}=this.entity,r=s.map((t=>({[n]:t.value,[o]:t.text})));return new p(r,200)}}),Jn=t("AcFetchMethod",class extends Qn{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),$n=class{create(t,e,a,i){return i.acMode?new Jn(t,e,a,i.localMode):new Qn(t,e,a,i.localMode)}};function Zn(){const t=new qn;Ss("DEACTION",(()=>t));const e=new $n;Ss("FETCH",(()=>e)),Ss("FETCHTEMP",(()=>e))}var to=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"update_time,desc"};Object.assign(e,t);const a=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),e);return a.headers&&(a.headers["x-page"]&&(a.page=Number(a.headers["x-page"])),a.headers["x-per-page"]&&(a.size=Number(a.headers["x-per-page"])),a.headers["x-total"]&&(a.total=Number(a.headers["x-total"]))),ct(a.data)&&(a.data=[]),a}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}}),eo=t("TreeNodeData",class{constructor(t,e,a){this._uuid=J(),this._leaf=!1,this._leaf=!0===a.leaf,this._parent=e,this._nodeType=t.treeNodeType,this._parent&&(this._context={...this._parent._context}),a.navContext&&(this._context=Object.assign(this._context||{},a.navContext)),a.navParams&&(this._params={...a.navParams}),this._nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath),e.rawContent&&(a.htmlStr=e.rawContent)),Object.values(a).length>0?a:void 0}}),ao=t("TreeCodeListNodeData",class extends eo{constructor(t,e,a){super(t,e,a);const{data:i}=a;this._text=i.text,this._value=i.value;const s="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(s):s},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=we(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),io=["_id","_value","_text","_deData","clone"],so=t("TreeDataSetNodeData",class t extends eo{constructor(e,a,i){var s,n;super(e,a,i);const{data:o}=i;this._deData=o;const r="".concat(e.id,"@").concat(o.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(r):r},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_text",{get(){return e.textAppDEFieldId?this._deData[e.textAppDEFieldId]:this._deData.srfmajortext},set(t){e.textAppDEFieldId?this._deData[e.textAppDEFieldId]=t:this._deData.srfmajortext=t},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_value",{get(){return e.idAppDEFieldId?this._deData[e.idAppDEFieldId]:this._deData.srfkey},set(t){e.idAppDEFieldId?this._deData[e.idAppDEFieldId]=t:this._deData.srfkey=t},enumerable:!0,configurable:!0}),e.appDataEntityId){const t=we(e.appDataEntityId);this._context=Object.assign(this._context||{},{[t]:o.srfkey})}this._icon=this.calcIcon(e),this._textHtml=this.calcTextHtml(e),e.leafFlagAppDEFieldId&&(this._leaf=Zs(o[e.leafFlagAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();c.set(e,a),t.defaultValue&&d.set(e,t.defaultValue)}));const l=new Map;null==(n=e.detreeNodeColumns)||n.forEach((t=>{if("DEFGRIDCOLUMN"!==t.columnType)return;const e=t.detreeColumnId,a=t.dataItemName;e&&a?l.set(e,a):ibiz.log.error("模型异常缺少detreeColumnId或者dataItemName",t)}));const h=new Map;h.set("srfuf","srfuf");const u=t=>l.has(t)?c.get(l.get(t)):c.has(t)?c.get(t):Object.prototype.hasOwnProperty.call(this._deData,t)?t:h.has(t)?h.get(t):void 0;return this.clone=()=>{const a=ht(this._deData),i=new t(e,this._parent,{data:a,leaf:this._leaf,navContext:this._context,navParams:this._params});return Object.keys(this).forEach((t=>{const e=u(t);ct(e)&&!io.includes(t)&&(i[t]=this[t])})),i},new Proxy(this,{set(t,e,a){const i=u(e);return ct(i)?t[e]=a:t._deData[i]=a,!0},get(t,e,a){const i=u(e);return ct(i)?t[e]:ct(t._deData[i])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[i];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return m(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:i}=t;a&&this._deData[a]&&(e.imagePath=this._deData[a]),e&&(this._icon=e);const s=null==i?void 0:i.find((t=>"icon"===t.id));return s&&(e.htmlStr=this.calcDataItemScript(s)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return Xe.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,i=null==a?void 0:a.find((t=>"text"===t.id));return i&&(e=this.calcDataItemScript(i)),e}}),no=t("TreeStaticNodeData",class extends eo{constructor(t,e,a){var i,s;super(t,e,a);const n="root"===t.nodeValue?void 0:t.nodeValue,o="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(o):o},enumerable:!0,configurable:!0}),this._text=t.text,this._value=n,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=n||(null==t?void 0:t._value)}this.srfkey=(null==(i=this._deData)?void 0:i.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),oo=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,ct(a.isOriginField)||(this.isOriginField=a.isOriginField),ct(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=ct(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),ro=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var co=["REGION","REGION2","REGION3","REGION4"],lo=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:i,longitudeAppDEFieldId:s,latitudeAppDEFieldId:n,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,co.includes(this._itemStyle)?s&&l.set("_areaCode",s):(s&&l.set("_longitude",s),n&&l.set("_latitude",n)),c&&l.set("_tooltip",c),o&&l.set("_text",o),r&&l.set("_value",r),d&&(this._symbol=d.rawContent||d.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:l.has(a)?t[l.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:l.has(a)?t[l.get(a)]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}});var ho=t("PanelData",class{constructor(t,e){const a=new $,i={},s={};return t.forEach((t=>{var e;i[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(s[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,n,o)=>(Object.prototype.hasOwnProperty.call(i,n)?i[n]?e[i[n]]=o:t[n]=o:e[n]=o,a.emit("change",n),i[n]&&i[n]!==n&&a.emit("change",i[n]),s[n]&&s[n]!==n&&a.emit("change",s[n]),!0),get:(t,s,n)=>"_evt"===s?a:i[s]?e[i[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const a=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,a),a}})}destroy(){this._evt.reset()}});var uo=t("ChartData",class{constructor(t,e,a,i){return this._seriesModelId=null==e?void 0:e.id,this._catalog=a,this._groupName=i,this._uuid=J(),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}}),po=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},mo=t("GanttStaticNodeData",class extends no{constructor(t,e,a,i){super(e,a,i),this._snDataItemValue=po(t.sndataItemName,e),this._beginDataItemValue=po(t.beginDataItemName,e),this._endDataItemValue=po(t.endDataItemName,e),this._prevDataItemValue=po(t.prevDataItemName,e),this._finishDataItemValue=po(t.finishDataItemName,e),this._totalDataItemValue=po(t.totalDataItemName,e)}}),fo=t("GanttDataSetNodeData",class extends so{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=po(t.sndataItemName,e,s),this._beginDataItemValue=po(t.beginDataItemName,e,s),this._endDataItemValue=po(t.endDataItemName,e,s),this._prevDataItemValue=po(t.prevDataItemName,e,s),this._finishDataItemValue=po(t.finishDataItemName,e,s),this._totalDataItemValue=po(t.totalDataItemName,e,s)}}),go=t("GanttCodeListNodeData",class extends ao{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=po(t.sndataItemName,e,s),this._beginDataItemValue=po(t.beginDataItemName,e,s),this._endDataItemValue=po(t.endDataItemName,e,s),this._prevDataItemValue=po(t.prevDataItemName,e,s),this._finishDataItemValue=po(t.finishDataItemName,e,s),this._totalDataItemValue=po(t.totalDataItemName,e,s)}}),wo=t("MqttService",class{constructor(t,e,a){this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new $,this.options={connectTimeout:6e3,clientId:J(),username:"",password:"",keepalive:60,clean:!0},this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),a=t.default?t.default:t,{location:i}=window;this.client=a.connect("ws://".concat(i.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.warn("mqtt reconnect")})),this.client.on("close",(()=>{ibiz.log.warn("mqtt close")}))}close(){var t;null==(t=this.client)||t.end(),this.evt.reset()}}),Eo=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,a){const i=e.srfsessionid||"applocation";this.cache.has(i)||this.cache.set(i,new Map);const s=this.cache.get(i);if(!s.has(a)){const e=await ibiz.hub.getAppDataEntity(a,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(a,"]"));const n=t.constructorCache.get(a.toUpperCase());let r;r=n?await n(i,e):new dn(i,e),s.set(a,r)}return s.get(a)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}clearTempCacheByRs(t,e,a=[]){if(!0===a.includes(e))return;a.push(e);const i=t.srfsessionid;if(!this.cache.has(i))return;const s=this.cache.get(i).get(e);s&&s.local.clear();const n=ibiz.uiDomainManager.get(t.srfsessionid);if(n){n.getDERConfigByMajor(e).forEach((e=>{this.clearTempCacheByRs(t,e.minorAppDataEntityId,a)}))}}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};Eo.constructorCache=new Map;var vo=t("DEServiceUtil",Eo),yo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=ht(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new o("应用视图[".concat(t,"]不存在"));if((n.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=we(r.appDataEntityId);n.srfkey&&(n[t]=n.srfkey,n.srfkey=void 0),0===a.srfuf&&(n[t]=void 0,delete a.srfuf)}if(r.redirectView){return Ve(await ibiz.hub.getAppView(t),n,a,s)}const{openMode:c="INDEXVIEWTAB"}=r,d=s.openMode||c;switch(void 0!==d&&"INDEXVIEWTAB"!==d&&n.toRouteDepth&&(n.toRouteDepth=void 0),d){case"INDEXVIEWTAB":case"INDEXVIEWTAB_POPUP":return s.noWaitRoute?(this.openIndexViewTab(r,n,a),{ok:!0}):this.openIndexViewTab(r,n,a);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,n,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,n,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,n,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,n,a);case"USER":return this.openUserCustom(r,n,a);default:return this.openIndexViewTab(r,n,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}openIndexViewTabByModal(t,e,a={}){return ibiz.openView.rootByModal(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,e,a,i={}){if(!e)throw new o("气泡打开缺少event");return ibiz.openView.popover(t.id,e,a,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};yo.TAG="ibiz.app-view.open";var Io=t("OpenAppViewCommand",yo),Do=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!n)throw new o("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:d}=n,l=e.clone();Object.assign(l,se(r,a,e));const h=se(c,a,e);switch(d){case"APPVIEW":return this.openAppView(n,l,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(n);case"PDTAPPFUNC":return this.openPdAppFunc(n,l,h);case"JAVASCRIPT":return this.executeJavaScript(n,l,h);case"CUSTOM":return this.custom(n,l,h);default:throw new i(n,"未支持的应用功能类型: ".concat(d))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new o("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(Io.TAG,t.appViewId,e,a,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,a){throw ibiz.log.warn("openPdAppFunc",t,e,a),new o("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new o("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new o("未实现")}};Do.TAG="ibiz.app-func.exec";var Co=t("AppFuncCommand",Do);function Ao(){new Co,new Io}var bo=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new en(t.appId,"PSSysApp",t.codeName),this.deService=new vo(t),this.codeList=new tn(t),this.authority=new fn(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),await this.initMqtt()}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,i;let s=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!s&&e){s=null==(i=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:i.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}async initMqtt(){this.mqtt&&this.mqtt.close(),ibiz.env.enableMqtt&&ibiz.appData&&ibiz.appData.mqtttopic&&!0!==ibiz.auth.isAnonymous&&(this.mqtt=new wo(ibiz.appData.mqtttopic,g(),this.model.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}}),Po=class{parse(t){return t}},To=class{constructor(){this.appMenu=new Po}},xo=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const a=this.calcAppViewId(t);this.viewConfigs.set(a,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new o("视图[".concat(e,"]不存在"));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},No=class{constructor(){this.view=new xo}},So=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(So||{})),Lo=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Lo||{})),Ro=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ro||{})),Mo=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t))(Mo||{})),Oo=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new o("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),_o=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new Oo(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),Vo=t("CTXState",class{}),Fo=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new $(3e3),this.controllersMap=new Map,this.state=new Vo}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),ko=t("ActivityCounter",class extends Oo{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),Wo=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await De(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:i,uiactionMode:s,uiactionTag:n}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0,"SINGLEKEY"!==i&&"MULTIKEY"!==i||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),Uo=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),zo=t("QXEventEx",class extends ${constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((a=>{a(t,...e)}))}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),i=this.anyEventFns.map((a=>a(t,...e))),s=Promise.all(i),n=await a,o=await s;return n.concat(...o)}reset(){super.reset(),nt(this.anyEventFns)}}),Bo=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new zo}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function Go(t){return window.location.hash.split("/").length>2*t+2}function jo(t,e){return(!ct(t)&&""!==t||!ct(e)&&""!==e)&&t!==e}function Ko(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof hn&&(e=e.getOrigin()),e}function Xo(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,n=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&n)"REG"===n.ruleType?i.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):"SCRIPT"===n.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{Xe.execScriptFn({rule:t,value:e,callback:a,source:i},n.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=a||e;i.push({validator:(e,a,i,s)=>{if(q(s[t]))return!0;const{isPast:n,infoMessage:c}=He(t,s,r.groupCond);return n||i(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function Ho(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:n}=t;return a&&e.push({validator:(t,e,i)=>{if(ct(e)||!(e.length>a))return!0;i(new Error("内容长度必须小于等于".concat(a,",当前长度为").concat(e.length)))}}),i&&e.push({validator:(t,e,a)=>{if(ct(e)||!(e.length<i))return!0;a(new Error("内容长度必须大于等于".concat(i,",当前长度为").concat(e.length)))}}),ct(s)||e.push({validator:(t,e,a)=>{if(!(!ct(e)&&ot(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),ct(n)||e.push({validator:(t,e,a)=>{if(!(!ct(e)&&ot(e)&&e<n))return!0;a(new Error("值必须大于等于".concat(n)))}}),e}var Yo=t("ValueExUtil",class{static mergeDefault(t){return mt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(ct(e)||""===e)return"";const{valueType:a,objectNameField:i,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!i)throw new o("缺少objectNameField");const t=i.toLowerCase();return"OBJECTS"===a?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===a?e.join(s):"".concat(e)}});function qo(t,e){var a;const{name:s,valueType:n,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(ct(n)&&ct(r))return;if("RESET"===n)return null;const u=d[s];if(!ft(u)){if(!n&&r)return r;switch(n){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(l,r))return l[r];break;case"OPERATORNAME":return l.srfusername;case"OPERATOR":return l.srfuserid;case"CURTIME":return wt().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new o("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return J();default:throw new i({},"默认值类型[".concat(n,"]未支持"))}}}var Qo="asyncimportdata2",Jo="importdata2";async function $o(t,e,a){if(!ibiz.util.getExcelUtil)throw new o("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new o("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function Zo(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid);let s="/jsonschema/".concat(i.name);0===i.dynaSysMode&&ibiz.appData&&(s+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await a.net.get(s)).data}var tr="__self",er=t("BaseController",class{constructor(t,e,a,i){this.model=t,this.context=e,this.params=a,this.ctx=i,this.id=J(),this.state={},this.name="",this.evt=new Bo(this.getEventArgs.bind(this)),this.mountCounter=new ko(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(tr),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(t=>{this.childNames.includes(t)&&this.mountCounter.enroll(t)})),this.ctx.evt.on("onRegister",((t,e)=>{this.childNames.includes(t)&&e.evt.on("onMounted",(()=>{this.mountCounter.attend(t)}))}))}async mountSelf(){this.mountCounter.registration.get(tr)||this.mountCounter.attend(tr)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),ar=class t{constructor(t){this.msgGroupId=t,this.viewMsgMap=new Map}async init(t){var e,a;const i=ibiz.hub.getApp(t.srfappid).model,s=null==(e=i.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new o("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const n=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=n.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),n.splice(e,1))})),n.length)throw new o("没有找到".concat(n.join(","),"视图消息模型"))}getDeFieldName(t,e){var a,i;if(e)return null==(i=null==(a=Ie(t,e))?void 0:a.name)?void 0:i.toLowerCase()}static async fetchDataSet(t,e,i){const{appDataEntityId:s,appDEDataSetId:n}=t;if(!n)throw new a(t,"未配置实体数据集");const o=await ibiz.hub.getApp(e.srfappid).deService.exec(s,n,e,i);return o.data.length?o.data:[]}async calcViewMessages(t,e){const a=this.msgGroup.appViewMsgGroupDetails,i=[];return(null==a?void 0:a.length)&&await Promise.all(a.map((async a=>{if(1===this.viewMsgMap.get(a.appViewMsgId).dynamicMode){const s=await this.calcDynaMsgs(a,t,e);i.push(...s)}else{const t=this.calcStaticMsg(a);i.push(t)}}))),i}calcStaticMsg(t){const{position:e}=t,a=this.viewMsgMap.get(t.appViewMsgId),{title:i,message:s,removeMode:n,position:o,messageType:r}=a,{userTag:c,userTag2:d,userTag3:l,userTag4:h}=a;return{title:i,message:s,position:e||o,messageType:r,removeMode:n,extraParams:{userTag:c,userTag2:d,userTag3:l,userTag4:h}}}async calcDynaMsgs(e,i,s){const n=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u}=n;if(!o)throw new a(n,"未配置应用实体");const p=await ibiz.hub.getAppDataEntity(o,i.srfappid),m={...s},f=this.getDeFieldName(p,r);f&&(m.sort="".concat(f,",asc"));const g=await t.fetchDataSet(n,i,m);if(!g.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(p,c),v=this.getDeFieldName(p,u),y=this.getDeFieldName(p,h),I=this.getDeFieldName(p,l),D=this.getDeFieldName(p,d);return g.map((t=>{const e={};return v&&!ct(t[v])&&(e.position=t[v]),E&&!ct(t[E])&&(e.title=t[E]),y&&!ct(t[y])&&(e.message=t[y]),I&&!ct(t[I])&&(e.messageType=t[I]),D&&!ct(t[D])&&(e.removeMode=t[D]),dt(w,e)}))}},ir=t("ViewController",class extends er{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),d.create({},e),a||{},new Fo(i)),this.session={},this.modal=new ha({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new _o,this.isCloseView=!1,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=Le(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn("未找到视图引擎实现:",t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await an.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{ft(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await Qi(t);this.providers[t.name]=e;const a=Ne(this.model);a&&await Promise.all(a.map((async t=>{const e=await Qi(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const i=Se(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){const t=this.context.srfsessionid;await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),Object.values(this.counters).forEach((t=>t.destroy())),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===t&&ibiz.uiDomainManager.destroy(t),this.context.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){if(this.context.srfappid=this.model.appId,ct(this.context.srfsessionid)||lt(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}const t=this.model.appViewNavContexts;let e={};Y(t)&&(e=se(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let i={};Y(a)&&(i=se(a,this.params,this.context)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const i of this.engines)if(a=await i.call(t,e),void 0!==a)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(void 0===a)throw new o("没有引擎支持预置界面行为".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new ar(t),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){const[e,...a]=t,i={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(i,{confirmButtonText:e.extraParams.userTag}),"WARN"===e.messageType?await ibiz.modal.warning(i):"ERROR"===e.messageType?await ibiz.modal.error(i):await ibiz.modal.info(i),a.length&&this.alertViewMessage(a)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}}),sr=(t("MobViewController",class extends ir{}),t("WFStepTraceViewController",class extends ir{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),a=null==(t=this.ctx.parent)?void 0:t.view;if(a&&a.model.appDataEntityId){const t=await e.deService.getService(a.context,a.model.appDataEntityId),i=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(i);s.data&&(this.state.historyData=s.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}get valueFormat(){return this.parent.valueFormat}get dataType(){return this.parent.dataType}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let n={};i&&t&&(n=se(i,t,a,e));const o=Object.assign(e.clone(),n);let r={};return s&&t&&(r=se(s,t,a,e)),{context:o,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Yo.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),nr=(t("CodeListEditorController",class extends sr{async loadCodeList(t){const{context:e,params:i}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,i),a}throw new a(this.model,"编辑器类型[".concat(this.model.editorType,"],未配置代码表"))}}),t("ControlController",class extends er{constructor(t,e,a,i){if(super(t,d.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=ue(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=ht(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await Qi(this.controlPanel);this.providers[this.controlPanel.name]=t}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)}))}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let i={};Y(e)&&(i=se(e,this.params,this.context)),Object.assign(this.context,i);let s={};Y(a)&&(s=se(a,this.params,this.context)),Object.assign(this.params,s)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let i=this.getData()||[];return(null==t?void 0:t.data)&&(i=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(a,t.viewParam),{context:e,params:a,data:i}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};Y(t)&&(e=se(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:i}=this.model,s=null==(a=null==i?void 0:i.ctrlMsgItems)?void 0:a.find((e=>e.name===t));let o,r;if(s&&s.content){r=ct(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),o=Xe.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();o=ibiz.i18n.t(e,""),o===e&&(o="")}if(!o&&(null==e?void 0:e.default)&&(o=e.default),!o&&(null==e?void 0:e.error)&&(o=o||e.error.message),o){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new n(o,r);ibiz.message.success(o,r,0===r)}}})),or=t("MDControlController",class extends nr{constructor(){super(...arguments),this.commandDataChange=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)}));const e=this.onDataChange.bind(this);this.onDataChange=_((t=>{e(t)}),300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&(this.state.activated?this.refresh():this.commandDataChange=!0)}onActivated(){super.onActivated(),this.commandDataChange&&(this.refresh(),this.commandDataChange=!1)}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const a=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(a.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};return a&&(n.page=e-1,n.size=a),!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),n=await this.service.fetch(i,s);"number"==typeof n.total&&(this.state.total=n.total),a?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new o("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{const n=we(this.model.appDataEntityId);await ya(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[n]=t.srfkey,await this.service.remove(i,a),s=!0}this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:i,default:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:i}),t}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,a;const{selectedData:i}=this.state;v(i,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const s=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,i=await ibiz.hub.getAppDataEntity(e,this.model.appId),s=null==(t=i.appDEDataImports)?void 0:t.find((t=>t.id===a));if(!s)throw new o("无导入模型!");let n="DataImport";s.enableCustomized&&(n="DataImport2");const r=ibiz.overlay.createModal(n,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),rr=t("AppMenuController",class extends nr{constructor(t,e,a,i){super(t,e,a,i),this.itemProviders={},this.flattenAllItems()}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await ks(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new o("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const n=this.itemProviders[t];if(n&&n.onClick)return n.onClick(s,e,this);if(!s.appFuncId)throw new a(s,"没有配置应用功能");const r=this.context.clone();r.srfappid=s.appId,this.routeDepth&&i&&Object.assign(r,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(Co.TAG,s.appFuncId,r,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let i=!0;t.accessKey&&(i=this.app.authority.calcByResCode(t.accessKey));let s=i;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}a.permitted=i,a.visible=s}return this.state.menuItemsState[t.id]=a,a}flattenAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var a;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(a=e.appMenuItems)?void 0:a.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),cr=(t("AppMenuIconViewController",class extends rr{async onClickMenuItem(t,e){const i=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new o("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!i.appFuncId)throw new a(i,"没有配置应用功能");const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(Co.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends pn{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const i=a.map((async a=>{const i=a.appDEDataSetId||"fetchdefault",s=t.clone(),n=ht(e);return a.maxSize&&(n.size=a.maxSize),this.exec2(i,s,n,void 0,a.appDataEntityId)}));return(await Promise.all(i)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new o("未找到日历项模型");const i=a[e];if(!i)throw new o("未找到日历项模型");return t.map((t=>new ro(i,t)))}async exec2(t,e,a={},i={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,a,i)}}));t("CalendarController",class extends or{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new cr(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(a,i)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.state.isLoaded=!0,this.state.items=s,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),s}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const a=t.beginTime,i=e.beginTime;let s=0;return wt(a).isAfter(i)?s=-1:wt(a).isBefore(i)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:i}=t;if(!a||!i){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:wt(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:wt(a).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:i}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};if(!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),a&&(n.page=e-1,n.size=a),t&&Object.assign(n,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(n);Object.assign(n,t)}return n}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});wt.extend(Dt),wt.extend(At),wt.extend(Pt),wt.extend(xt),wt.extend(St);var dr="$default_group",lr=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:i,caption:s,id:n,userParam:o}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=i||{};this.xAxisIndex=N(r),this.yAxisIndex=N(c),this.seriesName=s||n,this.staticOptions=this.calcStaticOptions(),o&&(this.seriesUserParam=Er(o))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(ct(e))return;if(ct(t))return e;const i=this.chartGenerator.codeListMap.get(t);if(null==i?void 0:i.length){const t=i.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}prepareChartData(t,e,a,i){var s;this.groupField&&Object.assign(e,{[this.groupField]:i}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const n=new uo(e,this.model,a,i);t[i].get(a).chartData=n,null==(s=this.chartDataArr)||s.push(n)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=dr;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(ct(e))return;s=e}if(!e[s]&&(e[s]=new Map,i&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(i).forEach((t=>{e[s].set(t.text,{value:0})}))}const n=this.translateVal(i,t[this.catalogField],!0);if(n)e[s].get(n)||e[s].set(n,{value:0}),e[s].get(n).value=x(e[s].get(n).value,t[this.valueField]),e[s].get(n).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(n).value},n,s):this.prepareChartData(e,t,n,s);else if(i&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(i).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,s)}))}})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const a=t[e],i=this.calcSeriesData(a);let s={...this.staticOptions,data:i};return e!==dr&&(s.name=e),this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push([a,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,i;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[dr].get(t.name))?void 0:e.chartData:null==(i=null==(a=this.groupData)?void 0:a[t.seriesName].get(t.name))?void 0:i.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(ht(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=wt(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(wt(t[this.catalogField]).format("YYYY"),"-").concat(wt(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(wt(t[this.catalogField]).format("YYYY"),"-").concat(wt(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const i=t[a];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(i.keys()).sort(((t,e)=>wt(t).diff(wt(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,n]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(n,10)})));const n=new Map;s.forEach((t=>{n.set(t,i.get(t))})),t[a]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(wt(e))}))}));const i=wt.max(a),s=wt.min(a);if("DAY"===e){let e=s;const a=i;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const a=i.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const a=i.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++)for(let a=1;a<=4;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++){const a=wt("".concat(e,"-12-31")).isoWeek();for(let i=1;i<=a;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},hr=class extends lr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:i}=this.model;return i&&(t.step="middle"),t}},ur=class extends lr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},pr=class extends lr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},mr=class extends lr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},fr=class extends lr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},gr=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},wr=class extends lr{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new gr(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),i=Object.keys(e).map((t=>{const i=e[t],s=a.indicatorKeys.map((t=>i.has(t)?i.get(t).value:0));return{name:t===dr?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}};function Er(t){const e={};return t&&Object.keys(t).forEach((a=>{const i=a.indexOf(".");if(-1===i)return;const s=a.slice(i+1);if(s)try{e[s]=JSON.parse(t[a])}catch(i){e[s]=t[a]}})),e}var vr=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:i,chartYAxises:s,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==i?void 0:i.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(i)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),n&&(this.chartUserParam=Er(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new hr(t,this);break;case"bar":e=new ur(t,this);break;case"scatter":e=new fr(t,this);break;case"pie":e=new mr(t,this);break;case"funnel":e=new pr(t,this);break;case"radar":e=new wr(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:i,titlePos:s}=t,n={show:e,text:a,subtext:i,left:"center"},o=null==s?void 0:s.toLowerCase();return"left"===o||"right"===o?n.left=o:"bottom"!==o&&"top"!==o||(n.top=o),n}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,i={};i.show=e;const s=null==a?void 0:a.toLowerCase();return"left"===s||"right"===s?(i.left=s,i.top="middle",i.orient="vertical"):"bottom"===s&&(i.top=s),i}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:i,userParam:s}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===i?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===i&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===i?45:0}};s&&(n=gt(n,Er(s))),e.push(n)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const i=ibiz.hub.getApp(t.srfappid),s=async a=>{if(!a||this.codeListMap.has(a))return;const s=await i.codeList.get(a,t,e);this.codeListMap.set(a,s)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await s(e),await s(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const i=e.length,s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const n=e.length-1;for(let t=i;t<=n;t++)this.seriesGeneratorIndexMap.set(t,a)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=gt(this.staticOptions,this.options),this.chartUserParam&&(this.options=gt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},yr=t("ChartService",class extends pn{}),Ir=(t("ChartController",class extends or{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new yr(this.model),await this.service.init(this.context),this.generator=new vr(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new o("chart对象没有正确初始化");if(!this.options)throw new o("options还没计算");this.chart.setOption(this.options,{notMerge:!0}),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends nr{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):"")}))}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),Dr=class{};function Cr(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(o){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=ht(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(o))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:Xe.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(r,"报错,源参数:"),c),t}return c}var Ar=class extends Dr{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=Cr(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return We(n,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=Cr(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return We(n,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return We(n,this.op,this.value)}}},br=class t extends Dr{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Ar(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},Pr=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===(e||0)&&a&&(this.groupCond=new br(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(e))}}},Tr=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new Pr(t)))}},xr=class extends Tr{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},Nr=class extends Tr{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:n}=t;if(!e)throw new a(this.model,"未配置界面行为");let o=[s];if(i){const e=t.params[i];o=e instanceof Array?e:[e]}await $r.execAndResolved(e,{...n,context:t.context,params:t.viewParam,data:o},this.model.appId)}},Sr=class extends Tr{async exec(t){}},Lr=class extends Tr{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}},Rr=class extends Tr{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new i(a,"暂未支持逻辑处理参数操作".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:i}=t;if(!i)throw new o("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=Cr(e,t);if(s)try{Xe.execScriptFn({srcVal:n,dstParam:e.params[i]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error("给目标参数属性".concat(a,"赋值报错,目标参数:"),e.params[i]),t}else e.params[i]=n}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=Cr(e,t);e.params[a]=ht(i)}bindParam(t,e){const a=Cr(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=Cr(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i;e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Mr=class extends Tr{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:i,invokeParamId:s}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!s)throw new a(this.model,"没有配置操作参数");if(!e)throw new a(this.model,"没有配置调用方法");const n=t.params[s];if(!n)throw new o("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new o("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new o("没有找到调用方法".concat(e));await r[e](n)}},Or=class extends Tr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Cr(t,this.model);t.params[e]=s}},_r=class extends Tr{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:n}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:o}=this.model,{message:r}=this.model;if(n){const e=t.params[n];e.title&&(o=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:o||"消息",desc:r};let d=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,d=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,d=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,d=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const l=await ibiz.modal.confirm(c);t.setLastReturn(d[l?0:1])}},Vr=class extends Tr{async exec(t){const e=await ws(this.model);e&&await e.exec(this.model,t)}},Fr=class extends Tr{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];ibiz.log.info("逻辑节点".concat(i,"操作参数值:"),s)}},kr=class extends Tr{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},Wr=class extends Tr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Cr(t,this.model);t.params[e]=ht(s)}},Ur=class extends Tr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Cr(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},zr=class extends Tr{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s;t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},Br=class extends Tr{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Gr=class extends Tr{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,o);c.ok&&(t.params[n]=c.data)}},jr=class extends Tr{async exec(t){const{errorInfo:e}=this.model;throw new o(e)}},Kr=class extends Tr{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:i,fireCtrlId:s}=this.model;if(!s)throw new a(this.model,"没有配置触发对象");if(!e)throw new a(this.model,"没有配置事件名称参数");if(!i)throw new a(this.model,"没有配置事件参数");const n=t.params[s];if(!n)throw new o("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new o("没有找到事件参数对象".concat(i));await n.evt.emit(e,r)}},Xr=class extends Tr{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!i)throw new a(this.model,"没有配置实体");if(!e)throw new a(this.model,"没有配置实体逻辑");if(!s)throw new a(this.model,"没有配置传入逻辑参数");const r=t.params[s];if(!r)throw new o("没有找到传入参数".concat(s));const c=await jn(e,i,t.context,r,t.params);n&&(t.params[n]=c)}},Hr=class extends Tr{async exec(t){Xe.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Yr=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:n,params:o,data:r}=s,c=ibiz.hub.getApp(a.appId);if("layoutPanel"!==a.codeName)if(a.default)a.entityListParam?t.params[e]=r||[]:t.params[e]=r&&r.length>0?r[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const i=s.view.getController(a.codeName.toLowerCase());i?t.params[e]=i:ibiz.log.error("视图逻辑初始化参数,未找到".concat(a.codeName,"指定部件对象"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=c;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=o;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}else t.params[e]=s.view.layoutPanel.panelItems}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},qr=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Sr(t);break;case"END":a=new Lr(t);break;case"DEACTION":a=new xr(t);break;case"DEUIACTION":a=new Nr(t);break;case"PREPAREJSPARAM":a=new Rr(t);break;case"RESETPARAM":a=new kr(t);break;case"COPYPARAM":a=new Wr(t);break;case"BINDPARAM":a=new Or(t);break;case"VIEWCTRLINVOKE":a=new Mr(t);break;case"MSGBOX":a=new _r(t);break;case"DEBUGPARAM":a=new Fr(t);break;case"APPENDPARAM":a=new Ur(t);break;case"SORTPARAM":a=new zr(t);break;case"RENEWPARAM":a=new Br(t);break;case"DEDATASET":a=new Gr(t);break;case"THROWEXCEPTION":a=new jr(t);break;case"VIEWCTRLFIREEVENT":a=new Kr(t);break;case"DELOGIC":a=new Xr(t);break;case"PFPLUGIN":a=new Vr(t);break;case"RAWJSCODE":a=new Hr(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Yr(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new Ir(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(i);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Qr=new Map;async function Jr(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new o("找不到实体".concat(e,"的界面逻辑").concat(t));Qr.has(s)||Qr.set(s,new qr(s));const n=Qr.get(s);return await n.exec(a),null}var $r=t("UIActionUtil",class{static async exec(t,e,a){const i=await De(t,a);if(!i)throw new o("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await fs(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const n=await this.exec(t,e,a);if(n.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(n.refresh)switch(n.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(i=e.view.parentView)||i.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}(await De(t,a)).asyncAction&&!n.cancel&&this.handleAsyncAction(e.event)}static async handleAsyncAction(t){this.handleAsyncActionAnime(t)}static async handleAsyncActionAnime(t){t&&t.target&&await ibiz.util.anime.moveAndResize(t.target,"#".concat("preset-message"))}}),Zr=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:n,uilogicAttachMode:o}=t;if("REPLACE"===o){if(!s)throw new a(t,"没有配置实体界面逻辑");return await Jr(s,n,e),i}if(!await this.isConfirm(t,e))return this.returnError(i);const r=await this.execAction(t,e);if(Object.assign(i,r),!0===i.cancel)return this.returnError(i);if("AFTER"===t.uilogicAttachMode){if(!s)throw new a(t,"没有配置实体界面逻辑");await Jr(s,n,this.mergeArgsByResult(e,i))}const c=this.mergeArgsByResult(e,i);if(t.closeEditView)this.doNextAction(t,c,t.appId);else{const e=await this.doNextAction(t,c,t.appId);if(e&&(Object.assign(i,e),!0===e.cancel))return this.returnError(i)}return i}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return!t.enableConfirm||!a||ibiz.confirm.warning({title:"操作确认",desc:a})}async doNextAction(t,e,a){const i=t.nextId;if(i)return $r.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const n=we(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[a[0]];break;case"MULTIDATA":s=a;break;case"MULTIKEY":s=n&&a.length>0?a.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=n?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||n,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,l=se(c,d?re(c,a):a[0]||{},i,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:se(h,d?re(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:n,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=n,s=o;break;case"success":i=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||i);t!==s.lanResTag&&(i=t)}if(i){const{data:t}=a,e={...a};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,Xe.execScriptFn(e,"`".concat(i,"`"),{isAsync:!1,singleRowReturn:!0})}}}),tc=t("BackendUIActionProvider",class extends Zr{async execAction(t,e){const{context:i,params:s,data:n,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new a(t,"未配置实体或实体行为");const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,i,n,s),p={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(Io.TAG,m,l,h,{event:o});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===u.length&&u.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((t=>{t.srfactionparam=e}))}}const f=ibiz.hub.getApp(null==i?void 0:i.srfappid),g=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await f.deService.exec(c,d,l,w?g:g[0],p);if(E.ok){const a=this.calcMessage("success",t,e);a&&ibiz.message.success(a)}return Object.assign(r,{data:Z(E.data)?E.data:[E.data],nextContext:l,nextParams:p}),r}}),ec=t("SysUIActionProvider",class extends Zr{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,i=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===i)return{closeView:!0};return await a.callUIAction(i,e)||{}}}),ac=t("FrontUIActionProvider",class extends Zr{async execAction(t,e){const{context:s,params:n,data:o,event:r,noWaitRoute:c}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=I.fill(t.htmlPageUrl,s,null==o?void 0:o[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:l}=await this.handleParams(t,s,o,n),h=await ibiz.commands.execute(Io.TAG,e,i,l,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(d.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(d.data=h.data,d.nextContext=i,d.nextParams={...n,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":d=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":d=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return d}doOther(t,e){const{scriptCode:i}=t,{context:s,params:n,data:o,event:r,view:c}=e;if(i){return Xe.execScriptFn({context:s,params:n,data:o,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:n,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),d=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!d)throw new o("没有找到实体打印项");{let t="";if(!n||!n[c.codeName.toLowerCase()])throw new o("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(n[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:d.codeName,...r}});if(!e.ok)throw new o("打印失败");if(r&&r.srfcontenttype){const t=null==(s=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:s.slice(9),a=URL.createObjectURL(e.data),i=document.createElement("a");i.href=a,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){var a;const{resultContext:i,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let c="DataImport";if(r&&r.enableCustomized&&(c="DataImport2"),r){const t=ibiz.overlay.createModal(c,{dismiss:()=>t.dismiss(),appDataEntity:n,dataImport:r,context:i,params:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new o("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new o("没有找到实体导出项");{const t="/".concat(null==(i=n.codeName2)?void 0:i.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(r.codeName),a={page:0,size:r.maxRowCount?r.maxRowCount:1e3,...e.params,...s},c=await ibiz.net.request(t,{method:"post",data:a});if(200!==c.status)throw new o("导出请求失败");{let t="".concat(n.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([c.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}}}),ic=t("WFWithdrawUIActionProvider",class extends Zr{async execAction(t,e){const{view:a}=e;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),sc=class extends Zr{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function nc(){const t=new ac;ps("FRONT",(()=>t));const e=new tc;ps("BACKEND",(()=>e));const a=new ec;ps("SYS",(()=>a));const i=new ic;ps("DEUIACTION_WFWithdraw",(()=>i));const s=new sc;ps("SYS_Logout",(()=>s))}var oc=t("ToolbarController",class extends nr{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new Uo,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const i=t.uiactionId,s=await De(i,t.appId);if(!s)throw new o("没有找到界面行为模型".concat(i));const n=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;n&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],n=this.getEventArgs();n.params=Object.assign(a,n.params),await $r.execAndResolved(i,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new Wo(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const i="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:i?"extra":"deuiaction"}),i||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof hn&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const t={};a&&(t.data=[a]),r(this.model,(e=>{const a=this.state.buttonsState[e.id];if(a){if(a.visible){const i=this.scheduler.triggerItemVisible(e.id,t);void 0!==i&&(a.visible=i)}if(!a.disabled){const i=this.scheduler.triggerItemEnable(e.id,t);void 0!==i&&(a.disabled=!i)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),rc=t("ContextMenuController",class extends oc{}),cc=(t("DashboardController",class extends nr{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=Ko(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var i;if(t.controlType&&a.includes(t.controlType))return;const s=await hs(t);if(s){this.providers[t.id]=s;const a=await s.createController(t,this,e);this.portlets[t.id]=a,(null==(i=t.controls)?void 0:i.length)&&await this.initPortlets(t.controls,a)}})))}async dataChangeNotify(t){await ya(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t){var e,a;this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null,this.model=t,this.config=new en(t.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(a=this.model.codeName)?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),dc=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=pe(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new cc}onDataChange(t){let e=t.data[0];e&&e instanceof hn&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Uo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Wo(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:i}=this.dashboard.view.model;i&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const i=t.uiactionId;await $r.execAndResolved(i,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=me(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),lc=(t("ContainerPortletController",class extends dc{}),t("ViewPortletController",class extends dc{}),t("MenuPortletController",class extends dc{}),t("ChartPortletController",class extends dc{}),t("ActionBarPortletController",class extends dc{}),t("HtmlPortletController",class extends dc{}),t("ListPortletController",class extends dc{}),t("RawItemPortletController",class extends dc{}),t("DataViewControlService",class extends pn{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new oo(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new oo(e,e);this.dataUIMap.set(e,i)}))}})),hc=t("DataViewControlController",class extends or{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new lc(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const a=new Uo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Wo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),t.groupActionGroupState=a}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[a],i=this.state.groups.find((t=>t.key===e));i&&i.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var a,i;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof hn&&(s=s.getOrigin()),s&&(null==(a=e.groupActionGroupState)||a.update(s,this.model.appDataEntityId))):null==(i=e.groupActionGroupState)||i.update(void 0,this.model.appDataEntityId)}));else{const a=this.state.groups.find((e=>-1!==e.children.indexOf(t)));a&&(null==(e=a.groupActionGroupState)||e.update(a.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const i=new Uo,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),i;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Wo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.getOrigin())}return i}async onActionClick(t,e,a){const i=t.uiactionId;await $r.execAndResolved(i,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};$r.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const i=t.uiactionId,s={...this.params,srfgroup:a.key};await $r.execAndResolved(i,{context:this.context,params:s,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:i,minorSortDir:s}=this.model,n=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:o}=t;if(t.capLanguageRes&&(o=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:o,key:t.appDEFieldId};n&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),uc=t("ExpBarControlController",class extends nr{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),i=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){if(t.isInitialLoad)this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem();else{const t=this.xDataController.state.selectedData;t[0]&&this.xDataController.setActive(t[0])}}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&Go(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:i}=t,s=this.getNavViewMsg(e[0],a,i);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,a,i){const{navDER:s,navFilter:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?we(c):void 0,navFilter:n,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:o,navParams:r},l={context:a,params:i,data:e},{resultContext:h,resultParams:u}=ce(d,l),p=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:p,params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new o("多节点视图由子类实现")}getNavViewMsg(t,e,a){const i=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:i,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),pc=(t("CalendarExpBarController",class extends uc{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:i}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:i,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends uc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}async onMounted(){super.onMounted(),this.xDataController&&this.xDataController.evt.on("onAfterRefreshParent",(t=>{const e=this.xDataController.state.selectedData;e[0]&&this.xDataController.setActive(e[0])}))}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const i=t._id,s=t._deData||t,n=this.getNodeModel(t._nodeId);if(!n)throw new o("找不到".concat(t._nodeId,"的节点模型"));const r=this.prepareParams(n,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:n.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,a)=>{0===a?e.push(t):e.push("".concat(e[a-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends uc{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,a,i){var s;const{context:n,params:o}=super.prepareParams(t,e,a,i);if(e._seriesModelId){const a=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(a){const{navigateContexts:t,navigateParams:s}=a,r=se(t,e,i,n),c=se(s,e,i,o);return{context:Object.assign(n.clone(),r),params:c}}}return{context:n,params:o}}getNavViewMsg(t,e,a){var i;let s;if(t._seriesModelId){const e=null==(i=this.XDataModel.dechartSerieses)?void 0:i.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const n=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:n.context,params:n.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends nr{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new hn,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await ya(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,i=void 0){await Promise.all(t.map((async t=>{const s=await as(t);if(!s)return;if(e.details[t.id])throw new a(t,"初始化异常: 表单成员[".concat(t.id,"](").concat(t.detailType,")已存在,表单项标识重复请检查配置"));e.providers[t.id]=s;const n=await s.createController(t,e,i);if(e.details[t.id]=n,"FORMITEM"===t.detailType&&e.formItems.push(n),"MDCTRL"===t.detailType&&e.formMDCtrls.push(n),xe(t))return;const o=Te(t);o.length&&await this.initDetailControllers(o,e,n)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||jo(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}})),mc=class extends un{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:n,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===i?n:r,h="create"===i?o:c,u=s.id.toLowerCase(),p=qo({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:a});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},fc=t("SearchFormService",class extends mc{async getDraft(t,e={}){let a={ok:!0,status:200,data:this.getFilteredData({...e})};return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new oo(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}}),gc=(t("SearchFormController",class extends pc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new en(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new fc(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const a=this.state.data[e];null!=a&&""!==a&&(t[e]=a)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const i=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===i,a="BOTTOM"!==i,"NONE"===t&&(e=!0,a=!0);const s=t=>{let i,n="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],n=e,!0))),i&&i.length>0){const o=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(o.push(t),s(t))})),o.length<i.length&&(t[n]=o)}};(a||e)&&s(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new o("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o("没有找到保存的搜索条件");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),wc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(wc||{})),Ec=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Ec||{})),vc=t("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a,capLanguageRes:i}=this.model;if(t){const{width:e,height:a}=pe(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName),i&&i.lanResTag&&(this.model.caption=ibiz.i18n.t(i.lanResTag,this.model.caption))}createState(){var t;return new gc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const i=a.relatedDetailNames||[];if(e||C(i,t))try{const t=qe(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=me(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=me(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}async onClick(t){t&&t.stopPropagation(),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),yc=t("FormButtonState",class extends gc{constructor(){super(...arguments),this.loading=!1}}),Ic=(t("FormButtonController",class extends vc{createState(){var t;return new yc(null==(t=this.parent)?void 0:t.state)}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await $r.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends gc{constructor(){super(...arguments),this.showMask=!1}})),Dc=(t("FormDRUIPartController",class extends vc{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Ic(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),C(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;Y(e)&&(t=Object.assign(t,se(e,this.data,this.form.params,this.form.context)));const a=se(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=J(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends gc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),Cc=t("FormGroupPanelController",class extends vc{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new Dc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Uo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Wo(t.id,this.form.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await $r.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Ac=t("FormItemState",class extends gc{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),bc=(t("FormItemController",class extends vc{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new Ac(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Zi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ua(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Xo(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...Ho(this.model.editor)),this.rules.length>0&&(this.validator=new Et({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&q(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),t("FormMDCtrlController",class extends vc{get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return A.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return A.checkPermission(this.model.buildInActions,2)}get enableDelete(){return A.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}})),Pc=(t("FormMDCtrlMDController",class extends bc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");"GRID"===t.controlType&&b(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await Qi(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new i(this.model,"多数据部件类型".concat(this.model.contentType,"暂不支持添加数据"));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController不存在")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends gc{}),Tc=(t("FormMDCtrlFormController",class extends bc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new Pc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await Qi(t);e&&(this.formProvider=e);const{appDataEntityId:i}=this.model.contentControl;this.deName=we(i)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const a={...this.params};return{id:t.srfkey,context:e,params:a}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const a=e.data[0],i=this.state.items.find((e=>e.id===t));i&&i.context[this.deName]!==a.srfkey&&(i.context[this.deName]=a.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o("没有找到对应".concat(t,"的表单控制器"));await e.remove();const a=this.state.items.findIndex((e=>e.id===t));-1!==a&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const i={id:J(),context:e,params:a};void 0!==t?this.state.items.splice(t,0,i):this.state.items.push(i)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends bc{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new i(this.model,"暂不支持重复器样式".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=ht(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,a)=>t!==a));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends Dc{})),xc=(t("FormPageController",class extends Cc{createState(){var t;return new Tc(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends gc{})),Nc=(t("FormRawItemController",class extends vc{createState(){var t;return new xc(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends gc{})),Sc=(t("FormTabPageController",class extends vc{createState(){var t;return new Nc(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends gc{constructor(){super(...arguments),this.activeTab=""}})),Lc=(t("FormTabPanelController",class extends vc{createState(){var t;return new Sc(null==(t=this.parent)?void 0:t.state)}async onInit(){var t;await super.onInit(),this.state.activeTab=(null==(t=this.model.deformTabPages)?void 0:t[0].id)||""}onTabChange(t){this.state.activeTab=t}}),t("EditFormService",class extends mc{async get(t,e={}){var a;let i=await this.exec((null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"update"),i}async getDraft(t,e={}){var a;let i=await this.exec((null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}async remove(t,e={}){var a;return await this.exec((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const i=e instanceof hn?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return n=this.handleResponse(n),n}async update(t,e){var a;const i=e instanceof hn?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return n=this.handleResponse(n),n}async goBack(t,e){var i;const s=null==(i=this.model.goBackControlAction)?void 0:i.appDEMethodId;if(!s)throw new a(this.model,"缺少返回操作实体行为");let n=await this.exec(s,t,e instanceof hn?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,a={}){let i=await this.exec(t,e,a);return i=this.handleResponse(i),i}async wfStart(t,e,a){var i;const s=(null==(i=this.model.wfstartControlAction)?void 0:i.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,a instanceof hn?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let n="";n=e.type?e.type:(null==(i=s.wfsubmitControlAction)?void 0:i.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,a instanceof hn?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const a=e,i=a.id.toLowerCase(),s=a.fieldName||e.appDEFieldId;let n;n=s?new oo(i,s,{isOriginField:!0,dataType:a.dataType}):new oo(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,n)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}})),Rc=(t("EditFormController",class extends pc{constructor(){super(...arguments),this.oldData=new hn}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new Lc(this.model),await this.service.init(this.context),this.autoSave=_(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),i=await this.service.getDraft(e,a)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=i.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=ht(this.context),e=ht(this.params),a=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(a&&this.params[a]){t[we(this.model.appDataEntityId)]=this.params[a],delete e[a],delete this.params[a],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=J(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Ee(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=ht(a);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),s=await this.service.get(e,i)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=s.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await P(500,this.save.bind(this),[t])}if(!await this.validate())throw new o("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],n=0===s.srfuf;let r;try{r=n?await this.service.create(a,s):await this.service.update(a,s)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):b(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(r.data.$origin,n?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i,s=!1;if(await this.evt.emit("onBeforeRemove",void 0),1===this.data.srfuf){if(s=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!s)return!1;await this.startLoading();try{i=await this.service.remove(e,a)}catch(t){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=i.ok}return this.state.data=new hn,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),s}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&b(this.data,t.data),this.data}async updateFormItem(t){var e;const a=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!a)throw new o("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:n,scriptCode:r,showBusyIndicator:c}=a,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),n&&r)t=Xe.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},a=await this.service.updateFormItem(i,this.context,e);t=a.data}t&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"流程启动成功"})}async wfSubmit(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"流程提交成功"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{demand:t}=this.model,e={silent:!0,noFillBack:!0};t&&(e.data=this.getDiffData());try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((a=>{t[a]===this.oldData[a]&&a!==t.srfkeyfield||(e[a]=t[a])})),e.srfuf=t.srfuf,new hn(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return Xe.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),Mc=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),Oc=t("GridService",class extends pn{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const i=t.id.toLowerCase(),s=t.appDEFieldId;let n;if(s){const o=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));n=new oo(i,o,{isOriginField:!0,dataType:r.dataType})}else n=new oo(i,i);this.dataUIMap.set(i,n)}))}}async updateGridEditItem(t,e,a={}){const i=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await i.exec(t,e,a);return s=this.handleResponse(s),s}}),_c={string:25,number:6,integer:9,date:5};var Vc=t("GridController",class extends or{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new Oc(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await Zo(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var a;if(!t.properties)return;const{properties:i}=t;if(!(Object.keys(i).length>0))return;const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e})}));const n={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[],r=[];return s.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,valueType:"SIMPLE",dataType:_c[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=ht(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===a.findIndex((e=>e.id===t.id)))),...a]}}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:i}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(s,"没有配置代码表"));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===i){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(s,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await ya(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new Mc(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.state.rows.forEach((t=>{Object.values(t.uiActionGroupStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,i="CODELIST"===a,s=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[s];i||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:i}=this.model;if("ALL"!==t)return;if(!i||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const s=await this.getFetchParams(),n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,i,this.context,void 0,s);o.data.length&&([this.state.remoteAggResult]=o.data)}async getFetchParams(t={}){return!0===this.model.enableItemPrivilege&&(t.srfdataaccessaction=!0),super.getFetchParams(t)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a))return void ibiz.log.error("不支持新建行");if("row"===a){if(this.state.rows.find((t=>t.showRowEdit)))throw new o("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let n;Object.assign(i,s);try{n=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=n.data;T(r,s),this.state.items.unshift(r);const c=new Mc(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,a=this.findRowState(t);if(!a)throw new o("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await P(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new o("行数据校验不通过,保存取消");let i;const s=we(this.model.appDataEntityId),n=this.context.clone();n[s]=t.srfkey;try{i=e?await this.service.create(n,t):await this.service.update(n,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:a.data}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await ya(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await ns(t);if(!a)return;this.providers[t.codeName]=a;const i=await a.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=i,t.enableRowEdit&&(this.editColumns[t.codeName]=i)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=i:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:a,frozenLastColumn:i}=this.model;t.forEach(((t,s)=>{t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":a&&s<a?t.fixed="left":i&&s>=e-i&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||jo(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await ya(Object.values(this.editColumns).map((async a=>a.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new o("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=ht(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let a;t&&(a=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(a,e)}async updateGridEditItem(t,e){var a;const i=null==(a=this.model.degridEditItemUpdates)?void 0:a.find((t=>t.id===e));if(!i)throw new o("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:n,customCode:r,scriptCode:c}=i,d=n.map((t=>t.id));let l;if(r&&c)l=Xe.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},a=await this.service.updateGridEditItem(s,this.context,e);l=a.data}l&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let i;await this.startLoading();try{i=await this.service.fetch(e,a)}finally{await this.endLoading()}return i.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),i=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=a.codeList.getCodeList(t.codeListId),e.codeListItems=await a.codeList.get(t.codeListId,this.context)),e}));if(i)return Promise.all(i)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=null==(e=this.dataEntity.appDEDataExports)?void 0:e.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=t=>{var e;const a=new Map;this.allExportColumns&&this.allExportColumns.length>0?null==(e=this.allExportColumns)||e.forEach((t=>{t.codeListItems&&a.set(t.appDEFieldId,t.codeListItems)})):Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&a.set(t,this.fieldColumns[t].codeListItems)}));const i=ht(t.map((t=>t.getOrigin())));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;a.get(e)&&(t[e]=(null==(i=a.get(e).find((a=>a.value===t[e])))?void 0:i.text)||t[e])}))})),i};let i=[],s=[];this.allExportColumns&&this.allExportColumns.length>0?(i=this.allExportColumns.map((t=>t.appDEFieldId)),s=this.allExportColumns.map((t=>t.caption))):(i=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.id)),s=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.caption)));const n=(r=i,(await(async()=>{var e;const i=null==(e=t.params)?void 0:e.type;let s=[];if("activatedPage"===i&&(s=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:n}=t.params,o="customPage"===i?{page:0,offset:(a-1)*e,size:(n-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:o})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new o("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await $o(s,n,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:n,updateDV:o,updateDVT:r}=i.editItem,c=e?n:r,d=e?s:o,l=qo({name:i.fieldName,valueType:c,defaultValue:d,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(a[i.fieldName]=l)})),a}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((a=>a.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.saveColumnStates()}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:this.initColumnStates()}changeColumnStateSort(t,e,a){const i=this.state.columnStates.find((e=>e.key===t));i&&(this.state.columnStates.splice(a,1),this.state.columnStates.splice(e,0,i),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}}),Fc=t("GridFieldColumnController",class extends Rc{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}get fieldName(){return this.model.id.toLowerCase()}async onInit(){await super.onInit(),this.loadCodeList=_(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new Uo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Wo(t.id,this.grid.context.srfappid,e);a.addState(t.id,i)}})),t.uiActionGroupStates[this.model.codeName]=a}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:i}=this.model;if(!i)return{context:e,params:a};const{navigateContexts:s,navigateParams:n}=he(i);let o={};s&&t&&(o=se(s,t,a,e));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=se(n,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:n}=this.model;if(!n)return;const o=$e(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...o}),c=ht(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Io.TAG,n,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await $r.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:n}=this.model;if(ct(a)||"NONE"===a)return;const o=e||this.model.id;let r;if(t=t.filter((t=>!ct(t[o]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new i(this.model,"远程聚合暂未支持"):new i(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[o])));break;case"MIN":r=Math.min(...t.map((t=>t[o])));break;default:throw new i(this.model,"暂未支持属性列聚合模式".concat(a))}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error("".concat(r," 值格式化错误"))}return c&&n&&(c+=n),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Yo.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,a){const i=t.uiactionId;await $r.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),kc=(t("GridUAColumnController",class extends Rc{initActionStates(t){var e;const{deuiactionGroup:i}=this.model;if(!i)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new Uo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Wo(t.id,this.grid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await $r.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends Fc{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}async onInit(){await super.onInit();const t=Pe(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Zi(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ua(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Xo(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...Ho(this.editItem.editor)),this.rules.length>0&&(this.validator=new Et({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let i=!1;a&&a.length>0&&a.forEach((t=>{e.includes(t)&&(i=!0)})),i&&this.setRowValue(t,null),this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new o("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&q(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:i}=a;return t.errors[e]=i[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends Rc{}),t("ListService",class extends pn{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new oo(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new oo(e,e);this.dataUIMap.set(e,i)}))}})),Wc=(t("ListController",class extends or{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new kc(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=a.get(e[t])||[];i.push(e),a.set(e[t],i)}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,i=[],s=ibiz.hub.getApp(this.context.srfappid),n=await s.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),o.push(e.value)}));const r=a.filter((e=>-1===o.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends nr{constructor(t,e,a,i,s){super(t,e,a,i),this.panelItems={},this.providers={},this.container=s}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var i,s;const n=await cs(t);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,a);e.panelItems[t.id]=o,(null==(i=t.panelItems)?void 0:i.length)&&!o.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,o),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,o)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new o("未获取到面板数据");const i=this.convertData(a);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=i,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=_e(this.model),a=e.map((t=>t.id)),i=new ho(e,t);return i._evt.on("change",(t=>{a.includes(t)&&this.dataChangeNotify([t])})),i}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),Uc=(t("ViewLayoutPanelController",class extends Wc{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),zc=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=pe(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new Uc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const i=a.relatedItemNames||[];if(e||C(i,t))try{const t=Qe(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=me(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=me(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends nr{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),i={...this.params};t&&Object.assign(a,se(t,this.params,this.context)),e&&Object.assign(i,se(e,this.params,this.context)),this.state.context=a,this.state.params=i}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),["ISNULL","ISNOTNULL"]),Bc=t("SearchBarFilterController",class{constructor(t,e,a,i){var s;let n;this.model=t,this.appDataEntity=e,this.noEditor=!1,this.context=a,this.params=i,t.appDEFieldId&&(n=Ie(e,t.appDEFieldId)),this.fieldName=n?n.codeName.toLowerCase():t.id,this.label=t.caption||(null==n?void 0:n.logicName)||t.id,this.valueOP=null==(s=t.defsearchMode)?void 0:s.valueOP,this.noEditor=this.valueOP?zc.includes(this.valueOP):!this.model.editor}async init(){if(!this.noEditor){if(!this.model.editor)throw new a(this.model,"缺少编辑器模型");this.editorProvider=await Zi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),Gc=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=[{condop:"EQ",condtype:"DEFIELD",fieldname:"app_view_tag",value:this.viewTag}],e=await this.app.net.post("".concat(this.themeUrl,"/fetch_cur_user_all"),{searchconds:t,sort:"create_time,asc"});return e.ok&&(e.data=this.convertBackDataToFront(e.data)),e}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t));return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t))}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:"".concat(this.viewTag,"___").concat(t),caption:t,app_tag:this.model.appId,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{name:t.name,caption:t.caption,app_tag:this.model.appId,app_view_tag:this.viewTag,theme_model:JSON.stringify(e),valid_flag:t.show?1:0})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[a]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),a)}async updateBatch(t){const e=this.convertFrontDataToBack(t),a=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(a),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={app_tag:this.model.appId,app_view_tag:this.viewTag};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},jc="",Kc={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},Xc={};function Hc(t,e){if(t.enumSource)return{appId:jc,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Xc["".concat(t.type,"_").concat(e)]}async function Yc(t,e,a){var i;if(!t.properties)return[];const{properties:s}=t;if(!(Object.keys(s).length>0))return[];const n=[];Object.keys(s).forEach((t=>{let e;switch(s[t].type){case"string":e="string","date-time"===s[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(s[t].type))}n.push({key:t,description:s[t].description,type:e,enumSource:s[t].enumSource})}));const o={};null==(i=(await ibiz.hub.getAppDataEntity(e,a)).appDEFields)||i.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const r=[];return n.forEach((t=>{const e=Kc[t.type];e?e.forEach((e=>{t&&r.push({appId:jc,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:jc,valueOP:e},editor:Hc(t,e)})})):ibiz.log.error("未支持的类型",t.type)})),r}function qc(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}function Qc(t){return t.leaf?{condtype:"DEFIELD",fieldname:t.field,condop:t.valueOP,value:t.value}:{condtype:"GROUP",condop:t.logicType,bnotmode:!1,searchconds:t.children.map((t=>Qc(t)))}}function Jc(t){if("GROUP"===t.condtype)return{leaf:!1,logicType:"AND"===t.condop?"AND":"OR",children:(t.searchconds||[]).map((t=>Jc(t)))};if("DEFIELD"===t.condtype)return{leaf:!0,field:t.fieldname||null,valueOP:t.condop||null,value:t.value||null};throw new o("无效的condtype:".concat(t.condtype))}function $c(t){let e=!1,a=!1;if(r(t[0],(t=>{t.leaf&&(t.field&&t.valueOP&&!ct(t.value)?e=!0:a=!0)})),e&&!a){return[Qc(t[0])]}}Object.keys(Kc).forEach((t=>{Kc[t].forEach((e=>{if(zc.includes(e))return;const a="".concat(t,"_").concat(e);Xc[a]||("date"!==t||["IN","NOTIN"].includes(e)?Xc[a]={appId:jc,editorType:"TEXTBOX",id:a}:Xc[a]={appId:jc,editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends nr{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!0}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Gc(this.model,this.view.model.codeName.toLowerCase()),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups(!0)}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await Zo(this.model.appDataEntityId,this.context);if(!e)return;const a=await Yc(e,this.model.appDataEntityId,this.model.appId),i=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===a.findIndex((e=>{var a;return e.appDEFieldId===t.appDEFieldId&&(!(null==(a=t.defsearchMode)?void 0:a.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&i.push(t)})),a.length>0&&(this.model=ht(this.model),this.model.searchBarFilters=a.concat(...i),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=se(Xe.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const a=this.calcFilters();return a&&(e.searchconds=a),e}resetFilter(){this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;(null==(t=this.searchBarFilters)?void 0:t.length)&&(this.searchBarFilters.forEach((t=>{const e=new Bc(t,this.appDataEntity,this.context,this.params);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.enableFilter)return;return $c(this.state.filterNodes)}async initSearBarGroups(t=!1){if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const a={name:t.id,caption:t.caption,saved:!1,show:!0,searchGroupData:{},order:100*(e+1),defaultSelect:!1,noEdit:!0};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(a.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(a.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(a.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(a.show="1"===e.valid_flag)}catch(e){ibiz.log.error("".concat(t.data,"非标准JSON格式:"),e)}return t.defaultGroup&&(a.defaultSelect=!0),a})));const e=await this.service.fetch();if(e.ok&&e.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)b(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,a)=>e.order>this.state.searchBarGroups[t].order?a:t),0);this.state.searchBarGroups.push({saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)})),t&&this.state.searchBarGroups&&this.state.searchBarGroups.length>0){this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){const t=this.state.searchBarGroups.find((t=>t.defaultSelect));t&&this.handleGroupClick(t)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:this.calcFilters(),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success("保存成功");else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.name===e.data.name));t&&(b(t,e.data),t.saved=!0),ibiz.message.success("保存成功")}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(b(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>Jc(t)));this.state.filterNodes=e}else this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}];this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}}),t("TabExpPanelController",class extends nr{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&Go(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);!0===e&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:i,navigateParams:s,appDataEntityId:n}=t,o={deName:we(n),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=ce(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}});var Zc=t("TreeService",class extends pn{async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=be(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:a});if(0===s.length)return;(await ya(s.map((async a=>{const i=Ae(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ce(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===be(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];if(t.accessKey){if(!this.app.authority.calcByResCode(t.accessKey))return r}switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,o)];break;case"DE":r=await this.getDENodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{var a;if(d&&(!c||c&&0===e)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,a,i){return new no(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...a.params},l={...a.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<i;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=Ae(this.model,h._nodeId);t.appDataEntityId&&(p=we(t.appDataEntityId)),u=h._value}const{resultContext:f,resultParams:g}=ce({deName:p,navFilter:o?"n_".concat(o.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:n,navContexts:s},{derValue:u,context:l,params:d,data:m});return Object.assign(l,f),Object.assign(d,g),{context:l,params:d,navContext:f,navParams:g}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new so(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new ao(t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}}),td=t("TreeController",class extends or{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),a=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new rc(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async onDestroyed(){await super.onDestroyed(),this.counter&&this.counter.destroy()}async initService(){this.service=new Zc(this.model),await this.service.init(this.context)}async initCounter(){const{appCounterRefs:t}=this.model,e=null==t?void 0:t[0];e&&(this.counter=await an.getCounterByRef(e,this.context))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];be(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var a;if(null==(a=t.parentDER1N)?void 0:a.pickupDEFName){const a=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&e.push({minorEntityId:a.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const a=t.decontextMenu;if(null==(e=null==a?void 0:a.detoolbarItems)?void 0:e.length){let e=0;const i=[];r(a,(t=>{if("DEUIACTION"===t.itemType){e+=1;const a=t;200===a.actionLevel&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:i[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let a;e&&await this.startLoading();try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;let i;this.state.isLoading=!0;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=i:this.state.rootNodes=i,await this.afterLoadNodes(i),i}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var a;const i=null==(a=this.contextMenuInfos[t._nodeId])?void 0:a.clickTBUIActionItem;if(i)return this.doUIAction(i.uiactionId,t,e,i.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e._id!==t._id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t._id);if(e&&!a)this.state.expandedKeys.push(t._id);else if(!e&&a){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),a=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(a)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,a,i){const s=this.getEventArgs(),n=this.parseTreeNodeData(e),o=await $r.exec(t,{...s,...n,event:a},i);if(o.closeView)this.view.closeView();else if(o.refresh)switch(o.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){let e=null;return e="DE"===t._nodeType?t:{...t,...t._deData||{}},{data:[e],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var a;(null==(a=t._children)?void 0:a.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"_id",i=this.state.items.find((e=>e[a]===t[a]));if(!i)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{_parent:t}=i;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?i._parent:i,n=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const a=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==a.length&&await Promise.all(a.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,a){var i,s;const n=this.getNodeModel(t._nodeId);if("inner"===a)return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId);if((null==(i=t._parent)?void 0:i._id)===(null==(s=e._parent)?void 0:s._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,n.appDataEntityId)}findDropNodeRS(t,e){const a=this.dropNodeRss.get(t);return null==a?void 0:a.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,i){var s,n,o;"inner"!==i||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===i?e:e._parent,l=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===i||(null==(n=e._parent)?void 0:n._id)!==(null==(o=t._parent)?void 0:o._id)){const e=this.findDropNodeRS(d._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=d._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const u=t._parent._children;if(u.splice(u.indexOf(t),1),"inner"===i)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let a=d._children.indexOf(e);"next"===i&&(a+=1),d._children.splice(a,0,t)}("inner"===i||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:f}=h;if(!0===f){if(!p)throw new a(h,"缺少配置排序属性");const e=p.toLowerCase(),i="ASC"===m,s=[...d._children];i||s.reverse();const n=t=>t+(100-t%100),o=t=>t[e]||0;let c;s.forEach(((a,i)=>{const d=a._deData;void 0===c?a===t&&(c=0===i?100:n(o(s[i-1]._deData)),d[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=o(d)&&(d[e]=n(c),r.push(a)),c=o(d))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const a=this.getNodeModel(t._nodeId),i=t._deData,s=we(a.appDataEntityId),n=this.context.clone();n[s]=i.srfkey;const o=await e.deService.exec(a.appDataEntityId,"update",n,i);o.data&&(t._deData=o.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t._nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if("DE"!==t._nodeType)throw new o("不是实体树节点数据");t._text=e,await this.updateDeNodeData([t])}}),ed=t("WizardPanelService",class extends un{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}}),ad=(t("WizardPanelController",class extends nr{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,i;t.firstForm&&(this.firstForm=t);const s="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),n=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),o=null==n?void 0:n.stepTag;this.stepTags[s]=o})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new ed(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await Qi(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o("找不到".concat(t,"的表单控制器"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const i=await a.load();Object.assign(this.formData,i)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=we(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new o("找不到标识为".concat(t,"的向导表单"));return a}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,{},this.params),e=we(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new o("没有上一个表单");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,a=this.model.dewizard.dewizardForms;if(t&&a){const a=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),i=t[a+1];if(!i)throw new o("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new o("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends pn{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new oo(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new oo(e,e);this.dataUIMap.set(e,i)}))}})),id=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),sd=(t("MDCtrlController",class extends or{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new ad(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new id(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new id(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,a){const i=t.uiactionId;await $r.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(null==(a=e.uiactionGroupDetails)?void 0:a.length)||ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Uo;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new Wo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.data.getOrigin()),t.uaColStates[e.id]=i}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(new id(e,this)))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(new id(e,this))}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}}),t("KanbanService",class extends lc{async updateGroup(t,e){var a;const i=(null==(a=this.model.updateGroupControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}})),nd=(t("KanbanController",class extends hc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new sd(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:i}=this.model;if(!e)throw new a(this.model,"排序属性没配置");if(!i)throw new a(this.model,"排序方向没配置");const s="ASC"===i;t.forEach((t=>{const a=t[e];if(ct(a))t[e]=0;else{const e=Number(a);if(Number.isNaN(e))throw new o("".concat(t.srfmajortext,"的排序属性无法转换成数值"))}})),t.sort(((t,a)=>s?t[e]-a[e]:a[e]-t[e]))}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,a){this.setSelectGroup(a.key),super.onGroupToolbarClick(t,e,a)}async onGroupActionClick(t,e,a,i){this.setSelectGroup(i.key);const s={...this.params,srfgroup:i},n=t.uiactionId;await $r.execAndResolved(n,{context:this.context,params:s,data:[e],view:this.view,event:a},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o("看板部件必须开启分组");return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));i.push({caption:a.text,color:a.color,key:a.value,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=n}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning("当前看板不允许调整分组!");const e="ASC"===this.model.minorSortDir,{from:a,to:i,fromIndex:s,toIndex:n}=t,o=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],d=this.state.groups.find((t=>t.key===a)),l=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=d.children[s];return e[o]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),u=[...l.children],p=[...l.children],m=d.children[s];t.from!==t.to?(m[o]=t.to,p.splice(n,0,m)):(p.splice(s,1),p.splice(n,0,m));const f=d.children.splice(s,1);let g;l.children.splice(n,0,...f),e||(u.reverse(),p.reverse());let w,E=[];p.forEach(((t,e)=>{void 0===g?t!==u[e]&&(g=u[e]?u[e][r]||100:0===e?100:h(u[e-1][r]),t[r]=g,c.push(t)):(g>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),g=w,w=0,E=[]),t[r]=h(g),c.push(t)):(0===E.length&&(w=g),E.push(t)),g=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=we(this.model.appDataEntityId),a=this.context.clone();a[e]=t.srfkey;const i=await this.service.updateGroup(a,t);if(i.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,i.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,a){const i=this.state.groups.find((e=>e.key===t));i&&(i[e]=a)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const a=t.split("quicktoolbar_")[1];this.setGroupController(a,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const a=t.split("batchtoolbar_")[1];this.setGroupController(a,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends Zc{})),od=t("TreeGridExRowState",class{constructor(t,e){this.errors={},this.columnActionsStates={},this.editColStates={},this.modified=!1,this.showRowEdit=!1,this.processing=!1,this.data=t,"DE"===t._nodeType&&(Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}})))}}),rd=t("TreeGridExController",class extends td{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get _evt(){return this.evt}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}get allowRowEdit(){return this.state.rowEditOpen}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={},this.state.rowEditOpen=!0}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new nd(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await _s(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=a:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=a)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,a)=>{t.uaColumn&&(t.fixed=a+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new od(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}async save(t){if(this.state.isSimple)return void ibiz.log.debug("简单模式,不保存");if("DE"!==t._nodeType)throw new o("非实体节点数据不能保存");const e=this.state.rows[t._uuid];if(!e)throw new o("行数据不存在");if(!e.modified)return void ibiz.log.debug("值没有发生改变");if(e.processing)return void await P(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:s,updateAppDEActionId:n}=i,r=0===t._deData.srfuf;if(r)throw new o("暂不支持新建");if(!n)throw new a(i,"树节点没有配置更新实体行为");const c=we(s),d=this.context.clone();d[c]=t._deData.srfkey;const l=ibiz.hub.getApp(this.context.srfappid);let h;try{h=await l.deService.exec(s,n,d,t._deData)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(r?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=h.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=Object.values(this.state.rows).filter((t=>t.modified)).map((t=>t.data));t.length&&await ya(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((a=>{a.gridStateNotify(t,e)}))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||jo(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await ya(Object.values(this.columns).map((async a=>a.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const a={};return Object.values(this.fieldColumns).forEach((i=>{const s=i.nodeColumnControllerMap.get(t._nodeId);if(!s||!s.nodeEditItem)return;const{createDV:n,createDVT:o,updateDV:r,updateDVT:c}=s.nodeEditItem,d=e?o:c,l=e?n:r,h=qo({name:i.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(a[i.name]=h)})),a}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data._deData.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data._deData.srfuf){t.cacheData=ht(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}}),cd=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}gridStateNotify(t,e){}async dataChangeNotify(t,e){}}),dd=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:i,detreeNodeDataItems:s,detreeNodeEditItems:n}=e,o=null==i?void 0:i.find((t=>t.detreeColumnId===this.fieldColumn.model.id)),r=null==s?void 0:s.find((t=>t.id===o.dataItemName));if(!o||!r)throw new a(e,"节点没有配置对应表格列".concat(this.fieldColumn.name,"的数据项"));if(this.nodeColumn=o,this.nodeDataItem=r,o.enableRowEdit){const t=null==n?void 0:n.find((t=>t.id===o.id));if(!t)throw new a(e,"没有找到对应表格列".concat(this.fieldColumn.name,"的编辑项模型"));this.nodeEditItem=t}}get unitName(){var t;return null==(t=this.nodeEditItem)?void 0:t.unitName}get valueFormat(){return this.nodeColumn.valueFormat}get context(){return this.fieldColumn.context}get params(){return this.fieldColumn.params}get dataType(){var t;return null==(t=this.nodeDataItem)?void 0:t.dataType}get name(){return this.fieldColumn.name}get treeGrid(){return this.fieldColumn.treeGrid}get isLinkColumn(){return!!this.nodeColumn.enableLinkView&&!!this.nodeColumn.linkAppViewId}get hasClickAction(){return!!this.nodeColumn.deuiactionId}get overflowMode(){return this.fieldColumn.treeGrid.overflowMode}async init(){var t;(null==(t=this.nodeEditItem)?void 0:t.editor)&&"HIDDEN"!==this.nodeEditItem.editor.editorType&&(this.editorProvider=await Zi(this.nodeEditItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.nodeEditItem.editor,this))),this.nodeEditItem||await this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.nodeColumn;if(e&&e.uiactionGroupDetails){const a=new Uo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Wo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.name]=a}}onTextClick(t,e){this.isLinkColumn?(e.stopPropagation(),this.openLinkView(t,e)):this.hasClickAction&&(e.stopPropagation(),this.triggerAction(t,e))}async openLinkView(t,e){if(!t.data[this.fieldColumn.name])return;const a=this.nodeColumn.linkValueItem||"srfkey",i=t.data[a];if(null==i)throw new o("未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const n=$e(t.data),r=Object.assign(this.context.clone(),{srfkey:i,...n}),c=ht(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:a}=he(d);let i={};e&&t.data&&(i=se(e,t.data,c,r)),Object.assign(r,i);let s={};a&&t.data&&(s=se(a,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute(Io.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const a=this.nodeColumn.deuiactionId;await $r.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,a){const i=t.uiactionId;await $r.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return Yo.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async loadCodeList(){const t=this.nodeColumn.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}async setRowValue(t,e,a){a=a||this.name,await this.treeGrid.setRowValue(t,a,e)}}),ld=(t("TreeGridExFieldColumnController",class extends cd{constructor(){super(...arguments),this.nodeColumnControllerMap=new Map}get name(){return this.model.id}async init(){await this.onInit(),await this.initNodeColumnController()}async initNodeColumnController(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;(null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id)))&&this.nodeColumnControllerMap.set(t.id,new dd(this,t))})),await Promise.all(Array.from(this.nodeColumnControllerMap.values()).map((t=>t.init())))}initActionStates(t){const e=this.nodeColumnControllerMap.get(t.data._nodeId);e&&e.initActionStates(t)}gridStateNotify(t,e){super.gridStateNotify(t,e);const a=this.nodeColumnControllerMap.get(t.data._nodeId);a&&a.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends cd{constructor(){super(...arguments),this.nodeColumnMap=new Map}async init(){await this.onInit(),await this.initNodeColumnMap()}initNodeColumnMap(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;const a=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));a&&this.nodeColumnMap.set(t.id,a)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const a=this.nodeColumnMap.get(t.data._nodeId);a.deuiactionGroup&&(e=a.deuiactionGroup)}return e}initActionStates(t){var e;const a=this.getUIActionGroup(t);if(!a)return void ibiz.log.warn("".concat(this.model.id,"操作列没有配置界面行为组"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Uo;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Wo(t.id,this.treeGrid.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.model.id]=i}async onActionClick(t,e,a){const i=t.uiactionId;await $r.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}gridStateNotify(t,e){if(super.gridStateNotify(t,e),"LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.model.id];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}}),t("TreeGridController",class extends Vc{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const i=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),s=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!i)throw new a(this.model,"树表格无值列模式");if(!s)throw new a(this.model,"树表格无父值列模式");this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=i.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends Oc{}),t("MEditViewPanelService",class extends pn{})),hd=(t("MEditViewPanelController",class extends or{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new ld(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const i=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);this.parameters=a&&i?[{parameterName:null==(t=i.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=i.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,a),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===a.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,a={id:t[e]?t[e]:"mockId:".concat(J()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:i,pathName:s}=e;t[i]&&!Object.is(t[i],"")&&Object.assign(a.context,{[s]:t[i]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(a,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(a,{srfmajortext:"草稿--新建"})})),a}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex((t=>t.id===e));if(a<0)throw new o("编辑视图面板部件UI数据不存在");const i=this.state.panelUiItems[a];i.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):i.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),t("MapService",class extends pn{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const i=[];if(null==(a=this.model.sysMapItems)?void 0:a.length){const a=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async s=>{const{appDataEntityId:n,appDEDataSetId:o,customCond:r}=s,c=t.clone(),d={...e};if(r){const a=Xe.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=he(a);i&&Object.assign(c,se(i,e,t)),s&&Object.assign(d,se(i,e,t))}}const l=await a.deService.exec(n,o,c,d);l.data&&i.push(...l.data.map((t=>new lo(t,s))))})))}return new p(i,200)}})),ud=(t("MapController",class extends or{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new hd(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);a.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(a,i);this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),i=[],s=[];return a.forEach((t=>{"REGION"===t._itemStyle?i.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=i,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const a=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=a;break;case"strareacode":this.state.strAreaCode="true"===a;break;case"jsonbaseurl":this.state.jsonBaseUrl=a}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends un{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(null==(a=this.dataEntity.codeName2)?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let s=await ibiz.net.request(i,{method:"post",data:e});return s=this.handleResponse(s),s}})),pd=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},md=class extends pd{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},fd=class extends pd{},gd=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new md(t);case"USER2":return new fd(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},wd=(t("ReportPanelController",class extends nr{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=gd.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new ud(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam),i=await this.service.fetch(e,a);this.state.data=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),t("GanttService",class extends Zc{execDeService(t,e,a,i){return this.app.deService.exec(t,e,a,i)}async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=be(this.model,{parentId:t._nodeId,hasQuery:a});if(0===s.length)return;(await ya(s.map((async a=>{const i=Ae(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ce(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===be(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{if(d&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new mo(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new fo(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new go(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}})),Ed=(t("GanttController",class extends rd{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new wd(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}transformNodeDataItem(t,e){var a;const i={};return null==(a=t.detreeNodeDataItems)||a.forEach((t=>{t.id&&t.appDEFieldId&&e.hasOwnProperty(t.id.toLowerCase())&&Object.assign(i,{[t.appDEFieldId.toLowerCase()]:e[t.id.toLowerCase()]})})),i}async updateNodeData(t,e,a=!1){const i=t.srfkey?"srfkey":"_id",s=this.state.items.find((e=>e[i]===t[i]));if(!s||!s.srfkey)return void ibiz.log.error("找不到对应的动态实体树节点数据",t);const n=this.getNodeModel(s._nodeId);if(n){const i=a?this.transformNodeDataItem(n,e):e;if(Object.keys(i).length>0){const e=we(n.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(n.appDataEntityId,"update",a,i)).status&&this.refreshNodeChildren(t,!0)}}}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}async logout(){const t=await ibiz.auth.logout();if(t){const t=window.location;if(-1!==t.search.indexOf("isAnonymous=true")){const e="".concat(t.origin).concat(t.pathname).concat(t.hash);window.history.replaceState({},"",e)}}return t}})),vd=class{constructor(){this.evt=new $,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new wn}async init(){this.listenMessage()}listenMessage(){ibiz.mc.command.asyncAction.on((async t=>{if(!t.data||"ASYNCACTION"!==t.subtype)return;const e=this.formatAsyncAction(t.data);-1===this.actions.findIndex((t=>t.asyncacitonid===e.asyncacitonid))?this.add(e):this.update(e)}))}formatAsyncAction(t){if(["begintime","endtime","createdate","updatedate"].forEach((e=>{H(t[e])&&(t[e]=wt(t[e]).format("YYYY-MM-DD HH:mm:ss"))})),!O(t.actionresult))try{const e=JSON.parse(t.actionresult);t.actionresult=e}catch(t){}if(!O(t.completionrate)){const e=Number(t.completionrate);Number.isNaN(e)?t.completionrate=void 0:t.completionrate=e}return t}add(t){this.actions.unshift(t),this.finishedStates.includes(t.actionstate)?this.noticeResult(t):(this.doingNum+=1,ibiz.notice.showDoingNotice({num:this.doingNum})),this.evt.emit("add",ht(t)),this.evt.emit("dataChange")}update(t){const e=this.actions.findIndex((e=>e.asyncacitonid===t.asyncacitonid));this.actions.splice(e,1,t),this.finishedStates.includes(t.actionstate)&&(this.doingNum-=1,this.doingNum<=0&&ibiz.notice.closeDoingNotice(),this.noticeResult(t)),this.evt.emit("change",ht(t)),this.evt.emit("dataChange")}noticeResult(t){ibiz.notice.showAsyncAction(t)}},yd=class{constructor(){this.evt=new $,this.total=0,this.page=0,this.size=20,this.messages=[],this.service=new to}async init(){this.load(),this.listenMqtt()}async load(){await this.fetch(!1)}async loadMore(){await this.fetch(!0)}async fetch(t=!1){!1===t?this.page=0:this.page+=1;const e={page:this.page,size:this.size,sort:"update_time,desc"},a=await this.service.fetch(e);this.total=a.total,t?this.messages.push(...a.data):this.messages=a.data,this.evt.emit("dataChange")}listenMqtt(){ibiz.mc.command.internalMessage.on((async t=>{ibiz.log.debug("mqtt internalMessage: ",t),"INTERNALMESSAGE"===t.subtype&&ibiz.notification.info({desc:t.content,position:"bottom-right"})}))}},Id=class{constructor(){this.total=0,this.asyncAction=new vd,this.internalMessage=new yd}async init(){await this.internalMessage.init(),await this.asyncAction.init()}},Dd=class{constructor(){this.convert=new To,this.controller=new Ed,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new No,this.notice=new Id,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId,a=-1){const i=this.calcAppViewId(t);if(this.view2appMap.has(i)){const t=this.view2appPriorityMap.get(i);if(t&&t<a)return}this.view2appMap.set(i,e),-1!==a&&this.view2appPriorityMap.set(i,a)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(t),t}throw new o("视图[".concat(e,"]不存在"))}async loadAppView(t,e,a){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,a)}throw new o("视图[".concat(e,"]不存在"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return a=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new o("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new bo(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new en(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,a){return(await this.getAppAsync(t)).deService.getService(a,e)}reset(){this.appMap.clear(),this.configCache=void 0}},Cd=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:i}=t,s="".concat(i,"_").concat(a),n=this.viewEngines.get(s);if(n)return n(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),Ad=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar"),this.calcDynamicLayout()}calcDynamicLayout(){const t=this.calcRemoveLayoutModel();ibiz.log.debug("".concat(this.view.model.codeName,"删除模型:").concat(t.join(";"))),this.removeLayoutModel(t)}calcRemoveLayoutModel(){const{model:t}=this.view,e=[];!1===t.showCaptionBar&&e.push("view_captionbar"),le(t,"toolbar")||e.push("view_toolbar","toolbar");return["lefttoolbar","righttoolbar","footertoolbar"].forEach((a=>{le(t,a)||e.push(a)})),this.calcViewHeaderVisible()||e.push("view_header"),ibiz.env.isMob&&(this.calcViewFooterVisible()||e.push("view_footer")),e}removeLayoutModel(t,e=this.view.model.viewLayoutPanel){if(!e)return;const a=e.rootPanelItems||e.panelItems||[],i=a.findIndex((e=>t.includes(e.id)));-1!==i&&a.splice(i,1),a.forEach((e=>{"CONTAINER"===e.itemType&&this.removeLayoutModel(t,e)}))}async onMounted(){const{model:t,childNames:e}=this.view;ibiz.log.debug("".concat(t.id,"的子组件:").concat(e.join(";"),"都已mounted"))}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){let t=!1;const{model:e}=this.view;return e.showCaptionBar&&(t=!0),ibiz.env.isMob?(this.isExistAndInLayout("lefttoolbar")&&(t=!0),this.isExistAndInLayout("righttoolbar")&&(t=!0)):this.isExistAndInLayout("toolbar")&&(t=!0),t}isExistAndInLayout(t){const e=this.view.model.viewLayoutPanel;if(!e)return!1;const a=y(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:i}=this.view,s=le(i,t);return!(!a||!s)}calcViewFooterVisible(){let t=!1;return this.isExistAndInLayout("footertoolbar")&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:i}=this.view;if(!t)throw new o("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),n=await s.deService.exec(t,"get",a,i),{data:r}=n;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),bd=(t("MDViewEngine",class extends Ad{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault&&(this.searchBar&&this.searchBar.hasDefaultSelect&&"grid"===this.xdataControlName?this.searchBar.setDefaultSelect():this.load())}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?this.openData(e):"New"===t?this.newData(e):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Search"===t?(await this.searchForm.search(),null):"Reset"===t?(await this.searchForm.reset(),null):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,i;const{data:s,event:n}=t,o=(t.context||this.view.context).clone(),r=t.params||this.view.params;o[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||we(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:o,params:r,data:s,event:n,view:this.view}));if(-1===c)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!c.ok}}async newData(t){var e,i,s;const{data:n,event:o,copyMode:r}=t;if(!(null==(i=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:i.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=ht(this.view.params);r&&(c.srfcopymode=r);const d=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:n,event:o,view:this.view}));if(-1===d)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!d.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){const t=super.calcViewHeaderVisible();return this.calcViewSearchBarVisible()||t}calcViewSearchBarVisible(){const{model:t}=this.view,e=this.isExistAndInLayout("searchbar");if(!e)return e;const a=le(t,"searchbar");return!(!a.enableQuickSearch&&!a.enableGroup&&!0!==a.enableFilter)}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}calcRemoveLayoutModel(){const{model:t}=this.view,e=super.calcRemoveLayoutModel();return le(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),class{constructor(){this.layoutPanel=new Je,this.theme=new ma,this.text=new pa,this.hbs=new ae,this.rawValue=new Ea,this.action=$r,this.error=new Ot,this.viewStack=new va,this.anime=new Mi,this.file=new Oi,this.error.register(new Mt)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}}),Pd=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o("Method not implemented.")}destroy(){}},Td=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new i(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},xd=class extends Pd{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const i=this.logic.scriptCode;this.scriptFn=Xe.createScriptFn(t,i,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Nd=class extends Pd{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Jr(e,i,t)}},Sd=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),mt(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const i={itemName:t,triggerType:e},s=this.triggerAndExecute(i,a);if(null==s?void 0:s.length)return s.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const i=this.getExecuteParams(e);return a.execute(i)}triggerControlEvent(t,e,a){const i={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(i,a)}},Ld=class extends Sd{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Rd=class extends Sd{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Md=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new i(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}},Od=class{constructor(){this.executorFactory=new Td,this.triggerFactory=new Md}createViewScheduler(t){return new Rd(t)}createControlScheduler(t){return new Ld(t)}},_d=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new o("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},Vd=class extends _d{},Fd=class extends _d{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:i}=t;return{context:e,params:a,data:(null==i?void 0:i[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(a=this.logic.itemName)?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},kd=class extends _d{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new a(this.logic,"定时器缺少定时间隔");this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Wd=class extends Pd{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:i,params:s,...n}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const d=c.refAppViewId;if(!d)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const l=c.navigateContexts||[],h=Object.assign(i,se(l,r[0],s,i));let u={};const p=c.navigateParams;return Y(p)&&(u=se(p,r[0],s,i)),ibiz.commands.execute(Io.TAG,d,h,u,n)}async calcOpenViewRef(t,e){const i=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=i.formTypeAppDEFieldId||i.dataTypeAppDEFieldId;if(!s)throw new a(t,"".concat(i.codeName,"[多表单实体] or [索引实体]缺少类型属性配置"));const{data:n}=e,r=n[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return d}async executeNewDataAppUILogic(t,e){const{context:s,params:n,...o}=e,{data:r,view:c}=e,{enableWizardAdd:d,enableBatchAdd:l,batchAddOnly:h,newDataAppView:u}=t;let p;if(d){if(p=await this.getWizardNewViewRef(t,e),!p)return{ok:!1}}else if(l){const e=we(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(p=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(p=u,!p||!p.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},f={};const g=(null==r?void 0:r[0])||{},w=p.navigateContexts;Y(w)&&(m=se(w,g,n,s)),m=Object.assign(s,m);const E=p.navigateParams;if(Y(E)&&(f=se(E,g,n,s)),n.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&g&&(f[t]=g.srfkey,f.srfcopymode=!0)}f.srfuf=0;const v=await ibiz.commands.execute(Io.TAG,p.refAppViewId,m,f,o);return l&&v.data&&await this.doBatchAdd(t,v.data,s,p,e.view),v}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:n}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const l=await ibiz.commands.execute(Io.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(i=l.data)?void 0:i[0];if(!h)throw new o("请选中一条数据");const u=h.srfkey,p=null==n?void 0:n.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===u.toUpperCase()}));if(!p)throw new o("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}async doBatchAdd(t,e,i,s,n){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new a(c,"实体没有从关系集合!");let h="";if(null==d||d.forEach((t=>{const e=we(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o("没有找到".concat(l,"在当前实体的外键属性"));const u={srfkey:h},p=null==(r=n.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(p){const t=p.value.split(",");for(const e of t){const[t,a]=e.split(":");t&&a&&(u[t]=a)}}ibiz.log.debug("批量新建转换映射属性",u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((a=>{const i=u[a];e[i]=t[a]})),e}));ibiz.log.debug("批量新建创建数据",m);const f=ibiz.hub.getApp(i.srfappid).deService;await f.exec(c.id,"Create",i,m)}}},Ud=class extends _d{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>aa[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},zd=class extends _d{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>sa[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},Bd=class extends Pd{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");$r.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=vt.dirname(this.url.pathname)}dir(t){return this.url.origin+vt.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.onload=t,i.onerror=a,document.head.appendChild(i)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));
|
|
1
|
+
System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var a,i,s,n,o,r,c,d,l,h,u,p,m,f,g,w,E,v,y,I,D,C,A,b,P,T,x,N,S,L,R,M,O,_,V,F,k,W,U,z,B,G,j,K,X,H,Y,q,Q,J,$,Z,tt,et,at,it,st,nt,ot,rt,ct,dt,lt,ht,ut,pt,mt,ft,gt,wt,Et,vt;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,n=t.NoticeError,o=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,d=t.IBizContext,l=t.DataTypes,h=t.clone,u=t.CoreConst,p=t.HttpResponse,m=t.updateKeyDefine,f=t.Net,g=t.getToken,w=t.NOOP,E=t.IBizParams,v=t.isElementSame,y=t.findRecursiveChild,I=t.StringUtil,D=t.debounceAndAsyncMerge,C=t.isOverlap,A=t.BitMask,b=t.mergeInLeft,P=t.awaitTimeout,T=t.mergeDefaultInLeft,x=t.plus,N=t.toNumberOrNil},function(t){S=t.isEmpty,L=t.isString,R=t.isArray,M=t.isObject,O=t.isNil,_=t.debounce,V=t.camelCase,F=t.eq,k=t.gt,W=t.gte,U=t.findIndex,z=t.lt,B=t.lte,G=t.upperFirst,j=t.snakeCase,K=t.kebabCase,X=t.isFunction,H=t.isNumber},function(t){Y=t.notNilEmpty,q=t.isNilOrEmpty,Q=t.AsyncSeriesHook,J=t.createUUID,$=t.QXEvent,Z=t.isArray,tt=t.getCookie,et=t.setCookie,at=t.clearCookie,it=t.ascSort,st=t.descSort,nt=t.clearAll,ot=t.isNumber},function(t){rt=t.default},function(t){ct=t.isNil,dt=t.mergeRight,lt=t.isEmpty,ht=t.clone,ut=t.equals,pt=t.where,mt=t.mergeLeft,ft=t.isNotNil,gt=t.mergeDeepRight},function(t){wt=t.default},function(t){Et=t.default},function(t){vt=t.default}],execute:function(){t({asyncImportData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(Jo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const n=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(o=n.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(o!==i)return;const s=a.data.actionstate;30!==s&&40!==s||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED");var o},calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t;let i;if(e||a){switch(i={display:"flex"},e){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(a){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:we,calcDynaClass:me,calcDynaSysParams:async function(t,e,a={}){const i=a.appId||e.srfappid,s=a.viewParams||{},n={},o=await ibiz.hub.getAppDataEntity(t,i);if(s.srfkey)n.srfkey=s.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(n.srfkey=t)}if(s.srfparentkey&&s.srfparentdeanme)n.srfparentkey=s.srfparentkey,n.srfparentdeanme=s.srfparentdeanme;else{const t=Qs(e,o);if(t&&t.keys.length>1){const a=t.keys[t.keys.length-2];n.srfparentkey=s.srfparentkey||e[a],n.srfparentdeanme=s.srfparentdeanme||a}}return n},calcFilterModelBySchema:qc,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:l(a,i),sm:l(s,n),md:l(o,r),lg:l(c,d)}},calcLayoutHeightWidth:pe,calcMainStateOPPrivsStrs:ge,calcNavParams:ce,calcResPath:Js,calcSearchConds:Zc,compare:Ue,compareNumber:ze,contains:Be,convertNavData:se,convertNavDataByArray:oe,convertObjectToNavParams:ie,execDELogic:Gn,execDELogicAction:Kn,execDELogicById:jn,execFieldLogics:Hn,execUILogic:$r,exportData:Zo,fieldValueToBoolean:Zs,filterFieldLogics:ye,filterValueRules:ua,findChildFormDetails:Te,findDELogic:ve,findEditItem:Pe,findFieldById:Ie,findModelChild:de,formatFilters:Jc,formatMultiData:re,generateEditorRules:Yo,generateRules:Ho,getAllPanelField:_e,getAppCounterProvider:Hi,getAppMenuItemProvider:ks,getAppViewRef:function(t,e){var a,i;let s=t.appViewRefs||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(a=t.actiontype||"DEFAULT",ibiz.register.get("".concat(ys,"_").concat(a)));var a;if(e)return e;throw new o("找不异步操作类型".concat(t.actiontype,"对应的适配器"))},getChildNodeRSs:be,getControl:le,getControlPanel:ue,getControlProvider:Qi,getControlsByView:Ne,getDEMethodProvider:Rs,getDERedirectToView:ke,getDeACMode:async function(t,e,a){var i;const s=await ibiz.hub.getAppDataEntity(e,a);return null==(i=s.appDEACModes)?void 0:i.find((e=>e.id===t))},getDefaultValue:Qo,getEditorProvider:Zi,getEntitySchema:tr,getFormDetailProvider:as,getGridColumnProvider:ns,getInternalMessageProvider:function(t){const e=(a=t.content_type||"DEFAULT",ibiz.register.get("".concat(Ws,"_").concat(a)));var a;if(e)return e;throw new o("找不站内信类型".concat(t.content_type,"对应的适配器"))},getMatchResPath:Qs,getOriginData:Xo,getOriginFilterNodes:Qc,getPFPlugin:function(t,e){const i=ibiz.hub.getApp(e);if(!i)throw new a(i,"未找到应用");const{model:s}=i;if(!s.appPFPluginRefs)throw new a(s,"应用未配置插件");const n=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!n)throw new Error("未找到插件".concat(t));return n},getPanelItemProvider:cs,getPlatformProvider:xs,getPlatformType:As,getPortletProvider:hs,getRootNode:Ce,getTreeGridExColumnProvider:_s,getTreeNode:Ae,getUIActionById:De,getUIActionItemsByActionLevel:function(t,e){const a=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const i=t;i.actionLevel===e&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),a},getUIActionProvider:fs,getUILogicNodeProvider:ws,getViewEngines:Le,getViewLogics:Se,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=vs(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=vs("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=vs(a));e||(e=vs("DEFAULT"));return e},getWFContext:$e,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:n}=e,o=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:s),c=null==o?void 0:o.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:ya,hasDeCodeName:Ee,hasSubRoute:jo,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat($o);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));return(await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}})).data},install:function(){const{ibiz:t}=window;t.util=new Pd,t.hub=new Cd,t.register=new Rt,t.config=new Lt,t.auth=new gn,t.engine=new Ad,t.uiDomainManager=new wa,t.markOpenData=new eo,bo(),oc(),Zn(),Gs(),ibiz.scheduler=new _d,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new kd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new kd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new kd(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Wd(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Fd(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new zd(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Bd(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Nd(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Sd(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Sd(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Ud(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new Gd(t,e))),function(){const t=new Ds;Ps("Browser",(()=>t))}(),t.platform=xs()},installCommand:bo,isDataContainer:Re,isFormDataContainer:xe,isValueChange:Ko,matchMainState:fe,openRedirectView:Ve,parseFilters:$c,parseUserParams:he,presetAppCounterProvider:Gs,presetDEMethodProvider:Zn,presetUIActionProvider:oc,registerAppCounterProvider:Ki,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Vs,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ys,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(Yi,"_").concat(t),e)},registerDEMethodProvider:Ss,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Ji,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(ts,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(is,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Ws,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(os,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:Ps,registerPortletProvider:function(t,e){ibiz.register.register("".concat(ds,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(Ms,"_").concat(t),e)},registerUIActionProvider:ps,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(gs,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(Es,"_").concat(t),e)},strContain:Ge,testCond:We,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await Fe(t,e,a);await ibiz.commands.execute(Do.TAG,i.viewId,i.context,i.params,i.opts)},verifyDeRules:He,verifyFormGroupLogic:qe,verifyPanelGroupLogic:Qe});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function yt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var It={exports:{}};!function(t,e){t.exports=function(t,e,a){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var a;1===e.length&&e[0].length>0&&(e=e[0]),a=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](a)||(a=e[i]);return a};a.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},a.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}}}(It);var Dt=yt(It.exports),Ct={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(Ct);var At=yt(Ct.exports),bt={exports:{}};!function(t,e){var a,i;t.exports=(a="month",i="quarter",function(t,e){var s=e.prototype;s.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var n=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):n.bind(this)(t,e)};var o=s.startOf;s.startOf=function(t,e){var s=this.$utils(),n=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return n?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return o.bind(this)(t,e)}})}(bt);var Pt=yt(bt.exports),Tt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var n=e.prototype;n.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var n=s(this).startOf(i).add(1,i).date(e),o=s(this).endOf(a);if(n.isBefore(o))return 1}var r=s(this).startOf(i).date(e).startOf(a).subtract(1,"millisecond"),c=this.diff(r,a,!0);return c<0?s(this).startOf("week").week():Math.ceil(c)},n.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Tt);var xt=yt(Tt.exports),Nt={exports:{}};!function(t,e){var a;t.exports=(a="day",function(t,e,i){var s=function(t){return t.add(4-t.isoWeekday(),a)},n=e.prototype;n.isoWeekYear=function(){return s(this).year()},n.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,n,o,r=s(this),c=(e=this.isoWeekYear(),o=4-(n=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,a));return r.diff(c,"week")+1},n.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var o=n.startOf;n.startOf=function(t,e){var a=this.$utils(),i=!!a.u(e)||e;return"isoweek"===a.p(t)?i?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):o.bind(this)(t,e)}})}(Nt);var St=yt(Nt.exports),Lt=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0}}},Rt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Mt=t("DefaultErrorHandler",class{handle(t){return t instanceof a||t instanceof i?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error("没有注册无权限错误处理器"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof n?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof o&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Ot=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error("没有找到能处理该错误的处理器",t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),_t=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};_t.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var Vt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Ft=class extends Vt{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const a=t.filter((t=>!!t)).length===t.length;return _t.handleJudgmentExecute(this,a,e)}},kt=class extends Vt{constructor(t){super(t,"camelCase")}onExecute(t){return t?V(t):""}},Wt=class extends Vt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Ut=class extends Vt{constructor(t){super(t,"eq")}onExecute(t,e,a){const i=F(t,e);return _t.handleJudgmentExecute(this,i,a)}},zt=class extends Vt{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return _t.handleJudgmentExecute(this,i,a)}},Bt=class extends Vt{constructor(t){super(t,"gte")}onExecute(t,e,a){const i=W(t,e);return _t.handleJudgmentExecute(this,i,a)}},Gt=class extends Vt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,i){let s=!1;return s=R(t)?!F(U(t,(t=>F(t[e],a))),-1):t.hasOwnProperty(e)&&(s=F(t[e],a)),_t.handleJudgmentExecute(this,s,i)}},jt=class extends Vt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},Kt=class extends Vt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Xt=class extends Vt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Ht=class extends Vt{constructor(t){super(t,"lt")}onExecute(t,e,a){const i=z(t,e);return _t.handleJudgmentExecute(this,i,a)}},Yt=class extends Vt{constructor(t){super(t,"lte")}onExecute(t,e,a){const i=B(t,e);return _t.handleJudgmentExecute(this,i,a)}},qt=class extends Vt{constructor(t){super(t,"neq")}onExecute(t,e,a){const i=!F(t,e);return _t.handleJudgmentExecute(this,i,a)}},Qt=class extends Vt{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return _t.handleJudgmentExecute(this,a,e)}},Jt=class extends Vt{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const i=t.find((t=>!!t));if(a.fn){const t=(null==(e=a.data)?void 0:e.root)||{};return i?a.fn(t):a.inverse(t)}return i||""}},$t=class extends Vt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},Zt=class extends Vt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?j(t):""}},te=class extends Vt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?K(t):""}},ee=class extends Vt{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var ae=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var a;return this.hsb=t.default||t,this.p=null,a=this.hsb,new Ft(a),new kt(a),new Wt(a),new Ut(a),new zt(a),new Bt(a),new jt(a),new Kt(a),new Xt(a),new Ht(a),new Yt(a),new qt(a),new Qt(a),new Jt(a),new $t(a),new Zt(a),new te(a),new ee(a),new Gt(a),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function ie(t){const e=[],a=/^%(.+)%$/;for(const i in t){let s=!0,n=t[i];Y(t[i])&&a.test(t[i])&&(s=!1,n=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:n})}return e}function se(t,...e){if(!t||S(t))return{};return oe(Array.isArray(t)?t:ie(t),...e)}function ne(t,e){const a=t.find((t=>!q(t)&&(t[e]||Object.prototype.hasOwnProperty.call(t,e))));return{find:!!a,value:null==a?void 0:a[e]}}function oe(t,...e){const a=/\$\{[^}]*\}/g,i={};for(const s of t)if(s.rawValue)i[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(a);if(null!==t){let a=s.value;t.forEach((t=>{const{find:i,value:s}=ne(e,t.slice(2,-1).toLowerCase());i&&(a=a.replace(t,"".concat(s)))})),i[s.key.toLowerCase()]=a}else{const{find:t,value:a}=ne(e,s.value.toLowerCase());t&&(i[s.key.toLowerCase()]=a)}}return i}function re(t,e){const a={};if(!t)return a;const i=Array.isArray(t)?t:ie(t),s=e[0];return i.forEach((t=>{const{rawValue:i,value:n}=t;!i&&n&&Object.prototype.hasOwnProperty.call(s,n)&&(a[n]=e.map((t=>t[n])).join(";"))})),a}function ce(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:n,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(a&&(h[a]=p),i&&(u[i]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=se(n,d,c,r),f=se(o,d,c,r);return Object.assign(h,m),Object.assign(u,f),{resultContext:h,resultParams:u}}function de(t,e){if(t&&e){const a=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(a)return a}return null}function le(t,e){var a,i;let s=t.controls||[];return(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.controls)),s.find((t=>t.name===e||t.codeName===e||t.id===e))}function he(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const n=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:e,navigateParams:a,other:i}}function ue(t){let e;if(t.controlRenders){const a=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==a?void 0:a.layoutPanel}return e}function pe(t){const{width:e,height:a,widthMode:i,heightMode:s}=t,n={width:"",height:""};return"FULL"===i?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?n.height="100%":a&&a>0&&(n.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),n}function me(t,e){const a=[],i=Xe.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return L(i)?a.push(i):R(i)?a.push(...i):M(i)&&Object.keys(i).forEach((t=>{i[t]&&a.push(t)})),a}function fe(t,e){const{mainStateAppDEFieldIds:a,demainStates:i}=t;if(a&&i){const t=[];return a.forEach((a=>{t.push(e[a])})),i.find((e=>{const{stateValue:a,state2Value:i,state3Value:s}=e;let n=!0;const o=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function ge(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,n=(null==i?void 0:i.map((t=>t.name)))||[];let o=[];if(s)o=n;else{o=[...a.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function we(t){return t.split(".").pop()}function Ee(t,e){const a=we(e);return Y(t[a])}function ve(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function ye(t,e){var a,i;const s=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?s.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?s.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&s.push(t.defaultValueAppDEFLogicId)})),(null==(i=t.appDELogics)?void 0:i.filter((t=>s.includes(t.id))))||[]}function Ie(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function De(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Ce(t){return t.detreeNodes.find((t=>t.rootNode))}function Ae(t,e){return t.detreeNodes.find((t=>t.id===e))}function be(t,e){const a=e.parentId||Ce(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(i=t.searchMode,s=e.hasQuery,3===i||(s?1===i:2===i));var i,s}))}function Pe(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function Te(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function xe(t){return"MDCTRL"===t.detailType}function Ne(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function Se(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function Le(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn("未支持的引擎分类:".concat(t.engineType)),!1)))}function Re(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Me=["panelItems","panelTabPages","rootPanelItems"];function Oe(t){let e=[];for(const a of Me)if(t[a]){e=t[a];break}const a=[];return e.length&&(a.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Re(t)||a.push(...Oe(t))}))),a}function _e(t){return Oe(t)}async function Ve(t,e,a={},i={}){return async function(t,e,a={},i={}){let s;try{s=await ke(t,e,a,i)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const a=window.open(t,"_blank");a&&(a.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Do.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,a,i)}async function Fe(t,e,a={}){const i=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(i+1,e.length)),n=rt.parse(s,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new o("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o("未找到指定实体的codeName: ".concat(r));n[c.toLowerCase()]=n[r.toLowerCase()];const d="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(d);if(delete n.srfdename,"undo"!==n.srfwf){const t=n.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=a}return n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),{context:t,params:n,opts:a,viewId:l.id}}async function ke(t,e,i={},s={}){var n;const r=se(t.appViewNavContexts||[],i,e);e=Object.assign(e.clone(),r);const c=se(t.appViewNavParams||[],i,e);Object.assign(i,c);const d=t.appDataEntityId,l=we(d);let h=(null==(n=s.data)?void 0:n[0])||{};e[l]=h[l]||e[l]||i[l];const u=t.getDataAppDEActionId,p=ibiz.hub.getApp(t.appId),m=await p.deService.getService(e,d);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,i);if(t.ok){h=t.data;let a=h.linkurl;if(a){if(e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://"))return{type:"url",url:a};if(a.startsWith("appredirectview?")){return{type:"view",...await Fe(e,a,s)}}throw new o("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(d,t.appId),g=await async function(t,e,a,i){let s="";const n=e.typeAppDEFieldId;if(n){const{codeName:a}=Ie(t,n),s=i[a.toLowerCase()];if(Y(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(n,"]值为空"),i)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(Y(r))return Y(a.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=Ie(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(q(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Ie(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=Y(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return s}(f,t,i,h);let w="";if(!g.startsWith("view://")){const n=g.split(":"),o=2===n.length?g:n.slice(0,2).join(":"),r="".concat(f.name.toUpperCase(),":").concat(g),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const d=c.find((t=>{const e=t.name||t.id;return e===r||e===g||e===o}));if(d){if(w=d.refAppViewId,w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(d,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(g,"]或[").concat(r,"]或工作流[").concat(o,"]对应视图"))}{const t=new URL(g);t.searchParams.size>0&&t.searchParams.forEach(((t,e)=>{i[e]=t}));const e=t.pathname.replace("//","").split("/"),[a,s]=e;w=s||a}if(w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(t,"标识[".concat(g,"]未匹配到实际引用视图"))}function We(t,e,a){if(Object.is(e,"IN"))return Be(t,a);if(Object.is(e,"NOTIN"))return!Be(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return Ue(t,a)<0;case"LTANDEQ":return Ue(t,a)<=0;case"GT":return Ue(t,a)>0;case"GTANDEQ":return Ue(t,a)>=0;case"ISNULL":return q(t);case"ISNOTNULL":return Y(t);case"TESTNULL":return ct(t);case"IN":return Be(t,a);case"NOTIN":return!Be(t,a);case"LIKE":return Ge(t,a);case"LEFTLIKE":return Ge(t,a,"start");case"RIGHTLIKE":return Ge(t,a,"end");default:throw new o("值操作:".concat(e,",暂未支持"))}}function Ue(t,e){const a=Number(t),i=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(i))return ze(a,i);const s=new Date(t).getTime(),n=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(n))return ze(s,n);throw new o("".concat(t," 和 ").concat(e," 无法比较大小"))}function ze(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Be(t,e){if(!e||"string"!=typeof e)throw new o("范围比较的条件值不存或者不是字符串");if(t){return e.split(",").includes("".concat(t))}return!1}function Ge(t,e,a){if(!t||!e)return!1;const i="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),n=i.indexOf(s);switch(a){case"start":return 0===n;case"end":return n+s.length===i.length;default:return-1!==n}}var je={singleRowReturn:!1,isAsync:!0},Ke=t("ScriptFunction",class{constructor(t,e,a=je){this.argKeys=[],this.options=a;const i=this.formatCode(e,a);this.calcArgKeys(t,a);const s=new Function(...this.argKeys,i);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error("报错脚本",i),t}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?dt(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const i=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),i.push(a[t])})),i}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),Xe=t("ScriptFactory",class{static createScriptFn(t,e,a){return new Ke(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function He(t,e,a){const i={isPast:!0,infoMessage:a.ruleInfo};if(function(t){return"GROUP"===t.condType}(a)){const s=a.conds;s&&s.length>0&&(i.isPast=function(t,e,a="AND",i=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===a;for(let i=0,n=t.length;i<n;i++){const n=e(t[i],i);if("AND"===a){if(!n){s=!1;break}}else if("OR"===a&&n){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:n}=He(t,e,a);return i.infoMessage=n,s}),a.condOp,!!a.notMode),!i.isPast&&("AND"===a.condOp&&a.notMode||"OR"===a.condOp&&!a.notMode)&&(i.infoMessage=a.ruleInfo))}else{t=(null==a?void 0:a.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=n[a=a?a.toLowerCase():""]?n[a]:a}(ct(i)||lt(i))&&(i="内容必须符合值规则");const c=We(t,e,a);if(!c&&r)throw new o(i);return!c}(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){q(n)&&(n="值必须符合值范围规则");if(q(t)){if(r)throw new o("值为空");return n="值为空",!0}if(Ye(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!=i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"REGEX"===t.condType}(a))i.isPast=!Ye(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){q(n)&&(n="内容长度必须符合范围规则");if(q(t)){if(r)throw new o("值为空");return n="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!==i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(a)&&(null==a?void 0:a.sysValueRule)){const{ruleType:s,regExCode:n,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!Ye(e[t],n,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:n}=function(t,e,a,i,s){q(i)&&(i="值必须符合脚本规则");const n=e;let r="",c=!0;const d=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=Xe.execScriptFn({value:t,data:n},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(i="",!c&&s)throw new o(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=n||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=a.notMode?!i.isPast:i.isPast}return i}function Ye(t,e,a,i){q(a)&&(a="值必须符合正则规则");if(q(t)){if(i)throw new o("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new o(a);return!0}return a="",!1}function qe(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.defdlogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!qe(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>qe(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return We(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}function Qe(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.panelItemLogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!Qe(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>Qe(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return We(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}var Je=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=ht(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:i,mainMenuAlign:s}=t;let n="";i?n="BLANK_MODE":s&&(n=s.toUpperCase());let o="";return o=""!==n?"".concat(e,"_").concat(a,"_").concat(n):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function $e(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var Ze=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))(Ze||{})),ta=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(ta||{})),ea=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(ea||{})),aa=t("StudioViewEvents",class{});aa.onViewMounted="onMounted",aa.onViewDestroyed="onDestroyed";var ia=t("StudioPanelEvents",class{});ia.onClick="onClick",ia.onChange="onChange",ia.onEnter="onEnter",ia.onLeave="onLeave";var sa=t("StudioControlEvents",class{});sa.onBeforeLoad="onBeforeLoad",sa.onLoadSuccess="onLoadSuccess",sa.onLoadError="onLoadError",sa.onBeforeLoadDraft="onBeforeLoadDraft",sa.onLoadDraftSuccess="onLoadDraftSuccess",sa.onLoadDraftError="onLoadDraftError",sa.onBeforeSave="onBeforeSave",sa.onSaveSuccess="onSaveSuccess",sa.onSaveError="onSaveError",sa.onBeforeRemove="onBeforeRemove",sa.onRemoveSuccess="onRemoveSuccess",sa.onRemoveError="onRemoveError",sa.CLICK="onClick";var na=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(na||{})),oa=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(oa||{})),ra=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(ra||{})),ca=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(ca||{})),da=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))(da||{})),la=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(la||{})),ha=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new Q,beforeDismiss:new Q},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function ua(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var pa=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),ma=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=ht(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let a=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];a+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}a+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=a,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),fa=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn("事务已经开启, 单个界面域只能开启一个事务"):this.state.isOpen=!0}change(t,e){this.state.isChange=!0,this.commitQueue.set(t,e)}commit(){const t=Array.from(this.commitQueue.values()).reverse();for(const e of t)e();this.commitQueue.clear(),this.state.isChange=!1}rollback(){this.commitQueue.clear(),this.state.isChange=!1}close(){if(this.state.isChange)throw new Error("当前事务未提交,不可以直接关闭事务");this.state.isOpen=!1}},ga=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new fa,this.id=t||J()}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}getDERConfigByMajor(t){return this.rs2Map.has(t)?this.rs2Map.get(t):[]}calcParentRs(){this.rs2Map.clear(),this.rsMap.forEach(((t,e)=>{t.forEach((t=>{t.minorAppDataEntityId=e;const a=t.majorAppDataEntityId;this.rs2Map.has(a)||this.rs2Map.set(a,[]),this.rs2Map.get(a).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),wa=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new ga(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error("无效的界面域标识[".concat(t,"]"))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),Ea=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}}),va=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new $}add(t,e){this.stack.push(e),this.stackMap.set(t,e),this.recalculateActiveStack(),this.evt.emit("add",e),this.evt.emit("change",{type:"add",view:e})}remove(t){const e=this.stackMap.get(t);e&&(this.stack.splice(this.stack.indexOf(e),1),this.stackMap.delete(t),this.recalculateActiveStack(),this.evt.emit("remove",e),this.evt.emit("change",{type:"remove",view:e}))}getActives(){return this.activeStack}active(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("active",e),this.evt.emit("change",{type:"active",view:e}))}deactivate(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("deactivate",e),this.evt.emit("change",{type:"deactivate",view:e}))}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function ya(t,e=!0){const a=await Promise.allSettled(t),i=[],s=[];if(a.forEach((t=>{"fulfilled"===t.status?i.push(t.value):s.push(t.reason)})),s.length>0){const t=1===s.length?s[0]:s;if(e)throw t;ibiz.util.error.handle(t)}return i}var Ia={position:"fixed",zIndex:"10000"};function Da(t,e=document.body,a=!0){const i=Aa(t);if(null==i)throw new Error("Cannot clone a null or undefined element.");const s=i.cloneNode(!0);if(a)for(;s.firstChild;)s.removeChild(s.firstChild);return function(t,{width:e,height:a,boundingLeft:i,boundingTop:s}){t.style.left="".concat(i,"px"),t.style.top="".concat(s,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(a,"px"),Object.assign(t.style,Ia)}(s,Ca(i)),e.appendChild(s),s}function Ca(t){const e=t.offsetWidth,a=t.offsetHeight,i=window.getComputedStyle(t),s=parseFloat(i.padding),{left:n,top:o}=t.getBoundingClientRect();return{width:e,height:a,padding:s,boundingLeft:n,boundingTop:o}}function Aa(t){return"string"==typeof t?document.querySelector(t):t}var ba={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Pa={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Ta=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],xa={CSS:{},springs:{}};function Na(t,e,a){return Math.min(Math.max(t,e),a)}function Sa(t,e){return t.indexOf(e)>-1}function La(t,e){return t.apply(null,e)}var Ra={arr:function(t){return Array.isArray(t)},obj:function(t){return Sa(Object.prototype.toString.call(t),"Object")},pth:function(t){return Ra.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||Ra.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return Ra.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return Ra.hex(t)||Ra.rgb(t)||Ra.hsl(t)},key:function(t){return!ba.hasOwnProperty(t)&&!Pa.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function Ma(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Oa(t,e){var a=Ma(t),i=Na(Ra.und(a[0])?1:a[0],.1,100),s=Na(Ra.und(a[1])?100:a[1],.1,100),n=Na(Ra.und(a[2])?10:a[2],.1,100),o=Na(Ra.und(a[3])?0:a[3],.1,100),r=Math.sqrt(s/i),c=n/(2*Math.sqrt(s*i)),d=c<1?r*Math.sqrt(1-c*c):0,l=1,h=c<1?(c*r-o)/d:-o+r;function u(t){var a=e?e*t/1e3:t;return a=c<1?Math.exp(-a*c*r)*(l*Math.cos(d*a)+h*Math.sin(d*a)):(l+h*a)*Math.exp(-a*r),0===t||1===t?t:1-a}return e?u:function(){var e=xa.springs[t];if(e)return e;for(var a=1/6,i=0,s=0;;)if(1===u(i+=a)){if(++s>=16)break}else s=0;var n=i*a*1e3;return xa.springs[t]=n,n}}function _a(t){return void 0===t&&(t=10),function(e){return Math.ceil(Na(e,1e-6,1)*t)*(1/t)}}var Va,Fa,ka=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function a(t,e){return 3*e-6*t}function i(t){return 3*t}function s(t,s,n){return((e(s,n)*t+a(s,n))*t+i(s))*t}function n(t,s,n){return 3*e(s,n)*t*t+2*a(s,n)*t+i(s)}return function(e,a,i,o){if(0<=e&&e<=1&&0<=i&&i<=1){var r=new Float32Array(11);if(e!==a||i!==o)for(var c=0;c<11;++c)r[c]=s(c*t,e,i);return function(t){return e===a&&i===o||0===t||1===t?t:s(d(t),a,o)}}function d(a){for(var o=0,c=1;10!==c&&r[c]<=a;++c)o+=t;--c;var d=o+(a-r[c])/(r[c+1]-r[c])*t,l=n(d,e,i);return l>=.001?function(t,e,a,i){for(var o=0;o<4;++o){var r=n(e,a,i);if(0===r)return e;e-=(s(e,a,i)-t)/r}return e}(a,d,e,i):0===l?d:function(t,e,a,i,n){var o,r,c=0;do{(o=s(r=e+(a-e)/2,i,n)-t)>0?a=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(a,o,o+t,e,i)}}}(),Wa=(Va={linear:function(){return function(t){return t}}},Fa={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Expo:function(){return function(t){return t?Math.pow(2,10*t-10):0}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,a=4;t<((e=Math.pow(2,--a))-1)/11;);return 1/Math.pow(4,3-a)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var a=Na(t,1,10),i=Na(e,.1,2);return function(t){return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/i)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Fa[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Fa).forEach((function(t){var e=Fa[t];Va["easeIn"+t]=e,Va["easeOut"+t]=function(t,a){return function(i){return 1-e(t,a)(1-i)}},Va["easeInOut"+t]=function(t,a){return function(i){return i<.5?e(t,a)(2*i)/2:1-e(t,a)(-2*i+2)/2}},Va["easeOutIn"+t]=function(t,a){return function(i){return i<.5?(1-e(t,a)(1-2*i))/2:(e(t,a)(2*i-1)+1)/2}}})),Va);function Ua(t,e){if(Ra.fnc(t))return t;var a=t.split("(")[0],i=Wa[a],s=Ma(t);switch(a){case"spring":return Oa(t,e);case"cubicBezier":return La(ka,s);case"steps":return La(_a,s);default:return La(i,s)}}function za(t){try{return document.querySelectorAll(t)}catch(t){return}}function Ba(t,e){for(var a=t.length,i=arguments.length>=2?arguments[1]:void 0,s=[],n=0;n<a;n++)if(n in t){var o=t[n];e.call(i,o,n,t)&&s.push(o)}return s}function Ga(t){return t.reduce((function(t,e){return t.concat(Ra.arr(e)?Ga(e):e)}),[])}function ja(t){return Ra.arr(t)?t:(Ra.str(t)&&(t=za(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Ka(t,e){return t.some((function(t){return t===e}))}function Xa(t){var e={};for(var a in t)e[a]=t[a];return e}function Ha(t,e){var a=Xa(t);for(var i in t)a[i]=e.hasOwnProperty(i)?e[i]:t[i];return a}function Ya(t,e){var a=Xa(t);for(var i in e)a[i]=Ra.und(t[i])?e[i]:t[i];return a}function qa(t){return Ra.rgb(t)?(a=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+a[1]+",1)":e:Ra.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,a,i){return e+e+a+a+i+i})),a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(a[1],16)+","+parseInt(a[2],16)+","+parseInt(a[3],16)+",1)"}(t):Ra.hsl(t)?function(t){var e,a,i,s=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),n=parseInt(s[1],10)/360,o=parseInt(s[2],10)/100,r=parseInt(s[3],10)/100,c=s[4]||1;function d(t,e,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?t+6*(e-t)*a:a<.5?e:a<2/3?t+(e-t)*(2/3-a)*6:t}if(0==o)e=a=i=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,n+1/3),a=d(h,l,n),i=d(h,l,n-1/3)}return"rgba("+255*e+","+255*a+","+255*i+","+c+")"}(t):void 0;var e,a}function Qa(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function Ja(t,e){return Ra.fnc(t)?t(e.target,e.id,e.total):t}function $a(t,e){return t.getAttribute(e)}function Za(t,e,a){if(Ka([a,"deg","rad","turn"],Qa(e)))return e;var i=xa.CSS[e+a];if(!Ra.und(i))return i;var s=document.createElement(t.tagName),n=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;n.appendChild(s),s.style.position="absolute",s.style.width=100+a;var o=100/s.offsetWidth;n.removeChild(s);var r=o*parseFloat(e);return xa.CSS[e+a]=r,r}function ti(t,e,a){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return a?Za(t,s,a):s}}function ei(t,e){return Ra.dom(t)&&!Ra.inp(t)&&(!Ra.nil($a(t,e))||Ra.svg(t)&&t[e])?"attribute":Ra.dom(t)&&Ka(Ta,e)?"transform":Ra.dom(t)&&"transform"!==e&&ti(t,e)?"css":null!=t[e]?"object":void 0}function ai(t){if(Ra.dom(t)){for(var e,a=t.style.transform||"",i=/(\w+)\(([^)]*)\)/g,s=new Map;e=i.exec(a);)s.set(e[1],e[2]);return s}}function ii(t,e,a,i){var s=Sa(e,"scale")?1:0+function(t){return Sa(t,"translate")||"perspective"===t?"px":Sa(t,"rotate")||Sa(t,"skew")?"deg":void 0}(e),n=ai(t).get(e)||s;return a&&(a.transforms.list.set(e,n),a.transforms.last=e),i?Za(t,n,i):n}function si(t,e,a,i){switch(ei(t,e)){case"transform":return ii(t,e,i,a);case"css":return ti(t,e,a);case"attribute":return $a(t,e);default:return t[e]||0}}function ni(t,e){var a=/^(\*=|\+=|-=)/.exec(t);if(!a)return t;var i=Qa(t)||0,s=parseFloat(e),n=parseFloat(t.replace(a[0],""));switch(a[0][0]){case"+":return s+n+i;case"-":return s-n+i;case"*":return s*n+i}}function oi(t,e){if(Ra.col(t))return qa(t);if(/\s/g.test(t))return t;var a=Qa(t),i=a?t.substr(0,t.length-a.length):t;return e?i+e:i}function ri(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ci(t){for(var e,a=t.points,i=0,s=0;s<a.numberOfItems;s++){var n=a.getItem(s);s>0&&(i+=ri(e,n)),e=n}return i}function di(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*$a(t,"r")}(t);case"rect":return function(t){return 2*$a(t,"width")+2*$a(t,"height")}(t);case"line":return function(t){return ri({x:$a(t,"x1"),y:$a(t,"y1")},{x:$a(t,"x2"),y:$a(t,"y2")})}(t);case"polyline":return ci(t);case"polygon":return function(t){var e=t.points;return ci(t)+ri(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function li(t,e){var a=e||{},i=a.el||function(t){for(var e=t.parentNode;Ra.svg(e)&&Ra.svg(e.parentNode);)e=e.parentNode;return e}(t),s=i.getBoundingClientRect(),n=$a(i,"viewBox"),o=s.width,r=s.height,c=a.viewBox||(n?n.split(" "):[0,0,o,r]);return{el:i,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function hi(t,e,a){function i(a){void 0===a&&(a=0);var i=e+a>=1?e+a:0;return t.el.getPointAtLength(i)}var s=li(t.el,t.svg),n=i(),o=i(-1),r=i(1),c=a?1:s.w/s.vW,d=a?1:s.h/s.vH;switch(t.property){case"x":return(n.x-s.x)*c;case"y":return(n.y-s.y)*d;case"angle":return 180*Math.atan2(r.y-o.y,r.x-o.x)/Math.PI}}function ui(t,e){var a=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,i=oi(Ra.pth(t)?t.totalLength:t,e)+"";return{original:i,numbers:i.match(a)?i.match(a).map(Number):[0],strings:Ra.str(t)||e?i.split(a):[]}}function pi(t){return Ba(t?Ga(Ra.arr(t)?t.map(ja):ja(t)):[],(function(t,e,a){return a.indexOf(t)===e}))}function mi(t){var e=pi(t);return e.map((function(t,a){return{target:t,id:a,total:e.length,transforms:{list:ai(t)}}}))}function fi(t,e){var a=Xa(e);if(/^spring/.test(a.easing)&&(a.duration=Oa(a.easing)),Ra.arr(t)){var i=t.length;2===i&&!Ra.obj(t[0])?t={value:t}:Ra.fnc(e.duration)||(a.duration=e.duration/i)}var s=Ra.arr(t)?t:[t];return s.map((function(t,a){var i=Ra.obj(t)&&!Ra.pth(t)?t:{value:t};return Ra.und(i.delay)&&(i.delay=a?0:e.delay),Ra.und(i.endDelay)&&(i.endDelay=a===s.length-1?e.endDelay:0),i})).map((function(t){return Ya(t,a)}))}function gi(t,e){var a=[],i=e.keyframes;for(var s in i&&(e=Ya(function(t){for(var e=Ba(Ga(t.map((function(t){return Object.keys(t)}))),(function(t){return Ra.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),a={},i=function(i){var s=e[i];a[s]=t.map((function(t){var e={};for(var a in t)Ra.key(a)?a==s&&(e.value=t[a]):e[a]=t[a];return e}))},s=0;s<e.length;s++)i(s);return a}(i),e)),e)Ra.key(s)&&a.push({name:s,tweens:fi(e[s],t)});return a}function wi(t,e){var a;return t.tweens.map((function(i){var s=function(t,e){var a={};for(var i in t){var s=Ja(t[i],e);Ra.arr(s)&&1===(s=s.map((function(t){return Ja(t,e)}))).length&&(s=s[0]),a[i]=s}return a.duration=parseFloat(a.duration),a.delay=parseFloat(a.delay),a}(i,e),n=s.value,o=Ra.arr(n)?n[1]:n,r=Qa(o),c=si(e.target,t.name,r,e),d=a?a.to.original:c,l=Ra.arr(n)?n[0]:d,h=Qa(l)||Qa(c),u=r||h;return Ra.und(o)&&(o=d),s.from=ui(l,u),s.to=ui(ni(o,l),u),s.start=a?a.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=Ua(s.easing,s.duration),s.isPath=Ra.pth(n),s.isPathTargetInsideSVG=s.isPath&&Ra.svg(e.target),s.isColor=Ra.col(s.from.original),s.isColor&&(s.round=1),a=s,s}))}var Ei={css:function(t,e,a){return t.style[e]=a},attribute:function(t,e,a){return t.setAttribute(e,a)},object:function(t,e,a){return t[e]=a},transform:function(t,e,a,i,s){if(i.list.set(e,a),e===i.last||s){var n="";i.list.forEach((function(t,e){n+=e+"("+t+") "})),t.style.transform=n}}};function vi(t,e){mi(t).forEach((function(t){for(var a in e){var i=Ja(e[a],t),s=t.target,n=Qa(i),o=si(s,a,n,t),r=ni(oi(i,n||Qa(o)),o),c=ei(s,a);Ei[c](s,a,r,t.transforms,!0)}}))}function yi(t,e){return Ba(Ga(t.map((function(t){return e.map((function(e){return function(t,e){var a=ei(t.target,e.name);if(a){var i=wi(e,t),s=i[i.length-1];return{type:a,property:e.name,animatable:t,tweens:i,duration:s.end,delay:i[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!Ra.und(t)}))}function Ii(t,e){var a=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=a?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,s.delay=a?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,s.endDelay=a?s.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,s}var Di=0;var Ci=[],Ai=function(){var t;function e(a){for(var i=Ci.length,s=0;s<i;){var n=Ci[s];n.paused?(Ci.splice(s,1),i--):(n.tick(a),s++)}t=s>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Pi.suspendWhenDocumentHidden&&(bi()?t=cancelAnimationFrame(t):(Ci.forEach((function(t){return t._onDocumentVisibility()})),Ai()))})),function(){t||bi()&&Pi.suspendWhenDocumentHidden||!(Ci.length>0)||(t=requestAnimationFrame(e))}}();function bi(){return!!document&&document.hidden}function Pi(t){void 0===t&&(t={});var e,a=0,i=0,s=0,n=0,o=null;function r(t){var e=window.Promise&&new Promise((function(t){return o=t}));return t.finished=e,e}var c=function(t){var e=Ha(ba,t),a=Ha(Pa,t),i=gi(a,t),s=mi(t.targets),n=yi(s,i),o=Ii(n,a),r=Di;return Di++,Ya(e,{id:r,children:[],animatables:s,animations:n,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function d(){var t=c.direction;"alternate"!==t&&(c.direction="normal"!==t?"normal":"reverse"),c.reversed=!c.reversed,e.forEach((function(t){return t.reversed=c.reversed}))}function l(t){return c.reversed?c.duration-t:t}function h(){a=0,i=l(c.currentTime)*(1/Pi.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,a=c.animations,i=a.length;e<i;){var s=a[e],n=s.animatable,o=s.tweens,r=o.length-1,d=o[r];r&&(d=Ba(o,(function(e){return t<e.end}))[0]||d);for(var l=Na(t-d.start-d.delay,0,d.duration)/d.duration,h=isNaN(l)?1:d.easing(l),u=d.to.strings,p=d.round,m=[],f=d.to.numbers.length,g=void 0,w=0;w<f;w++){var E=void 0,v=d.to.numbers[w],y=d.from.numbers[w]||0;E=d.isPath?hi(d.value,h*v,d.isPathTargetInsideSVG):y+h*(v-y),p&&(d.isColor&&w>2||(E=Math.round(E*p)/p)),m.push(E)}var I=u.length;if(I){g=u[0];for(var D=0;D<I;D++){u[D];var C=u[D+1],A=m[D];isNaN(A)||(g+=C?A+C:A+" ")}}else g=m[0];Ei[s.type](n.target,s.property,g,n.transforms),s.currentValue=g,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function f(t){var h=c.duration,f=c.delay,g=h-c.endDelay,w=l(t);c.progress=Na(w/h*100,0,100),c.reversePlayback=w<c.currentTime,e&&function(t){if(c.reversePlayback)for(var a=n;a--;)u(t,e[a]);else for(var i=0;i<n;i++)u(t,e[i])}(w),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),w<=f&&0!==c.currentTime&&p(0),(w>=g&&c.currentTime!==h||!h)&&p(h),w>f&&w<g?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(w)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Na(w,0,h),c.began&&m("update"),t>=h&&(i=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(a=s,m("loopComplete"),c.loopBegan=!1,"alternate"===c.direction&&d()):(c.paused=!0,c.completed||(c.completed=!0,m("loopComplete"),m("complete"),!c.passThrough&&"Promise"in window&&(o(),r(c)))))}return r(c),c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.loopBegan=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var a=n=e.length;a--;)c.children[a].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,p(c.reversed?c.duration:0)},c._onDocumentVisibility=h,c.set=function(t,e){return vi(t,e),c},c.tick=function(t){s=t,a||(a=s),f((s+(i-a))*Pi.speed)},c.seek=function(t){f(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,Ci.push(c),h(),Ai())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){xi(pi(t),c)},c.reset(),c.autoplay&&c.play(),c}function Ti(t,e){for(var a=e.length;a--;)Ka(t,e[a].animatable.target)&&e.splice(a,1)}function xi(t,e){var a=e.animations,i=e.children;Ti(t,a);for(var s=i.length;s--;){var n=i[s],o=n.animations;Ti(t,o),o.length||n.children.length||i.splice(s,1)}a.length||i.length||e.pause()}Pi.version="3.2.1",Pi.speed=1,Pi.suspendWhenDocumentHidden=!0,Pi.running=Ci,Pi.remove=function(t){for(var e=pi(t),a=Ci.length;a--;){xi(e,Ci[a])}},Pi.get=si,Pi.set=vi,Pi.convertPx=Za,Pi.path=function(t,e){var a=Ra.str(t)?za(t)[0]:t,i=e||100;return function(t){return{property:t,el:a,svg:li(a),totalLength:di(a)*(i/100)}}},Pi.setDashoffset=function(t){var e=di(t);return t.setAttribute("stroke-dasharray",e),e},Pi.stagger=function(t,e){void 0===e&&(e={});var a=e.direction||"normal",i=e.easing?Ua(e.easing):null,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Ra.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=Qa(l?t[1]:t)||0,m=e.start||0+(l?h:0),f=[],g=0;return function(t,e,w){if(r&&(o=0),c&&(o=(w-1)/2),d&&(o=w-1),!f.length){for(var E=0;E<w;E++){if(s){var v=c?(s[0]-1)/2:o%s[0],y=c?(s[1]-1)/2:Math.floor(o/s[0]),I=v-E%s[0],D=y-Math.floor(E/s[0]),C=Math.sqrt(I*I+D*D);"x"===n&&(C=-I),"y"===n&&(C=-D),f.push(C)}else f.push(Math.abs(o-E));g=Math.max.apply(Math,f)}i&&(f=f.map((function(t){return i(t/g)*g}))),"reverse"===a&&(f=f.map((function(t){return n?t<0?-1*t:-t:Math.abs(g-t)})))}return m+(l?(u-h)/g:h)*(Math.round(100*f[e])/100)+p}},Pi.timeline=function(t){void 0===t&&(t={});var e=Pi(t);return e.duration=0,e.add=function(a,i){var s=Ci.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&Ci.splice(s,1);for(var r=0;r<n.length;r++)o(n[r]);var c=Ya(a,Ha(Pa,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Ra.und(i)?d:ni(i,d),o(e),e.seek(c.timelineOffset);var l=Pi(c);o(l),n.push(l);var h=Ii(n,t);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Pi.easing=Ua,Pi.penner=Wa,Pi.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var Ni=Pi,Si={duration:1e3,loop:!1,easing:"easeInOutSine"};function Li(t,e){const a={};if(e.complete&&t.complete){const i=e.complete,s=t.complete;a.complete=t=>{i(t),s(t)}}return{...t,...e,...a}}function Ri(t,e,a={}){const{left:i,top:s}=t.getBoundingClientRect(),{left:n,top:o}=e.getBoundingClientRect(),r=n-i,c=o-s;return new Promise((e=>{const i=Li({targets:t,translateX:r,translateY:c,...Si,complete:()=>{e(!0)}},a);Ni(i)}))}var Mi=t("AnimeUtil",class{async movePoint(t,e,a={}){const i=Aa(e);if(!i)return ibiz.log.debug("终点元素不存在"),!1;const s=Da(t,document.body);if(!s)return ibiz.log.debug("动画元素不存在"),!1;const{padding:n,width:o,height:r}=Ca(s),c={borderRadius:["0%","50%"],maxWidth:[o,"6px"],maxHeight:[r,"6px"],minWidth:[o,"6px"],minHeight:[r,"6px"],padding:[n,"6px"],duration:700};Object.assign(c,a);const d=await Ri(s,i,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,a={}){return Ri(t,e,a)}resize(t,e={}){return function(t,e={}){return new Promise((a=>{const i=Li({scale:[1,.8,1],targets:t,...Si,complete:()=>{a(!0)}},e);Ni(i)}))}(t,e)}async moveAndResize(t,e,a={}){const i=await this.movePoint(t,e,a);return i&&await this.resize(e,{duration:500}),i}}),Oi=t("FileUtil",class{calcOSSCatUrl(t,e,a){var i;let s="".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId).concat(t);const n=ibiz.hub.getApp(e.srfappid),o=a||n.model.defaultOSSCat||(null==(i=n.model.userParam)?void 0:i.DefaultOSSCat);return s=s.replace("/{cat}",o?"/".concat(o):""),s}calcFileUpDownUrl(t,e,a={},i={}){const{uploadParams:s,exportParams:n,osscat:o}=i;let r=this.calcOSSCatUrl(ibiz.env.uploadFileUrl,t,o),c=this.calcOSSCatUrl("".concat(ibiz.env.downloadFileUrl,"/%fileId%"),t,o),d={},l={};return s&&(d=se(s,a,e,t)),n&&(l=se(n,a,e,t)),r+=rt.stringify(d,{addQueryPrefix:!0}),c+=rt.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o("下载文件失败");if(!a.data)throw new o("文件流数据不存在");{const t=e;c(a.data,t)}}async fileUpload(t,e,a){const i=new FormData;i.append("file",e);const s=await ibiz.net.axios({url:t,method:"post",headers:a,data:i});if(200!==s.status)throw new o("文件上传失败");return s.data}}),_i=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){if(null==e||null==a)return!1;let i=-1;if(e==a?i=0:e>a&&(i=1),"EQ"===t||"ABSEQ"===t)return 0===i;if("GT"===t)return i>0;if("GTANDEQ"===t)return i>=0;if("LT"===t)return i<0;if("LTANDEQ"===t)return i<=0;if("NOTEQ"===t)return 0!==i}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Vi=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Fi=class extends Vi{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let n=0;n<e;n++)if(a){const e=t[n];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[n];this.setParam(e),i=!1,s=!0}else if(s){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},ki=class t extends Vi{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,n=!1;for(let r=0;r<a;r++){if(i&&s){if("!"===e[r]){this.setNotMode(!0),i=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,i=!1,n=!0}else if(n){const a=e[r];if(!(a instanceof Array))throw new o("值必须为数组");a.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new Fi;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Wi=class extends ki{},Ui=class extends Fi{},zi=class t extends _i{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof ki){const t=e.getChildPSModelCondBases();if(null==t||lt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let n=s;for(let e=0;e<t.length;e++){const o=t[e];if(this.testCond(o,a,i)){if(!s){n=!0;break}}else if(s){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Fi){lt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||lt(o)?n=e.getValue():(lt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===o?n=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,n)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Ui}createPSModelGroupCond(){return new Wi}};zi.PARAMTYPE_DATACONTEXT="DATACONTEXT",zi.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Bi=t("PSDEDQCondEngine",zi);async function Gi(t,e){var a;const i=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(i)return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode);ibiz.log.error("未匹配到插件[".concat(t,"]模型"))}var ji=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Ki(t,e){ibiz.register.register("".concat(ji,"_").concat(t),e)}function Xi(t){return ibiz.register.get("".concat(ji,"_").concat(t))}async function Hi(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=Xi(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Xi(a),e)return e;throw new o("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Xi(i),e)return e;throw new o("找不系统计数器类型".concat(i,"对应的适配器"))}var Yi=t("CONTROL_PROVIDER_PREFIX","CONTROL");function qi(t){return ibiz.register.get("".concat(Yi,"_").concat(t))}async function Qi(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=qi(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=qi("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=qi(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var Ji=t("EDITOR_PROVIDER_PREFIX","EDITOR");function $i(t){return ibiz.register.get("".concat(Ji,"_").concat(t))}async function Zi(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Gi(n,o);if(t&&(e=$i(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=$i("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let n="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(n+="_".concat(i)),e=$i(n),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=$i(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var ts=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function es(t){return ibiz.register.get("".concat(ts,"_").concat(t))}async function as(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Gi(i,s);if(t&&(e=es(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=es(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var is=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function ss(t){return ibiz.register.get("".concat(is,"_").concat(t))}async function ns(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Gi(s,n);if(t&&(e=ss(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const o=i?"".concat(a,"_EDIT"):a;if(e=ss(o),e)return e;ibiz.log.error("找不到表格列类型".concat(o,"对应的适配器"))}var os=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function rs(t){return ibiz.register.get("".concat(os,"_").concat(t.toUpperCase()))}async function cs(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:n,controlRenders:o}=t;if(s){const t=await Gi(s,n);if(t&&(a=rs(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if(o&&o.length>0)a=rs("PREDEFINE_RENDER");else{if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=rs(i),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器,注册key为").concat(i))}if("RAWITEM"===i){const i=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT",s="RAWITEM_".concat(i);if(a=rs(s),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器,注册key为").concat(s))}if("FIELD"===i){const{editor:e}=t;if(e&&e.predefinedType){if(a=rs("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}a=rs(i)}if(a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var ds=t("PORTLET_PROVIDER_PREFIX","PORTLET");function ls(t){return ibiz.register.get("".concat(ds,"_").concat(t))}async function hs(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Gi(i,s);if(t&&(e=ls(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=ls(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var us=t("UIACTION_PROVIDER_PREFIX","UIACTION");function ps(t,e){ibiz.register.register("".concat(us,"_").concat(t),e)}function ms(t){return ibiz.register.get("".concat(us,"_").concat(t))}async function fs(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:n}=t;if(i){const t=await Gi(i,s);if(t&&(e=ms(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=ms("".concat(a,"_").concat(n)),e)return e;if(e=ms(a),e)return e;throw new o("找不界面行为模式".concat(a,"对应的适配器"))}var gs=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function ws(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Gi(a,i);if(s){if(e=ibiz.register.get("".concat(gs,"_").concat(s)),e)return e;throw new o("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var Es=t("VIEW_PROVIDER_PREFIX","VIEW");function vs(t){return ibiz.register.get("".concat(Es,"_").concat(t))}var ys=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var Is=t("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new o("文件流数据不存在")}}),Ds=t("BrowserPlatformProvider",class extends Is{});var Cs=window.navigator.userAgent.toLowerCase();function As(){return/Android|Adr/i.test(Cs)?"Android":/iPhone|iPod|iPad/i.test(Cs)?"IOS":/MicroMessenger/i.test(Cs)?"WeChat":/DingTalk/i.test(Cs)?"DingTalk":/miniProgram/i.test(Cs)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var bs=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function Ps(t,e){ibiz.register.register("".concat(bs,"_").concat(t),e)}function Ts(t){return ibiz.register.get("".concat(bs,"_").concat(t))}function xs(){const t=Ts(As());return t||Ts("Browser")}var Ns=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ss(t,e){ibiz.register.register("".concat(Ns,"_").concat(t),e)}function Ls(t){return ibiz.register.get("".concat(Ns,"_").concat(t))}async function Rs(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Gi(i,s);if(t&&(e=Ls(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=Ls(a),e)return e;throw new o("找不实体行为方法类型为".concat(a,"的适配器"))}var Ms=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Os(t){return ibiz.register.get("".concat(Ms,"_").concat(t))}async function _s(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Gi(s,i);if(t&&(e=Os(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=Os(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var Vs=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Fs(t){return ibiz.register.get("".concat(Vs,"_").concat(t))}async function ks(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Gi(a,i);if(t&&(e=Fs(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}return e=Fs(s),e}var Ws=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var Us=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new $,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=ht(t)),e&&(this.params=ht(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&Y(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),zs=t("AppDECounter",class extends Us{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new a(this.model,"未找到获取计数器行为!");this.action=i,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),Bs=t("AppDECounterProvider",class{createCounter(t){return new zs(t)}});function Gs(){Ki("DEDR",(()=>new Bs))}var js=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Bi;return 1===e.length?a.parse(this.calcCond(e)[0]):e.length>1&&a.parse(["AND",this.calcCond(e)][0]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const i=e.dedqconditions;if(i){const t=this.calcCond(i);a.push(t)}}else{if("SINGLE"!==t.condType)throw new i(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.condOp),a.push(e.fieldName),e.condValue?e.vartypeId?a.push({type:e.vartypeId,value:e.condValue}):a.push(e.condValue):a.push("")}}e.push(a)})),e}});js.map=new WeakMap;var Ks=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new i(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:i,iconClsAppDEFieldId:s,iconClsXAppDEFieldId:n,iconPathAppDEFieldId:o,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:d,clsAppDEFieldId:l,colorAppDEFieldId:h}=this.codeList,u=a?t[a]:t.srfkey;if(e.id=u,e.value=u,e.text=i?t[i]:t.srfmajortext,(s||n||o||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),n&&(e.sysImage.cssClassX=t[n]),o&&(e.sysImage.imagePath=t[o]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Zs(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=Xe.execSingleLine(t[d])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:n,minorSortAppDEFieldId:o,minorSortDir:r,pvalueAppDEFieldId:c,customCond:d}=this.codeList,l={...e};if(o&&r&&Object.assign(l,{sort:"".concat(o.toLowerCase(),",").concat(r.toLowerCase())}),d){const e=se(Xe.execSingleLine(d),l,t);Object.assign(l,e)}if(l.size||(l.size=1e4),this.isPredefined&&this.codeList.codeName){let t=this.codeList.codeName;if("OPERATOR"===this.codeList.predefinedType){const e=this.codeList.codeName.indexOf("__");t=-1!==e?this.codeList.codeName.substring(e+2):this.codeList.codeName}const e=await i.net.get("/dictionaries/codelist/".concat(t),l);return Object.freeze(e.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!n)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,n,t,void 0,l);let u=[];if(h.data.length)if(c){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach((t=>{u.push(this.convertData(t))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:a}=this.codeList,i={},s=[];return t.forEach((t=>{i[t[e]]=this.convertData(t)})),t.forEach((t=>{const n=i[t[a]];n?(n.children=n.children||[],n.children.push(i[t[e]])):s.push(i[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const i=this.load(t,e),{cacheTimeout:s}=this.codeList,n=-1===s||ct(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(a,o);const r=await i;return o.items=r,delete o.promise,r}});function Xs(t,e){if(null!=e){const{srfkey:t}=e;if(!ct(t)&&!lt(t))return!0}throw new o("执行「".concat(t,"」不存在「srfkey」无法处理"))}function Hs(t,e){const{srfsessionid:a}=e;if(!ct(a)&&!lt(a))return!0;throw new o("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Ys=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const a=this.cacheMap.get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,ht(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new o("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Hs("add",t),(ct(e.srfkey)||lt(e.srfkey))&&(e.srfkey=J()),e.srftempdate=(new Date).getTime();const a=()=>{this.cacheMap.set(e.srfkey,ht(e)),ibiz.log.warn("add",e.srfkey,e)},i=this.getTransaction(t);return i?i.change(e.srfkey,(()=>{a()})):a(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Hs("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),ht(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Hs("update",t),Xs("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i){const s=ht(i);s.assign(e);const n=()=>{i.assign(e),a!==e.srfkey&&this.cacheMap.delete(a),this.cacheMap.set(e.srfkey,i),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{n()})):n(),s}throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Hs("delete",t);const a=e;if(this.cacheMap.has(a)){const e=this.cacheMap.get(a),i=()=>{this.cacheMap.delete(a),ibiz.log.warn("delete",a)},s=this.getTransaction(t);return s?s.change(a,(()=>{i()})):i(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Hs("add",t);const a=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},i=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(ct(s.srfkey)||lt(s.srfkey))&&(s.srfkey=J()),s.srftempdate=(new Date).getTime();const n=ht(s);i?i.change(n.srfkey,(()=>{a(n)})):a(n)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Hs("update",t);const a=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},i=this.getTransaction(t);for(let s=0;s<e.length;s++){const n=e[s];Xs("update",n);const r=n.srfkey;if(this.isUnionKey&&(this.calcUnionKey(n),r!==n.srfkey&&this.checkData(t,n.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(n.srfkey,"的数据"));n.srftempdate=(new Date).getTime();const c=this.cacheMap.get(n.srfkey);if(!c)throw new Error("数据[".concat(n.srfdename,"-").concat(n.srfmajortext,"(").concat(n.srfkey,")]不存在,无法更新!"));{const t=ht(c);t.assign(n),e[s]=t,i?i.change(n.srfkey,(()=>{c.assign(n),a(c,r)})):(c.assign(n),a(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Hs("delete",t)}catch(t){return ibiz.log.error(t),e}const a=[];for(let t=0;t<e.length;t++){const i=e[t];this.cacheMap.has(i)||a.push(i)}if(a.length>0)throw new Error("未找到以下数据「".concat(a.join("、"),"」,无法删除!"));const i=t=>{this.cacheMap.delete(t),ibiz.log.warn("delete",t)},s=this.getTransaction(t);for(let t=0;t<e.length;t++){const a=e[t];s?s.change(a,(()=>{i(a)})):i(a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ut(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const i=t[a];e[a]=ut(i)}return pt(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>de(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>ct(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}getTransaction(t){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&!0===e.transaction.state.isOpen?e.transaction:null}}),qs=/\$\{(.*?)\}/g;function Qs(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(qs);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,i)=>i===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function Js(t,e){const a=Qs(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((i,s)=>{e=s===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):e.replace("${".concat(i,"}"),t[i])})),e}return a.path}return""}var $s=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(ct(e.page)||lt(e.page)||(this.page=e.page),ct(e.size)||lt(e.size)||(this.size=e.size),ct(e.query)||lt(e.query)||(this.query=e.query),!ct(e.sort)&&!lt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Zs(t){return[1,"1",!0,"true"].includes(t)}var tn=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let i=[];return(null==a?void 0:a.length)&&(i=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(i)),i}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var a;let i=t.text;t.textLanguageRes&&(i=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:s}=t;t.tooltipLanguageRes&&(s=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const n={text:i,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?Xe.execSingleLine(t.data):void 0,sysImage:t.sysImage};return(null==(a=t.codeItems)?void 0:a.length)&&(n.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(n)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new Ks(t),this.cache.set(s,i),await i.init()),i.get(e,a)}async get(t,e,a){const i=this.allCodeLists.get(t);if(!i)throw new o("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),en=t("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),an=t("CounterService",class{static async getCounter(t,e,a){const i=t.id;if(this.counterMap.has(i)){const t=this.counterMap.get(i);if(!1===t.isDestroyed)return t;this.counterMap.delete(i)}const s=(await Hi(t)).createCounter(t);return await s.init(e,a),this.counterMap.set(i,s),s}static async getCounterByRef(t,e,i){const{appCounter:s}=t;if(!s)throw new a(t,"未配置应用计数器!");return this.getCounter(s,e,i)}});an.counterMap=new Map;var sn=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},i={}){switch(t){case"wfstart":return this.wfStart(e,a,i);case"wfsubmit":return this.wfSubmit(e,a,i);case"reassign":return this.wfReassign(e,a,i);case"addstepbefore":return this.wfAddStepBefore(e,a,i);case"addstepafter":return this.wfAddStepAfter(e,a,i);case"sendback":return this.wfSendBack(e,a,i);case"sendcopy":return this.wfSendCopy(e,a,i);default:throw new o("「".concat(t,"」未实现"))}}}),nn=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Js(a,this.model),n="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}},on=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(on||{})),rn=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:ht(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=de(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const s=de(e.appDEFields||[],e.majorAppDEFieldId);if(s){const t=s.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:ct(this.srfkey)?J():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:a}=this,i={};Object.keys(e).forEach((t=>{i[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();i[s]={enumerable:!0,set(i){e[s]=a(i,t.stdDataType)},get:()=>e[s]},e[s]=a(e[s],t.stdDataType)})),Object.defineProperties(this,i)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return a=e instanceof t?e._data:e,Object.keys(a).forEach((t=>{void 0===a[t]&&delete a[t]})),Object.assign(this._data,a),this}convertVal(t,e){if(null==t)return t;if(ct(e))return t;if(l.isNumber(e)){const e=ct(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),cn=t("MethodDto",class{constructor(t,e,a,i){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.dtoMap=new Map,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,a)=>{e[a+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((a=>{const i=parseInt(a,10);e[i-1]=t[i]})),e}async get(t,e,s=!1){const n={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],d=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[d]&&(n[d]=0===e[d].length?null:this.convertArrayToListMap(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const i=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=i.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const a=ht(t);a[this.entity.codeName.toLowerCase()]=e.srfkey;const i={};h.parentAppDEFieldId&&(i[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,a,i)}else{if(r.entity.id===this.entity.id)throw new a(c,"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!");u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,a=[];for(let i=0;i<e.length;i++)a.push(await r.get(t,e[i],!0));n[d]=a}}break;default:throw new i(c,"未支持的应用实体方法输入属性类型: ".concat(c.type))}}return{...e,...n}}async sets(t,e){const a=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const i=this.fields.filter((t=>"DTOS"===t.type)).map((async i=>{const s=i.codeName.toLowerCase();if(i.listMap&&"object"==typeof e[s])e[s]=this.convertListMapToArray(e[s]);else{if(!i.refAppDataEntityId)return;const n=a.getDERConfig(i.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,i);n||o.service.local.clear();const r=e[s];if(r&&r.length>0){const a=e[this.entity.keyAppDEFieldId];i.refPickupAppDEFieldId&&r.forEach((t=>{t[i.refPickupAppDEFieldId]=a})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<i.length;t++)await i[t];const s=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,s),s})))}async calcRs(t,e=0){if(e>10)return;e+=1;const a=ibiz.uiDomainManager.get(t.srfsessionid),i=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<i.length;s++){const n=i[s];if(!n.refAppDataEntityId)continue;if(0===a.getDERConfig(n.refAppDataEntityId).length){const i=await this.getFieldDto(t,n);i.entity.minorAppDERSs&&a.setDERConfig(n.refAppDataEntityId,i.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await i.calcRs(t,e)}}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),i=de(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,a.id);s.isLocalMode=!0;const n=s.createMethodDto(i,{isLocalMode:!0});return this.dtoMap.set(e.codeName,n),n}}),dn=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Ys(e),this.configCache=new en(e.appId,"PSAppDataEntity",e.codeName),this.wf=new sn(e),this.file=new nn(e)}async getMethod(t,e=!1){const s=e?"ac-".concat(t):t;if(this.methodMap.has(s))return this.methodMap.get(s);const n=de(this.model.appDEMethods,t);if(!n)throw new a(this.model,"未找到服务方法: ".concat(t));const o=await Rs(n);if(!o)throw new i(n,"未支持的服务方法类型: ".concat(n.methodType));const r=o.create(this,this.model,n,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(s,r),r}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(e);return new Promise(((e,o)=>{s.net.sse("/".concat(n),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),onmessage:e=>{if(e.data){const a=JSON.parse(e.data);t(a)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},a={}){const i=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return i.net.post(s,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],i="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return Js(t,this.model)+i}newEntity(t){return t instanceof rn?t.clone():new rn(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new cn(this,this.model,null==e?void 0:e.isLocalMode,t)}}),ln=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],hn=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:ct(this.srfkey)?J():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a){const i=!a||a.isOriginField;ln.includes(t)||(i||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=ht(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),un=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,i){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,i)}handleResponse(t){return h(t)}toUIData(t){return new hn(t,this.dataUIMap)}}),pn=t("MDControlService",class extends un{async fetch(t,e={}){var a;const i=(null==(a=this.model.fetchControlAction)?void 0:a.appDEMethodId)||"fetchdefault";let s=await this.exec(i,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var a;const i=(null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var a;const i=(null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var a;const i=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(i,t,void 0,e)}async create(t,e){var a;const i=(null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,a={}){throw new o("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&(Z(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),mn=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,i);const s=fe(i,e);if(s){ibiz.log.debug("匹配主状态",s);const e=ge(s,i);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),fn=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new mn(e),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),gn=t("V7AuthService",class{get isAnonymous(){return"1"===tt(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error("未找到匿名登录配置用户名或密码"),!1;const a=await this.login(t,e);if(a){et(u.IS_ANONYMOUS,"1",0,!0);const t=tt(u.TOKEN),e=tt(u.TOKEN_EXPIRES),a=tt(u.TOKEN_REMEMBER),i=tt(u.REFRESH_TOKEN);et(u.TOKEN,t,0,!0),et(u.TOKEN_EXPIRES,e,0,!0),et(u.TOKEN_REMEMBER,a,0,!0),i&&et(u.REFRESH_TOKEN,i,0,!0)}return a}async login(t,e,a){try{const i=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:s}=i;if(s&&s.token){const t=a?7:0;a&&et(u.TOKEN_REMEMBER,"1",t,!0),et(u.TOKEN,s.token,t,!0);const e=(new Date).getTime()+1e3*(s.expirein||7199);et(u.TOKEN_EXPIRES,"".concat(e),t,!0),s.refresh_token&&et(u.REFRESH_TOKEN,s.refresh_token,t,!0),at(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),at(u.TOKEN),at(u.TOKEN_EXPIRES),at(u.TOKEN_REMEMBER),at(u.REFRESH_TOKEN),at(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0,!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=tt(u.TOKEN),e=tt(u.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const a=3e5;t=t>a?t-a:0,setTimeout((async()=>{const t=tt(u.TOKEN_REMEMBER),e=tt(u.REFRESH_TOKEN),a=t?7:0;let i;if(i=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),i.ok){et(u.TOKEN,i.data.token,a,!0);const t=(new Date).getTime()+1e3*(i.data.expirein||7199);et(u.TOKEN_EXPIRES,"".concat(t),a,!0),i.data.refresh_token&&et(u.REFRESH_TOKEN,i.data.refresh_token,a,!0),await this.loadAppData(),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}getAuthInfo(){const t=tt(u.TOKEN),e=!!tt(u.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}async loadAppData(){const t=await ibiz.net.get("/appdata");t.ok&&(ibiz.appData=t.data)}}),wn=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return ct(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),En=t("MethodInput",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodInput;if(s){const a=de(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),vn=t("MethodReturn",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodReturn;if(s){const a=de(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const a=ibiz.hub.getApp(this.entity.appId),i=ibiz.uiDomainManager.get(t.srfsessionid);i&&!0!==i.state.rsInit&&(await this.dto.calcRs(t),i.calcParentRs(),i.state.rsInit=!0),a.deService.clearTempCacheByRs({srfappid:a.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return q(e)&&(e={}),new rn(this.entity,e)}}),yn=t("Method",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i,this.app=ibiz.hub.getApp(e.appId),this.input=new En(t,e,a),this.result=new vn(t,e,a)}async request(t,e,i,s){const{actionType:n,requestMethod:o}=this.method;if("REMOTE"===n){const e=this.method.codeName.toLowerCase();let n=null;switch(o){case"POST":n=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":n=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":n=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":n=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,o?"未支持的请求方式: ".concat(o):"未配置请求方式")}return n}throw new a(this.method,"未支持的行为类型[".concat(n,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Js(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),In=class{constructor(t,e,a,i){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:R(a)?a:[a],params:i}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},Dn=class{},Cn=class extends Dn{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return We(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return We(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return We(n[this.dstField],this.op,this.value)}}},An=class t extends Dn{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Cn(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},bn=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new An(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},Pn=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new bn(t)))}},Tn=class extends Pn{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},xn=class extends Pn{async exec(t){}},Nn=class extends Pn{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function Sn(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:n,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[a],t.isEntityParam(a)&&(d=null==d?void 0:d.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=ht(ibiz.env);break;case"EXPRESSION":if(!o)throw new i(e,"表达式为空");c=Xe.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new i(e,"暂未支持源值类型".concat(r))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:Xe.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(d,"报错,源参数:"),c),t}return c}var Ln=class extends Pn{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new i(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,i=Sn(e,t);e.params[a]=ht(i)}bindParam(t,e){const a=Sn(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:i}=t;let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=Sn(e,t);s?e.params[i][s]=n:e.params[i]=n}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=Sn(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Rn=class extends Pn{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,n=t.params[i],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(a,e,t.context,n);r.ok&&(t.params[s]=r.data)}},Mn=class extends Pn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Sn(t,this.model);t.params[e]=s}},On=class extends Pn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},_n=class extends Pn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Vn=class extends Pn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Sn(t,this.model);t.params[e]=ht(s)}},Fn=class extends Pn{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},kn=class extends Pn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Sn(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},Wn=class extends Pn{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},Un=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=ht(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=ht(t.data||{});else{if(a.envParam)throw new i(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new i(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new i(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new i(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new i(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new i(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new i(a,"未支持的逻辑参数类型: 操作会话变量")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},zn=class{constructor(t){var e,s;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new a(t,"脚本代码模式没有配置脚本代码");this.scriptFn=Xe.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new xn(t);break;case"END":a=new Nn(t);break;case"DEACTION":a=new Tn(t);break;case"PREPAREPARAM":a=new Ln(t);break;case"DEDATASET":a=new Rn(t);break;case"THROWEXCEPTION":a=new Wn(t);break;case"BINDPARAM":a=new Mn(t);break;case"RESETPARAM":a=new On(t);break;case"COPYPARAM":a=new Vn(t);break;case"RENEWPARAM":a=new _n(t);break;case"APPENDPARAM":a=new kn(t);break;case"SORTPARAM":a=new Fn(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new Un(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,i){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:i});const s=new In(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(n);await this.deepExec(t,s)}return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Bn=new Map;async function Gn(t,e,a={},i={}){Bn.has(t)||Bn.set(t,new zn(t));return Bn.get(t).exec(e,a,i)}async function jn(t,e,a,i,s){const n=await async function(t,e,a){return ve(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!n)throw new o("".concat(e,"找不到实体逻辑").concat(t));return Gn(n,a,i,s)}async function Kn(t,e,a,i){const n=ht(e),o=a?ht(a):a,r=i?ht(i):i;try{const e=await Gn(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function Xn(t,e,a,i,s){const n=ye(t,e);if(n.length){(await Promise.all(n.map((t=>Gn(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function Hn(t,e,a,i,s={}){if(i){if(!R(i))return Xn(t,e,a,i,s);await Promise.all(i.map((i=>Xn(t,e,a,i,s))))}}var Yn=t("DEActionMethod",class extends yn{async inputHandle(t,e){return R(e)?e:this.input.handle(t,e)}async exec(t,e,i){let s;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await Hn(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const n=ve(this.method.appDELogicId,this.entity);if(!n)throw new a(this.method,"缺少实体处理逻辑");s=await Kn(n,t,e,i)}else switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),this.method.codeName){case"Create":s=await this.create(t,e,i||{});break;case"Get":s=await this.get(t,i);break;case"GetDraft":s=await this.getDraft(t,i);break;case"Remove":s=await this.remove(t,i);break;case"Update":s=await this.update(t,e,i);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,i);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);if(this.method.needResourceKey){let i=t[this.entity.codeName.toLowerCase()];O(i)&&(i=R(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),a="".concat(a,"/").concat(i)}const n=await this.request(a,t,e,i);n.data=await this.result.handle(t,n.data),s=n}}return s.data&&await Hn(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new o("create行为没有传data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.post(i,e,a);return s.data=await this.result.handle(t,s.data),s}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new o("update行为没有传data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.put("".concat(i,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return s.data=await this.result.handle(t,s.data),s}async get(t,e={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e);return i.data=await this.result.handle(t,i.data),i}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/getdraft"),e);return i.data=await this.result.handle(t,i.data),i}async createTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,a)),new p(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new p(t):new p(t,500)}catch(t){return new p(t,500)}}async removeTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(a,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const i=this.service.local.delete(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,i){const s=ibiz.uiDomainManager.get(e.srfsessionid),n=s.transaction;let o=!1;!1===n.state.isOpen&&(n.open(),o=!0);try{let i=s.getDERConfigByMajor(this.entity.id);if(i.length>0){const s=this.service.local.get(e,t);i=it(i,"removeOrder");for(const n of i){if("DER1N"!==n.rstype)throw new a(n,"目前只支持[DER1N]关系类型关联删除删除");const{removeActionType:i,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=n,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=ht(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(i){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const a=await l.remove(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 2:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey,e[n.parentAppDEFieldId.toLowerCase()]=void 0;const a=await l.updateTemp(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e="无法删除[".concat(this.entity.logicName,"-").concat(s.srfmajortext,"], 数据被[").concat(l.model.logicName,"-").concat(t,"]引用");throw new Error(o||e)}}}}o&&n.state.isOpen&&n.commit()}catch(t){throw o&&n.state.isOpen&&n.rollback(),t}finally{o&&n.state.isOpen&&n.close()}}async updateTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,a)),i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=this.service.local.get(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new p(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{if(a.parentAppDEFieldId){const{majorAppDataEntityId:i,parentAppDEFieldId:s}=a,n=we(i),o=s.toLowerCase(),r=t[n];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),qn=class{create(t,e,a,i){return new Yn(t,e,a,i.localMode)}},Qn=t("FetchMethod",class extends yn{async exec(t,e,a){const s=e&&!R(e)?e:a||{};let n;if(this.isLocalMode){const e=js.getCond(this.method),a=new $s(t,s),i=await this.searchLocal(e,a);n=new p(i,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":n=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);n=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const o=n.data||[];n.data=o.map((t=>this.createEntity(t)))}return n.data&&await Hn(this.entity,"compute",t,n.data,s),n}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=this.service.local.getList();t?i.length>0&&(i=i.filter((a=>t.test(a,e)))):i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const i=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const s=t[a[e]];if(i.test(s))return!0}return!1}))),ct(e.sortField)||lt(e.sortField)||(i="DESC"===e.sortMode?st(i,e.sortField):it(i,e.sortField));const{page:s,size:n}=e,o=s*n,r=(s+1)*n-1;return i.slice(o,r).map((t=>ht(t)))}async fetchCodeListSet(t,e){const{appCodeListId:i}=this.method;if(!i)throw new a(this.method,"没有指定数据来源代码表");const s=await this.app.codeList.get(i,t,e),{keyAppDEFieldId:n,majorAppDEFieldId:o}=this.entity,r=s.map((t=>({[n]:t.value,[o]:t.text})));return new p(r,200)}}),Jn=t("AcFetchMethod",class extends Qn{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),$n=class{create(t,e,a,i){return i.acMode?new Jn(t,e,a,i.localMode):new Qn(t,e,a,i.localMode)}};function Zn(){const t=new qn;Ss("DEACTION",(()=>t));const e=new $n;Ss("FETCH",(()=>e)),Ss("FETCHTEMP",(()=>e))}var to=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"update_time,desc"};Object.assign(e,t);const a=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),e);return a.headers&&(a.headers["x-page"]&&(a.page=Number(a.headers["x-page"])),a.headers["x-per-page"]&&(a.size=Number(a.headers["x-per-page"])),a.headers["x-total"]&&(a.total=Number(a.headers["x-total"]))),ct(a.data)&&(a.data=[]),a}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}}),eo=t("MarkOpenDataService",class{constructor(){this.baseUrl="/portal/markopendata"}async action(t,e,a){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(a))}}),ao=t("TreeNodeData",class{constructor(t,e,a){this._uuid=J(),this._leaf=!1,this._leaf=!0===a.leaf,this._parent=e,this._nodeType=t.treeNodeType,this._parent&&(this._context={...this._parent._context}),a.navContext&&(this._context=Object.assign(this._context||{},a.navContext)),a.navParams&&(this._params={...a.navParams}),this._nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath),e.rawContent&&(a.htmlStr=e.rawContent)),Object.values(a).length>0?a:void 0}}),io=t("TreeCodeListNodeData",class extends ao{constructor(t,e,a){super(t,e,a);const{data:i}=a;this._text=i.text,this._value=i.value;const s="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(s):s},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=we(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),so=["_id","_value","_text","_deData","clone"],no=t("TreeDataSetNodeData",class t extends ao{constructor(e,a,i){var s,n;super(e,a,i);const{data:o}=i;this._deData=o;const r="".concat(e.id,"@").concat(o.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(r):r},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_text",{get(){return e.textAppDEFieldId?this._deData[e.textAppDEFieldId]:this._deData.srfmajortext},set(t){e.textAppDEFieldId?this._deData[e.textAppDEFieldId]=t:this._deData.srfmajortext=t},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_value",{get(){return e.idAppDEFieldId?this._deData[e.idAppDEFieldId]:this._deData.srfkey},set(t){e.idAppDEFieldId?this._deData[e.idAppDEFieldId]=t:this._deData.srfkey=t},enumerable:!0,configurable:!0}),e.appDataEntityId){const t=we(e.appDataEntityId);this._context=Object.assign(this._context||{},{[t]:o.srfkey})}this._icon=this.calcIcon(e),this._textHtml=this.calcTextHtml(e),e.leafFlagAppDEFieldId&&(this._leaf=Zs(o[e.leafFlagAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();c.set(e,a),t.defaultValue&&d.set(e,t.defaultValue)}));const l=new Map;null==(n=e.detreeNodeColumns)||n.forEach((t=>{if("DEFGRIDCOLUMN"!==t.columnType)return;const e=t.detreeColumnId,a=t.dataItemName;e&&a?l.set(e,a):ibiz.log.error("模型异常缺少detreeColumnId或者dataItemName",t)}));const h=new Map;h.set("srfuf","srfuf");const u=t=>l.has(t)?c.get(l.get(t)):c.has(t)?c.get(t):Object.prototype.hasOwnProperty.call(this._deData,t)?t:h.has(t)?h.get(t):void 0;return this.clone=()=>{const a=ht(this._deData),i=new t(e,this._parent,{data:a,leaf:this._leaf,navContext:this._context,navParams:this._params});return Object.keys(this).forEach((t=>{const e=u(t);ct(e)&&!so.includes(t)&&(i[t]=this[t])})),i},new Proxy(this,{set(t,e,a){const i=u(e);return ct(i)?t[e]=a:t._deData[i]=a,!0},get(t,e,a){const i=u(e);return ct(i)?t[e]:ct(t._deData[i])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[i];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return m(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:i}=t;a&&this._deData[a]&&(e.imagePath=this._deData[a]),e&&(this._icon=e);const s=null==i?void 0:i.find((t=>"icon"===t.id));return s&&(e.htmlStr=this.calcDataItemScript(s)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return Xe.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,i=null==a?void 0:a.find((t=>"text"===t.id));return i&&(e=this.calcDataItemScript(i)),e}}),oo=t("TreeStaticNodeData",class extends ao{constructor(t,e,a){var i,s;super(t,e,a);const n="root"===t.nodeValue?void 0:t.nodeValue,o="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(o):o},enumerable:!0,configurable:!0}),this._text=t.text,this._value=n,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=n||(null==t?void 0:t._value)}this.srfkey=(null==(i=this._deData)?void 0:i.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),ro=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,ct(a.isOriginField)||(this.isOriginField=a.isOriginField),ct(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=ct(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),co=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var lo=["REGION","REGION2","REGION3","REGION4"],ho=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:i,longitudeAppDEFieldId:s,latitudeAppDEFieldId:n,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,lo.includes(this._itemStyle)?s&&l.set("_areaCode",s):(s&&l.set("_longitude",s),n&&l.set("_latitude",n)),c&&l.set("_tooltip",c),o&&l.set("_text",o),r&&l.set("_value",r),d&&(this._symbol=d.rawContent||d.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:l.has(a)?t[l.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:l.has(a)?t[l.get(a)]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}});var uo=t("PanelData",class{constructor(t,e){const a=new $,i={},s={};return t.forEach((t=>{var e;i[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(s[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,n,o)=>(Object.prototype.hasOwnProperty.call(i,n)?i[n]?e[i[n]]=o:t[n]=o:e[n]=o,a.emit("change",n),i[n]&&i[n]!==n&&a.emit("change",i[n]),s[n]&&s[n]!==n&&a.emit("change",s[n]),!0),get:(t,s,n)=>"_evt"===s?a:i[s]?e[i[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const a=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,a),a}})}destroy(){this._evt.reset()}});var po=t("ChartData",class{constructor(t,e,a,i){return this._seriesModelId=null==e?void 0:e.id,this._catalog=a,this._groupName=i,this._uuid=J(),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}}),mo=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},fo=t("GanttStaticNodeData",class extends oo{constructor(t,e,a,i){super(e,a,i),this._snDataItemValue=mo(t.sndataItemName,e),this._beginDataItemValue=mo(t.beginDataItemName,e),this._endDataItemValue=mo(t.endDataItemName,e),this._prevDataItemValue=mo(t.prevDataItemName,e),this._finishDataItemValue=mo(t.finishDataItemName,e),this._totalDataItemValue=mo(t.totalDataItemName,e)}}),go=t("GanttDataSetNodeData",class extends no{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=mo(t.sndataItemName,e,s),this._beginDataItemValue=mo(t.beginDataItemName,e,s),this._endDataItemValue=mo(t.endDataItemName,e,s),this._prevDataItemValue=mo(t.prevDataItemName,e,s),this._finishDataItemValue=mo(t.finishDataItemName,e,s),this._totalDataItemValue=mo(t.totalDataItemName,e,s)}}),wo=t("GanttCodeListNodeData",class extends io{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=mo(t.sndataItemName,e,s),this._beginDataItemValue=mo(t.beginDataItemName,e,s),this._endDataItemValue=mo(t.endDataItemName,e,s),this._prevDataItemValue=mo(t.prevDataItemName,e,s),this._finishDataItemValue=mo(t.finishDataItemName,e,s),this._totalDataItemValue=mo(t.totalDataItemName,e,s)}}),Eo=t("MqttService",class{constructor(t,e,a){this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new $,this.options={connectTimeout:6e3,clientId:J(),username:"",password:"",keepalive:60,clean:!0},this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),a=t.default?t.default:t,{location:i}=window;this.client=a.connect("ws://".concat(i.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.warn("mqtt reconnect")})),this.client.on("close",(()=>{ibiz.log.warn("mqtt close")}))}close(){var t;null==(t=this.client)||t.end(),this.evt.reset()}}),vo=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,a){const i=e.srfsessionid||"applocation";this.cache.has(i)||this.cache.set(i,new Map);const s=this.cache.get(i);if(!s.has(a)){const e=await ibiz.hub.getAppDataEntity(a,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(a,"]"));const n=t.constructorCache.get(a.toUpperCase());let r;r=n?await n(i,e):new dn(i,e),s.set(a,r)}return s.get(a)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}clearTempCacheByRs(t,e,a=[]){if(!0===a.includes(e))return;a.push(e);const i=t.srfsessionid;if(!this.cache.has(i))return;const s=this.cache.get(i).get(e);s&&s.local.clear();const n=ibiz.uiDomainManager.get(t.srfsessionid);if(n){n.getDERConfigByMajor(e).forEach((e=>{this.clearTempCacheByRs(t,e.minorAppDataEntityId,a)}))}}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};vo.constructorCache=new Map;var yo=t("DEServiceUtil",vo),Io=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=ht(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new o("应用视图[".concat(t,"]不存在"));if((n.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=we(r.appDataEntityId);n.srfkey&&(n[t]=n.srfkey,n.srfkey=void 0),0===a.srfuf&&(n[t]=void 0,delete a.srfuf)}if(r.redirectView){return Ve(await ibiz.hub.getAppView(t),n,a,s)}const{openMode:c="INDEXVIEWTAB"}=r,d=s.openMode||c;switch(void 0!==d&&"INDEXVIEWTAB"!==d&&n.toRouteDepth&&(n.toRouteDepth=void 0),d){case"INDEXVIEWTAB":case"INDEXVIEWTAB_POPUP":return s.noWaitRoute?(this.openIndexViewTab(r,n,a),{ok:!0}):this.openIndexViewTab(r,n,a);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,n,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,n,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,n,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,n,a);case"USER":return this.openUserCustom(r,n,a);default:return this.openIndexViewTab(r,n,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}openIndexViewTabByModal(t,e,a={}){return ibiz.openView.rootByModal(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,e,a,i={}){if(!e)throw new o("气泡打开缺少event");return ibiz.openView.popover(t.id,e,a,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};Io.TAG="ibiz.app-view.open";var Do=t("OpenAppViewCommand",Io),Co=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!n)throw new o("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:d}=n,l=e.clone();Object.assign(l,se(r,a,e));const h=se(c,a,e);switch(d){case"APPVIEW":return this.openAppView(n,l,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(n);case"PDTAPPFUNC":return this.openPdAppFunc(n,l,h);case"JAVASCRIPT":return this.executeJavaScript(n,l,h);case"CUSTOM":return this.custom(n,l,h);default:throw new i(n,"未支持的应用功能类型: ".concat(d))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new o("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(Do.TAG,t.appViewId,e,a,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,a){throw ibiz.log.warn("openPdAppFunc",t,e,a),new o("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new o("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new o("未实现")}};Co.TAG="ibiz.app-func.exec";var Ao=t("AppFuncCommand",Co);function bo(){new Ao,new Do}var Po=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new en(t.appId,"PSSysApp",t.codeName),this.deService=new yo(t),this.codeList=new tn(t),this.authority=new fn(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),await this.initMqtt()}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,i;let s=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!s&&e){s=null==(i=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:i.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}async initMqtt(){this.mqtt&&this.mqtt.close(),ibiz.env.enableMqtt&&ibiz.appData&&ibiz.appData.mqtttopic&&!0!==ibiz.auth.isAnonymous&&(this.mqtt=new Eo(ibiz.appData.mqtttopic,g(),this.model.appId),this.mqtt.evt.on("message",(t=>{console.log("message",t),ibiz.mc.command.next(t)})),await this.mqtt.connect())}}),To=class{parse(t){return t}},xo=class{constructor(){this.appMenu=new To}},No=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const a=this.calcAppViewId(t);this.viewConfigs.set(a,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new o("视图[".concat(e,"]不存在"));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},So=class{constructor(){this.view=new No}},Lo=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Lo||{})),Ro=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ro||{})),Mo=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Mo||{})),Oo=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t))(Oo||{})),_o=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new o("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Vo=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new _o(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),Fo=t("CTXState",class{}),ko=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new $(3e3),this.controllersMap=new Map,this.state=new Fo}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),Wo=t("ActivityCounter",class extends _o{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),Uo=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await De(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:i,uiactionMode:s,uiactionTag:n}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0,"SINGLEKEY"!==i&&"MULTIKEY"!==i||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),zo=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),Bo=t("QXEventEx",class extends ${constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((a=>{a(t,...e)}))}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),i=this.anyEventFns.map((a=>a(t,...e))),s=Promise.all(i),n=await a,o=await s;return n.concat(...o)}reset(){super.reset(),nt(this.anyEventFns)}}),Go=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new Bo}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function jo(t){return window.location.hash.split("/").length>2*t+2}function Ko(t,e){return(!ct(t)&&""!==t||!ct(e)&&""!==e)&&t!==e}function Xo(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof hn&&(e=e.getOrigin()),e}function Ho(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,n=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&n)"REG"===n.ruleType?i.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):"SCRIPT"===n.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{Xe.execScriptFn({rule:t,value:e,callback:a,source:i},n.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=a||e;i.push({validator:(e,a,i,s)=>{if(q(s[t]))return!0;const{isPast:n,infoMessage:c}=He(t,s,r.groupCond);return n||i(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function Yo(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:n}=t;return a&&e.push({validator:(t,e,i)=>{if(ct(e)||!(e.length>a))return!0;i(new Error("内容长度必须小于等于".concat(a,",当前长度为").concat(e.length)))}}),i&&e.push({validator:(t,e,a)=>{if(ct(e)||!(e.length<i))return!0;a(new Error("内容长度必须大于等于".concat(i,",当前长度为").concat(e.length)))}}),ct(s)||e.push({validator:(t,e,a)=>{if(!(!ct(e)&&ot(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),ct(n)||e.push({validator:(t,e,a)=>{if(!(!ct(e)&&ot(e)&&e<n))return!0;a(new Error("值必须大于等于".concat(n)))}}),e}var qo=t("ValueExUtil",class{static mergeDefault(t){return mt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(ct(e)||""===e)return"";const{valueType:a,objectNameField:i,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!i)throw new o("缺少objectNameField");const t=i.toLowerCase();return"OBJECTS"===a?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===a?e.join(s):"".concat(e)}});function Qo(t,e){var a;const{name:s,valueType:n,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(ct(n)&&ct(r))return;if("RESET"===n)return null;const u=d[s];if(!ft(u)){if(!n&&r)return r;switch(n){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(l,r))return l[r];break;case"OPERATORNAME":return l.srfusername;case"OPERATOR":return l.srfuserid;case"CURTIME":return wt().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new o("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return J();default:throw new i({},"默认值类型[".concat(n,"]未支持"))}}}var Jo="asyncimportdata2",$o="importdata2";async function Zo(t,e,a){if(!ibiz.util.getExcelUtil)throw new o("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new o("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function tr(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid);let s="/jsonschema/".concat(i.name);0===i.dynaSysMode&&ibiz.appData&&(s+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await a.net.get(s)).data}var er="__self",ar=t("BaseController",class{constructor(t,e,a,i){this.model=t,this.context=e,this.params=a,this.ctx=i,this.id=J(),this.state={},this.name="",this.evt=new Go(this.getEventArgs.bind(this)),this.mountCounter=new Wo(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(er),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(t=>{this.childNames.includes(t)&&this.mountCounter.enroll(t)})),this.ctx.evt.on("onRegister",((t,e)=>{this.childNames.includes(t)&&e.evt.on("onMounted",(()=>{this.mountCounter.attend(t)}))}))}async mountSelf(){this.mountCounter.registration.get(er)||this.mountCounter.attend(er)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),ir=class t{constructor(t){this.msgGroupId=t,this.viewMsgMap=new Map}async init(t){var e,a;const i=ibiz.hub.getApp(t.srfappid).model,s=null==(e=i.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new o("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const n=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=n.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),n.splice(e,1))})),n.length)throw new o("没有找到".concat(n.join(","),"视图消息模型"))}getDeFieldName(t,e){var a,i;if(e)return null==(i=null==(a=Ie(t,e))?void 0:a.name)?void 0:i.toLowerCase()}static async fetchDataSet(t,e,i){const{appDataEntityId:s,appDEDataSetId:n}=t;if(!n)throw new a(t,"未配置实体数据集");const o=await ibiz.hub.getApp(e.srfappid).deService.exec(s,n,e,i);return o.data.length?o.data:[]}async calcViewMessages(t,e){const a=this.msgGroup.appViewMsgGroupDetails,i=[];return(null==a?void 0:a.length)&&await Promise.all(a.map((async a=>{if(1===this.viewMsgMap.get(a.appViewMsgId).dynamicMode){const s=await this.calcDynaMsgs(a,t,e);i.push(...s)}else{const t=this.calcStaticMsg(a);i.push(t)}}))),i}calcStaticMsg(t){const{position:e}=t,a=this.viewMsgMap.get(t.appViewMsgId),{title:i,message:s,removeMode:n,position:o,messageType:r}=a,{userTag:c,userTag2:d,userTag3:l,userTag4:h}=a;return{title:i,message:s,position:e||o,messageType:r,removeMode:n,extraParams:{userTag:c,userTag2:d,userTag3:l,userTag4:h}}}async calcDynaMsgs(e,i,s){const n=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u}=n;if(!o)throw new a(n,"未配置应用实体");const p=await ibiz.hub.getAppDataEntity(o,i.srfappid),m={...s},f=this.getDeFieldName(p,r);f&&(m.sort="".concat(f,",asc"));const g=await t.fetchDataSet(n,i,m);if(!g.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(p,c),v=this.getDeFieldName(p,u),y=this.getDeFieldName(p,h),I=this.getDeFieldName(p,l),D=this.getDeFieldName(p,d);return g.map((t=>{const e={};return v&&!ct(t[v])&&(e.position=t[v]),E&&!ct(t[E])&&(e.title=t[E]),y&&!ct(t[y])&&(e.message=t[y]),I&&!ct(t[I])&&(e.messageType=t[I]),D&&!ct(t[D])&&(e.removeMode=t[D]),dt(w,e)}))}},sr=t("ViewController",class extends ar{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),d.create({},e),a||{},new ko(i)),this.session={},this.modal=new ha({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Vo,this.isCloseView=!1,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=Le(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn("未找到视图引擎实现:",t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await an.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{ft(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await Qi(t);this.providers[t.name]=e;const a=Ne(this.model);a&&await Promise.all(a.map((async t=>{const e=await Qi(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const i=Se(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){const t=this.context.srfsessionid;await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),Object.values(this.counters).forEach((t=>t.destroy())),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===t&&ibiz.uiDomainManager.destroy(t),this.context.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){if(this.context.srfappid=this.model.appId,ct(this.context.srfsessionid)||lt(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}const t=this.model.appViewNavContexts;let e={};Y(t)&&(e=se(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let i={};Y(a)&&(i=se(a,this.params,this.context)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const i of this.engines)if(a=await i.call(t,e),void 0!==a)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(void 0===a)throw new o("没有引擎支持预置界面行为".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new ir(t),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){const[e,...a]=t,i={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(i,{confirmButtonText:e.extraParams.userTag}),"WARN"===e.messageType?await ibiz.modal.warning(i):"ERROR"===e.messageType?await ibiz.modal.error(i):await ibiz.modal.info(i),a.length&&this.alertViewMessage(a)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}}),nr=(t("MobViewController",class extends sr{}),t("WFStepTraceViewController",class extends sr{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),a=null==(t=this.ctx.parent)?void 0:t.view;if(a&&a.model.appDataEntityId){const t=await e.deService.getService(a.context,a.model.appDataEntityId),i=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(i);s.data&&(this.state.historyData=s.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}get valueFormat(){return this.parent.valueFormat}get dataType(){return this.parent.dataType}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let n={};i&&t&&(n=se(i,t,a,e));const o=Object.assign(e.clone(),n);let r={};return s&&t&&(r=se(s,t,a,e)),{context:o,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return qo.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),or=(t("CodeListEditorController",class extends nr{async loadCodeList(t){const{context:e,params:i}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,i),a}throw new a(this.model,"编辑器类型[".concat(this.model.editorType,"],未配置代码表"))}}),t("ControlController",class extends ar{constructor(t,e,a,i){if(super(t,d.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=ue(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=ht(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await Qi(this.controlPanel);this.providers[this.controlPanel.name]=t}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)}))}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let i={};Y(e)&&(i=se(e,this.params,this.context)),Object.assign(this.context,i);let s={};Y(a)&&(s=se(a,this.params,this.context)),Object.assign(this.params,s)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let i=this.getData()||[];return(null==t?void 0:t.data)&&(i=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(a,t.viewParam),{context:e,params:a,data:i}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};Y(t)&&(e=se(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:i}=this.model,s=null==(a=null==i?void 0:i.ctrlMsgItems)?void 0:a.find((e=>e.name===t));let o,r;if(s&&s.content){r=ct(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),o=Xe.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();o=ibiz.i18n.t(e,""),o===e&&(o="")}if(!o&&(null==e?void 0:e.default)&&(o=e.default),!o&&(null==e?void 0:e.error)&&(o=o||e.error.message),o){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new n(o,r);ibiz.message.success(o,r,0===r)}}})),rr=t("MDControlController",class extends or{constructor(){super(...arguments),this.commandDataChange=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)}));const e=this.onDataChange.bind(this);this.onDataChange=_((t=>{e(t)}),300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&(this.state.activated?this.refresh():this.commandDataChange=!0)}onActivated(){super.onActivated(),this.commandDataChange&&(this.refresh(),this.commandDataChange=!1)}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const a=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(a.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};return a&&(n.page=e-1,n.size=a),!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),n=await this.service.fetch(i,s);"number"==typeof n.total&&(this.state.total=n.total),a?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new o("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{const n=we(this.model.appDataEntityId);await ya(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[n]=t.srfkey,await this.service.remove(i,a),s=!0}this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:i,default:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:i}),t}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,a;const{selectedData:i}=this.state;v(i,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const s=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,i=await ibiz.hub.getAppDataEntity(e,this.model.appId),s=null==(t=i.appDEDataImports)?void 0:t.find((t=>t.id===a));if(!s)throw new o("无导入模型!");let n="DataImport";s.enableCustomized&&(n="DataImport2");const r=ibiz.overlay.createModal(n,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),cr=t("AppMenuController",class extends or{constructor(t,e,a,i){super(t,e,a,i),this.itemProviders={},this.flattenAllItems()}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await ks(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new o("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const n=this.itemProviders[t];if(n&&n.onClick)return n.onClick(s,e,this);if(!s.appFuncId)throw new a(s,"没有配置应用功能");const r=this.context.clone();r.srfappid=s.appId,this.routeDepth&&i&&Object.assign(r,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(Ao.TAG,s.appFuncId,r,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let i=!0;t.accessKey&&(i=this.app.authority.calcByResCode(t.accessKey));let s=i;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}a.permitted=i,a.visible=s}return this.state.menuItemsState[t.id]=a,a}flattenAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var a;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(a=e.appMenuItems)?void 0:a.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),dr=(t("AppMenuIconViewController",class extends cr{async onClickMenuItem(t,e){const i=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new o("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!i.appFuncId)throw new a(i,"没有配置应用功能");const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(Ao.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends pn{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const i=a.map((async a=>{const i=a.appDEDataSetId||"fetchdefault",s=t.clone(),n=ht(e);return a.maxSize&&(n.size=a.maxSize),this.exec2(i,s,n,void 0,a.appDataEntityId)}));return(await Promise.all(i)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new o("未找到日历项模型");const i=a[e];if(!i)throw new o("未找到日历项模型");return t.map((t=>new co(i,t)))}async exec2(t,e,a={},i={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,a,i)}}));t("CalendarController",class extends rr{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new dr(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(a,i)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.state.isLoaded=!0,this.state.items=s,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),s}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const a=t.beginTime,i=e.beginTime;let s=0;return wt(a).isAfter(i)?s=-1:wt(a).isBefore(i)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:i}=t;if(!a||!i){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:wt(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:wt(a).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:i}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};if(!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),a&&(n.page=e-1,n.size=a),t&&Object.assign(n,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(n);Object.assign(n,t)}return n}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});wt.extend(Dt),wt.extend(At),wt.extend(Pt),wt.extend(xt),wt.extend(St);var lr="$default_group",hr=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:i,caption:s,id:n,userParam:o}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=i||{};this.xAxisIndex=N(r),this.yAxisIndex=N(c),this.seriesName=s||n,this.staticOptions=this.calcStaticOptions(),o&&(this.seriesUserParam=vr(o))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(ct(e))return;if(ct(t))return e;const i=this.chartGenerator.codeListMap.get(t);if(null==i?void 0:i.length){const t=i.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}prepareChartData(t,e,a,i){var s;this.groupField&&Object.assign(e,{[this.groupField]:i}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const n=new po(e,this.model,a,i);t[i].get(a).chartData=n,null==(s=this.chartDataArr)||s.push(n)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=lr;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(ct(e))return;s=e}if(!e[s]&&(e[s]=new Map,i&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(i).forEach((t=>{e[s].set(t.text,{value:0})}))}const n=this.translateVal(i,t[this.catalogField],!0);if(n)e[s].get(n)||e[s].set(n,{value:0}),e[s].get(n).value=x(e[s].get(n).value,t[this.valueField]),e[s].get(n).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(n).value},n,s):this.prepareChartData(e,t,n,s);else if(i&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(i).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,s)}))}})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const a=t[e],i=this.calcSeriesData(a);let s={...this.staticOptions,data:i};return e!==lr&&(s.name=e),this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push([a,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,i;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[lr].get(t.name))?void 0:e.chartData:null==(i=null==(a=this.groupData)?void 0:a[t.seriesName].get(t.name))?void 0:i.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(ht(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=wt(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(wt(t[this.catalogField]).format("YYYY"),"-").concat(wt(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(wt(t[this.catalogField]).format("YYYY"),"-").concat(wt(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const i=t[a];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(i.keys()).sort(((t,e)=>wt(t).diff(wt(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,n]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(n,10)})));const n=new Map;s.forEach((t=>{n.set(t,i.get(t))})),t[a]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(wt(e))}))}));const i=wt.max(a),s=wt.min(a);if("DAY"===e){let e=s;const a=i;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const a=i.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const a=i.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++)for(let a=1;a<=4;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++){const a=wt("".concat(e,"-12-31")).isoWeek();for(let i=1;i<=a;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},ur=class extends hr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:i}=this.model;return i&&(t.step="middle"),t}},pr=class extends hr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},mr=class extends hr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},fr=class extends hr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},gr=class extends hr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},wr=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},Er=class extends hr{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new wr(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),i=Object.keys(e).map((t=>{const i=e[t],s=a.indicatorKeys.map((t=>i.has(t)?i.get(t).value:0));return{name:t===lr?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}};function vr(t){const e={};return t&&Object.keys(t).forEach((a=>{const i=a.indexOf(".");if(-1===i)return;const s=a.slice(i+1);if(s)try{e[s]=JSON.parse(t[a])}catch(i){e[s]=t[a]}})),e}var yr=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:i,chartYAxises:s,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==i?void 0:i.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(i)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),n&&(this.chartUserParam=vr(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new ur(t,this);break;case"bar":e=new pr(t,this);break;case"scatter":e=new gr(t,this);break;case"pie":e=new fr(t,this);break;case"funnel":e=new mr(t,this);break;case"radar":e=new Er(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:i,titlePos:s}=t,n={show:e,text:a,subtext:i,left:"center"},o=null==s?void 0:s.toLowerCase();return"left"===o||"right"===o?n.left=o:"bottom"!==o&&"top"!==o||(n.top=o),n}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,i={};i.show=e;const s=null==a?void 0:a.toLowerCase();return"left"===s||"right"===s?(i.left=s,i.top="middle",i.orient="vertical"):"bottom"===s&&(i.top=s),i}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:i,userParam:s}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===i?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===i&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===i?45:0}};s&&(n=gt(n,vr(s))),e.push(n)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const i=ibiz.hub.getApp(t.srfappid),s=async a=>{if(!a||this.codeListMap.has(a))return;const s=await i.codeList.get(a,t,e);this.codeListMap.set(a,s)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await s(e),await s(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const i=e.length,s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const n=e.length-1;for(let t=i;t<=n;t++)this.seriesGeneratorIndexMap.set(t,a)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=gt(this.staticOptions,this.options),this.chartUserParam&&(this.options=gt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},Ir=t("ChartService",class extends pn{}),Dr=(t("ChartController",class extends rr{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Ir(this.model),await this.service.init(this.context),this.generator=new yr(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new o("chart对象没有正确初始化");if(!this.options)throw new o("options还没计算");this.chart.setOption(this.options,{notMerge:!0}),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends or{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):"")}))}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),Cr=class{};function Ar(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(o){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=ht(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(o))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:Xe.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(r,"报错,源参数:"),c),t}return c}var br=class extends Cr{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=Ar(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return We(n,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=Ar(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return We(n,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return We(n,this.op,this.value)}}},Pr=class t extends Cr{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new br(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},Tr=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===(e||0)&&a&&(this.groupCond=new Pr(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(e))}}},xr=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new Tr(t)))}},Nr=class extends xr{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},Sr=class extends xr{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:n}=t;if(!e)throw new a(this.model,"未配置界面行为");let o=[s];if(i){const e=t.params[i];o=e instanceof Array?e:[e]}await Zr.execAndResolved(e,{...n,context:t.context,params:t.viewParam,data:o},this.model.appId)}},Lr=class extends xr{async exec(t){}},Rr=class extends xr{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}},Mr=class extends xr{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new i(a,"暂未支持逻辑处理参数操作".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:i}=t;if(!i)throw new o("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=Ar(e,t);if(s)try{Xe.execScriptFn({srcVal:n,dstParam:e.params[i]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error("给目标参数属性".concat(a,"赋值报错,目标参数:"),e.params[i]),t}else e.params[i]=n}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=Ar(e,t);e.params[a]=ht(i)}bindParam(t,e){const a=Ar(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=Ar(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i;e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Or=class extends xr{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:i,invokeParamId:s}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!s)throw new a(this.model,"没有配置操作参数");if(!e)throw new a(this.model,"没有配置调用方法");const n=t.params[s];if(!n)throw new o("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new o("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new o("没有找到调用方法".concat(e));await r[e](n)}},_r=class extends xr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Ar(t,this.model);t.params[e]=s}},Vr=class extends xr{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:n}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:o}=this.model,{message:r}=this.model;if(n){const e=t.params[n];e.title&&(o=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:o||"消息",desc:r};let d=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,d=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,d=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,d=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const l=await ibiz.modal.confirm(c);t.setLastReturn(d[l?0:1])}},Fr=class extends xr{async exec(t){const e=await ws(this.model);e&&await e.exec(this.model,t)}},kr=class extends xr{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];ibiz.log.info("逻辑节点".concat(i,"操作参数值:"),s)}},Wr=class extends xr{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},Ur=class extends xr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Ar(t,this.model);t.params[e]=ht(s)}},zr=class extends xr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Ar(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},Br=class extends xr{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s;t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},Gr=class extends xr{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},jr=class extends xr{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,o);c.ok&&(t.params[n]=c.data)}},Kr=class extends xr{async exec(t){const{errorInfo:e}=this.model;throw new o(e)}},Xr=class extends xr{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:i,fireCtrlId:s}=this.model;if(!s)throw new a(this.model,"没有配置触发对象");if(!e)throw new a(this.model,"没有配置事件名称参数");if(!i)throw new a(this.model,"没有配置事件参数");const n=t.params[s];if(!n)throw new o("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new o("没有找到事件参数对象".concat(i));await n.evt.emit(e,r)}},Hr=class extends xr{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!i)throw new a(this.model,"没有配置实体");if(!e)throw new a(this.model,"没有配置实体逻辑");if(!s)throw new a(this.model,"没有配置传入逻辑参数");const r=t.params[s];if(!r)throw new o("没有找到传入参数".concat(s));const c=await jn(e,i,t.context,r,t.params);n&&(t.params[n]=c)}},Yr=class extends xr{async exec(t){Xe.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},qr=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:n,params:o,data:r}=s,c=ibiz.hub.getApp(a.appId);if("layoutPanel"!==a.codeName)if(a.default)a.entityListParam?t.params[e]=r||[]:t.params[e]=r&&r.length>0?r[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const i=s.view.getController(a.codeName.toLowerCase());i?t.params[e]=i:ibiz.log.error("视图逻辑初始化参数,未找到".concat(a.codeName,"指定部件对象"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=c;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=o;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}else t.params[e]=s.view.layoutPanel.panelItems}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},Qr=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Lr(t);break;case"END":a=new Rr(t);break;case"DEACTION":a=new Nr(t);break;case"DEUIACTION":a=new Sr(t);break;case"PREPAREJSPARAM":a=new Mr(t);break;case"RESETPARAM":a=new Wr(t);break;case"COPYPARAM":a=new Ur(t);break;case"BINDPARAM":a=new _r(t);break;case"VIEWCTRLINVOKE":a=new Or(t);break;case"MSGBOX":a=new Vr(t);break;case"DEBUGPARAM":a=new kr(t);break;case"APPENDPARAM":a=new zr(t);break;case"SORTPARAM":a=new Br(t);break;case"RENEWPARAM":a=new Gr(t);break;case"DEDATASET":a=new jr(t);break;case"THROWEXCEPTION":a=new Kr(t);break;case"VIEWCTRLFIREEVENT":a=new Xr(t);break;case"DELOGIC":a=new Hr(t);break;case"PFPLUGIN":a=new Fr(t);break;case"RAWJSCODE":a=new Yr(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new qr(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new Dr(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(i);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Jr=new Map;async function $r(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new o("找不到实体".concat(e,"的界面逻辑").concat(t));Jr.has(s)||Jr.set(s,new Qr(s));const n=Jr.get(s);return await n.exec(a),null}var Zr=t("UIActionUtil",class{static async exec(t,e,a){const i=await De(t,a);if(!i)throw new o("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await fs(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const n=await this.exec(t,e,a);if(n.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(n.refresh)switch(n.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(i=e.view.parentView)||i.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}(await De(t,a)).asyncAction&&!n.cancel&&this.handleAsyncAction(e.event)}static async handleAsyncAction(t){this.handleAsyncActionAnime(t)}static async handleAsyncActionAnime(t){t&&t.target&&await ibiz.util.anime.moveAndResize(t.target,"#".concat("preset-message"))}}),tc=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:n,uilogicAttachMode:o}=t;if("REPLACE"===o){if(!s)throw new a(t,"没有配置实体界面逻辑");return await $r(s,n,e),i}if(!await this.isConfirm(t,e))return this.returnError(i);const r=await this.execAction(t,e);if(Object.assign(i,r),!0===i.cancel)return this.returnError(i);if("AFTER"===t.uilogicAttachMode){if(!s)throw new a(t,"没有配置实体界面逻辑");await $r(s,n,this.mergeArgsByResult(e,i))}const c=this.mergeArgsByResult(e,i);if(t.closeEditView)this.doNextAction(t,c,t.appId);else{const e=await this.doNextAction(t,c,t.appId);if(e&&(Object.assign(i,e),!0===e.cancel))return this.returnError(i)}return i}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return!t.enableConfirm||!a||ibiz.confirm.warning({title:"操作确认",desc:a})}async doNextAction(t,e,a){const i=t.nextId;if(i)return Zr.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const n=we(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[a[0]];break;case"MULTIDATA":s=a;break;case"MULTIKEY":s=n&&a.length>0?a.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=n?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||n,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,l=se(c,d?re(c,a):a[0]||{},i,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:se(h,d?re(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:n,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=n,s=o;break;case"success":i=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||i);t!==s.lanResTag&&(i=t)}if(i){const{data:t}=a,e={...a};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,Xe.execScriptFn(e,"`".concat(i,"`"),{isAsync:!1,singleRowReturn:!0})}}}),ec=t("BackendUIActionProvider",class extends tc{async execAction(t,e){const{context:i,params:s,data:n,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new a(t,"未配置实体或实体行为");const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,i,n,s),p={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(Do.TAG,m,l,h,{event:o});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===u.length&&u.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((t=>{t.srfactionparam=e}))}}const f=ibiz.hub.getApp(null==i?void 0:i.srfappid),g=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await f.deService.exec(c,d,l,w?g:g[0],p);if(E.ok){const a=this.calcMessage("success",t,e);a&&ibiz.message.success(a)}return Object.assign(r,{data:Z(E.data)?E.data:[E.data],nextContext:l,nextParams:p}),r}}),ac=t("SysUIActionProvider",class extends tc{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,i=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===i)return{closeView:!0};return await a.callUIAction(i,e)||{}}}),ic=t("FrontUIActionProvider",class extends tc{async execAction(t,e){const{context:s,params:n,data:o,event:r,noWaitRoute:c}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=I.fill(t.htmlPageUrl,s,null==o?void 0:o[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:l}=await this.handleParams(t,s,o,n),h=await ibiz.commands.execute(Do.TAG,e,i,l,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(d.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(d.data=h.data,d.nextContext=i,d.nextParams={...n,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":d=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":d=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return d}doOther(t,e){const{scriptCode:i}=t,{context:s,params:n,data:o,event:r,view:c}=e;if(i){return Xe.execScriptFn({context:s,params:n,data:o,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:n,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),d=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!d)throw new o("没有找到实体打印项");{let t="";if(!n||!n[c.codeName.toLowerCase()])throw new o("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(n[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:d.codeName,...r}});if(!e.ok)throw new o("打印失败");if(r&&r.srfcontenttype){const t=null==(s=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:s.slice(9),a=URL.createObjectURL(e.data),i=document.createElement("a");i.href=a,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){var a;const{resultContext:i,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let c="DataImport";if(r&&r.enableCustomized&&(c="DataImport2"),r){const t=ibiz.overlay.createModal(c,{dismiss:()=>t.dismiss(),appDataEntity:n,dataImport:r,context:i,params:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new o("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new o("没有找到实体导出项");{const t="/".concat(null==(i=n.codeName2)?void 0:i.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(r.codeName),a={page:0,size:r.maxRowCount?r.maxRowCount:1e3,...e.params,...s},c=await ibiz.net.request(t,{method:"post",data:a});if(200!==c.status)throw new o("导出请求失败");{let t="".concat(n.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([c.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}}}),sc=t("WFWithdrawUIActionProvider",class extends tc{async execAction(t,e){const{view:a}=e;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),nc=class extends tc{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function oc(){const t=new ic;ps("FRONT",(()=>t));const e=new ec;ps("BACKEND",(()=>e));const a=new ac;ps("SYS",(()=>a));const i=new sc;ps("DEUIACTION_WFWithdraw",(()=>i));const s=new nc;ps("SYS_Logout",(()=>s))}var rc=t("ToolbarController",class extends or{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new zo,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const i=t.uiactionId,s=await De(i,t.appId);if(!s)throw new o("没有找到界面行为模型".concat(i));const n=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;n&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],n=this.getEventArgs();n.params=Object.assign(a,n.params),await Zr.execAndResolved(i,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new Uo(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const i="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:i?"extra":"deuiaction"}),i||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof hn&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const t={};a&&(t.data=[a]),r(this.model,(e=>{const a=this.state.buttonsState[e.id];if(a){if(a.visible){const i=this.scheduler.triggerItemVisible(e.id,t);void 0!==i&&(a.visible=i)}if(!a.disabled){const i=this.scheduler.triggerItemEnable(e.id,t);void 0!==i&&(a.disabled=!i)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),cc=t("ContextMenuController",class extends rc{}),dc=(t("DashboardController",class extends or{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=Xo(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var i;if(t.controlType&&a.includes(t.controlType))return;const s=await hs(t);if(s){this.providers[t.id]=s;const a=await s.createController(t,this,e);this.portlets[t.id]=a,(null==(i=t.controls)?void 0:i.length)&&await this.initPortlets(t.controls,a)}})))}async dataChangeNotify(t){await ya(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t){var e,a;this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null,this.model=t,this.config=new en(t.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(a=this.model.codeName)?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),lc=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=pe(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new dc}onDataChange(t){let e=t.data[0];e&&e instanceof hn&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new zo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Uo(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:i}=this.dashboard.view.model;i&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const i=t.uiactionId;await Zr.execAndResolved(i,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=me(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),hc=(t("ContainerPortletController",class extends lc{}),t("ViewPortletController",class extends lc{}),t("MenuPortletController",class extends lc{}),t("ChartPortletController",class extends lc{}),t("ActionBarPortletController",class extends lc{}),t("HtmlPortletController",class extends lc{}),t("ListPortletController",class extends lc{}),t("RawItemPortletController",class extends lc{}),t("DataViewControlService",class extends pn{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new ro(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new ro(e,e);this.dataUIMap.set(e,i)}))}})),uc=t("DataViewControlController",class extends rr{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new hc(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const a=new zo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Uo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),t.groupActionGroupState=a}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[a],i=this.state.groups.find((t=>t.key===e));i&&i.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var a,i;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof hn&&(s=s.getOrigin()),s&&(null==(a=e.groupActionGroupState)||a.update(s,this.model.appDataEntityId))):null==(i=e.groupActionGroupState)||i.update(void 0,this.model.appDataEntityId)}));else{const a=this.state.groups.find((e=>-1!==e.children.indexOf(t)));a&&(null==(e=a.groupActionGroupState)||e.update(a.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const i=new zo,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),i;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Uo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.getOrigin())}return i}async onActionClick(t,e,a){const i=t.uiactionId;await Zr.execAndResolved(i,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};Zr.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const i=t.uiactionId,s={...this.params,srfgroup:a.key};await Zr.execAndResolved(i,{context:this.context,params:s,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:i,minorSortDir:s}=this.model,n=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:o}=t;if(t.capLanguageRes&&(o=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:o,key:t.appDEFieldId};n&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),pc=t("ExpBarControlController",class extends or{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),i=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){if(t.isInitialLoad)this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem();else{const t=this.xDataController.state.selectedData;t[0]&&this.xDataController.setActive(t[0])}}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&jo(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:i}=t,s=this.getNavViewMsg(e[0],a,i);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,a,i){const{navDER:s,navFilter:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?we(c):void 0,navFilter:n,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:o,navParams:r},l={context:a,params:i,data:e},{resultContext:h,resultParams:u}=ce(d,l),p=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:p,params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new o("多节点视图由子类实现")}getNavViewMsg(t,e,a){const i=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:i,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),mc=(t("CalendarExpBarController",class extends pc{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:i}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:i,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends pc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}async onMounted(){super.onMounted(),this.xDataController&&this.xDataController.evt.on("onAfterRefreshParent",(t=>{const e=this.xDataController.state.selectedData;e[0]&&this.xDataController.setActive(e[0])}))}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const i=t._id,s=t._deData||t,n=this.getNodeModel(t._nodeId);if(!n)throw new o("找不到".concat(t._nodeId,"的节点模型"));const r=this.prepareParams(n,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:n.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,a)=>{0===a?e.push(t):e.push("".concat(e[a-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends pc{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,a,i){var s;const{context:n,params:o}=super.prepareParams(t,e,a,i);if(e._seriesModelId){const a=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(a){const{navigateContexts:t,navigateParams:s}=a,r=se(t,e,i,n),c=se(s,e,i,o);return{context:Object.assign(n.clone(),r),params:c}}}return{context:n,params:o}}getNavViewMsg(t,e,a){var i;let s;if(t._seriesModelId){const e=null==(i=this.XDataModel.dechartSerieses)?void 0:i.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const n=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:n.context,params:n.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends or{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new hn,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await ya(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,i=void 0){await Promise.all(t.map((async t=>{const s=await as(t);if(!s)return;if(e.details[t.id])throw new a(t,"初始化异常: 表单成员[".concat(t.id,"](").concat(t.detailType,")已存在,表单项标识重复请检查配置"));e.providers[t.id]=s;const n=await s.createController(t,e,i);if(e.details[t.id]=n,"FORMITEM"===t.detailType&&e.formItems.push(n),"MDCTRL"===t.detailType&&e.formMDCtrls.push(n),xe(t))return;const o=Te(t);o.length&&await this.initDetailControllers(o,e,n)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||Ko(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}})),fc=class extends un{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:n,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===i?n:r,h="create"===i?o:c,u=s.id.toLowerCase(),p=Qo({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:a});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},gc=t("SearchFormService",class extends fc{async getDraft(t,e={}){let a={ok:!0,status:200,data:this.getFilteredData({...e})};return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new ro(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}}),wc=(t("SearchFormController",class extends mc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new en(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new gc(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const a=this.state.data[e];null!=a&&""!==a&&(t[e]=a)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const i=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===i,a="BOTTOM"!==i,"NONE"===t&&(e=!0,a=!0);const s=t=>{let i,n="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],n=e,!0))),i&&i.length>0){const o=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(o.push(t),s(t))})),o.length<i.length&&(t[n]=o)}};(a||e)&&s(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new o("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o("没有找到保存的搜索条件");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),Ec=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Ec||{})),vc=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(vc||{})),yc=t("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a,capLanguageRes:i}=this.model;if(t){const{width:e,height:a}=pe(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName),i&&i.lanResTag&&(this.model.caption=ibiz.i18n.t(i.lanResTag,this.model.caption))}createState(){var t;return new wc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const i=a.relatedDetailNames||[];if(e||C(i,t))try{const t=qe(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=me(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=me(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}async onClick(t){t&&t.stopPropagation(),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),Ic=t("FormButtonState",class extends wc{constructor(){super(...arguments),this.loading=!1}}),Dc=(t("FormButtonController",class extends yc{createState(){var t;return new Ic(null==(t=this.parent)?void 0:t.state)}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await Zr.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends wc{constructor(){super(...arguments),this.showMask=!1}})),Cc=(t("FormDRUIPartController",class extends yc{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Dc(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),C(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;Y(e)&&(t=Object.assign(t,se(e,this.data,this.form.params,this.form.context)));const a=se(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=J(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends wc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),Ac=t("FormGroupPanelController",class extends yc{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new Cc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new zo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Uo(t.id,this.form.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await Zr.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),bc=t("FormItemState",class extends wc{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),Pc=(t("FormItemController",class extends yc{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new bc(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Zi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ua(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Ho(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...Yo(this.model.editor)),this.rules.length>0&&(this.validator=new Et({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&q(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),t("FormMDCtrlController",class extends yc{get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return A.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return A.checkPermission(this.model.buildInActions,2)}get enableDelete(){return A.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}})),Tc=(t("FormMDCtrlMDController",class extends Pc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");"GRID"===t.controlType&&b(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await Qi(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new i(this.model,"多数据部件类型".concat(this.model.contentType,"暂不支持添加数据"));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController不存在")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends wc{}),xc=(t("FormMDCtrlFormController",class extends Pc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new Tc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await Qi(t);e&&(this.formProvider=e);const{appDataEntityId:i}=this.model.contentControl;this.deName=we(i)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const a={...this.params};return{id:t.srfkey,context:e,params:a}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const a=e.data[0],i=this.state.items.find((e=>e.id===t));i&&i.context[this.deName]!==a.srfkey&&(i.context[this.deName]=a.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o("没有找到对应".concat(t,"的表单控制器"));await e.remove();const a=this.state.items.findIndex((e=>e.id===t));-1!==a&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const i={id:J(),context:e,params:a};void 0!==t?this.state.items.splice(t,0,i):this.state.items.push(i)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends Pc{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new i(this.model,"暂不支持重复器样式".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=ht(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,a)=>t!==a));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends Cc{})),Nc=(t("FormPageController",class extends Ac{createState(){var t;return new xc(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends wc{})),Sc=(t("FormRawItemController",class extends yc{createState(){var t;return new Nc(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends wc{})),Lc=(t("FormTabPageController",class extends yc{createState(){var t;return new Sc(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends wc{constructor(){super(...arguments),this.activeTab=""}})),Rc=(t("FormTabPanelController",class extends yc{createState(){var t;return new Lc(null==(t=this.parent)?void 0:t.state)}async onInit(){var t;await super.onInit(),this.state.activeTab=(null==(t=this.model.deformTabPages)?void 0:t[0].id)||""}onTabChange(t){this.state.activeTab=t}}),t("EditFormService",class extends fc{async get(t,e={}){var a;let i=await this.exec((null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"update"),i}async getDraft(t,e={}){var a;let i=await this.exec((null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}async remove(t,e={}){var a;return await this.exec((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const i=e instanceof hn?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return n=this.handleResponse(n),n}async update(t,e){var a;const i=e instanceof hn?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return n=this.handleResponse(n),n}async goBack(t,e){var i;const s=null==(i=this.model.goBackControlAction)?void 0:i.appDEMethodId;if(!s)throw new a(this.model,"缺少返回操作实体行为");let n=await this.exec(s,t,e instanceof hn?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,a={}){let i=await this.exec(t,e,a);return i=this.handleResponse(i),i}async wfStart(t,e,a){var i;const s=(null==(i=this.model.wfstartControlAction)?void 0:i.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,a instanceof hn?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let n="";n=e.type?e.type:(null==(i=s.wfsubmitControlAction)?void 0:i.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,a instanceof hn?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const a=e,i=a.id.toLowerCase(),s=a.fieldName||e.appDEFieldId;let n;n=s?new ro(i,s,{isOriginField:!0,dataType:a.dataType}):new ro(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,n)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}})),Mc=(t("EditFormController",class extends mc{constructor(){super(...arguments),this.oldData=new hn}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new Rc(this.model),await this.service.init(this.context),this.autoSave=_(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),i=await this.service.getDraft(e,a)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=i.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=ht(this.context),e=ht(this.params),a=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(a&&this.params[a]){t[we(this.model.appDataEntityId)]=this.params[a],delete e[a],delete this.params[a],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=J(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Ee(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=ht(a);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),s=await this.service.get(e,i)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=s.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await P(500,this.save.bind(this),[t])}if(!await this.validate())throw new o("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],n=0===s.srfuf;let r;try{r=n?await this.service.create(a,s):await this.service.update(a,s)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):b(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(r.data.$origin,n?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i,s=!1;if(await this.evt.emit("onBeforeRemove",void 0),1===this.data.srfuf){if(s=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!s)return!1;await this.startLoading();try{i=await this.service.remove(e,a)}catch(t){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=i.ok}return this.state.data=new hn,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),s}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&b(this.data,t.data),this.data}async updateFormItem(t){var e;const a=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!a)throw new o("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:n,scriptCode:r,showBusyIndicator:c}=a,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),n&&r)t=Xe.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},a=await this.service.updateFormItem(i,this.context,e);t=a.data}t&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"流程启动成功"})}async wfSubmit(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"流程提交成功"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{demand:t}=this.model,e={silent:!0,noFillBack:!0};t&&(e.data=this.getDiffData());try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((a=>{t[a]===this.oldData[a]&&a!==t.srfkeyfield||(e[a]=t[a])})),e.srfuf=t.srfuf,new hn(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return Xe.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),Oc=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),_c=t("GridService",class extends pn{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const i=t.id.toLowerCase(),s=t.appDEFieldId;let n;if(s){const o=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));n=new ro(i,o,{isOriginField:!0,dataType:r.dataType})}else n=new ro(i,i);this.dataUIMap.set(i,n)}))}}async updateGridEditItem(t,e,a={}){const i=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await i.exec(t,e,a);return s=this.handleResponse(s),s}}),Vc={string:25,number:6,integer:9,date:5};var Fc=t("GridController",class extends rr{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new _c(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await tr(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var a;if(!t.properties)return;const{properties:i}=t;if(!(Object.keys(i).length>0))return;const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e})}));const n={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[],r=[];return s.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,valueType:"SIMPLE",dataType:Vc[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=ht(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===a.findIndex((e=>e.id===t.id)))),...a]}}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:i}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(s,"没有配置代码表"));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===i){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(s,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await ya(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new Oc(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.state.rows.forEach((t=>{Object.values(t.uiActionGroupStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,i="CODELIST"===a,s=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[s];i||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:i}=this.model;if("ALL"!==t)return;if(!i||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const s=await this.getFetchParams(),n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,i,this.context,void 0,s);o.data.length&&([this.state.remoteAggResult]=o.data)}async getFetchParams(t={}){return!0===this.model.enableItemPrivilege&&(t.srfdataaccessaction=!0),super.getFetchParams(t)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a))return void ibiz.log.error("不支持新建行");if("row"===a){if(this.state.rows.find((t=>t.showRowEdit)))throw new o("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let n;Object.assign(i,s);try{n=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=n.data;T(r,s),this.state.items.unshift(r);const c=new Oc(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,a=this.findRowState(t);if(!a)throw new o("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await P(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new o("行数据校验不通过,保存取消");let i;const s=we(this.model.appDataEntityId),n=this.context.clone();n[s]=t.srfkey;try{i=e?await this.service.create(n,t):await this.service.update(n,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:a.data}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await ya(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await ns(t);if(!a)return;this.providers[t.codeName]=a;const i=await a.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=i,t.enableRowEdit&&(this.editColumns[t.codeName]=i)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=i:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:a,frozenLastColumn:i}=this.model;t.forEach(((t,s)=>{t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":a&&s<a?t.fixed="left":i&&s>=e-i&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Ko(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await ya(Object.values(this.editColumns).map((async a=>a.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new o("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=ht(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let a;t&&(a=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(a,e)}async updateGridEditItem(t,e){var a;const i=null==(a=this.model.degridEditItemUpdates)?void 0:a.find((t=>t.id===e));if(!i)throw new o("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:n,customCode:r,scriptCode:c}=i,d=n.map((t=>t.id));let l;if(r&&c)l=Xe.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},a=await this.service.updateGridEditItem(s,this.context,e);l=a.data}l&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let i;await this.startLoading();try{i=await this.service.fetch(e,a)}finally{await this.endLoading()}return i.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),i=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=a.codeList.getCodeList(t.codeListId),e.codeListItems=await a.codeList.get(t.codeListId,this.context)),e}));if(i)return Promise.all(i)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=null==(e=this.dataEntity.appDEDataExports)?void 0:e.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=t=>{var e;const a=new Map;this.allExportColumns&&this.allExportColumns.length>0?null==(e=this.allExportColumns)||e.forEach((t=>{t.codeListItems&&a.set(t.appDEFieldId,t.codeListItems)})):Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&a.set(t,this.fieldColumns[t].codeListItems)}));const i=ht(t.map((t=>t.getOrigin())));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;a.get(e)&&(t[e]=(null==(i=a.get(e).find((a=>a.value===t[e])))?void 0:i.text)||t[e])}))})),i};let i=[],s=[];this.allExportColumns&&this.allExportColumns.length>0?(i=this.allExportColumns.map((t=>t.appDEFieldId)),s=this.allExportColumns.map((t=>t.caption))):(i=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.id)),s=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.caption)));const n=(r=i,(await(async()=>{var e;const i=null==(e=t.params)?void 0:e.type;let s=[];if("activatedPage"===i&&(s=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:n}=t.params,o="customPage"===i?{page:0,offset:(a-1)*e,size:(n-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:o})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new o("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await Zo(s,n,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:n,updateDV:o,updateDVT:r}=i.editItem,c=e?n:r,d=e?s:o,l=Qo({name:i.fieldName,valueType:c,defaultValue:d,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(a[i.fieldName]=l)})),a}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((a=>a.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.saveColumnStates()}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:this.initColumnStates()}changeColumnStateSort(t,e,a){const i=this.state.columnStates.find((e=>e.key===t));i&&(this.state.columnStates.splice(a,1),this.state.columnStates.splice(e,0,i),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}}),kc=t("GridFieldColumnController",class extends Mc{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}get fieldName(){return this.model.id.toLowerCase()}async onInit(){await super.onInit(),this.loadCodeList=_(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new zo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Uo(t.id,this.grid.context.srfappid,e);a.addState(t.id,i)}})),t.uiActionGroupStates[this.model.codeName]=a}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:i}=this.model;if(!i)return{context:e,params:a};const{navigateContexts:s,navigateParams:n}=he(i);let o={};s&&t&&(o=se(s,t,a,e));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=se(n,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:n}=this.model;if(!n)return;const o=$e(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...o}),c=ht(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Do.TAG,n,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await Zr.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:n}=this.model;if(ct(a)||"NONE"===a)return;const o=e||this.model.id;let r;if(t=t.filter((t=>!ct(t[o]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new i(this.model,"远程聚合暂未支持"):new i(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[o])));break;case"MIN":r=Math.min(...t.map((t=>t[o])));break;default:throw new i(this.model,"暂未支持属性列聚合模式".concat(a))}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error("".concat(r," 值格式化错误"))}return c&&n&&(c+=n),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return qo.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,a){const i=t.uiactionId;await Zr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),Wc=(t("GridUAColumnController",class extends Mc{initActionStates(t){var e;const{deuiactionGroup:i}=this.model;if(!i)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new zo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Uo(t.id,this.grid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await Zr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends kc{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}async onInit(){await super.onInit();const t=Pe(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Zi(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ua(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Ho(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...Yo(this.editItem.editor)),this.rules.length>0&&(this.validator=new Et({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let i=!1;a&&a.length>0&&a.forEach((t=>{e.includes(t)&&(i=!0)})),i&&this.setRowValue(t,null),this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new o("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&q(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:i}=a;return t.errors[e]=i[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends Mc{}),t("ListService",class extends pn{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new ro(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new ro(e,e);this.dataUIMap.set(e,i)}))}})),Uc=(t("ListController",class extends rr{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new Wc(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=a.get(e[t])||[];i.push(e),a.set(e[t],i)}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,i=[],s=ibiz.hub.getApp(this.context.srfappid),n=await s.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),o.push(e.value)}));const r=a.filter((e=>-1===o.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends or{constructor(t,e,a,i,s){super(t,e,a,i),this.panelItems={},this.providers={},this.container=s}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var i,s;const n=await cs(t);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,a);e.panelItems[t.id]=o,(null==(i=t.panelItems)?void 0:i.length)&&!o.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,o),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,o)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new o("未获取到面板数据");const i=this.convertData(a);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=i,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=_e(this.model),a=e.map((t=>t.id)),i=new uo(e,t);return i._evt.on("change",(t=>{a.includes(t)&&this.dataChangeNotify([t])})),i}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),zc=(t("ViewLayoutPanelController",class extends Uc{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),Bc=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=pe(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new zc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const i=a.relatedItemNames||[];if(e||C(i,t))try{const t=Qe(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=me(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=me(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends or{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),i={...this.params};t&&Object.assign(a,se(t,this.params,this.context)),e&&Object.assign(i,se(e,this.params,this.context)),this.state.context=a,this.state.params=i}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),["ISNULL","ISNOTNULL"]),Gc=t("SearchBarFilterController",class{constructor(t,e,a,i){var s;let n;this.model=t,this.appDataEntity=e,this.noEditor=!1,this.context=a,this.params=i,t.appDEFieldId&&(n=Ie(e,t.appDEFieldId)),this.fieldName=n?n.codeName.toLowerCase():t.id,this.label=t.caption||(null==n?void 0:n.logicName)||t.id,this.valueOP=null==(s=t.defsearchMode)?void 0:s.valueOP,this.noEditor=this.valueOP?Bc.includes(this.valueOP):!this.model.editor}async init(){if(!this.noEditor){if(!this.model.editor)throw new a(this.model,"缺少编辑器模型");this.editorProvider=await Zi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),jc=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=[{condop:"EQ",condtype:"DEFIELD",fieldname:"app_view_tag",value:this.viewTag}],e=await this.app.net.post("".concat(this.themeUrl,"/fetch_cur_user_all"),{searchconds:t,sort:"create_time,asc"});return e.ok&&(e.data=this.convertBackDataToFront(e.data)),e}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t));return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t))}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:"".concat(this.viewTag,"___").concat(t),caption:t,app_tag:this.model.appId,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{name:t.name,caption:t.caption,app_tag:this.model.appId,app_view_tag:this.viewTag,theme_model:JSON.stringify(e),valid_flag:t.show?1:0})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[a]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),a)}async updateBatch(t){const e=this.convertFrontDataToBack(t),a=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(a),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={app_tag:this.model.appId,app_view_tag:this.viewTag};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},Kc="",Xc={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},Hc={};function Yc(t,e){if(t.enumSource)return{appId:Kc,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Hc["".concat(t.type,"_").concat(e)]}async function qc(t,e,a){var i;if(!t.properties)return[];const{properties:s}=t;if(!(Object.keys(s).length>0))return[];const n=[];Object.keys(s).forEach((t=>{let e;switch(s[t].type){case"string":e="string","date-time"===s[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(s[t].type))}n.push({key:t,description:s[t].description,type:e,enumSource:s[t].enumSource})}));const o={};null==(i=(await ibiz.hub.getAppDataEntity(e,a)).appDEFields)||i.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const r=[];return n.forEach((t=>{const e=Xc[t.type];e?e.forEach((e=>{t&&r.push({appId:Kc,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Kc,valueOP:e},editor:Yc(t,e)})})):ibiz.log.error("未支持的类型",t.type)})),r}function Qc(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}function Jc(t){return t.leaf?{condtype:"DEFIELD",fieldname:t.field,condop:t.valueOP,value:t.value}:{condtype:"GROUP",condop:t.logicType,bnotmode:!1,searchconds:t.children.map((t=>Jc(t)))}}function $c(t){if("GROUP"===t.condtype)return{leaf:!1,logicType:"AND"===t.condop?"AND":"OR",children:(t.searchconds||[]).map((t=>$c(t)))};if("DEFIELD"===t.condtype)return{leaf:!0,field:t.fieldname||null,valueOP:t.condop||null,value:t.value||null};throw new o("无效的condtype:".concat(t.condtype))}function Zc(t){let e=!1,a=!1;if(r(t[0],(t=>{t.leaf&&(t.field&&t.valueOP&&!ct(t.value)?e=!0:a=!0)})),e&&!a){return[Jc(t[0])]}}Object.keys(Xc).forEach((t=>{Xc[t].forEach((e=>{if(Bc.includes(e))return;const a="".concat(t,"_").concat(e);Hc[a]||("date"!==t||["IN","NOTIN"].includes(e)?Hc[a]={appId:Kc,editorType:"TEXTBOX",id:a}:Hc[a]={appId:Kc,editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends or{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new jc(this.model,this.view.model.codeName.toLowerCase()),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups(!0)}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await tr(this.model.appDataEntityId,this.context);if(!e)return;const a=await qc(e,this.model.appDataEntityId,this.model.appId),i=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===a.findIndex((e=>{var a;return e.appDEFieldId===t.appDEFieldId&&(!(null==(a=t.defsearchMode)?void 0:a.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&i.push(t)})),a.length>0&&(this.model=ht(this.model),this.model.searchBarFilters=a.concat(...i),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=se(Xe.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const a=this.calcFilters();return a&&(e.searchconds=a),e}resetFilter(){this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;(null==(t=this.searchBarFilters)?void 0:t.length)&&(this.searchBarFilters.forEach((t=>{const e=new Gc(t,this.appDataEntity,this.context,this.params);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.enableFilter)return;return Zc(this.state.filterNodes)}async initSearBarGroups(t=!1){if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const a={name:t.id,caption:t.caption,saved:!1,show:!0,searchGroupData:{},order:100*(e+1),defaultSelect:!1,noEdit:!0};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(a.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(a.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(a.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(a.show="1"===e.valid_flag)}catch(e){ibiz.log.error("".concat(t.data,"非标准JSON格式:"),e)}return t.defaultGroup&&(a.defaultSelect=!0),a})));const e=await this.service.fetch();if(e.ok&&e.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)b(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,a)=>e.order>this.state.searchBarGroups[t].order?a:t),0);this.state.searchBarGroups.push({saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)})),t&&this.state.searchBarGroups&&this.state.searchBarGroups.length>0){this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){const t=this.state.searchBarGroups.find((t=>t.defaultSelect));t&&this.handleGroupClick(t)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:this.calcFilters(),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success("保存成功");else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.name===e.data.name));t&&(b(t,e.data),t.saved=!0),ibiz.message.success("保存成功")}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(b(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>$c(t)));this.state.filterNodes=e}else this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}];this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}}),t("TabExpPanelController",class extends or{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&jo(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);!0===e&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:i,navigateParams:s,appDataEntityId:n}=t,o={deName:we(n),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=ce(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}});var td=t("TreeService",class extends pn{async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=be(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:a});if(0===s.length)return;(await ya(s.map((async a=>{const i=Ae(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ce(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===be(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];if(t.accessKey){if(!this.app.authority.calcByResCode(t.accessKey))return r}switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,o)];break;case"DE":r=await this.getDENodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{var a;if(d&&(!c||c&&0===e)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,a,i){return new oo(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...a.params},l={...a.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<i;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=Ae(this.model,h._nodeId);t.appDataEntityId&&(p=we(t.appDataEntityId)),u=h._value}const{resultContext:f,resultParams:g}=ce({deName:p,navFilter:o?"n_".concat(o.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:n,navContexts:s},{derValue:u,context:l,params:d,data:m});return Object.assign(l,f),Object.assign(d,g),{context:l,params:d,navContext:f,navParams:g}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new no(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new io(t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}}),ed=t("TreeController",class extends rr{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),a=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new cc(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async onDestroyed(){await super.onDestroyed(),this.counter&&this.counter.destroy()}async initService(){this.service=new td(this.model),await this.service.init(this.context)}async initCounter(){const{appCounterRefs:t}=this.model,e=null==t?void 0:t[0];e&&(this.counter=await an.getCounterByRef(e,this.context))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];be(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var a;if(null==(a=t.parentDER1N)?void 0:a.pickupDEFName){const a=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&e.push({minorEntityId:a.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const a=t.decontextMenu;if(null==(e=null==a?void 0:a.detoolbarItems)?void 0:e.length){let e=0;const i=[];r(a,(t=>{if("DEUIACTION"===t.itemType){e+=1;const a=t;200===a.actionLevel&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:i[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let a;e&&await this.startLoading();try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;let i;this.state.isLoading=!0;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=i:this.state.rootNodes=i,await this.afterLoadNodes(i),i}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var a;const i=null==(a=this.contextMenuInfos[t._nodeId])?void 0:a.clickTBUIActionItem;if(i)return this.doUIAction(i.uiactionId,t,e,i.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e._id!==t._id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t._id);if(e&&!a)this.state.expandedKeys.push(t._id);else if(!e&&a){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),a=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(a)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,a,i){const s=this.getEventArgs(),n=this.parseTreeNodeData(e),o=await Zr.exec(t,{...s,...n,event:a},i);if(o.closeView)this.view.closeView();else if(o.refresh)switch(o.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){let e=null;return e="DE"===t._nodeType?t:{...t,...t._deData||{}},{data:[e],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var a;(null==(a=t._children)?void 0:a.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"_id",i=this.state.items.find((e=>e[a]===t[a]));if(!i)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{_parent:t}=i;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?i._parent:i,n=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const a=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==a.length&&await Promise.all(a.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,a){var i,s;const n=this.getNodeModel(t._nodeId);if("inner"===a)return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId);if((null==(i=t._parent)?void 0:i._id)===(null==(s=e._parent)?void 0:s._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,n.appDataEntityId)}findDropNodeRS(t,e){const a=this.dropNodeRss.get(t);return null==a?void 0:a.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,i){var s,n,o;"inner"!==i||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===i?e:e._parent,l=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===i||(null==(n=e._parent)?void 0:n._id)!==(null==(o=t._parent)?void 0:o._id)){const e=this.findDropNodeRS(d._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=d._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const u=t._parent._children;if(u.splice(u.indexOf(t),1),"inner"===i)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let a=d._children.indexOf(e);"next"===i&&(a+=1),d._children.splice(a,0,t)}("inner"===i||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:f}=h;if(!0===f){if(!p)throw new a(h,"缺少配置排序属性");const e=p.toLowerCase(),i="ASC"===m,s=[...d._children];i||s.reverse();const n=t=>t+(100-t%100),o=t=>t[e]||0;let c;s.forEach(((a,i)=>{const d=a._deData;void 0===c?a===t&&(c=0===i?100:n(o(s[i-1]._deData)),d[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=o(d)&&(d[e]=n(c),r.push(a)),c=o(d))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const a=this.getNodeModel(t._nodeId),i=t._deData,s=we(a.appDataEntityId),n=this.context.clone();n[s]=i.srfkey;const o=await e.deService.exec(a.appDataEntityId,"update",n,i);o.data&&(t._deData=o.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t._nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if("DE"!==t._nodeType)throw new o("不是实体树节点数据");t._text=e,await this.updateDeNodeData([t])}}),ad=t("WizardPanelService",class extends un{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}}),id=(t("WizardPanelController",class extends or{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,i;t.firstForm&&(this.firstForm=t);const s="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),n=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),o=null==n?void 0:n.stepTag;this.stepTags[s]=o})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new ad(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await Qi(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o("找不到".concat(t,"的表单控制器"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const i=await a.load();Object.assign(this.formData,i)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=we(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new o("找不到标识为".concat(t,"的向导表单"));return a}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,{},this.params),e=we(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new o("没有上一个表单");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,a=this.model.dewizard.dewizardForms;if(t&&a){const a=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),i=t[a+1];if(!i)throw new o("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new o("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends pn{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new ro(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new ro(e,e);this.dataUIMap.set(e,i)}))}})),sd=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),nd=(t("MDCtrlController",class extends rr{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new id(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new sd(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new sd(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,a){const i=t.uiactionId;await Zr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(null==(a=e.uiactionGroupDetails)?void 0:a.length)||ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new zo;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new Uo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.data.getOrigin()),t.uaColStates[e.id]=i}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(new sd(e,this)))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(new sd(e,this))}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}}),t("KanbanService",class extends hc{async updateGroup(t,e){var a;const i=(null==(a=this.model.updateGroupControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}})),od=(t("KanbanController",class extends uc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new nd(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:i}=this.model;if(!e)throw new a(this.model,"排序属性没配置");if(!i)throw new a(this.model,"排序方向没配置");const s="ASC"===i;t.forEach((t=>{const a=t[e];if(ct(a))t[e]=0;else{const e=Number(a);if(Number.isNaN(e))throw new o("".concat(t.srfmajortext,"的排序属性无法转换成数值"))}})),t.sort(((t,a)=>s?t[e]-a[e]:a[e]-t[e]))}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,a){this.setSelectGroup(a.key),super.onGroupToolbarClick(t,e,a)}async onGroupActionClick(t,e,a,i){this.setSelectGroup(i.key);const s={...this.params,srfgroup:i},n=t.uiactionId;await Zr.execAndResolved(n,{context:this.context,params:s,data:[e],view:this.view,event:a},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o("看板部件必须开启分组");return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));i.push({caption:a.text,color:a.color,key:a.value,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=n}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning("当前看板不允许调整分组!");const e="ASC"===this.model.minorSortDir,{from:a,to:i,fromIndex:s,toIndex:n}=t,o=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],d=this.state.groups.find((t=>t.key===a)),l=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=d.children[s];return e[o]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),u=[...l.children],p=[...l.children],m=d.children[s];t.from!==t.to?(m[o]=t.to,p.splice(n,0,m)):(p.splice(s,1),p.splice(n,0,m));const f=d.children.splice(s,1);let g;l.children.splice(n,0,...f),e||(u.reverse(),p.reverse());let w,E=[];p.forEach(((t,e)=>{void 0===g?t!==u[e]&&(g=u[e]?u[e][r]||100:0===e?100:h(u[e-1][r]),t[r]=g,c.push(t)):(g>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),g=w,w=0,E=[]),t[r]=h(g),c.push(t)):(0===E.length&&(w=g),E.push(t)),g=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=we(this.model.appDataEntityId),a=this.context.clone();a[e]=t.srfkey;const i=await this.service.updateGroup(a,t);if(i.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,i.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,a){const i=this.state.groups.find((e=>e.key===t));i&&(i[e]=a)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const a=t.split("quicktoolbar_")[1];this.setGroupController(a,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const a=t.split("batchtoolbar_")[1];this.setGroupController(a,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends td{})),rd=t("TreeGridExRowState",class{constructor(t,e){this.errors={},this.columnActionsStates={},this.editColStates={},this.modified=!1,this.showRowEdit=!1,this.processing=!1,this.data=t,"DE"===t._nodeType&&(Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}})))}}),cd=t("TreeGridExController",class extends ed{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get _evt(){return this.evt}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}get allowRowEdit(){return this.state.rowEditOpen}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={},this.state.rowEditOpen=!0}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new od(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await _s(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=a:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=a)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,a)=>{t.uaColumn&&(t.fixed=a+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new rd(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}async save(t){if(this.state.isSimple)return void ibiz.log.debug("简单模式,不保存");if("DE"!==t._nodeType)throw new o("非实体节点数据不能保存");const e=this.state.rows[t._uuid];if(!e)throw new o("行数据不存在");if(!e.modified)return void ibiz.log.debug("值没有发生改变");if(e.processing)return void await P(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:s,updateAppDEActionId:n}=i,r=0===t._deData.srfuf;if(r)throw new o("暂不支持新建");if(!n)throw new a(i,"树节点没有配置更新实体行为");const c=we(s),d=this.context.clone();d[c]=t._deData.srfkey;const l=ibiz.hub.getApp(this.context.srfappid);let h;try{h=await l.deService.exec(s,n,d,t._deData)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(r?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=h.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=Object.values(this.state.rows).filter((t=>t.modified)).map((t=>t.data));t.length&&await ya(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((a=>{a.gridStateNotify(t,e)}))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Ko(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await ya(Object.values(this.columns).map((async a=>a.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const a={};return Object.values(this.fieldColumns).forEach((i=>{const s=i.nodeColumnControllerMap.get(t._nodeId);if(!s||!s.nodeEditItem)return;const{createDV:n,createDVT:o,updateDV:r,updateDVT:c}=s.nodeEditItem,d=e?o:c,l=e?n:r,h=Qo({name:i.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(a[i.name]=h)})),a}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data._deData.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data._deData.srfuf){t.cacheData=ht(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}}),dd=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}gridStateNotify(t,e){}async dataChangeNotify(t,e){}}),ld=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:i,detreeNodeDataItems:s,detreeNodeEditItems:n}=e,o=null==i?void 0:i.find((t=>t.detreeColumnId===this.fieldColumn.model.id)),r=null==s?void 0:s.find((t=>t.id===o.dataItemName));if(!o||!r)throw new a(e,"节点没有配置对应表格列".concat(this.fieldColumn.name,"的数据项"));if(this.nodeColumn=o,this.nodeDataItem=r,o.enableRowEdit){const t=null==n?void 0:n.find((t=>t.id===o.id));if(!t)throw new a(e,"没有找到对应表格列".concat(this.fieldColumn.name,"的编辑项模型"));this.nodeEditItem=t}}get unitName(){var t;return null==(t=this.nodeEditItem)?void 0:t.unitName}get valueFormat(){return this.nodeColumn.valueFormat}get context(){return this.fieldColumn.context}get params(){return this.fieldColumn.params}get dataType(){var t;return null==(t=this.nodeDataItem)?void 0:t.dataType}get name(){return this.fieldColumn.name}get treeGrid(){return this.fieldColumn.treeGrid}get isLinkColumn(){return!!this.nodeColumn.enableLinkView&&!!this.nodeColumn.linkAppViewId}get hasClickAction(){return!!this.nodeColumn.deuiactionId}get overflowMode(){return this.fieldColumn.treeGrid.overflowMode}async init(){var t;(null==(t=this.nodeEditItem)?void 0:t.editor)&&"HIDDEN"!==this.nodeEditItem.editor.editorType&&(this.editorProvider=await Zi(this.nodeEditItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.nodeEditItem.editor,this))),this.nodeEditItem||await this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.nodeColumn;if(e&&e.uiactionGroupDetails){const a=new zo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Uo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.name]=a}}onTextClick(t,e){this.isLinkColumn?(e.stopPropagation(),this.openLinkView(t,e)):this.hasClickAction&&(e.stopPropagation(),this.triggerAction(t,e))}async openLinkView(t,e){if(!t.data[this.fieldColumn.name])return;const a=this.nodeColumn.linkValueItem||"srfkey",i=t.data[a];if(null==i)throw new o("未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const n=$e(t.data),r=Object.assign(this.context.clone(),{srfkey:i,...n}),c=ht(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:a}=he(d);let i={};e&&t.data&&(i=se(e,t.data,c,r)),Object.assign(r,i);let s={};a&&t.data&&(s=se(a,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute(Do.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const a=this.nodeColumn.deuiactionId;await Zr.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,a){const i=t.uiactionId;await Zr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return qo.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async loadCodeList(){const t=this.nodeColumn.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}async setRowValue(t,e,a){a=a||this.name,await this.treeGrid.setRowValue(t,a,e)}}),hd=(t("TreeGridExFieldColumnController",class extends dd{constructor(){super(...arguments),this.nodeColumnControllerMap=new Map}get name(){return this.model.id}async init(){await this.onInit(),await this.initNodeColumnController()}async initNodeColumnController(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;(null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id)))&&this.nodeColumnControllerMap.set(t.id,new ld(this,t))})),await Promise.all(Array.from(this.nodeColumnControllerMap.values()).map((t=>t.init())))}initActionStates(t){const e=this.nodeColumnControllerMap.get(t.data._nodeId);e&&e.initActionStates(t)}gridStateNotify(t,e){super.gridStateNotify(t,e);const a=this.nodeColumnControllerMap.get(t.data._nodeId);a&&a.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends dd{constructor(){super(...arguments),this.nodeColumnMap=new Map}async init(){await this.onInit(),await this.initNodeColumnMap()}initNodeColumnMap(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;const a=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));a&&this.nodeColumnMap.set(t.id,a)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const a=this.nodeColumnMap.get(t.data._nodeId);a.deuiactionGroup&&(e=a.deuiactionGroup)}return e}initActionStates(t){var e;const a=this.getUIActionGroup(t);if(!a)return void ibiz.log.warn("".concat(this.model.id,"操作列没有配置界面行为组"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new zo;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Uo(t.id,this.treeGrid.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.model.id]=i}async onActionClick(t,e,a){const i=t.uiactionId;await Zr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}gridStateNotify(t,e){if(super.gridStateNotify(t,e),"LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.model.id];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}}),t("TreeGridController",class extends Fc{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const i=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),s=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!i)throw new a(this.model,"树表格无值列模式");if(!s)throw new a(this.model,"树表格无父值列模式");this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=i.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends _c{}),t("MEditViewPanelService",class extends pn{})),ud=(t("MEditViewPanelController",class extends rr{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new hd(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const i=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);this.parameters=a&&i?[{parameterName:null==(t=i.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=i.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,a),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===a.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,a={id:t[e]?t[e]:"mockId:".concat(J()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:i,pathName:s}=e;t[i]&&!Object.is(t[i],"")&&Object.assign(a.context,{[s]:t[i]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(a,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(a,{srfmajortext:"草稿--新建"})})),a}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex((t=>t.id===e));if(a<0)throw new o("编辑视图面板部件UI数据不存在");const i=this.state.panelUiItems[a];i.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):i.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),t("MapService",class extends pn{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const i=[];if(null==(a=this.model.sysMapItems)?void 0:a.length){const a=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async s=>{const{appDataEntityId:n,appDEDataSetId:o,customCond:r}=s,c=t.clone(),d={...e};if(r){const a=Xe.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=he(a);i&&Object.assign(c,se(i,e,t)),s&&Object.assign(d,se(i,e,t))}}const l=await a.deService.exec(n,o,c,d);l.data&&i.push(...l.data.map((t=>new ho(t,s))))})))}return new p(i,200)}})),pd=(t("MapController",class extends rr{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new ud(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);a.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(a,i);this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),i=[],s=[];return a.forEach((t=>{"REGION"===t._itemStyle?i.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=i,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const a=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=a;break;case"strareacode":this.state.strAreaCode="true"===a;break;case"jsonbaseurl":this.state.jsonBaseUrl=a}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends un{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(null==(a=this.dataEntity.codeName2)?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let s=await ibiz.net.request(i,{method:"post",data:e});return s=this.handleResponse(s),s}})),md=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},fd=class extends md{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},gd=class extends md{},wd=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new fd(t);case"USER2":return new gd(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},Ed=(t("ReportPanelController",class extends or{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=wd.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new pd(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam),i=await this.service.fetch(e,a);this.state.data=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),t("GanttService",class extends td{execDeService(t,e,a,i){return this.app.deService.exec(t,e,a,i)}async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=be(this.model,{parentId:t._nodeId,hasQuery:a});if(0===s.length)return;(await ya(s.map((async a=>{const i=Ae(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ce(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===be(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{if(d&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new fo(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new go(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new wo(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}})),vd=(t("GanttController",class extends cd{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new Ed(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}transformNodeDataItem(t,e){var a;const i={};return null==(a=t.detreeNodeDataItems)||a.forEach((t=>{t.id&&t.appDEFieldId&&e.hasOwnProperty(t.id.toLowerCase())&&Object.assign(i,{[t.appDEFieldId.toLowerCase()]:e[t.id.toLowerCase()]})})),i}async updateNodeData(t,e,a=!1){const i=t.srfkey?"srfkey":"_id",s=this.state.items.find((e=>e[i]===t[i]));if(!s||!s.srfkey)return void ibiz.log.error("找不到对应的动态实体树节点数据",t);const n=this.getNodeModel(s._nodeId);if(n){const i=a?this.transformNodeDataItem(n,e):e;if(Object.keys(i).length>0){const e=we(n.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(n.appDataEntityId,"update",a,i)).status&&this.refreshNodeChildren(t,!0)}}}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}async logout(){const t=await ibiz.auth.logout();if(t){const t=window.location;if(-1!==t.search.indexOf("isAnonymous=true")){const e="".concat(t.origin).concat(t.pathname).concat(t.hash);window.history.replaceState({},"",e)}}return t}})),yd=class{constructor(){this.evt=new $,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new wn}async init(){this.listenMessage()}listenMessage(){ibiz.mc.command.asyncAction.on((async t=>{if(!t.data||"ASYNCACTION"!==t.subtype)return;const e=this.formatAsyncAction(t.data);-1===this.actions.findIndex((t=>t.asyncacitonid===e.asyncacitonid))?this.add(e):this.update(e)}))}formatAsyncAction(t){if(["begintime","endtime","createdate","updatedate"].forEach((e=>{H(t[e])&&(t[e]=wt(t[e]).format("YYYY-MM-DD HH:mm:ss"))})),!O(t.actionresult))try{const e=JSON.parse(t.actionresult);t.actionresult=e}catch(t){}if(!O(t.completionrate)){const e=Number(t.completionrate);Number.isNaN(e)?t.completionrate=void 0:t.completionrate=e}return t}add(t){this.actions.unshift(t),this.finishedStates.includes(t.actionstate)?this.noticeResult(t):(this.doingNum+=1,ibiz.notice.showDoingNotice({num:this.doingNum})),this.evt.emit("add",ht(t)),this.evt.emit("dataChange")}update(t){const e=this.actions.findIndex((e=>e.asyncacitonid===t.asyncacitonid));this.actions.splice(e,1,t),this.finishedStates.includes(t.actionstate)&&(this.doingNum-=1,this.doingNum<=0&&ibiz.notice.closeDoingNotice(),this.noticeResult(t)),this.evt.emit("change",ht(t)),this.evt.emit("dataChange")}noticeResult(t){ibiz.notice.showAsyncAction(t)}},Id=class{constructor(){this.evt=new $,this.total=0,this.page=0,this.size=20,this.messages=[],this.service=new to}async init(){this.load(),this.listenMqtt()}async load(){await this.fetch(!1)}async loadMore(){await this.fetch(!0)}async fetch(t=!1){!1===t?this.page=0:this.page+=1;const e={page:this.page,size:this.size,sort:"update_time,desc"},a=await this.service.fetch(e);this.total=a.total,t?this.messages.push(...a.data):this.messages=a.data,this.evt.emit("dataChange")}listenMqtt(){ibiz.mc.command.internalMessage.on((async t=>{ibiz.log.debug("mqtt internalMessage: ",t),"INTERNALMESSAGE"===t.subtype&&ibiz.notification.info({desc:t.content,position:"bottom-right"})}))}},Dd=class{constructor(){this.total=0,this.asyncAction=new yd,this.internalMessage=new Id}async init(){await this.internalMessage.init(),await this.asyncAction.init()}},Cd=class{constructor(){this.convert=new xo,this.controller=new vd,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new So,this.notice=new Dd,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId,a=-1){const i=this.calcAppViewId(t);if(this.view2appMap.has(i)){const t=this.view2appPriorityMap.get(i);if(t&&t<a)return}this.view2appMap.set(i,e),-1!==a&&this.view2appPriorityMap.set(i,a)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(t),t}throw new o("视图[".concat(e,"]不存在"))}async loadAppView(t,e,a){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,a)}throw new o("视图[".concat(e,"]不存在"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return a=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new o("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new Po(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new en(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,a){return(await this.getAppAsync(t)).deService.getService(a,e)}reset(){this.appMap.clear(),this.configCache=void 0}},Ad=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:i}=t,s="".concat(i,"_").concat(a),n=this.viewEngines.get(s);if(n)return n(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),bd=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar"),this.calcDynamicLayout()}calcDynamicLayout(){const t=this.calcRemoveLayoutModel();ibiz.log.debug("".concat(this.view.model.codeName,"删除模型:").concat(t.join(";"))),this.removeLayoutModel(t)}calcRemoveLayoutModel(){const{model:t}=this.view,e=[];!1===t.showCaptionBar&&e.push("view_captionbar"),le(t,"toolbar")||e.push("view_toolbar","toolbar");return["lefttoolbar","righttoolbar","footertoolbar"].forEach((a=>{le(t,a)||e.push(a)})),this.calcViewHeaderVisible()||e.push("view_header"),ibiz.env.isMob&&(this.calcViewFooterVisible()||e.push("view_footer")),e}removeLayoutModel(t,e=this.view.model.viewLayoutPanel){if(!e)return;const a=e.rootPanelItems||e.panelItems||[],i=a.findIndex((e=>t.includes(e.id)));-1!==i&&a.splice(i,1),a.forEach((e=>{"CONTAINER"===e.itemType&&this.removeLayoutModel(t,e)}))}async onMounted(){const{model:t,childNames:e}=this.view;ibiz.log.debug("".concat(t.id,"的子组件:").concat(e.join(";"),"都已mounted"))}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){let t=!1;const{model:e}=this.view;return e.showCaptionBar&&(t=!0),ibiz.env.isMob?(this.isExistAndInLayout("lefttoolbar")&&(t=!0),this.isExistAndInLayout("righttoolbar")&&(t=!0)):this.isExistAndInLayout("toolbar")&&(t=!0),t}isExistAndInLayout(t){const e=this.view.model.viewLayoutPanel;if(!e)return!1;const a=y(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:i}=this.view,s=le(i,t);return!(!a||!s)}calcViewFooterVisible(){let t=!1;return this.isExistAndInLayout("footertoolbar")&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:i}=this.view;if(!t)throw new o("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),n=await s.deService.exec(t,"get",a,i),{data:r}=n;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),Pd=(t("MDViewEngine",class extends bd{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault&&(this.searchBar&&this.searchBar.hasDefaultSelect&&"grid"===this.xdataControlName?this.searchBar.setDefaultSelect():this.load())}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?this.openData(e):"New"===t?this.newData(e):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Search"===t?(await this.searchForm.search(),null):"Reset"===t?(await this.searchForm.reset(),null):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,i;const{data:s,event:n}=t,o=(t.context||this.view.context).clone(),r=t.params||this.view.params;o[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||we(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:o,params:r,data:s,event:n,view:this.view}));if(-1===c)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!c.ok}}async newData(t){var e,i,s;const{data:n,event:o,copyMode:r}=t;if(!(null==(i=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:i.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=ht(this.view.params);r&&(c.srfcopymode=r);const d=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:n,event:o,view:this.view}));if(-1===d)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!d.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){const t=super.calcViewHeaderVisible();return this.calcViewSearchBarVisible()||t}calcViewSearchBarVisible(){const{model:t}=this.view,e=this.isExistAndInLayout("searchbar");if(!e)return e;const a=le(t,"searchbar");return!(!a.enableQuickSearch&&!a.enableGroup&&!0!==a.enableFilter)}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}calcRemoveLayoutModel(){const{model:t}=this.view,e=super.calcRemoveLayoutModel();return le(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),class{constructor(){this.layoutPanel=new Je,this.theme=new ma,this.text=new pa,this.hbs=new ae,this.rawValue=new Ea,this.action=Zr,this.error=new Ot,this.viewStack=new va,this.anime=new Mi,this.file=new Oi,this.error.register(new Mt)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}}),Td=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o("Method not implemented.")}destroy(){}},xd=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new i(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},Nd=class extends Td{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const i=this.logic.scriptCode;this.scriptFn=Xe.createScriptFn(t,i,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Sd=class extends Td{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");$r(e,i,t)}},Ld=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),mt(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const i={itemName:t,triggerType:e},s=this.triggerAndExecute(i,a);if(null==s?void 0:s.length)return s.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const i=this.getExecuteParams(e);return a.execute(i)}triggerControlEvent(t,e,a){const i={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(i,a)}},Rd=class extends Ld{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Md=class extends Ld{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Od=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new i(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}},_d=class{constructor(){this.executorFactory=new xd,this.triggerFactory=new Od}createViewScheduler(t){return new Md(t)}createControlScheduler(t){return new Rd(t)}},Vd=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new o("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},Fd=class extends Vd{},kd=class extends Vd{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:i}=t;return{context:e,params:a,data:(null==i?void 0:i[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(a=this.logic.itemName)?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},Wd=class extends Vd{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new a(this.logic,"定时器缺少定时间隔");this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Ud=class extends Td{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:i,params:s,...n}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const d=c.refAppViewId;if(!d)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const l=c.navigateContexts||[],h=Object.assign(i,se(l,r[0],s,i));let u={};const p=c.navigateParams;return Y(p)&&(u=se(p,r[0],s,i)),ibiz.commands.execute(Do.TAG,d,h,u,n)}async calcOpenViewRef(t,e){const i=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=i.formTypeAppDEFieldId||i.dataTypeAppDEFieldId;if(!s)throw new a(t,"".concat(i.codeName,"[多表单实体] or [索引实体]缺少类型属性配置"));const{data:n}=e,r=n[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return d}async executeNewDataAppUILogic(t,e){const{context:s,params:n,...o}=e,{data:r,view:c}=e,{enableWizardAdd:d,enableBatchAdd:l,batchAddOnly:h,newDataAppView:u}=t;let p;if(d){if(p=await this.getWizardNewViewRef(t,e),!p)return{ok:!1}}else if(l){const e=we(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(p=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(p=u,!p||!p.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},f={};const g=(null==r?void 0:r[0])||{},w=p.navigateContexts;Y(w)&&(m=se(w,g,n,s)),m=Object.assign(s,m);const E=p.navigateParams;if(Y(E)&&(f=se(E,g,n,s)),n.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&g&&(f[t]=g.srfkey,f.srfcopymode=!0)}f.srfuf=0;const v=await ibiz.commands.execute(Do.TAG,p.refAppViewId,m,f,o);return l&&v.data&&await this.doBatchAdd(t,v.data,s,p,e.view),v}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:n}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const l=await ibiz.commands.execute(Do.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(i=l.data)?void 0:i[0];if(!h)throw new o("请选中一条数据");const u=h.srfkey,p=null==n?void 0:n.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===u.toUpperCase()}));if(!p)throw new o("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}async doBatchAdd(t,e,i,s,n){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new a(c,"实体没有从关系集合!");let h="";if(null==d||d.forEach((t=>{const e=we(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o("没有找到".concat(l,"在当前实体的外键属性"));const u={srfkey:h},p=null==(r=n.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(p){const t=p.value.split(",");for(const e of t){const[t,a]=e.split(":");t&&a&&(u[t]=a)}}ibiz.log.debug("批量新建转换映射属性",u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((a=>{const i=u[a];e[i]=t[a]})),e}));ibiz.log.debug("批量新建创建数据",m);const f=ibiz.hub.getApp(i.srfappid).deService;await f.exec(c.id,"Create",i,m)}}},zd=class extends Vd{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>aa[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Bd=class extends Vd{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>sa[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},Gd=class extends Td{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");Zr.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=vt.dirname(this.url.pathname)}dir(t){return this.url.origin+vt.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.onload=t,i.onerror=a,document.head.appendChild(i)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));
|