@ibiz-template/runtime 0.7.26 → 0.7.27
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 +324 -250
- package/dist/index.system.min.js +1 -1
- package/out/controller/control/chart/chart.controller.d.ts +3 -1
- package/out/controller/control/chart/chart.controller.d.ts.map +1 -1
- package/out/controller/control/chart/chart.controller.js +5 -1
- package/out/controller/control/chart/generator/base-series-generator.d.ts +8 -0
- package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
- package/out/controller/control/chart/generator/base-series-generator.js +22 -0
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.js +10 -3
- package/out/controller/control/gantt/gantt.controller.d.ts +0 -10
- package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
- package/out/controller/control/gantt/gantt.controller.js +0 -96
- package/out/controller/control/grid/grid/grid.controller.d.ts +5 -5
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +17 -31
- package/out/controller/control/grid/grid/grid.service.d.ts +10 -0
- package/out/controller/control/grid/grid/grid.service.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.service.js +19 -0
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +6 -2
- package/out/controller/control/report-panel/generator/bi-generator.d.ts +0 -10
- package/out/controller/control/report-panel/generator/bi-generator.d.ts.map +1 -1
- package/out/controller/control/report-panel/generator/bi-generator.js +5 -62
- package/out/controller/control/report-panel/report-panel.controller.d.ts.map +1 -1
- package/out/controller/control/report-panel/report-panel.controller.js +1 -1
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +24 -85
- package/out/interface/controller/event/control/i-chart.event.d.ts +10 -0
- package/out/interface/controller/event/control/i-chart.event.d.ts.map +1 -1
- package/out/interface/controller/event/control/i-edit-form.event.d.ts +26 -0
- package/out/interface/controller/event/control/i-edit-form.event.d.ts.map +1 -1
- package/out/interface/controller/state/view/i-pickup-tree-view.state.d.ts +8 -0
- package/out/interface/controller/state/view/i-pickup-tree-view.state.d.ts.map +1 -1
- package/out/interface/provider/model-loader.provider.d.ts +2 -2
- package/out/interface/provider/model-loader.provider.d.ts.map +1 -1
- package/out/utils/bi-report-util/bi-report-util.d.ts +33 -2
- package/out/utils/bi-report-util/bi-report-util.d.ts.map +1 -1
- package/out/utils/bi-report-util/bi-report-util.js +193 -9
- package/package.json +5 -5
package/dist/index.system.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@ibiz-template/core","lodash-es","ramda","qx-util","qs","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var i,a,s,n,o,r,c,d,l,h,u,p,m,g,f,y,w,E,v,I,b,D,C,A,P,T,N,x,S,L,M,R,O,_,F,z,V,k,U,B,W,G,j,K,H,X,q,Y,Q,J,$,Z,tt,et,it,at,st,nt,ot,rt,ct,dt,lt,ht,ut,pt,mt,gt,ft,yt,wt,Et,vt,It,bt,Dt,Ct,At,Pt;return{setters:[function(t){i=t.RuntimeModelError,a=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.isBase64Image,g=t.updateKeyDefine,f=t.Net,y=t.getToken,w=t.NOOP,E=t.selectFile,v=t.Namespace,I=t.IBizParams,b=t.isElementSame,D=t.findRecursiveChild,C=t.StringUtil,A=t.debounceAndAsyncMerge,P=t.EntityError,T=t.isOverlap,N=t.BitMask,x=t.mergeInLeft,S=t.awaitTimeout,L=t.mergeDefaultInLeft,M=t.plus,R=t.toNumberOrNil},function(t){O=t.isEmpty,_=t.isNil,F=t.isString,z=t.isArray,V=t.isObject,k=t.merge,U=t.debounce,B=t.camelCase,W=t.eq,G=t.gt,j=t.gte,K=t.findIndex,H=t.lt,X=t.lte,q=t.upperFirst,Y=t.snakeCase,Q=t.kebabCase,J=t.isFunction,$=t.isNumber},function(t){Z=t.isNil,tt=t.mergeRight,et=t.isEmpty,it=t.clone,at=t.equals,st=t.where,nt=t.mergeLeft,ot=t.isNotNil,rt=t.mergeDeepRight},function(t){ct=t.notNilEmpty,dt=t.isNilOrEmpty,lt=t.AsyncSeriesHook,ht=t.QXEvent,ut=t.createUUID,pt=t.isArray,mt=t.getCookie,gt=t.setCookie,ft=t.clearCookie,yt=t.ascSort,wt=t.descSort,Et=t.clearAll,vt=t.isNumber,It=t.isString,bt=t.isObject},function(t){Dt=t.default},function(t){Ct=t.default},function(t){At=t.default},function(t){Pt=t.default}],execute:function(){t({SearchCondEx2filterNode:Wd,asyncImportData:vr,asyncImportData2:Nr,calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:i}=t;let a;if(e||i){switch(a={display:"flex"},e){case"TOP":Object.assign(a,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(a,{"align-items":"center"});break;case"BOTTOM":Object.assign(a,{"align-items":"flex-end"})}switch(i){case"LEFT":Object.assign(a,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(a,{"justify-content":"center"});break;case"RIGHT":Object.assign(a,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(a,{"justify-content":"space-between"})}}return a},calcDeCodeNameById:Ae,calcDynaClass:be,calcDynaSysParams:async function(t,e,i={}){const a=i.appId||e.srfappid,s=i.viewParams||{},n={},o=await ibiz.hub.getAppDataEntity(t,a);if(s.srfkey)n.srfkey=s.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(n.srfkey=t)}if(s.srfparentkey&&s.srfparentdename)n.srfparentkey=s.srfparentkey,n.srfparentdename=s.srfparentdename;else{const t=Ga(e,o);if(t&&t.keys.length>1){const i=t.keys[t.keys.length-2];n.srfparentkey=s.srfparentkey||e[i],n.srfparentdename=s.srfparentdename||i}}return n},calcFilterModelBySchema:_d,calcGridLayoutPos:function(t){const{layout:e,colXS:i,colXSOffset:a,colSM:s,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,i)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:i&&-1!==i?i:void 0});return{xs:l(i,a),sm:l(s,n),md:l(o,r),lg:l(c,d)}},calcImportSchemaData:xr,calcItemVisible:async function(t,e,i,a,s,n){const{enableMode:o,dataAccessAction:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===o&&r){const t=ibiz.hub.getApp(e.srfappid);return!!await t.authority.calcByDataAccessAction(r,e,n,a)}if("DELOGIC"===o&&c&&a&&s){const t=Te(c,await ibiz.hub.getAppDataEntity(a,s));if(t){return!!(await Us(t,e,n,i)).data}}if("SCRIPT"===o&&d){return!!ei.execScriptFn({data:n,context:e,params:i},d,{isAsync:!1,singleRowReturn:!0})}},calcItemVisibleByCounter:function(t,e){const{enableMode:i,counterId:a}=t;if(!e||!a)return;if("COUNT_GTE_ZERO"===i)return e.getCounter(a)>=0;if("COUNT_GT_ZERO"===i)return e.getCounter(a)>0},calcLayoutHeightWidth:Ie,calcMainStateOPPrivsStrs:Ce,calcNavParams:ge,calcResPath:ja,calcSearchCondExs:jd,calcSearchConds:Bd,calcThresholdRange:function(t,e){return t.find((t=>{if(!t.beginValue&&!t.endValue)return t.value==e;let i=!0;t.beginValue&&(i=t.includeBeginValue?e>=t.beginValue:e>t.beginValue);let a=!0;return t.endValue&&(a=t.includeEndValue?e<=t.endValue:e<t.endValue),i&&a}))},compare:Ye,compareNumber:Qe,contains:Je,convertNavData:he,convertNavDataByArray:pe,convertObjectToNavParams:le,createImportSchema:async function(t){const e=xr(t);return await ibiz.net.request("extension/import_schemas",{method:"post",data:e})},deleteImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"delete"})},downloadImportTemplate:Pr,execDELogic:Vs,execDELogicAction:Us,execDELogicById:ks,execFieldLogics:Ws,execUILogic:Lc,exportData:Dr,fetchImportSchemas:async function(t){var e;const i={n_import_tag_eq:t.appDataEntity.defaultAppDEDataImportId,n_system_tag_eq:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,n_data_entity_tag_eq:t.appDataEntity.codeName};return await ibiz.net.request("extension/import_schemas/fetch_cur_user",{method:"post",data:i})},fieldValueToBoolean:Ha,filterFieldLogics:Ne,filterNode2SearchCond:Ud,filterNode2SearchCondEx:Gd,filterValueRules:Ii,findAppDEMethod:ve,findChildFormDetails:_e,findDELogic:Te,findEditItem:Oe,findFieldById:xe,findModelChild:fe,formatMultiData:me,generateEditorRules:gr,generateRules:mr,getAcItemProvider:async function(t){let e;const{itemSysPFPluginId:i,appId:a}=t;if(i){const t=await Li(i,a);if(t&&(s=t,e=ibiz.register.get("".concat(Ma,"_").concat(s))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.acItem",{pluginKey:t}))}var s;return e},getAllPanelField:Ge,getAppCounterProvider:_i,getAppMenuItemProvider:Ta,getAppViewRef:function(t,e){var i,a;let s=t.appViewRefs||[];(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)?void 0:a.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(i=t.actiontype||"DEFAULT",ibiz.register.get("".concat(da,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.asynchronousAction",{actiontype:t.actiontype}))},getChildNodeRSs:Re,getControl:ye,getControlPanel:Ee,getControlProvider:ki,getControlsByView:ze,getCtrlTeleportParams:function(t){var e,i,a,s;const n=null==(i=null==(e=t.controlParam)?void 0:e.ctrlParams)?void 0:i.TELEPORTTAG,o="true"===(null==(s=null==(a=t.controlParam)?void 0:a.ctrlParams)?void 0:s.TELEPORTFLAG);return{teleportTag:n,teleportFlag:o}},getDEMethodProvider:Ia,getDERedirectToView:Xe,getDataImportModels:Cr,getDeACMode:async function(t,e,i){var a;const s=await ibiz.hub.getAppDataEntity(e,i);return null==(a=s.appDEACModes)?void 0:a.find((e=>e.id===t))},getDefaultDataImport:function(t){var e;if(t.defaultAppDEDataImportId)return null==(e=t.appDEDataImports)?void 0:e.find((e=>e.id===t.defaultAppDEDataImportId))},getDefaultValue:yr,getEditorProvider:Wi,getEntitySchema:Sr,getErrorViewProvider:function(t){let e;e||(i=t,e=ibiz.register.get("".concat(xa,"_").concat(i)));var i;return e},getFormDetailProvider:Ki,getGridColumnProvider:qi,getImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"get"})},getInternalMessageProvider:function(t){const e=(i=t.content_type||"DEFAULT",ibiz.register.get("".concat(Na,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.messageType",{content_type:t.content_type}))},getMatchResPath:Ga,getOriginData:pr,getOriginFilterNodes:Vd,getPFPlugin:function(t,e){const a=ibiz.hub.getApp(e);if(!a)throw new i(a,ibiz.i18n.t("runtime.model.utils.noFoundApplication"));const{model:s}=a;if(!s.appPFPluginRefs)throw new i(s,ibiz.i18n.t("runtime.model.utils.unconfiguredPlugins"));const n=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!n)throw new Error(ibiz.i18n.t("runtime.model.utils.noFound",{id:t}));return n},getPanelItemProvider:Ji,getPlatformProvider:ya,getPlatformType:pa,getPortletProvider:ta,getRootNode:Le,getToolbarItemProvider:La,getTreeGridExColumnProvider:Ca,getTreeNode:Me,getUIActionById:Se,getUIActionItemsByActionLevel:function(t,e){const i=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const a=t;a.actionLevel===e&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),i},getUIActionProvider:sa,getUILogicNodeProvider:oa,getViewEngines:ke,getViewLogics:Ve,getViewProvider:async function(t){let e;const{viewType:i,viewStyle:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Li(s,n);if(t&&(e=ca(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.viewPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=ca("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.correspondViewTypeStyle",{viewType:i,viewStyle:a}),t)}e||(e=ca(i));e||(e=ca("DEFAULT"));return e},getWFContext:ri,getWFSubmitViewId:function(t,e){var i;const{type:a,sequenceflowview:s,sequenceflowmobview:n}=e,o=(null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)||t.appViewRefs,r=a?"WFUTILACTION@".concat(a.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:Cn,hasDeCodeName:Pe,hasSubRoute:hr,importData:Ir,importData2:br,install:function(){const{ibiz:t}=window;t.util=new bl,t.hub=new wl,t.register=new kt,t.config=new Vt,t.auth=new hs,t.engine=new El,t.uiDomainManager=new In,t.markOpenData=new Qs,Ho(),kc(),qs(),Fa(),ibiz.scheduler=new Ll,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Ol(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Ol(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Ol(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new _l(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Rl(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new zl(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Vl(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Al(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Pl(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Pl(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Fl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new kl(t,e))),function(){const t=new ha;ga("Browser",(()=>t))}(),t.platform=ya()},installCommand:Ho,isDataContainer:Ue,isFormDataContainer:Fe,isHiddenFilter:Ad,isSimpleItems:Cd,isValueChange:ur,matchMainState:De,openDataImport:Ar,openRedirectView:Ke,parseSubFieldInfo:Pd,parseUserParams:we,parseViewProtocol:je,presetAppCounterProvider:Fa,presetDEMethodProvider:qs,presetUIActionProvider:kc,registerAcItemProvider:function(t,e){ibiz.register.register("".concat(Ma,"_").concat(t),e)},registerAppCounterProvider:Ri,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Aa,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(da,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(zi,"_").concat(t),e)},registerDEMethodProvider:Ea,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Ui,"_").concat(t),e)},registerErrorViewProvider:function(t,e){ibiz.register.register("".concat(xa,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Gi,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(Hi,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Na,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Yi,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:ga,registerPortletProvider:function(t,e){ibiz.register.register("".concat($i,"_").concat(t),e)},registerToolbarItemProvider:function(t,e){ibiz.register.register("".concat(Sa,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(ba,"_").concat(t),e)},registerUIActionProvider:ia,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(na,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(ra,"_").concat(t),e)},selectAndImport:Tr,strContain:$e,testCond:qe,toLocalOpenWFRedirectView:async function(t,e,i={}){const a=await He(t,e,i);await ibiz.commands.execute(Go.TAG,a.viewId,a.context,a.params,a.opts)},updateImportSchema:async function(t){const e=xr(t),i="extension/import_schemas/".concat(e.id);return await ibiz.net.request(i,{method:"put",data:e})},validateFilterNodes:kd,verifyDeRules:ii,verifyFormGroupLogic:si,verifyPanelGroupLogic:ni});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Tt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nt={exports:{}};!function(t,e){t.exports=function(t,e,i){var a=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 i;1===e.length&&e[0].length>0&&(e=e[0]),i=(e=e.filter((function(t){return t})))[0];for(var a=1;a<e.length;a+=1)e[a].isValid()&&!e[a][t](i)||(i=e[a]);return i};i.max=function(){var t=[].slice.call(arguments,0);return a("isAfter",t)},i.min=function(){var t=[].slice.call(arguments,0);return a("isBefore",t)}}}(Nt);var xt=Tt(Nt.exports),St={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(St);var Lt=Tt(St.exports),Mt={exports:{}};!function(t,e){var i,a;t.exports=(i="month",a="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)===a?this.add(3*t,i):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)===a){var r=this.quarter()-1;return n?this.month(3*r).startOf(i).startOf("day"):this.month(3*r+2).endOf(i).endOf("day")}return o.bind(this)(t,e)}})}(Mt);var Rt=Tt(Mt.exports),Ot={exports:{}};!function(t,e){var i,a;t.exports=(i="week",a="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(a).add(1,a).date(e),o=s(this).endOf(i);if(n.isBefore(o))return 1}var r=s(this).startOf(a).date(e).startOf(i).subtract(1,"millisecond"),c=this.diff(r,i,!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)}})}(Ot);var _t=Tt(Ot.exports),Ft={exports:{}};!function(t,e){var i;t.exports=(i="day",function(t,e,a){var s=function(t){return t.add(4-t.isoWeekday(),i)},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()),i);var e,n,o,r=s(this),c=(e=this.isoWeekYear(),o=4-(n=(this.$u?a.utc:a)().year(e).startOf("year")).isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,i));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 i=this.$utils(),a=!!i.u(e)||e;return"isoweek"===i.p(t)?a?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)}})}(Ft);var zt=Tt(Ft.exports),Vt=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},this.pickerEditor={overflowMode:"auto"}}},kt=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 i=this.providers.get(t);if(i)return i(...e)}}),Ut=t("DefaultErrorHandler",class{handle(t){return t instanceof i||t instanceof a?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error(ibiz.i18n.t("runtime.utils.errorHandler.noPermissionless")):404===t.status?ibiz.mc.error.send(t):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}}),Bt=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error(ibiz.i18n.t("runtime.utils.errorHandler.noProcessor"),t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),Wt=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,i){return i.fn?e?i.fn(t):i.inverse(t):e?i.hash.yes=!0:i.hash.no=!1}};Wt.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var Gt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},jt=class extends Gt{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const i=t.filter((t=>!!t)).length===t.length;return Wt.handleJudgmentExecute(this,i,e)}},Kt=class extends Gt{constructor(t){super(t,"camelCase")}onExecute(t){return t?B(t):""}},Ht=class extends Gt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Xt=class extends Gt{constructor(t){super(t,"eq")}onExecute(t,e,i){const a=W(t,e);return Wt.handleJudgmentExecute(this,a,i)}},qt=class extends Gt{constructor(t){super(t,"gt")}onExecute(t,e,i){const a=G(t,e);return Wt.handleJudgmentExecute(this,a,i)}},Yt=class extends Gt{constructor(t){super(t,"gte")}onExecute(t,e,i){const a=j(t,e);return Wt.handleJudgmentExecute(this,a,i)}},Qt=class extends Gt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,i,a){let s=!1;return s=z(t)?!W(K(t,(t=>W(t[e],i))),-1):t.hasOwnProperty(e)&&(s=W(t[e],i)),Wt.handleJudgmentExecute(this,s,a)}},Jt=class extends Gt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},$t=class extends Gt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Zt=class extends Gt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},te=class extends Gt{constructor(t){super(t,"lt")}onExecute(t,e,i){const a=H(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ee=class extends Gt{constructor(t){super(t,"lte")}onExecute(t,e,i){const a=X(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ie=class extends Gt{constructor(t){super(t,"neq")}onExecute(t,e,i){const a=!W(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ae=class extends Gt{constructor(t){super(t,"not")}onExecute(t,e){const i=et(t)||Z(t);return Wt.handleJudgmentExecute(this,i,e)}},se=class extends Gt{constructor(t){super(t,"or")}onExecute(...t){var e;const i=t[t.length-1];t.pop();const a=t.find((t=>!!t));if(i.fn){const t=(null==(e=i.data)?void 0:e.root)||{};return a?i.fn(t):i.inverse(t)}return a||""}},ne=class extends Gt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?q(t):""}},oe=class extends Gt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?Y(t):""}},re=class extends Gt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?Q(t):""}},ce=class extends Gt{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var de=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 i;return this.hsb=t.default||t,this.p=null,i=this.hsb,new jt(i),new Kt(i),new Ht(i),new Xt(i),new qt(i),new Yt(i),new Jt(i),new $t(i),new Zt(i),new te(i),new ee(i),new ie(i),new ae(i),new se(i),new ne(i),new oe(i),new re(i),new ce(i),new Qt(i),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(ibiz.i18n.t("runtime.utils.handlebars.noInitHandlebars"));return this.hsb.compile(t)(e)}});function le(t){const e=[],i=/^%(.+)%$/;for(const a in t){let s=!0,n=t[a];ct(t[a])&&i.test(t[a])&&(s=!1,n=t[a].substring(1,t[a].length-1)),e.push({key:a.toLowerCase(),rawValue:s,value:n})}return e}function he(t,...e){if(!t||O(t))return{};return pe(Array.isArray(t)?t:le(t),...e)}function ue(t,e){const i=e.split(".");let a;const s=t.find((t=>{if(dt(t))return!1;if(i.length>1){a=t;for(let t=0;t<i.length;t++){const e=i[t];if(!a||!a[e]&&!Object.prototype.hasOwnProperty.call(a,e)){a=void 0;break}a=a[e]}return void 0!==a}return t[e]||Object.prototype.hasOwnProperty.call(t,e)}));return{find:!!s,value:i.length>1?a:null==s?void 0:s[e]}}function pe(t,...e){const i=/\$\{[^}]*\}/g,a={};for(const s of t)if(s.rawValue)a[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(i);if(null!==t){let i=s.value;t.forEach((t=>{const{find:a,value:s}=ue(e,t.slice(2,-1).toLowerCase());a&&(i=i.replace(t,"".concat(_(s)?"":s)))})),a[s.key.toLowerCase()]=i}else{const{find:t,value:i}=ue(e,s.value.toLowerCase());t&&(a[s.key.toLowerCase()]=i)}}return a}function me(t,e){const i={};if(!t)return i;const a=Array.isArray(t)?t:le(t),s=e[0];return a.forEach((t=>{const{rawValue:a,value:n}=t;!a&&n&&Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=e.map((t=>t[n])).join(";"))})),i}function ge(t,e){const{deName:i,navFilter:a,pickupDEFName:s,navContexts:n,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(i&&(h[i]=p),a&&(u[a]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=he(n,d,c,r),g=he(o,d,c,r);return Object.assign(h,m),Object.assign(u,g),{resultContext:h,resultParams:u}}function fe(t,e){if(t&&e){const i=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(i)return i}return null}function ye(t,e){var i,a;let s=t.controls||[];return(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.controls)?void 0:a.length)&&(s=s.concat(t.viewLayoutPanel.controls)),s.find((t=>t.name===e||t.codeName===e||t.id===e))}function we(t){const e={},i={},a={};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(i,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:n});break;default:Object.assign(a,{key:n})}}}return{navigateContexts:e,navigateParams:i,other:a}}function Ee(t){let e;if(t.controlRenders){const i=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==i?void 0:i.layoutPanel}return e}function ve(t,e){const i=t.appDEMethods;if(i&&e){const t=fe(i,e);if(t)return t;const a=i.find((t=>{switch(t.methodType){case"DEACTION":{const{actionTag:i}=t;return(null==i?void 0:i.toLowerCase())===e.toLowerCase()}case"FETCH":{const{dataSetTag:i}=t;return"fetch".concat(null==i?void 0:i.toLowerCase())===e.toLowerCase()}default:return!1}}));if(a)return a}return null}function Ie(t){const{width:e,height:i,widthMode:a,heightMode:s}=t,n={width:"",height:""};return"FULL"===a?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===a?"%":"px")),"FULL"===s?n.height="100%":i&&i>0&&(n.height=i>0&&i<=1?"".concat(100*i,"%"):"".concat(i,"PERCENTAGE"===s?"%":"px")),n}function be(t,e){const i=[],a=ei.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return F(a)?i.push(a):z(a)?i.push(...a):V(a)&&Object.keys(a).forEach((t=>{a[t]&&i.push(t)})),i}function De(t,e){const{mainStateAppDEFieldIds:i,demainStates:a}=t;if(i&&a){const t=[];return i.forEach((i=>{t.push(e[i])})),a.find((e=>{const{stateValue:i,state2Value:a,state3Value:s}=e;let n=!0;const o=[i,a,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function Ce(t,e){const i=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:a,opprivAllowMode:s}=t,n=(null==a?void 0:a.map((t=>t.name)))||[];let o=[];if(s)o=n;else{o=[...i.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function Ae(t){return t.split(".").pop()}function Pe(t,e){const i=Ae(e);return ct(t[i])}function Te(t,e){var i;return null==(i=e.appDELogics)?void 0:i.find((e=>e.id===t))}function Ne(t,e){var i,a;const s=[];return null==(i=t.appDEFields)||i.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==(a=t.appDELogics)?void 0:a.filter((t=>s.includes(t.id))))||[]}function xe(t,e){var i;return null==(i=t.appDEFields)?void 0:i.find((t=>t.id===e))}async function Se(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Le(t){return t.detreeNodes.find((t=>t.rootNode))}function Me(t,e){return t.detreeNodes.find((t=>t.id===e))}function Re(t,e){const i=e.parentId||Le(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===i&&(a=t.searchMode,s=e.hasQuery,3===a||(s?1===a:2===a));var a,s}))}function Oe(t,e){var i;return null==(i=t.degridEditItems)?void 0:i.find((t=>t.codeName===e))}function _e(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Fe(t){return"MDCTRL"===t.detailType}function ze(t){const{viewLayoutPanel:e}=t,i=t.controls||[];return e&&i.push(...e.controls||[]),i}function Ve(t){const{viewLayoutPanel:e}=t,i=t.appViewLogics||[];return e&&i.push(...e.appViewLogics||[]),i}function ke(t){const{viewLayoutPanel:e}=t,i=t.appViewEngines||[];return e&&i.push(...e.appViewEngines||[]),i.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn(ibiz.i18n.t("runtime.model.view.engineClassifications",{engineType:t.engineType})),!1)))}function Ue(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Be=["panelItems","panelTabPages","rootPanelItems"];function We(t){let e=[];for(const i of Be)if(t[i]&&t[i].length&&t[i].length>0){e=t[i];break}const i=[];return e.length&&(i.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Ue(t)||i.push(...We(t))}))),i}function Ge(t){return We(t)}function je(t){const e=new URL(t),i={},a={};let s="";if(e.searchParams.size>0){const s=e.searchParams.get("srfnavctx");if(s){try{Object.assign(i,JSON.parse(s))}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.parseSrfnavctxParameter",{urlStr:t}),e)}e.searchParams.delete("srfnavctx")}e.searchParams.forEach(((t,e)=>{a[e]=t}))}const n=e.pathname.replace("//","").split("/"),[o,r]=n;return s=r||o,{context:i,params:a,viewId:s}}async function Ke(t,e,i={},a={}){return async function(t,e,i={},a={}){let s;try{s=await Xe(t,e,i,a)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const i=window.open(t,"_blank");i&&(i.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Go.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,i,a)}async function He(t,e,i={}){const a=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(a+1,e.length)),n=Dt.parse(s,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.missingEntityName"));const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.noFoundSpecifiedEntity",{deName: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")),i=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=i}return n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),{context:t,params:n,opts:i,viewId:l.id}}async function Xe(t,e,a={},s={}){var n;const r=he(t.appViewNavContexts||[],a,e);e=Object.assign(e.clone(),r);const c=he(t.appViewNavParams||[],a,e);Object.assign(a,c);const d=t.appDataEntityId,l=Ae(d);let h=(null==(n=s.data)?void 0:n[0])||{};e[l]=h[l]||e[l]||a[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,a);if(t.ok){h=t.data;let i=h.linkurl;if(i){if(e.srfprocessinstanceid&&(i+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==i.indexOf("appredirectview?")&&(i=i.slice(i.indexOf("appredirectview?"))),i.startsWith("http://")||i.startsWith("https://"))return{type:"url",url:i};if(i.startsWith("appredirectview?")){return{type:"view",...await He(e,i,s)}}throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.unsupportedLinkUrl",{linkUrl:i}))}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(d,t.appId),f=await async function(t,e,i,a){let s="";const n=e.typeAppDEFieldId;if(n){const{codeName:i}=xe(t,n),s=a[i.toLowerCase()];if(ct(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn(ibiz.i18n.t("runtime.utils.openRedirectView.redirectionView",{name:e.name,typeFieldId:n}),a)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=i.srfwf;if(ct(r))return ct(i.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(i.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=xe(t,t.indexTypeAppDEFieldId);c=a[e.toLowerCase()]}if(dt(c)&&t.formTypeAppDEFieldId){const{codeName:e}=xe(t,t.formTypeAppDEFieldId);c=a[e.toLowerCase()]}s=ct(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return s}(g,t,a,h);let y="";if(!f.startsWith("view://")){const n=f.split(":"),o=2===n.length?f:n.slice(0,2).join(":"),r="".concat(g.name.toUpperCase(),":").concat(f),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===f||e===o}));if(d){if(y=d.refAppViewId,d.openMode&&(s.openMode=d.openMode),y)return{type:"view",viewId:y,context:e,params:a,opts:{...s,data:[h]}};throw new i(d,ibiz.i18n.t("runtime.utils.openRedirectView.noConfiguredActualReference"))}throw ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.redirectingViewReferences"),null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:i})=>({viewId:t,tag:e,title:i})))),new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.redirectionIdentifier",{rdTag:f,deRdTag:r,wfRdTag:o}))}{const t=je(f);Object.assign(e,t.context),Object.assign(a,t.params),y=t.viewId}if(y)return{type:"view",viewId:y,context:e,params:a,opts:{...s,data:[h]}};throw new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.noMatchActualReferenceView",{rdTag:f}))}function qe(t,e,i){if(Object.is(e,"IN"))return Je(t,i);if(Object.is(e,"NOTIN"))return!Je(t,i);switch(e){case"EQ":return"".concat(t)==="".concat(i);case"NOTEQ":return"".concat(t)!=="".concat(i);case"LT":return Ye(t,i)<0;case"LTANDEQ":return Ye(t,i)<=0;case"GT":return Ye(t,i)>0;case"GTANDEQ":return Ye(t,i)>=0;case"ISNULL":return dt(t);case"ISNOTNULL":return ct(t);case"TESTNULL":return Z(t);case"IN":return Je(t,i);case"NOTIN":return!Je(t,i);case"LIKE":return $e(t,i);case"LEFTLIKE":return $e(t,i,"start");case"RIGHTLIKE":return $e(t,i,"end");default:throw new o(ibiz.i18n.t("runtime.utils.verify.valueOperations",{op:e}))}}function Ye(t,e){const i=Number(t),a=Number(e);if(!Number.isNaN(i)&&!Number.isNaN(a))return Qe(i,a);const s=new Date(t).getTime(),n=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(n))return Qe(s,n);throw new o(ibiz.i18n.t("runtime.utils.verify.noCompared",{value:t,value2:e}))}function Qe(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Je(t,e){if(!e||"string"!=typeof e)throw new o(ibiz.i18n.t("runtime.utils.verify.conditionalValues"));if(t){return e.split(",").includes("".concat(t))}return!1}function $e(t,e,i){if(!t||!e)return!1;const a="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),n=a.indexOf(s);switch(i){case"start":return 0===n;case"end":return n+s.length===a.length;default:return-1!==n}}var Ze={singleRowReturn:!1,isAsync:!0},ti=t("ScriptFunction",class{constructor(t,e,i=Ze){this.argKeys=[],this.options=i;const a=this.formatCode(e,i);this.calcArgKeys(t,i);const s=new Function(...this.argKeys,a);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.utils.script.errorReportingScript"),a),t}}}formatCode(t,e){let i=t;return e.singleRowReturn&&(i="return (".concat(i,")")),e.isAsync&&(i="return (async function() { ".concat(i,"} )();")),i}calcArgKeys(t,e){const i=e.presetParams?Object.keys(e.presetParams):[];i.push(...t);i.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util","ctrl"),this.argKeys=Array.from(new Set(i))}convertArgs(t){const{presetParams:e}=this.options,i=e?tt(e,t):t;i.document=document,i.selector=t=>document.getElementsByClassName(t);const a=[];return this.argKeys.forEach((t=>{void 0===i[t]&&this.fillDefaultParams(t,i),a.push(i[t])})),a}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 i=e.view;if(i)switch(t){case"parent":e.parent=i.parentView;break;case"topView":e.topView=i.getTopView();break;case"parentView":e.parentView=i.parentView;break;case"topViewSession":e.topViewSession=i.getTopView().session;break;case"viewSession":e.viewSession=i.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),ei=t("ScriptFactory",class{static createScriptFn(t,e,i){return new ti(t,e,i)}static execScriptFn(t,e,i){return this.createScriptFn(Object.keys(t),e,i).exec(t)}static async asyncExecScriptFn(t,e,i={}){return await this.createScriptFn(Object.keys(t),e,{...i,isAsync:!0}).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function ii(t,e,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(t){return"GROUP"===t.condType}(i)){const s=i.conds;s&&s.length>0&&(a.isPast=function(t,e,i="AND",a=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===i;for(let a=0,n=t.length;a<n;a++){const n=e(t[a],a);if("AND"===i){if(!n){s=!1;break}}else if("OR"===i&&n){s=!0;break}}return a?!s:s}(s,(i=>{const{isPast:s,infoMessage:n}=ii(t,e,i);return a.infoMessage=n,s}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{t=(null==i?void 0:i.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){Object.is(s,"CURTIME")&&(i="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){i=n[i=i?i.toLowerCase():""]?n[i]:i}(Z(a)||et(a))&&(a=ibiz.i18n.t("runtime.utils.verify.contentConform"));const c=qe(t,e,i);if(!c&&r)throw new o(a);return!c}(e[t],i.condOp,i.paramValue,i.ruleInfo,i.paramType,e,i.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){dt(n)&&(n=ibiz.i18n.t("runtime.utils.verify.rangeRules"));if(dt(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return n=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(ai(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(i){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!=a)if(s){if(c>a){if(r)throw new o(n);return!0}}else if(c>=a){if(r)throw new o(n);return!0}return n="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"REGEX"===t.condType}(i))a.isPast=!ai(e[t],i.regExCode,i.ruleInfo,i.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){dt(n)&&(n=ibiz.i18n.t("runtime.utils.verify.scopeRules"));if(dt(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return n=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}const c=t.length;if(null!==e)if(i){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!==a)if(s){if(c>a){if(r)throw new o(n);return!0}}else if(c>=a){if(r)throw new o(n);return!0}return n="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:s,regExCode:n,scriptCode:r,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===s)a.isPast=!ai(e[t],n,a.infoMessage,i.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:n}=function(t,e,i,a,s){dt(a)&&(a=ibiz.i18n.t("runtime.utils.verify.scriptRules"));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=ei.execScriptFn({value:t,data:n},i,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(a="",!c&&s)throw new o(a);return{isPast:c,infoMessage:r||a}}(e[t],e,r,a.infoMessage,i.keyCond);a.isPast=s,a.infoMessage=n||a.infoMessage}}}catch(t){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function ai(t,e,i,a){dt(i)&&(i=ibiz.i18n.t("runtime.utils.verify.regularRules"));if(dt(t)){if(a)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return i=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(!new RegExp(e).test(t)){if(a)throw new o(i);return!0}return i="",!1}function si(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.defdlogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroups"));let s=!0;if("AND"===e.groupOP){s=void 0===a.find((e=>!si(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>si(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return qe(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}function ni(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.panelItemLogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroupsProperly"));let s=!0;if("AND"===e.groupOP){s=void 0===a.find((e=>!ni(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>ni(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return qe(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}var oi=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 i=it(this.cache.get(e));t.viewLayoutPanel=i,t.appCounterRefs&&(i.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(i.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(i.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(i.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(i.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:i}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(i)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:i,blankMode:a,mainMenuAlign:s}=t;let n="";a?n="BLANK_MODE":s&&(n=s.toUpperCase());let o="";return o=""!==n?"".concat(e,"_").concat(i,"_").concat(n):"".concat(e,"_").concat(i),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function ri(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var ci=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))(ci||{})),di=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))(di||{})),li=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(li||{})),hi=t("StudioViewEvents",class{});hi.onViewMounted="onMounted",hi.onViewDestroyed="onDestroyed";var ui=t("StudioPanelEvents",class{});ui.onClick="onClick",ui.onChange="onChange",ui.onEnter="onEnter",ui.onLeave="onLeave";var pi=t("StudioControlEvents",class{});pi.onBeforeLoad="onBeforeLoad",pi.onLoadSuccess="onLoadSuccess",pi.onLoadError="onLoadError",pi.onBeforeLoadDraft="onBeforeLoadDraft",pi.onLoadDraftSuccess="onLoadDraftSuccess",pi.onLoadDraftError="onLoadDraftError",pi.onBeforeSave="onBeforeSave",pi.onSaveSuccess="onSaveSuccess",pi.onSaveError="onSaveError",pi.onBeforeRemove="onBeforeRemove",pi.onRemoveSuccess="onRemoveSuccess",pi.onRemoveError="onRemoveError",pi.CLICK="onClick";var mi=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.FIRST_RECORD="FirstRecord",t.LAST_RECORD="LastRecord",t.PREV_RECORD="PrevRecord",t.NEXT_RECORD="NextRecord",t.LOAD_MORE="LoadMore",t.SHOTR_CUT="ShortCut",t))(mi||{})),gi=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))(gi||{})),fi=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))(fi||{})),yi=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.ROUTE_MODAL="ROUTE_MODAL",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(yi||{})),wi=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))(wi||{})),Ei=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(Ei||{})),vi=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new lt,beforeDismiss:new lt},this._dismiss=t=>{ibiz.log.error(ibiz.i18n.t("runtime.utils.modal.externalClosureCapability"),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={};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),!1===e.allowClose?(ibiz.log.debug(ibiz.i18n.t("runtime.utils.modal.shouldDismissResult")),!1):(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function Ii(t,e){return t.filter((t=>{const{checkMode:i}=t,a=t.deformItemName||t.degridEditItemName;return 2!==i&&a===e}))}var bi=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")}}),Di=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,i){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==i)return!1;let a=-1;if(e==i?a=0:e>i&&(a=1),"EQ"===t||"ABSEQ"===t)return 0===a;if("GT"===t)return a>0;if("GTANDEQ"===t)return a>=0;if("LT"===t)return a<0;if("LTANDEQ"===t)return a<=0;if("NOTEQ"===t)return 0!==a}if("LIKE"===t)return null!=e&&null!=i&&-1!==e.toString().toUpperCase().indexOf(i.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=i&&0===e.toString().toUpperCase().indexOf(i.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Ci=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Ai=class extends Ci{parse(t){const e=t.length;let i=!0,a=!1,s=!1;for(let n=0;n<e;n++)if(i){const e=t[n];this.setCondOp(e),i=!1,a=!0}else if(a){const e=t[n];this.setParam(e),a=!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}},Pi=class t extends Ci{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const i=e.length;let a=!0,s=!0,n=!1;for(let r=0;r<i;r++){if(a&&s){if("!"===e[r]){this.setNotMode(!0),a=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,a=!1,n=!0}else if(n){const i=e[r];if(!(i instanceof Array))throw new o(ibiz.i18n.t("runtime.service.mustArray"));i.forEach((e=>{if(e.length>0){const i=e[0].toString();if("!"===i||"OR"===i||"AND"===i){const i=new t;i.parse(e),this.childCondList.push(i)}else{const t=new Ai;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Ti=class extends Pi{},Ni=class extends Ai{},xi=class t extends Di{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,i,a){if(e instanceof Pi){const t=e.getChildPSModelCondBases();if(null==t||et(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,i,a)){if(!s){n=!0;break}}else if(s){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Ai){et(e.getParam())&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noAttributeName"),e);const s=i[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||et(o)?n=e.getValue():(et(r)&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noContextParameterName")),t.PARAMTYPE_WEBCONTEXT===o?n=a.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=a.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,n)}return ibiz.log.warn(ibiz.log.warn(ibiz.i18n.t("runtime.service.conditionalObjects")),e),!1}createPSModelSingleCond(){return new Ni}createPSModelGroupCond(){return new Ti}};xi.PARAMTYPE_DATACONTEXT="DATACONTEXT",xi.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Si=t("PSDEDQCondEngine",xi);async function Li(t,e){var i;const a=null==(i=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:i.find((e=>e.pluginCode.toLowerCase()===t));if(a)return await ibiz.plugin.loadPlugin(a),"".concat(a.pluginType,"_").concat(a.pluginCode);ibiz.log.error(ibiz.i18n.t("runtime.register.helper.matchedPlugin",{pluginId:t}))}var Mi=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Ri(t,e){ibiz.register.register("".concat(Mi,"_").concat(t),e)}function Oi(t){return ibiz.register.get("".concat(Mi,"_").concat(t))}async function _i(t){let e;const{codeName:i,counterType:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Li(s,n);if(t&&(e=Oi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.adapter",{pluginKey:t}))}if("CUSTOM"===a){if(e=Oi(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.customizedSystemAdapter",{codeName:i}))}if(e=Oi(a),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.noFoundSystemCounter",{counterType:a}))}var Fi=class{static getRegisterKey(t,e){switch(t){case Yi:return this.calcKeyByView(e);case Gi:case Hi:case zi:return this.calcKeyByCtrl(e);default:return""}}static calcKeyByView(t){const{controlItemModel:e,controlModel:i,viewModel:a}=t;let s="";return(null==a?void 0:a.codeName)&&(s+="".concat(a.codeName.toUpperCase())),(null==i?void 0:i.codeName)&&(s+="@".concat(i.codeName.toUpperCase())),(null==e?void 0:e.id)&&(s+="@".concat(e.id.toUpperCase())),s}static calcKeyByCtrl(t){const{controlModel:e,controlItemModel:i}=t;let a="",s="APP";if(e){const{appDataEntityId:t,controlType:i,codeName:n}=e;t&&(s=Ae(t).toUpperCase()),i&&(a+="@".concat(i.toUpperCase())),n&&(a+="@".concat(n.toUpperCase()))}return(null==i?void 0:i.codeName)&&(a+="@".concat(i.codeName.toUpperCase())),a=s+a,a}},zi=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Vi(t){return ibiz.register.get("".concat(zi,"_").concat(t))}async function ki(t){let e;const{controlType:i,controlStyle:a,sysPFPluginId:s,appId:n}=t,o=Fi.getRegisterKey(zi,{controlModel:t});if(e=Vi(o),e)return e;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Li(s,n);if(t&&(e=Vi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Vi("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetStyleType",{controlType:i,controlStyle:a}),t)}if(e=Vi(i),e)return e;"DATAINFOBAR"!==i&&ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetType",{controlType:i}))}var Ui=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Bi(t){return ibiz.register.get("".concat(Ui,"_").concat(t))}async function Wi(t){let e;const{editorType:i,editorStyle:a,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Li(n,o);if(t&&(e=Bi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Bi("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorStyleType",{editorType:i,editorStyle:a}),t)}if(s){let n="".concat(s,"_").concat(i);if(a&&"DEFAULT"!==a&&(n+="_".concat(a)),e=Bi(n),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorTypePredefinedType",{editorType:i,predefinedType:s}),t)}if(e=Bi(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorType",{editorType:i}))}var Gi=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function ji(t){return ibiz.register.get("".concat(Gi,"_").concat(t))}async function Ki(t,e){let i;const{detailType:a,sysPFPluginId:s,appId:n}=t,o=Fi.getRegisterKey(Gi,{controlItemModel:t,controlModel:e});if(i=ji(o),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Li(s,n);if(t&&(i=ji(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberPlugin",{pluginKey:t}))}if(i=ji(a),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberType",{detailType:a}))}var Hi=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Xi(t){return ibiz.register.get("".concat(Hi,"_").concat(t))}async function qi(t,e){let i;const{columnType:a,enableRowEdit:s,sysPFPluginId:n,appId:o}=t,r=Fi.getRegisterKey(Hi,{controlItemModel:t,controlModel:e});if(i=Xi(r),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:r})),n){const t=await Li(n,o);if(t&&(i=Xi(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnPlugin",{pluginKey:t}))}const c=s?"".concat(a,"_EDIT"):a;if(i=Xi(c),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:c}))}var Yi=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Qi(t){return ibiz.register.get("".concat(Yi,"_").concat(t.toUpperCase()))}async function Ji(t,e,i){var a;let s;const{itemType:n,sysPFPluginId:o,appId:r,controlRenders:c}=t,d=Fi.getRegisterKey(Yi,{controlItemModel:t,controlModel:e,viewModel:i});if(s=Qi(d),s)return s;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:d})),o){const t=await Li(o,r);if(t&&(s=Qi(t)),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberPlugin",{pluginKey:t}))}if(c&&c.length>0)s=Qi("PREDEFINE_RENDER");else{if("CONTAINER"===n){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(s=Qi(i),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelContainerPredefined",{predefinedType:e,key:i}))}if("RAWITEM"===n){const e=(null==(a=t.rawItem)?void 0:a.predefinedType)||"DEFAULT",i="RAWITEM_".concat(e);if(s=Qi(i),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberDirectContent",{predefinedType:e,key:i}))}if("FIELD"===n){const{editor:e}=t;if(e&&e.predefinedType){if(s=Qi("FIELD_".concat(e.predefinedType.toUpperCase())),s)return s}}s=Qi(n)}if(s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberType",{itemType:n}))}var $i=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Zi(t){return ibiz.register.get("".concat($i,"_").concat(t))}async function ta(t){let e;const{portletType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Li(a,s);if(t&&(e=Zi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetPlugin",{pluginKey:t}))}if(e=Zi(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetMemberType",{portletType:i}))}var ea=t("UIACTION_PROVIDER_PREFIX","UIACTION");function ia(t,e){ibiz.register.register("".concat(ea,"_").concat(t),e)}function aa(t){return ibiz.register.get("".concat(ea,"_").concat(t))}async function sa(t){let e;const{uiactionMode:i,sysPFPluginId:a,appId:s,uiactionTag:n}=t;if(a){const t=await Li(a,s);if(t&&(e=aa(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorPlugin",{pluginKey:t}))}if(e=aa("".concat(i,"_").concat(n)),e)return e;if(e=aa(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorMode",{uiactionMode:i}))}var na=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function oa(t){let e;const{sysPFPluginId:i,appId:a}=t,s=await Li(i,a);if(s){if(e=ibiz.register.get("".concat(na,"_").concat(s)),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.frontEndPluginNode",{pluginKey:s}))}}var ra=t("VIEW_PROVIDER_PREFIX","VIEW");function ca(t){return ibiz.register.get("".concat(ra,"_").concat(t))}var da=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var la=t("PlatformProviderBase",class{back(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}init(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}async login(t,e,i){return ibiz.auth.login(t,e)}async download(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(i.data){const t=e;return c(i.data,t),Promise.resolve(!0)}throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"))}}),ha=t("BrowserPlatformProvider",class extends la{});var ua=window.navigator.userAgent.toLowerCase();function pa(){return/Android|Adr/i.test(ua)?"Android":/iPhone|iPod|iPad/i.test(ua)?"IOS":/MicroMessenger/i.test(ua)?"WeChat":/DingTalk/i.test(ua)?"DingTalk":/miniProgram/i.test(ua)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var ma=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function ga(t,e){ibiz.register.register("".concat(ma,"_").concat(t),e)}function fa(t){return ibiz.register.get("".concat(ma,"_").concat(t))}function ya(){const t=fa(pa());return t||fa("Browser")}var wa=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ea(t,e){ibiz.register.register("".concat(wa,"_").concat(t),e)}function va(t){return ibiz.register.get("".concat(wa,"_").concat(t))}async function Ia(t){let e;const{methodType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Li(a,s);if(t&&(e=va(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.entityBehaviorPlugin",{pluginKey:t}))}if(e=va(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.entityBehaviorMethod",{methodType:i}))}var ba=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Da(t){return ibiz.register.get("".concat(ba,"_").concat(t))}async function Ca(t){let e;const{columnType:i,appId:a,renderSysPFPluginId:s}=t;if(s){const t=await Li(s,a);if(t&&(e=Da(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.treeTableColumnPlugin",{pluginKey:t}))}if(e=Da(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:i}))}var Aa=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Pa(t){return ibiz.register.get("".concat(Aa,"_").concat(t))}async function Ta(t){let e;const{sysPFPluginId:i,appId:a,itemType:s}=t;if(i){const t=await Li(i,a);if(t&&(e=Pa(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.applicationMenu",{pluginKey:t}))}return e=Pa(s),e}var Na=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var xa=t("ERROR_VIEW_PROVIDER_PREFIX","ERROR_VIEW");var Sa=t("TOOLBAR_ITEM_PROVIDER_PREFIX","TOOLBAR_ITEM");async function La(t){let e;const{sysPFPluginId:i,appId:a}=t;if(i){const t=await Li(i,a);if(t&&(s=t,e=ibiz.register.get("".concat(Sa,"_").concat(s))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.toolbarItem",{pluginKey:t}))}var s;return e}var Ma=t("AC_ITEM_PROVIDER_PREFIX","AC_ITEM");var Ra=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new ht,this.data={},this.countChange=this.countChange.bind(this)}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load(),this.model.appDataEntityId&&ibiz.mc.command.change.on(this.countChange)}countChange(t){const e=t.data;if(this.model.appDataEntityId){const t=Ae(this.model.appDataEntityId);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}setParams(t,e){t&&(this.context=it(t)),e&&(this.params=it(e))}interval(){this.destroyInterval(),this.model.timer&&(this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer))}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o(ibiz.i18n.t("runtime.service.noImplementedCounter"))}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&ct(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(),ibiz.mc.command.change.off(this.countChange)}}),Oa=t("AppDECounter",class extends Ra{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const a=this.model.getAppDEActionId;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundCounterBehavior"));this.action=a,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}}),_a=t("AppDECounterProvider",class{createCounter(t){return new Oa(t)}});function Fa(){Ri("DEDR",(()=>new _a))}var za=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const i=new Si;return 1===e.length?i.parse(this.calcCond(e)[0]):e.length>1&&i.parse(["AND",this.calcCond(e)][0]),this.map.set(t,i),i}return null}static calcCond(t){const e=[];return t.forEach((t=>{const i=[];if("GROUP"===t.condType){const e=t;e.notMode&&i.push("!"),i.push(t.condOp);const a=e.dedqconditions;if(a){const t=this.calcCond(a);i.push(t)}}else{if("SINGLE"!==t.condType)throw new a(t,ibiz.i18n.t("runtime.service.unsupportedQueryTypes",{condType:t.condType}));{const e=t;i.push(e.condOp),i.push(e.fieldName),e.condValue?e.vartypeId?i.push({type:e.vartypeId,value:e.condValue}):i.push(e.condValue):i.push("")}}e.push(i)})),e}});za.map=new WeakMap;var Va=t("DynamicCodeListCache",class{constructor(t){if(this.cache=new Map,this.isPredefined=!1,this.context=d.create(),this.params={},this.evt=new ht,this.commonKeys=["query","queryconds","searchconds"],this.codeList=t,this.codeList.enableCache){this.codelistChange=this.codelistChange.bind(this);const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&ibiz.mc.command.change.on(this.codelistChange)}}setParams(t,e){t&&(this.context=d.create({},{...t})),e&&(this.params=it(e))}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new a(this.codeList,ibiz.i18n.t("runtime.service.predefinedType",{predefinedType:t}))}else this.initPromise=void 0})(),this.initPromise}convertData(t,e,i){const a={},{valueAppDEFieldId:s,textAppDEFieldId:n,iconClsAppDEFieldId:o,iconClsXAppDEFieldId:r,iconPathAppDEFieldId:c,iconPathXAppDEFieldId:d,disableAppDEFieldId:l,dataAppDEFieldId:h,clsAppDEFieldId:u,colorAppDEFieldId:p,thresholdGroup:m,beginValueAppDEFieldId:g,endValueAppDEFieldId:f,incBeginValueMode:y,incEndValueMode:w,bkcolorAppDEFieldId:E}=this.codeList,v=s?t[s]:t.srfkey;if(a.id=v,a.value=v,a.text=n?t[n]:t.srfmajortext,(o||r||c||d)&&(a.sysImage={appId:this.codeList.appId},o&&(a.sysImage.cssClass=t[o]),r&&(a.sysImage.cssClassX=t[r]),c&&(a.sysImage.imagePath=t[c]),d&&(a.sysImage.imagePathX=t[d])),l&&(a.disableSelect=Ha(t[l])),u&&(a.textCls=t[u]),p&&(a.color=t[p]),E&&(a.bkcolor=t[E]),h&&t[h])try{a.data=ei.execSingleLine(h,t)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.service.dynamicCodeTable"))}if(m){if(g&&(a.beginValue=t[g]),f&&(a.endValue=t[f]),y)switch(y){case 1:a.includeBeginValue=!0;break;case 2:a.includeBeginValue=0===e;break;case 3:a.includeBeginValue=e===i.length-1}if(w)switch(w){case 1:a.includeEndValue=!0;break;case 2:a.includeEndValue=0===e;break;case 3:a.includeEndValue=e===i.length-1}}return a}presetconvertData(t){const e={},{color:i,bkcolor:a,disabled:s,id:n,text:o,value:r,cls:c}=t;return e.value=r,e.color=i,e.bkcolor=a,e.text=o,e.id=n,e.disableSelect=s,e.cls=c,e.data=t,e}sortShoworder(t){return t.forEach((t=>{"showorder"in t||Object.assign(t,{showorder:1e3})})),t.sort(((t,e)=>t.showorder-e.showorder))}async load(t,e={}){const a={...e};this.commonKeys.forEach((t=>{delete a[t]})),this.setParams(t,a);const s=ibiz.hub.getApp(t.srfappid),{appDataEntityId:n,appDEDataSetId:o,minorSortAppDEFieldId:r,minorSortDir:c,pvalueAppDEFieldId:d,customCond:l}=this.codeList;if(r&&c&&Object.assign(a,{sort:"".concat(r.toLowerCase(),",").concat(c.toLowerCase())}),l){const e=he(ei.execSingleLine(l),a,t);Object.assign(a,e)}if(a.size||(a.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 s.net.get("/dictionaries/codelist/".concat(t),a),i=[],{items:n}=e.data;return this.sortShoworder(n).length&&n.forEach((t=>{i.push(this.presetconvertData(t))})),Object.freeze(i)}if(!n)throw new i(this.codeList,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));if(!o)throw new i(this.codeList,ibiz.i18n.t("runtime.service.unconfiguredDataset"));const h=await s.deService.exec(n,o,t,void 0,a);let u=[];if(h.data.length)if(d){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach(((t,e)=>{u.push(this.convertData(t,e,h.data))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:i}=this.codeList,a={},s=[];return t.forEach(((i,s)=>{a[i[e]]=this.convertData(i,s,t)})),t.forEach((t=>{const n=a[t[i]];n?(n.children=n.children||[],n.children.push(a[t[e]])):s.push(a[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const i=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(i)){const t=this.cache.get(i);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(i)}const a=this.load(t,e),{cacheTimeout:s}=this.codeList,n=-1===s||Z(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:a};this.cache.set(i,o);const r=await a;return o.items=r,delete o.promise,r}codelistChange(t){const e=t.data,{appDataEntityId:i}=this.codeList;if(i){const t=Ae(i);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}async refresh(){const t=JSON.stringify(this.context)+JSON.stringify(this.params);this.cache.delete(t);const e=await this.get(this.context,this.params);this.evt.emit("change",e)}onChange(t,e=!0){this.evt.on("change",t);const i=JSON.stringify(this.context)+JSON.stringify(this.params),a=this.cache.get(i);e&&ct(a)&&t(a.items)}offChange(t){this.evt.off("change",t)}destroy(){const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&this.codeList.enableCache&&ibiz.mc.command.change.off(this.codelistChange)}});function ka(t,e){if(null!=e){const{srfkey:t}=e;if(!Z(t)&&!et(t))return!0}throw new o(ibiz.i18n.t("runtime.service.processedWithout",{funcName:t}))}function Ua(t,e){const{srfsessionid:i}=e;if(!Z(i)&&!et(i))return!0;throw new o(ibiz.i18n.t("runtime.service.noExistProcessed",{funcName:t}))}var Ba=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 i=this.cacheMap.get(e.srfkey);i&&(i.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,it(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(ibiz.i18n.t("runtime.service.createPrimaryKeyData",{srfkey:e.srfkey}));try{Ua("add",t),(Z(e.srfkey)||et(e.srfkey))&&(e.srfkey=ut()),e.srftempdate=(new Date).getTime();const i=()=>{this.cacheMap.set(e.srfkey,it(e)),ibiz.log.warn("add",e.srfkey,e)},a=this.getTransaction(t);return a?a.change(e.srfkey,(()=>{i()})):i(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Ua("get",t);const i=this.cacheMap.get(e);return ibiz.log.warn("get",e,i),it(i)}catch(t){return ibiz.log.error(t),null}}update(t,e){const i=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),i!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:e.srfkey}));try{Ua("update",t),ka("update",e),e.srftempdate=(new Date).getTime();const a=this.cacheMap.get(i);if(a){const s=it(a);s.assign(e);const n=()=>{a.assign(e),i!==e.srfkey&&this.cacheMap.delete(i),this.cacheMap.set(e.srfkey,a),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{n()})):n(),s}throw new Error(ibiz.i18n.t("runtime.service.noExistNoUpdated"))}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Ua("delete",t);const i=e;if(this.cacheMap.has(i)){const e=this.cacheMap.get(i),a=()=>{this.cacheMap.delete(i),ibiz.log.warn("delete",i)},s=this.getTransaction(t);return s?s.change(i,(()=>{a()})):a(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Ua("add",t);const i=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},a=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(Z(s.srfkey)||et(s.srfkey))&&(s.srfkey=ut()),s.srftempdate=(new Date).getTime();const n=it(s);a?a.change(n.srfkey,(()=>{i(n)})):i(n)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Ua("update",t);const i=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},a=this.getTransaction(t);for(let s=0;s<e.length;s++){const n=e[s];ka("update",n);const r=n.srfkey;if(this.isUnionKey&&(this.calcUnionKey(n),r!==n.srfkey&&this.checkData(t,n.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:n.srfkey}));n.srftempdate=(new Date).getTime();const c=this.cacheMap.get(n.srfkey);if(!c)throw new Error(ibiz.i18n.t("runtime.service.dataNoExistNoUpdated",{srfdename:n.srfdename,srfmajortext:n.srfmajortext,srfkey:n.srfkey}));{const t=it(c);t.assign(n),e[s]=t,a?a.change(n.srfkey,(()=>{c.assign(n),i(c,r)})):(c.assign(n),i(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{const i=[];for(let a=0;a<e.length;a++){const s=e[a],n=this.delete(t,s);n&&i.push(n)}return i}catch(t){return ibiz.log.error(t),null}}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=at(t.srfkey)),delete t.srfkey;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e[i]=at(a)}return st(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>fe(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>Z(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}}),Wa=/\$\{(.*?)\}/g;function Ga(t,e){const i=(e.requestPaths||[]).map((t=>{const e=t.match(Wa);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:i}=e;return 0===i.length||i.every(((e,a)=>a===i.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(i.length>0)return i[0]}function ja(t,e){const i=Ga(t,e);if(i){if(i.keys.length>0){let{path:e}=i;return i.keys.forEach(((a,s)=>{e=s===i.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(a,"\\}")),""):e.replace("${".concat(a,"}"),t[a])})),e}return i.path}return""}var Ka=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(Z(e.page)||et(e.page)||(this.page=e.page),Z(e.size)||et(e.size)||(this.size=e.size),Z(e.query)||et(e.query)||(this.query=e.query),!Z(e.sort)&&!et(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 Ha(t){if("boolean"==typeof t)return t;if("number"==typeof t)return t>0;if("string"!=typeof t)return!!t;switch(t){case"true":return!0;case"false":return!1;default:{const e=Number(t);return!Number.isNaN(e)&&e>0}}}function Xa(t){const e={};if(!t)return e;const i=t.split(",");return i&&i.length>0&&i.forEach((t=>{const[i,a]=t.split(":");e[i]=parseInt(a,10)})),e}function qa(t){const e={};return t.forEach((t=>{e[t.srflistmapfield]=t,delete t.srflistmapfield})),e}function Ya(t){const e=[];return Object.keys(t).forEach((i=>{const a=t[i];a.srflistmapfield=i,e.push(a)})),e}var Qa=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 i=t.codeItems;let a=[];return(null==i?void 0:i.length)&&(a=this.formatStaticItems(i,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(a)),a}setCodeList(t){const{id:e,codeName:i}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(i,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var i;let a=t.text;t.textLanguageRes&&(a=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:a,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?ei.execSingleLine(t.data):void 0,sysImage:t.sysImage,userData:t.userData,beginValue:t.beginValue,endValue:t.endValue,includeBeginValue:t.includeBeginValue,includeEndValue:t.includeEndValue};return(null==(i=t.codeItems)?void 0:i.length)&&(n.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(n)}))}async getDynamicCodeList(t,e,i={}){let a;const s=t.codeName;return this.cache.has(s)?a=this.cache.get(s):(a=new Va(t),this.cache.set(s,a),await a.init()),a.get(e,i)}async get(t,e,i){const a=this.allCodeLists.get(t);if(!a)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,e,i):[]}async getCodeListInstance(t){let e;const i=this.allCodeLists.get(t);if(!i)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));if("DYNAMIC"===i.codeListType){const t=i.codeName;this.cache.has(t)?e=this.cache.get(t):(e=new Va(i),this.cache.set(t,e),await e.init())}return e}destroy(){Array.from(this.cache.values()).forEach((t=>{t instanceof Va&&t.destroy()}))}}),Ja=t("ConfigService",class{constructor(t,e,i){this.appId=t,this.folder=e,this.tag=i,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||{}}}),$a=t("CounterService",class{static async getCounter(t,e,i){let a=t.id;if(i&&i.srfcustomtag&&(a=i.srfcustomtag),this.counterMap.has(a)){const t=this.counterMap.get(a);if(!1===t.isDestroyed)return t;this.counterMap.delete(a)}const s=(await _i(t)).createCounter(t);return await s.init(e,i),this.counterMap.set(a,s),s}static async getCounterByRef(t,e,a){const{appCounter:s}=t;if(!s)throw new i(t,ibiz.i18n.t("runtime.service.noConfiguredCounters"));return this.getCounter(s,e,a)}});$a.counterMap=new Map;var Za=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:i}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(i))}async getWFLink(t,e){const i=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:a}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(i,"/usertasks/").concat(a,"/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,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(i,t)})}async wfSubmit(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(i,t)})}async wfWithdraw(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(i,t)})}async wfReassign(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepBefore(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepAfter(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(i,t)})}async wfSendBack(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(i,t)})}async wfSendCopy(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(i,t)})}async exec(t,e,i={},a={}){switch(t){case"wfstart":return this.wfStart(e,i,a);case"wfsubmit":return this.wfSubmit(e,i,a);case"reassign":return this.wfReassign(e,i,a);case"addstepbefore":return this.wfAddStepBefore(e,i,a);case"addstepafter":return this.wfAddStepAfter(e,i,a);case"sendback":return this.wfSendBack(e,i,a);case"sendcopy":return this.wfSendCopy(e,i,a);default:throw new o(ibiz.i18n.t("runtime.service.noImplemented",{methodName:t}))}}}),ts=class{constructor(t){this.model=t}exportData(t,e,i,a){const s=ja(i,this.model),n="".concat(s,"/").concat(this.model.deapicodeName2,"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:a,responseType:"blob"})}},es=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(es||{})),is=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,i={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:it(i instanceof t?i._data:i)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const a=fe(e.appDEFields||[],e.keyAppDEFieldId);if(a){const t=a.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(ibiz.i18n.t("runtime.service.noConfiguredPrimary",{codeName:e.codeName}));const s=fe(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(ibiz.i18n.t("runtime.service.noConfiguredField",{codeName:e.codeName}));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:Z(this.srfkey)?ut():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:i}=this,a={};Object.keys(e).forEach((t=>{a[t]={enumerable:!0,set(i){e[t]=i},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();a[s]={enumerable:!0,set(a){e[s]=i(a,t.stdDataType)},get:()=>e[s]},e[s]=i(e[s],t.stdDataType)})),Object.defineProperties(this,a)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e.srfordervalue=this.srfordervalue,e}assign(e){let i={};return e instanceof t?(i=e._data,this.srfordervalue=e.srfordervalue):i=e,Object.keys(i).forEach((t=>{void 0===i[t]&&delete i[t]})),Object.assign(this._data,i),this}convertVal(t,e){if(null==t)return t;if(Z(e))return t;if(l.isNumber(e)){const e=Z(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),as=t("MethodDto",class{constructor(t,e,i,a){this.service=t,this.entity=e,this.isLocalMode=i,this.dto=a,this.dtoMap=new Map,a?(this.app=ibiz.hub.getApp(e.appId),this.fields=a.appDEMethodDTOFields||[]):this.fields=[]}async get(t,e,s=!1){if(!0===t.srfsimple&&!1===this.isLocalMode)return e=this.format(t,e);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:qa(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const a=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=a.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const i=it(t);i[this.entity.codeName.toLowerCase()]=e.srfkey;const a={};h.parentAppDEFieldId&&(a[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,i,a)}else{if(r.entity.id===this.entity.id)throw new i(c,ibiz.i18n.t("runtime.service.subRelationships"));u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,i=[];for(let a=0;a<e.length;a++)i.push(await r.get(t,e[a],!0));n[d]=i}}break;default:throw new a(c,ibiz.i18n.t("runtime.service.unsupportedMethod",{type:c.type}))}}return{...e,...n}}async sets(t,e){if(!0===t.srfsimple&&!1===this.isLocalMode){if(e&&e.length>0){for(let i=0;i<e.length;i++)e[i]=this.format(t,e[i]);return e.map((t=>this.service.createEntity(t)))}return[]}const i=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const s=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[s])e[s]=Ya(e[s]);else{if(!a.refAppDataEntityId)return;const n=i.getDERConfig(a.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,a);n||o.service.local.clear();const r=e[s];if(r&&r.length>0){const i=e[this.entity.keyAppDEFieldId];a.refPickupAppDEFieldId&&r.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[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 i=ibiz.uiDomainManager.get(t.srfsessionid),a=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<a.length;s++){const n=a[s];if(!n.refAppDataEntityId)continue;if(0===i.getDERConfig(n.refAppDataEntityId).length){const a=await this.getFieldDto(t,n);a.entity.minorAppDERSs&&i.setDERConfig(n.refAppDataEntityId,a.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await a.calcRs(t,e)}}}format(t,e){const i={};for(let t=0;t<this.fields.length;t++){const a=this.fields[t],s=a.codeName.toLowerCase();"DTOS"===a.type&&a.listMap&&("[object Object]"===Object.prototype.toString.call(e[s])&&(i[s]=Ya(e[s])),"[object Array]"===Object.prototype.toString.call(e[s])&&(i[s]=qa(e[s])))}return{...e,...i}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const i=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),a=fe(i.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,i.id);s.isLocalMode=!0;const n=s.createMethodDto(a,{isLocalMode:!0});return this.dtoMap.set(e.codeName,n),n}}),ss=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Ba(e),this.configCache=new Ja(e.appId,"PSAppDataEntity",e.codeName),this.wf=new Za(e),this.file=new ts(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=ve(this.model,t);if(!n)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundServiceMethod",{id:t}));const o=await Ia(n);if(!o)throw new a(n,ibiz.i18n.t("runtime.service.UnsupportedServiceMethod",{methodType: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,i,a,s){const n=await this.getMethod(t);if(n)return n.exec(e,i,a,s);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}getDraft(t,e,i){return this.exec("GetDraft",t,e,i)}create(t,e,i){return this.exec("Create",t,e,i)}get(t,e,i){return this.exec("Get",t,e,i)}update(t,e,i){return this.exec("Update",t,e,i)}remove(t,e,i){return this.exec("Remove",t,e,i)}fetchDefault(t,e,i){return this.exec("FetchDefault",t,e,i)}getDraftTemp(t,e,i){return this.exec("GetDraftTemp",t,e,i)}createTemp(t,e,i){return this.exec("CreateTemp",t,e,i)}getTemp(t,e,i){return this.exec("GetTemp",t,e,i)}updateTemp(t,e,i){return this.exec("UpdateTemp",t,e,i)}removeTemp(t,e,i){return this.exec("RemoveTemp",t,e,i)}fetchTempDefault(t,e,i){return this.exec("FetchTempDefault",t,e,i)}async execAc(t,e,i,a={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,i,a);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}aiChatSse(t,e,i={},a={}){const s=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(e);return new Promise(((e,o)=>{s.net.sse("/".concat(n),{srfactag:"AIChat",...i},{headers:{"Content-Type":"application/json"},body:JSON.stringify(a),onmessage:e=>{if(e.data){const i=JSON.parse(e.data);t(i)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},i={}){const a=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return a.net.post(s,i,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const i=t[this.model.codeName.toLowerCase()],a="/".concat(this.model.deapicodeName2,"/ssechatcompletion").concat(e?"/histories":"").concat(i?"/".concat(i):"");return ja(t,this.model)+a}newEntity(t){return t instanceof is?t.clone():new is(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 as(this,this.model,null==e?void 0:e.isLocalMode,t)}}),ns=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],os=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:Z(this.srfkey)?ut():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 i=t.dataKey;this.linkProperty(e,i,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,i){const a=!i||i.isOriginField;ns.includes(t)||(a||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=it(this.$origin),i=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{i[t]=this[t]})),i}}),rs=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,i,a){const s=this.handleCustomRequestHeader(),n=await this.app.deService.exec(this.model.appDataEntityId,t,e,i,a,s);return await this.handleItemPrivilege(n.data,e),n}async handleItemPrivilege(t,e){const{enableItemPrivilege:i,appDataEntityId:a}=this.model;if(t&&i&&a){const i=await this.app.authority.getService(a);(Array.isArray(t)?t:[t]).forEach((t=>{i.setDataAccAction({srfkey:t.srfkey,srfsessionid:e.srfsessionid},t.srfdataaccaction)}))}}handleCustomRequestHeader(){const t={},{enableItemPrivilege:e}=this.model;return e&&Object.assign(t,{srfdataaccaction:!0}),t}handleResponse(t){return h(t)}toUIData(t){return new os(t,this.dataUIMap)}}),cs=t("MDControlService",class extends rs{async fetch(t,e={}){var i;const a=(null==(i=this.model.fetchControlAction)?void 0:i.appDEMethodId)||"fetchdefault";let s=await this.exec(a,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var i;const a=(null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get";let s=await this.exec(a,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var i;const a=(null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft";let s=await this.exec(a,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var i;const a=(null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove";return await this.exec(a,t,void 0,e)}async create(t,e){var i;const a=(null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,i={}){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.headers["x-total-pages"]&&(e.totalPages=Number(e.headers["x-total-pages"]))),e.ok&&(pt(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),ds=t("DeAuthorityService",class{constructor(t){this.entityModel=t,this.dataAccActionMap=new Map}setDataAccAction(t,e){t.srfsessionid&&this.dataAccActionMap.set("".concat(t.srfsessionid,"-").concat(t.srfkey),e),this.dataAccActionMap.set(t.srfkey,e)}getDataAccAction(t){return this.dataAccActionMap.get(t)}async calcByDataAccessAction(t,e,i,a){if(a){if(!await this.calcDeDataAccAction(t,e,i))return!1}return!!await this.calcByDeMainState(t,e)}async calcMajorDataAccAction(t){const{minorAppDERSs:e}=this.entityModel;if(!e)return;const i=null==e?void 0:e.find((e=>{const i=Ae(e.majorAppDataEntityId);return Object.prototype.hasOwnProperty.call(t,i)&&t[i]}));if(!i)return;const a=await ibiz.hub.getApp(t.srfappid),s=await a.authority.getService(i.majorAppDataEntityId);if(!s)return;const n=Ae(i.majorAppDataEntityId);return s.getDataAccAction("".concat(t.srfsessionid,"-").concat(t[n]))||s.getDataAccAction("".concat(t[n]))}async calcDeDataAccAction(t,e,i){let a,s=!0;const{dataAccCtrlMode:n}=this.entityModel;switch(n){case 1:a=(null==e?void 0:e.srfdataaccaction)?Xa(e.srfdataaccaction):void 0;break;case 2:case 3:if(a=Xa(await this.calcMajorDataAccAction(i)),e&&e.srfdataaccaction){const t=Xa(e.srfdataaccaction);Object.assign(a,t)}}return a&&t&&!a[t]&&(s=!1),s}async calcByDeMainState(t,e={}){let i=!0;if(0===Object.keys(e).length)return i;const a=this.entityModel;if(!a.enableDEMainState||!a.demainStates)return ibiz.log.debug(ibiz.i18n.t("runtime.service.mainState",{codeName:a.codeName})),i;ibiz.log.debug(ibiz.i18n.t("runtime.service.operationIdentifier",{dataAccessAction:t}),e,a);const s=De(a,e);if(s){ibiz.log.debug(ibiz.i18n.t("runtime.service.matchMasterState"),s);const e=Ce(s,a);ibiz.log.debug(ibiz.i18n.t("runtime.service.masterStatePermissions"),e),i=e.includes(t)}else ibiz.log.debug(ibiz.i18n.t("runtime.service.noMatchedState")),i=!1;return ibiz.log.debug(ibiz.i18n.t("runtime.service.permissionCalculation",{dataAccessAction:t,result:i})),i}}),ls=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(ibiz.i18n.t("runtime.service.noFound",{id:t}));const i=this.constructorCache.get(t);let a;a=i?await i(e):new ds(e),this.cache.set(t,a)}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 calcByNoDataAccessAction(t,e,i){if(this.enablePermission){const a=await ibiz.hub.getApp(this.appModel.appId),s=await a.getOPPriv(t,i);if(this.enablePermission&&(null==s?void 0:s.mapSysUniResCode)){if(!this.calcByResCode(s.mapSysUniResCode))return!1}else if(i){const a=await this.getService(i),s=Xa(await a.calcMajorDataAccAction(e));if(s&&t&&!s[t])return!1}}return!0}async calcByDataAccessAction(t,e,i,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(a){return(await this.getService(a)).calcByDataAccessAction(t,i,e,this.enablePermission)}return!0}}),hs=t("V7AuthService",class{get isAnonymous(){return"1"===mt(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error(ibiz.i18n.t("runtime.service.noFoundUsernamePassword")),!1;const i=await this.login(t,e);if(i){gt(u.IS_ANONYMOUS,"1",0,!0);const t=mt(u.TOKEN),e=mt(u.TOKEN_EXPIRES),i=mt(u.TOKEN_REMEMBER),a=mt(u.REFRESH_TOKEN);gt(u.TOKEN,t,0,!0),gt(u.TOKEN_EXPIRES,e,0,!0),gt(u.TOKEN_REMEMBER,i,0,!0),a&>(u.REFRESH_TOKEN,a,0,!0)}return i}async login(t,e,i,a){try{this.clearAuthData();const s=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:i},{},a),{data:n}=s;if(n&&n.token){const t=i?30:0;i&>(u.TOKEN_REMEMBER,"1",t,!0),gt(u.TOKEN,n.token,t,!0);const e=(new Date).getTime()+1e3*(n.expirein||7199);gt(u.TOKEN_EXPIRES,"".concat(e),t,!0),n.refresh_token&>(u.REFRESH_TOKEN,n.refresh_token,t,!0),ft(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.loginFailure"),desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),this.clearAuthData(),!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.logoutFailure"),desc:t.message||""})}return!1}async changePwd(t,e){try{return{ok:!0,result:await ibiz.net.post("/uaa/changepwd",{oldPwd:t,newPwd:e})}}catch(t){return{ok:!1,result:t}}}async extendLogin(){if(this.isAnonymous)return;const t=mt(u.TOKEN),e=mt(u.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=mt(u.TOKEN_REMEMBER),e=mt(u.REFRESH_TOKEN),i=t?30:0;let a;if(a=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),a.ok){t&>(u.TOKEN_REMEMBER,"1",i,!0),gt(u.TOKEN,a.data.token,i,!0);const e=(new Date).getTime()+1e3*(a.data.expirein||7199);gt(u.TOKEN_EXPIRES,"".concat(e),i,!0),a.data.refresh_token&>(u.REFRESH_TOKEN,a.data.refresh_token,i,!0),await this.loadAppData(),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}async refreshToken(){const t=mt(u.TOKEN_REMEMBER),e=mt(u.REFRESH_TOKEN);if(null!=e&&""!==e){const i=await ibiz.net.get("/uaa/refresh_token/".concat(e));if(i.ok){const e=t?30:0;t&>(u.TOKEN_REMEMBER,"1",e,!0),gt(u.TOKEN,i.data.token,e,!0);const a=(new Date).getTime()+1e3*(i.data.expirein||7199);gt(u.TOKEN_EXPIRES,"".concat(a),e,!0),i.data.refresh_token&>(u.REFRESH_TOKEN,i.data.refresh_token,e,!0),ft(u.IS_ANONYMOUS)}}}getAuthInfo(){const t=mt(u.TOKEN),e=!!mt(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)}clearAuthData(){ft(u.TOKEN),ft(u.TOKEN_EXPIRES),ft(u.TOKEN_REMEMBER),ft(u.REFRESH_TOKEN),ft(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0}}),us=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return Z(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),ps=t("MethodInput",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const s=i.appDEMethodInput;if(s){const i=fe(e.appDEMethodDTOs||[],s.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}async format(t,e){return this.dto?this.dto.format(t,e):e}}),ms=t("MethodReturn",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const s=i.appDEMethodReturn;if(s){const i=fe(e.appDEMethodDTOs||[],s.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const i=ibiz.hub.getApp(this.entity.appId),a=ibiz.uiDomainManager.get(t.srfsessionid);a&&!0!==a.state.rsInit&&(await this.dto.calcRs(t),a.calcParentRs(),a.state.rsInit=!0),a.dataChangeCompleted(),i.deService.clearTempCacheByRs({srfappid:i.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return dt(e)&&(e={}),new is(this.entity,e)}async format(t,e){return this.dto?this.dto.format(t,e):e}}),gs=t("Method",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a,this.app=ibiz.hub.getApp(e.appId),this.input=new ps(t,e,i),this.result=new ms(t,e,i)}async request(t,e,a,s,n){const{actionType:o,requestMethod:r}=this.method;if("REMOTE"===o){const e=this.method.requestPath;let o=null;switch(r){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),a||s||{},{},n);break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),a||s,n);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),a||s||{},n);break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),a||s);break;default:throw new i(this.method,r?ibiz.i18n.t("runtime.service.requestMethods",{requestMethod:r}):ibiz.i18n.t("runtime.service.noConfiguredRequestMethod"))}return o}throw new i(this.method,ibiz.i18n.t("runtime.service.unsupportedBehaviorTypes",{actionType:o}))}mergeRequestPath(t,e){return e?"".concat(t).concat(e):"".concat(t)}calcPath(t){const e="/".concat(this.entity.deapicodeName2);return ja(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}calcMultiData(t,e){let i="";return e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]),i.split(";")}}),fs=class{constructor(t,e,i,a){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:z(i)?i:[i],params:a}}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)}},ys=class{},ws=class extends ys{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];let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.missingConditionValue"));const t=null!=s[this.value]?s[this.value]:e[this.value];r=t,o=qe(n[this.dstField],this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.sourceDataMissingConditionValue"));const e=t.params[this.srcParam];r=e[this.value],o=qe(n[this.dstField],this.op,e[this.value]);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.noSupportedTime"));default:r=this.value,o=qe(n[this.dstField],this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityLogicalConnection",{name:this.model.name,type:this.type,dstField:this.dstField}),n[this.dstField],ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},Es=class t extends ys{constructor(e){super(),this.model=e;const i=e.conds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new ws(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let s="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.connectionConditional"));for(let i=0;i<this.conds.length;i++){const n=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}const n=this.notMode?!s:s;return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityConnectionConditional",{name:this.model.name,id:this.model.id}),n),n}},vs=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new Es(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},Is=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new vs(t)))}},bs=class extends Is{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDELogicParamId:s,retDELogicParamId:n}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.entityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDELogicParamId:n}),t.params[n])}},Ds=class extends Is{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startupNode",{id:this.model.id}))}},Cs=class extends Is{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:i,rawValue:s}=this.model;if(i){switch(i){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 a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedReturnType",{returnType:i}))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endNode",{id:this.model.id,returnType:i}),t.result)}}};function As(t,e){const{srcDELogicParamId:i,srcFieldName:s,srcValue:n,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[i],t.isEntityParam(i)&&(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=it(ibiz.env);break;case"EXPRESSION":if(!o)throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.expressionEmpty"));c=ei.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:r}))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:ei.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:d}),c),t}return c}var Ps=class extends Is{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{let i,s;switch(e.dstDELogicParamId&&"DEBUG"===ibiz.env.logLevel&&(s=it(t.params[e.dstDELogicParamId])),e.paramAction){case"SETPARAMVALUE":i=this.setParamValue(e,t);break;case"RESETPARAM":i=this.resetParam(e,t);break;case"COPYPARAM":i=this.copyParam(e,t);break;case"BINDPARAM":i=this.bindParam(e,t);break;case"RENEWPARAM":i=this.renewParam(e,t);break;case"APPENDPARAM":i=this.appendParam(e,t);break;case"SORTPARAM":i=this.sortParam(e,t);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:e.paramAction}))}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.preparationParameter",{id:this.model.id,paramAction:e.paramAction,dstDELogicParamId:e.dstDELogicParamId}),s,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[e.dstDELogicParamId]),i})))}copyParam(t,e){const{dstDELogicParamId:i}=t,a=As(e,t);e.params[i]=it(a)}bindParam(t,e){const i=As(e,t);e.params[t.dstDELogicParamId]=i}setParamValue(t,e){const{dstFieldName:i,dstDELogicParamId:a}=t;let s=i;e.isEntityParam(a)&&(s=null==s?void 0:s.toLowerCase());const n=As(e,t);s?e.params[a][s]=n:e.params[a]=n}resetParam(t,e){const{dstDELogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDELogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDELogicParamId:i,dstIndex:a,srcIndex:s,srcSize:n}=t,o=As(e,t),r=a||0,c=s||0,d=n||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:i,dstFieldName:a,dstSortDir:s}=t,n=a.toLowerCase();e.params[i].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Ts=class extends Is{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDELogicParamId:a,retDELogicParamId:s}=this.model,n=t.params[a],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(i,e,t.context,n);r.ok&&(t.params[s]=r.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.dataSet",{id:this.model.id,dstAppDataEntityId:i,dstAppDEDataSetId:e,retDELogicParamId:s}),t.params[s])}},Ns=class extends Is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const s=As(t,this.model);t.params[e]=s,ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.logicNodeParameterName",{id:this.model.id,dstDELogicParamId:e}),s)}},xs=class extends Is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.resetParameter",{id:this.model.id,dstDELogicParamId:e}))}},Ss=class extends Is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.rebuildParameter",{id:this.model.id,dstDELogicParamId:e}))}},Ls=class extends Is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const s=As(t,this.model);t.params[e]=it(s),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.copyParameter",{id:this.model.id,dstDELogicParamId:e}),s)}},Ms=class extends Is{async exec(t){const{dstDELogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const n=s.toLowerCase(),o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[n]-e[n]:e[n]-t[n])),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.sortedArrayParameters",{id:this.model.id,dstFieldName:s,dstSortDir:a,dstDELogicParamId:e}),o)}},Rs=class extends Is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const r=As(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.additionalParameter",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},Os=class extends Is{async exec(t){const{errorCode:e,errorInfo:i}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.throwsException",{id:this.model.id,errorCode:e,errorInfo:i})),new s({response:{status:e,statusText:i}})}},_s=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model;if(i.default)i.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(i.appGlobalParam)t.params[e]=it(ibiz.env);else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]={};else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.appContextParam)t.params[e]=t.parameters.context;else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.cloneParam)t.params[e]=it(t.data||{});else{if(i.envParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.environmentVariables"));if(i.fileListParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectListVariable"));if(i.fileParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectVariables"));if(i.filterParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.filterObjectVariables"));if(i.lastParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.finalDataVariables"));if(i.originEntity)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.rawDataObjects"));if(i.sessionParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.operationSessionVariables"))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.calculateEntity",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.reEstablish",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}},Fs=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 i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noScriptCode"));this.scriptFn=ei.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noConfigurationLogicNode"));t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new Ds(t);break;case"END":i=new Cs(t);break;case"DEACTION":i=new bs(t);break;case"PREPAREPARAM":i=new Ps(t);break;case"DEDATASET":i=new Ts(t);break;case"THROWEXCEPTION":i=new Os(t);break;case"BINDPARAM":i=new Ns(t);break;case"RESETPARAM":i=new xs(t);break;case"COPYPARAM":i=new Ls(t);break;case"RENEWPARAM":i=new Ss(t);break;case"APPENDPARAM":i=new Rs(t);break;case"SORTPARAM":i=new Ms(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new _s(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,a){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:a});const s=new fs(this.params,t,e,a);this.initLogicParams(s);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{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:i}=t;for(let a=0;a<i.length;a++){const s=i[a];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!0!==t.model.parallelOutput))break}}},zs=new Map;async function Vs(t,e,i={},a={}){zs.has(t)||zs.set(t,new Fs(t)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startExecuting",{id:t.id,name:t.name}));const s=zs.get(t),n=await s.exec(e,i,a);return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endExecution",{id:t.id,name:t.name})),n}async function ks(t,e,i,a,s){const n=await async function(t,e,i){return Te(t,await ibiz.hub.getAppDataEntity(e,i))}(t,e,i.srfappid);if(!n)throw new o(ibiz.i18n.t("runtime.deLogic.deLogicNode.noFoundEntityLogic",{dataEntityId:e,deDELogicId:t}));return Vs(n,i,a,s)}async function Us(t,e,i,a){const n=it(e),o=i?it(i):i,r=a?it(a):a;try{const e=await Vs(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function Bs(t,e,i,a,s){const n=Ne(t,e);if(n.length){(await Promise.all(n.map((t=>Vs(t,i,a,s))))).forEach((t=>{Object.assign(a,t)}))}}async function Ws(t,e,i,a,s={}){if(a){if(!z(a))return Bs(t,e,i,a,s);await Promise.all(a.map((a=>Bs(t,e,i,a,s))))}}var Gs=t("DEActionMethod",class extends gs{async inputHandle(t,e){return z(e)?e:this.input.handle(t,e)}async inputFormat(t,e){const i=async e=>this.input.format(t,e);if(Array.isArray(e)){const t=[];for(let a=0;a<e.length;a++)t.push(await i(e[a]));return t}return i(e)}async exec(t,e,a,s){let n;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await Ws(this.entity,"change",t,e,a),"DELOGIC"===this.method.actionType){const s=Te(this.method.appDELogicId,this.entity);if(!s)throw new i(this.method,ibiz.i18n.t("runtime.service.lackEntityLogic"));n=await Us(s,t,e,a)}else{e&&(e=this.isLocalMode?await this.inputFormat(t,e):await this.inputHandle(t,e));switch(this.method.actionTag?this.method.actionTag.toUpperCase():this.method.codeName.toUpperCase()){case"CREATE":n=await this.create(t,e,a||{},s);break;case"GET":n=await this.get(t,a,s);break;case"GETDRAFT":n=await this.getDraft(t,a,s);break;case"REMOVE":n=await this.remove(t,a);break;case"UPDATE":n=await this.update(t,e,a,s);break;case"CREATETEMP":n=await this.createTemp(t,e);break;case"GETTEMP":n=await this.getTemp(t,e);break;case"GETDRAFTTEMP":n=await this.getDraftTemp(t,a);break;case"REMOVETEMP":n=await this.removeTemp(t,e);break;case"UPDATETEMP":n=await this.updateTemp(t,e);break;default:{let i=this.calcPath(t);if(this.method.needResourceKey){let a=t[this.entity.codeName.toLowerCase()];_(a)&&(a=z(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),i="".concat(i,"/").concat(a)}const o=await this.request(i,t,e,a,s);o.data||ibiz.log.error(ibiz.i18n.t("runtime.deAction.responseDataError"),o),a&&a.srfupdateitem||(o.data=await this.result.handle(t,o.data)),n=o}}}return n.data&&await Ws(this.entity,"compute",t,n.data,a),n}async create(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.createBehavior"));if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const s=this.calcPath(t),n=await this.app.net.post(s,e,i,a);return n.data=await this.result.handle(t,n.data),n}async remove(t,e,i){if(this.isLocalMode){const i=this.calcMultiData(t,e);return i.length>1?this.removeBatchTemp(t,i):this.removeTemp(t,e)}const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i)}async update(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.updateBehavior"));if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const s=this.calcPath(t),n=await this.app.net.put("".concat(s,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i,a);return n.data=await this.result.handle(t,n.data),n}async get(t,e={},i={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i);return s.data=await this.result.handle(t,s.data),s}async getDraft(t,e,i){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get(this.mergeRequestPath(a,this.method.requestPath),e,i);return s.data=await this.result.handle(t,s.data),s}async createTemp(t,e){try{const i=this.createEntity(e);let a;a=z(i)?await Promise.all(i.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,i));const s=ibiz.uiDomainManager.get(t.srfsessionid);return s&&s.dataChange(),new p(a)}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 i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(i,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const a=this.service.local.delete(t,i);if(a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new p(a)}return new p(a,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,a){const s=ibiz.uiDomainManager.get(e.srfsessionid),n=s.transaction;let o=!1;!1===n.state.isOpen&&(n.open(),o=!0);try{let a=s.getDERConfigByMajor(this.entity.id);if(a.length>0){const s=this.service.local.get(e,t);a=yt(a,"removeOrder");for(const n of a){if("DER1N"!==n.rstype)throw new i(n,ibiz.i18n.t("runtime.service.deletionDeletion"));const{removeActionType:a,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=n,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=it(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(a){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const i=await l.remove(h,e);if(!1===i.ok)throw new Error(i.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 i=await l.updateTemp(h,e);if(!1===i.ok)throw new Error(i.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e=ibiz.i18n.t("runtime.service.unableDelete",{logicName:this.entity.logicName,srfmajortext:s.srfmajortext,modelLogicName:l.model.logicName,msg: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 i=this.createEntity(e);let a;if(a=z(i)?await Promise.all(i.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,i)),a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new p(a)}return new p(a,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);const a=this.service.local.get(t,i);return a?new p(a):new p(a,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){try{const i=this.service.local.deleteBatch(t,e);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}attach(t,e){const i=t.srfsessionid,a=ibiz.uiDomainManager.get(i).getDERConfig(this.entity.id);return a.length>0&&a.forEach((i=>{if(i.parentAppDEFieldId){const{majorAppDataEntityId:a,parentAppDEFieldId:s}=i,n=Ae(a),o=s.toLowerCase(),r=t[n];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),js=class{create(t,e,i,a){return new Gs(t,e,i,a.localMode)}},Ks=t("FetchMethod",class extends gs{async exec(t,e,i,s){const n=e&&!z(e)?e:i||{};let o;if(this.isLocalMode){const e=za.getCond(this.method),i=new Ka(t,n),a=await this.searchLocal(e,i);o=new p(a,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,n);break;case"REMOTE":{const a=this.calcPath(t);o=await this.request(a,t,e,i,s)}break;default:throw new a(this.method,ibiz.i18n.t("runtime.service.noSupportedDataSource",{dataSetType:this.method.dataSetType}))}const r=o.data||[];for(let e=0;e<r.length;e++)r[e]=await this.result.format(t,r[e]);o.data=r.map((t=>this.createEntity(t)))}return o.data&&await Ws(this.entity,"compute",t,o.data,n),o}async searchLocal(t,e,i=this.entity.quickSearchAppDEFieldIds){let a=this.service.local.getList();t?a.length>0&&(a=a.filter((i=>t.test(i,e)))):a.length>0&&e.query&&""!==e.query&&i&&(a=a.filter((t=>{const a=new RegExp(e.query);for(let e=0;e<i.length;e+=1){const s=t[i[e]];if(a.test(s))return!0}return!1}))),Z(e.sortField)||et(e.sortField)||(a="DESC"===e.sortMode?wt(a,e.sortField):yt(a,e.sortField));const{page:s,size:n}=e,o=s*n,r=(s+1)*n-1;return a.slice(o,r).map((t=>it(t)))}async fetchCodeListSet(t,e){const{appCodeListId:a}=this.method;if(!a)throw new i(this.method,ibiz.i18n.t("runtime.service.sourceCodeTable"));const s=await this.app.codeList.get(a,t,e),{keyAppDEFieldId:n,majorAppDEFieldId:o}=this.entity,r=s.map((t=>({[n]:t.value,[o]:t.text})));return new p(r,200)}}),Hs=t("AcFetchMethod",class extends Ks{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Xs=class{create(t,e,i,a){return a.acMode?new Hs(t,e,i,a.localMode):new Ks(t,e,i,a.localMode)}};function qs(){const t=new js;Ea("DEACTION",(()=>t));const e=new Xs;Ea("FETCH",(()=>e)),Ea("FETCHTEMP",(()=>e))}var Ys=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"timestamp,desc"};Object.assign(e,t);const i=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),e);return i.headers&&(i.headers["x-page"]&&(i.page=Number(i.headers["x-page"])),i.headers["x-per-page"]&&(i.size=Number(i.headers["x-per-page"])),i.headers["x-total"]&&(i.total=Number(i.headers["x-total"]))),Z(i.data)&&(i.data=[]),i}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}async markRead(t){await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/mark_read"),{})}async batchMarkRead(){await ibiz.net.post("".concat(this.baseUrl,"/mark_all_read"),{})}async getUnreadNum(){const t=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),{page:0,size:1,sort:"timestamp,desc",searchconds:[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]});return t.headers["x-total"]?Number(t.headers["x-total"]):0}}),Qs=t("MarkOpenDataService",class{constructor(){this.callbackMap=new Map,this.baseUrl="/portal/markopendata",ibiz.mc.command.markOpenData.on((t=>{const e=t.data,{entity:i,key:a}=e,s="".concat(i,"_").concat(a);this.callbackMap.has(s)&&this.callbackMap.get(s).forEach((t=>t(e)))}))}async action(t,e,i){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i))}async send(t,e,i,a){return await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i),a)}subscribe(t,e,i){const a="".concat(t,"_").concat(e),s=this.callbackMap.get(a)||[];s.push(i),this.callbackMap.set(a,s)}unsubscribe(t,e,i){const a="".concat(t,"_").concat(e),s=this.callbackMap.get(a)||[],n=s.indexOf(i);n>-1&&(s.splice(n,1),this.callbackMap.set(a,s))}}),Js=t("UtilService",class{constructor(t){this.appUtil=t,this.stoageAppDataEntity=null,this.appDEService=null}async getAppDEService(t){if(this.appDEService)return this.appDEService;const{appId:e,name:i,stoageAppDataEntityId:a}=this.appUtil;if(e&&a){const s=ibiz.hub.getApp(e);this.stoageAppDataEntity=await ibiz.hub.getAppDataEntity(a,e);const n=await s.deService.getService(t,a);if(n)return this.appDEService=n,n;throw new Error(ibiz.i18n.t("runtime.service.noFoundStorageEntity",{name:i,stoageAppDataEntityId:a}))}throw new Error(ibiz.i18n.t("runtime.service.noExist",{name:i}))}async load(t,e,i){const a=e.clone(),s=await this.getAppDEService(a);a[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{getAppDEActionId:n}=this.appUtil;try{const t=await s.exec(n||"get",a,i);return this.handleResponse(t)}catch(t){return{}}}async save(t,e,i,a){const s=await this.getAppDEService(e),{context:n,params:o,data:r}=this.handleRequestData(t,e,i,a);return s.exec("save",n,r,o)}handleRequestData(t,e,i,a){const{modelIdAppDEFieldId:s,modelAppDEFieldId:n,appIdAppDEFieldId:o,userIdAppDEFieldId:r,stoageAppDataEntityId:c}=this.appUtil;if(!this.stoageAppDataEntity)throw new Error(ibiz.i18n.t("runtime.service.noFoundEntity",{stoageAppDataEntityId:c}));const d=e.clone(),l={};d[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{keyAppDEFieldId:h}=this.stoageAppDataEntity;return l[h]=t,l[s]=null==i?void 0:i.modelId,l[n]=JSON.stringify(a),l[o]=d.srfappid,l[r]=d.srfpersonid,l.type=null==i?void 0:i.type,l.owner_type=null==i?void 0:i.ownerType,l.owner_id=null==i?void 0:i.ownerId,{context:d,params:i,data:l}}handleResponse(t){const{data:e}=t,{modelAppDEFieldId:i}=this.appUtil;return JSON.parse(e[i])}}),$s=t("TreeNodeData",class{constructor(t,e,i){this._uuid=ut(),this._leaf=!1,this._defaultExpand=!1,this._leaf=!0===i.leaf,this._defaultExpand=!0===i.defaultExpand,this._parent=e,this._nodeType=t.treeNodeType,this._disableSelect=!0===t.disableSelect,this._changedOnly=!0===t.enableRowEditChangedOnly,this._parent&&(this._context={...this._parent._context}),i.navContext&&(this._context=Object.assign(this._context||{},i.navContext)),i.navParams&&(this._params={...i.navParams}),this._nodeId=t.id,Object.defineProperty(this,"srfnodeid",{get(){return this._id},enumerable:!0,configurable:!0})}calcIcon(t){const{sysImage:e}=t,i={};return e&&(e.cssClass&&(i.cssClass=e.cssClass),e.imagePath&&(i.imagePath=e.imagePath),e.rawContent&&(m(e.rawContent)?i.imagePath=e.rawContent:i.htmlStr=e.rawContent)),Object.values(i).length>0?i:void 0}getDiffData(){if(this._deData&&this._oldDeData){const t={};return Object.keys(this._deData).forEach((e=>{this._deData[e]===this._oldDeData[e]&&e!==this._deData.srfkeyfield||(t[e]=this._deData[e])})),t.srfkey=this._deData.srfkey,t}return this._deData}}),Zs=t("TreeCodeListNodeData",class extends $s{constructor(t,e,i){super(t,e,i);const{data:a}=i;this._text=a.text,this._value=a.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=Ae(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),tn=["_id","srfnodeid","_value","_text","_deData","clone"],en=t("TreeDataSetNodeData",class t extends $s{constructor(e,i,a){var s,n;super(e,i,a);const{data:o}=a;this._deData=o,this._oldDeData=o.clone();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=Ae(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=Ha(o[e.leafFlagAppDEFieldId]):e.childCntAppDEFieldId&&(this._leaf=!Ha(o[e.childCntAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),i=t.appDEFieldId.toLowerCase();c.set(e,i),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,i=t.dataItemName;e&&i?l.set(e,i):ibiz.log.error(ibiz.i18n.t("runtime.service.missingDetreeColumnId"),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 i=it(this._deData),a=new t(e,this._parent,{data:i,leaf:this._leaf,navContext:this._context,navParams:this._params,defaultExpand:this._defaultExpand});return Object.keys(this).forEach((t=>{const e=u(t);Z(e)&&!tn.includes(t)&&(a[t]=this[t])})),a},new Proxy(this,{set(t,e,i){const a=u(e);return Z(a)?t[e]=i:t._deData[a]=i,!0},get(t,e,i){const a=u(e);return Z(a)?t[e]:Z(t._deData[a])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[a];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return g(t,e),e}})}calcIcon(t){let e=super.calcIcon(t)||{};const{iconAppDEFieldId:i,detreeNodeDataItems:a}=t;if(i&&this._deData[i]){const t=this._deData[i];e={},-1!==t.indexOf("fa-")?e.cssClass=t:e.imagePath=t}e&&(this._icon=e);const s=null==a?void 0:a.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 ei.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:i}=t,a=null==i?void 0:i.find((t=>"text"===t.id));return a&&(e=this.calcDataItemScript(a)),e}}),an=t("TreeStaticNodeData",class extends $s{constructor(t,e,i){var a,s;super(t,e,i);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&&i.parentValueLevel){let t=e;for(let e=1;e<i.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==(a=this._deData)?void 0:a.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),sn=t("UIMapField",class{constructor(t,e,i={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,Z(i.isOriginField)||(this.isOriginField=i.isOriginField),Z(i.dataType)||(this.dataType=i.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=Z(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),nn=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 on=["REGION","REGION2","REGION3","REGION4"],rn=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:i,itemStyle:a,longitudeAppDEFieldId:s,latitudeAppDEFieldId:n,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=i+t.srfkey,this._itemStyle=a,this._mapItemId=i,on.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,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:l.has(i)?t[l.get(i)]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:l.has(i)?t[l.get(i)]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...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,i),i}})}});var cn=t("PanelData",class{constructor(t,e){const i=new ht,a={},s={};return t.forEach((t=>{var e;a[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(a,n)?a[n]?e[a[n]]=o:t[n]=o:e[n]=o,i.emit("change",n),a[n]&&a[n]!==n&&i.emit("change",a[n]),s[n]&&s[n]!==n&&i.emit("change",s[n]),!0),get:(t,s,n)=>"_evt"===s?i:a[s]?e[a[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const i=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,i),i}})}destroy(){this._evt.reset()}});var dn=t("ChartData",class{constructor(t,e,i,a){return this._seriesModelId=null==e?void 0:e.id,this._catalog=i,this._groupName=a,this._uuid=ut(),new Proxy(this,{set:(e,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...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,i),i}})}}),ln=(t,e,i={})=>{let a="";if(!t||!e.detreeNodeDataItems)return a;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(a=i[s.appDEFieldId.toLowerCase()]),a},hn=t("GanttStaticNodeData",class extends an{constructor(t,e,i,a){super(e,i,a),this._snDataItemValue=ln(t.sndataItemName,e),this._beginDataItemValue=ln(t.beginDataItemName,e),this._endDataItemValue=ln(t.endDataItemName,e),this._prevDataItemValue=ln(t.prevDataItemName,e),this._finishDataItemValue=ln(t.finishDataItemName,e),this._totalDataItemValue=ln(t.totalDataItemName,e)}}),un=t("GanttDataSetNodeData",class extends en{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=ln(t.sndataItemName,e,s),this._beginDataItemValue=ln(t.beginDataItemName,e,s),this._endDataItemValue=ln(t.endDataItemName,e,s),this._prevDataItemValue=ln(t.prevDataItemName,e,s),this._finishDataItemValue=ln(t.finishDataItemName,e,s),this._totalDataItemValue=ln(t.totalDataItemName,e,s)}}),pn=t("GanttCodeListNodeData",class extends Zs{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=ln(t.sndataItemName,e,s),this._beginDataItemValue=ln(t.beginDataItemName,e,s),this._endDataItemValue=ln(t.endDataItemName,e,s),this._prevDataItemValue=ln(t.prevDataItemName,e,s),this._finishDataItemValue=ln(t.finishDataItemName,e,s),this._totalDataItemValue=ln(t.totalDataItemName,e,s)}}),mn=t("MqttService",class{constructor(t,e,i){this.mqttTopic=t,this.token=e,this.appId=i,this.evt=new ht,this.options={connectTimeout:6e3,clientId:ut(),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"),i=t.default?t.default:t,{location:a}=window;this.client=i.connect("ws://".concat(a.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()}}),gn=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,i){const a=e.srfsessionid||"applocation";this.cache.has(a)||this.cache.set(a,new Map);const s=this.cache.get(a);if(!s.has(i)){const e=await ibiz.hub.getAppDataEntity(i,this.appModel.appId);if(!e)throw new o(ibiz.i18n.t("runtime.service.noFound",{id:i}));const n=t.constructorCache.get(i.toUpperCase());let r;r=n?await n(a,e):new ss(a,e),s.set(i,r)}return s.get(i)}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,i=[]){if(!0===i.includes(e))return;i.push(e);const a=t.srfsessionid;if(!this.cache.has(a))return;const s=this.cache.get(a).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,i)}))}}async exec(t,e,i,a,n,o){const r=await this.getService(i,t);try{return await r.exec(e,i,a,n,o)}catch(t){throw t instanceof s&&(t.tag=i.srfviewid),t}}};gn.constructorCache=new Map;var fn=t("DEServiceUtil",gn),yn=class{constructor(t){this.themeUtil=t,this.state={},this.state.themeTag=ibiz.util.theme.getTheme(),this.state.themeVars={};const{appData:e}=ibiz;if(!e)return;const i=ibiz.hub.getApp();this.config=new Ja(i.appId,"customtheme","theme_config_".concat(e.context.srfuserid))}transCustomVars(t){let e="";for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e+=".".concat(i,"{").concat(a,"}")}return e}setCustomThemeParams(t,e){const i=document.getElementById(t);i&&i.remove();const a={};let s=":root.".concat(t,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))if(2===t.split(":").length){const i=t.split(":")[0],s=t.split(":")[1],n=e[t];a[i]||(a[i]=""),a[i]+="".concat(s,": ").concat(n).concat(n.endsWith(";")?"":";")}else{const i=e[t];s+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}s+="}",s+=this.transCustomVars(a);const n=document.createElement("style");n.id=t,n.type="text/css",n.innerHTML=s,document.head.appendChild(n)}clearCustomThemeParams(){this.state.themeVars={};const t=document.getElementById(this.state.themeTag);t&&t.remove()}async loadCustomTheme(){const t=await this.config.load();return t.themeTag&&(this.state.themeTag=t.themeTag,ibiz.util.theme.setTheme(this.state.themeTag)),ct(t.themeVars)&&(this.state.themeVars=t.themeVars,this.setCustomThemeParams(this.state.themeTag,t.themeVars)),t}previewCustomTheme(t,e){return t&&(this.state.themeTag=t,ibiz.util.theme.setTheme(this.state.themeTag)),ct(e)&&(this.state.themeVars=e,this.setCustomThemeParams(this.state.themeTag,e)),this.state}async saveCustomTheme(t,e){const i={themeTag:t,themeVars:e},a=await this.config.save(i);return a&&ibiz.message.success("保存自定义主题成功!"),a}async shareCustomTheme(t,e){const{appData:i}=ibiz;if(!i)return;const a={themeTag:t,themeVars:e},s=ibiz.hub.getApp(),n=Date.now(),o=new Ja(s.appId,"customtheme","theme_share_".concat(i.context.srfuserid,"_").concat(n));if(await o.save(a)){const{origin:t,pathname:e}=window.location,a="shareThemeId=".concat(window.btoa(n.toString())),s="shareUserName=".concat(encodeURIComponent(i.context.srfusername)),o="shareUserId=".concat(encodeURIComponent(i.context.srfuserid)),r="/share?".concat(a,"&").concat(s,"&").concat(o);return"".concat(t).concat(e,"#").concat(r)}ibiz.message.error("分享自定义主题失败!")}async getShareTheme(t,e){const i=ibiz.hub.getApp();return new Ja(i.appId,"customtheme","theme_share_".concat(t,"_").concat(e)).load()}},wn=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0],this.customUtil={}}async loadTheme(t){const e=it(t.themeParams||{}),i=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:i}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let i=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];i+="".concat(t,": ").concat(a).concat(a.endsWith(";")?"":";")}i+="}";const a=document.createElement("style");a.id=t.themeTag,a.type="text/css",a.innerHTML=i,document.head.appendChild(a)}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")}customTheme(){ibiz.overlay.drawer("IBizCustomTheme",void 0,{width:30,placement:"right"})}async initCustomTheme(t=!0){this.customUtil=new yn(this),t&&await this.customUtil.loadCustomTheme()}getCustomTheme(){return this.customUtil.state}setCustomTheme(t){Object.assign(this.customUtil.state,t)}previewCustomTheme(t,e){return this.customUtil.previewCustomTheme(t,e)}resetCustomTheme(){return this.customUtil.clearCustomThemeParams()}async saveCustomTheme(t,e){return this.customUtil.saveCustomTheme(t,e)}async shareCustomTheme(t,e){return this.customUtil.shareCustomTheme(t,e)}async getShareTheme(t,e){return this.customUtil.getShareTheme(t,e)}}),En=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn(ibiz.i18n.t("runtime.utils.uiDomain.transactionOpen")):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(ibiz.i18n.t("runtime.utils.uiDomain.currentTransaction"));this.state.isOpen=!1}},vn=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new En,this.dataModification=!1,this.id=t||ut()}dataChange(){this.dataModification=!0}dataChangeCompleted(){this.dataModification=!1}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 i=t.majorAppDataEntityId;this.rs2Map.has(i)||this.rs2Map.set(i,[]),this.rs2Map.get(i).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),In=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new vn(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error(ibiz.i18n.t("runtime.utils.uiDomainManager.invalidInterfaceDomain",{id:t}))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),bn=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}}),Dn=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new ht}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}))}getView(t){return this.stackMap.get(t)}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function Cn(t,e=!0){const i=await Promise.allSettled(t),a=[],s=[];if(i.forEach((t=>{"fulfilled"===t.status?a.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 a}var An={position:"fixed",zIndex:"10000"};function Pn(t,e=document.body,i=!0){const a=Nn(t);if(null==a)throw new Error(ibiz.i18n.t("runtime.utils.anime.noClone"));const s=a.cloneNode(!0);if(i)for(;s.firstChild;)s.removeChild(s.firstChild);return function(t,{width:e,height:i,boundingLeft:a,boundingTop:s}){t.style.left="".concat(a,"px"),t.style.top="".concat(s,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(i,"px"),Object.assign(t.style,An)}(s,Tn(a)),e.appendChild(s),s}function Tn(t){const e=t.offsetWidth,i=t.offsetHeight,a=window.getComputedStyle(t),s=parseFloat(a.padding),{left:n,top:o}=t.getBoundingClientRect();return{width:e,height:i,padding:s,boundingLeft:n,boundingTop:o}}function Nn(t){return"string"==typeof t?document.querySelector(t):t}var xn={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Sn={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Ln=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Mn={CSS:{},springs:{}};function Rn(t,e,i){return Math.min(Math.max(t,e),i)}function On(t,e){return t.indexOf(e)>-1}function _n(t,e){return t.apply(null,e)}var Fn={arr:function(t){return Array.isArray(t)},obj:function(t){return On(Object.prototype.toString.call(t),"Object")},pth:function(t){return Fn.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||Fn.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 Fn.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 Fn.hex(t)||Fn.rgb(t)||Fn.hsl(t)},key:function(t){return!xn.hasOwnProperty(t)&&!Sn.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function zn(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Vn(t,e){var i=zn(t),a=Rn(Fn.und(i[0])?1:i[0],.1,100),s=Rn(Fn.und(i[1])?100:i[1],.1,100),n=Rn(Fn.und(i[2])?10:i[2],.1,100),o=Rn(Fn.und(i[3])?0:i[3],.1,100),r=Math.sqrt(s/a),c=n/(2*Math.sqrt(s*a)),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 i=e?e*t/1e3:t;return i=c<1?Math.exp(-i*c*r)*(l*Math.cos(d*i)+h*Math.sin(d*i)):(l+h*i)*Math.exp(-i*r),0===t||1===t?t:1-i}return e?u:function(){var e=Mn.springs[t];if(e)return e;for(var i=1/6,a=0,s=0;;)if(1===u(a+=i)){if(++s>=16)break}else s=0;var n=a*i*1e3;return Mn.springs[t]=n,n}}function kn(t){return void 0===t&&(t=10),function(e){return Math.ceil(Rn(e,1e-6,1)*t)*(1/t)}}var Un,Bn,Wn=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function i(t,e){return 3*e-6*t}function a(t){return 3*t}function s(t,s,n){return((e(s,n)*t+i(s,n))*t+a(s))*t}function n(t,s,n){return 3*e(s,n)*t*t+2*i(s,n)*t+a(s)}return function(e,i,a,o){if(0<=e&&e<=1&&0<=a&&a<=1){var r=new Float32Array(11);if(e!==i||a!==o)for(var c=0;c<11;++c)r[c]=s(c*t,e,a);return function(t){return e===i&&a===o||0===t||1===t?t:s(d(t),i,o)}}function d(i){for(var o=0,c=1;10!==c&&r[c]<=i;++c)o+=t;--c;var d=o+(i-r[c])/(r[c+1]-r[c])*t,l=n(d,e,a);return l>=.001?function(t,e,i,a){for(var o=0;o<4;++o){var r=n(e,i,a);if(0===r)return e;e-=(s(e,i,a)-t)/r}return e}(i,d,e,a):0===l?d:function(t,e,i,a,n){var o,r,c=0;do{(o=s(r=e+(i-e)/2,a,n)-t)>0?i=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(i,o,o+t,e,a)}}}(),Gn=(Un={linear:function(){return function(t){return t}}},Bn={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,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-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 i=Rn(t,1,10),a=Rn(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-a/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/a)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Bn[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Bn).forEach((function(t){var e=Bn[t];Un["easeIn"+t]=e,Un["easeOut"+t]=function(t,i){return function(a){return 1-e(t,i)(1-a)}},Un["easeInOut"+t]=function(t,i){return function(a){return a<.5?e(t,i)(2*a)/2:1-e(t,i)(-2*a+2)/2}},Un["easeOutIn"+t]=function(t,i){return function(a){return a<.5?(1-e(t,i)(1-2*a))/2:(e(t,i)(2*a-1)+1)/2}}})),Un);function jn(t,e){if(Fn.fnc(t))return t;var i=t.split("(")[0],a=Gn[i],s=zn(t);switch(i){case"spring":return Vn(t,e);case"cubicBezier":return _n(Wn,s);case"steps":return _n(kn,s);default:return _n(a,s)}}function Kn(t){try{return document.querySelectorAll(t)}catch(t){return}}function Hn(t,e){for(var i=t.length,a=arguments.length>=2?arguments[1]:void 0,s=[],n=0;n<i;n++)if(n in t){var o=t[n];e.call(a,o,n,t)&&s.push(o)}return s}function Xn(t){return t.reduce((function(t,e){return t.concat(Fn.arr(e)?Xn(e):e)}),[])}function qn(t){return Fn.arr(t)?t:(Fn.str(t)&&(t=Kn(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Yn(t,e){return t.some((function(t){return t===e}))}function Qn(t){var e={};for(var i in t)e[i]=t[i];return e}function Jn(t,e){var i=Qn(t);for(var a in t)i[a]=e.hasOwnProperty(a)?e[a]:t[a];return i}function $n(t,e){var i=Qn(t);for(var a in e)i[a]=Fn.und(t[a])?e[a]:t[a];return i}function Zn(t){return Fn.rgb(t)?(i=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+i[1]+",1)":e:Fn.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,a){return e+e+i+i+a+a})),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(i[1],16)+","+parseInt(i[2],16)+","+parseInt(i[3],16)+",1)"}(t):Fn.hsl(t)?function(t){var e,i,a,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,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==o)e=i=a=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,n+1/3),i=d(h,l,n),a=d(h,l,n-1/3)}return"rgba("+255*e+","+255*i+","+255*a+","+c+")"}(t):void 0;var e,i}function to(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 eo(t,e){return Fn.fnc(t)?t(e.target,e.id,e.total):t}function io(t,e){return t.getAttribute(e)}function ao(t,e,i){if(Yn([i,"deg","rad","turn"],to(e)))return e;var a=Mn.CSS[e+i];if(!Fn.und(a))return a;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+i;var o=100/s.offsetWidth;n.removeChild(s);var r=o*parseFloat(e);return Mn.CSS[e+i]=r,r}function so(t,e,i){if(e in t.style){var a=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(a)||"0";return i?ao(t,s,i):s}}function no(t,e){return Fn.dom(t)&&!Fn.inp(t)&&(!Fn.nil(io(t,e))||Fn.svg(t)&&t[e])?"attribute":Fn.dom(t)&&Yn(Ln,e)?"transform":Fn.dom(t)&&"transform"!==e&&so(t,e)?"css":null!=t[e]?"object":void 0}function oo(t){if(Fn.dom(t)){for(var e,i=t.style.transform||"",a=/(\w+)\(([^)]*)\)/g,s=new Map;e=a.exec(i);)s.set(e[1],e[2]);return s}}function ro(t,e,i,a){var s=On(e,"scale")?1:0+function(t){return On(t,"translate")||"perspective"===t?"px":On(t,"rotate")||On(t,"skew")?"deg":void 0}(e),n=oo(t).get(e)||s;return i&&(i.transforms.list.set(e,n),i.transforms.last=e),a?ao(t,n,a):n}function co(t,e,i,a){switch(no(t,e)){case"transform":return ro(t,e,a,i);case"css":return so(t,e,i);case"attribute":return io(t,e);default:return t[e]||0}}function lo(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var a=to(t)||0,s=parseFloat(e),n=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return s+n+a;case"-":return s-n+a;case"*":return s*n+a}}function ho(t,e){if(Fn.col(t))return Zn(t);if(/\s/g.test(t))return t;var i=to(t),a=i?t.substr(0,t.length-i.length):t;return e?a+e:a}function uo(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function po(t){for(var e,i=t.points,a=0,s=0;s<i.numberOfItems;s++){var n=i.getItem(s);s>0&&(a+=uo(e,n)),e=n}return a}function mo(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*io(t,"r")}(t);case"rect":return function(t){return 2*io(t,"width")+2*io(t,"height")}(t);case"line":return function(t){return uo({x:io(t,"x1"),y:io(t,"y1")},{x:io(t,"x2"),y:io(t,"y2")})}(t);case"polyline":return po(t);case"polygon":return function(t){var e=t.points;return po(t)+uo(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function go(t,e){var i=e||{},a=i.el||function(t){for(var e=t.parentNode;Fn.svg(e)&&Fn.svg(e.parentNode);)e=e.parentNode;return e}(t),s=a.getBoundingClientRect(),n=io(a,"viewBox"),o=s.width,r=s.height,c=i.viewBox||(n?n.split(" "):[0,0,o,r]);return{el:a,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function fo(t,e,i){function a(i){void 0===i&&(i=0);var a=e+i>=1?e+i:0;return t.el.getPointAtLength(a)}var s=go(t.el,t.svg),n=a(),o=a(-1),r=a(1),c=i?1:s.w/s.vW,d=i?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 yo(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=ho(Fn.pth(t)?t.totalLength:t,e)+"";return{original:a,numbers:a.match(i)?a.match(i).map(Number):[0],strings:Fn.str(t)||e?a.split(i):[]}}function wo(t){return Hn(t?Xn(Fn.arr(t)?t.map(qn):qn(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function Eo(t){var e=wo(t);return e.map((function(t,i){return{target:t,id:i,total:e.length,transforms:{list:oo(t)}}}))}function vo(t,e){var i=Qn(e);if(/^spring/.test(i.easing)&&(i.duration=Vn(i.easing)),Fn.arr(t)){var a=t.length;2===a&&!Fn.obj(t[0])?t={value:t}:Fn.fnc(e.duration)||(i.duration=e.duration/a)}var s=Fn.arr(t)?t:[t];return s.map((function(t,i){var a=Fn.obj(t)&&!Fn.pth(t)?t:{value:t};return Fn.und(a.delay)&&(a.delay=i?0:e.delay),Fn.und(a.endDelay)&&(a.endDelay=i===s.length-1?e.endDelay:0),a})).map((function(t){return $n(t,i)}))}function Io(t,e){var i=[],a=e.keyframes;for(var s in a&&(e=$n(function(t){for(var e=Hn(Xn(t.map((function(t){return Object.keys(t)}))),(function(t){return Fn.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),i={},a=function(a){var s=e[a];i[s]=t.map((function(t){var e={};for(var i in t)Fn.key(i)?i==s&&(e.value=t[i]):e[i]=t[i];return e}))},s=0;s<e.length;s++)a(s);return i}(a),e)),e)Fn.key(s)&&i.push({name:s,tweens:vo(e[s],t)});return i}function bo(t,e){var i;return t.tweens.map((function(a){var s=function(t,e){var i={};for(var a in t){var s=eo(t[a],e);Fn.arr(s)&&1===(s=s.map((function(t){return eo(t,e)}))).length&&(s=s[0]),i[a]=s}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}(a,e),n=s.value,o=Fn.arr(n)?n[1]:n,r=to(o),c=co(e.target,t.name,r,e),d=i?i.to.original:c,l=Fn.arr(n)?n[0]:d,h=to(l)||to(c),u=r||h;return Fn.und(o)&&(o=d),s.from=yo(l,u),s.to=yo(lo(o,l),u),s.start=i?i.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=jn(s.easing,s.duration),s.isPath=Fn.pth(n),s.isPathTargetInsideSVG=s.isPath&&Fn.svg(e.target),s.isColor=Fn.col(s.from.original),s.isColor&&(s.round=1),i=s,s}))}var Do={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,a,s){if(a.list.set(e,i),e===a.last||s){var n="";a.list.forEach((function(t,e){n+=e+"("+t+") "})),t.style.transform=n}}};function Co(t,e){Eo(t).forEach((function(t){for(var i in e){var a=eo(e[i],t),s=t.target,n=to(a),o=co(s,i,n,t),r=lo(ho(a,n||to(o)),o),c=no(s,i);Do[c](s,i,r,t.transforms,!0)}}))}function Ao(t,e){return Hn(Xn(t.map((function(t){return e.map((function(e){return function(t,e){var i=no(t.target,e.name);if(i){var a=bo(e,t),s=a[a.length-1];return{type:i,property:e.name,animatable:t,tweens:a,duration:s.end,delay:a[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!Fn.und(t)}))}function Po(t,e){var i=t.length,a=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=i?Math.max.apply(Math,t.map((function(t){return a(t)+t.duration}))):e.duration,s.delay=i?Math.min.apply(Math,t.map((function(t){return a(t)+t.delay}))):e.delay,s.endDelay=i?s.duration-Math.max.apply(Math,t.map((function(t){return a(t)+t.duration-t.endDelay}))):e.endDelay,s}var To=0;var No=[],xo=function(){var t;function e(i){for(var a=No.length,s=0;s<a;){var n=No[s];n.paused?(No.splice(s,1),a--):(n.tick(i),s++)}t=s>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Lo.suspendWhenDocumentHidden&&(So()?t=cancelAnimationFrame(t):(No.forEach((function(t){return t._onDocumentVisibility()})),xo()))})),function(){t||So()&&Lo.suspendWhenDocumentHidden||!(No.length>0)||(t=requestAnimationFrame(e))}}();function So(){return!!document&&document.hidden}function Lo(t){void 0===t&&(t={});var e,i=0,a=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=Jn(xn,t),i=Jn(Sn,t),a=Io(i,t),s=Eo(t.targets),n=Ao(s,a),o=Po(n,i),r=To;return To++,$n(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(){i=0,a=l(c.currentTime)*(1/Lo.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,i=c.animations,a=i.length;e<a;){var s=i[e],n=s.animatable,o=s.tweens,r=o.length-1,d=o[r];r&&(d=Hn(o,(function(e){return t<e.end}))[0]||d);for(var l=Rn(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=[],g=d.to.numbers.length,f=void 0,y=0;y<g;y++){var w=void 0,E=d.to.numbers[y],v=d.from.numbers[y]||0;w=d.isPath?fo(d.value,h*E,d.isPathTargetInsideSVG):v+h*(E-v),p&&(d.isColor&&y>2||(w=Math.round(w*p)/p)),m.push(w)}var I=u.length;if(I){f=u[0];for(var b=0;b<I;b++){u[b];var D=u[b+1],C=m[b];isNaN(C)||(f+=D?C+D:C+" ")}}else f=m[0];Do[s.type](n.target,s.property,f,n.transforms),s.currentValue=f,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function g(t){var h=c.duration,g=c.delay,f=h-c.endDelay,y=l(t);c.progress=Rn(y/h*100,0,100),c.reversePlayback=y<c.currentTime,e&&function(t){if(c.reversePlayback)for(var i=n;i--;)u(t,e[i]);else for(var a=0;a<n;a++)u(t,e[a])}(y),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),y<=g&&0!==c.currentTime&&p(0),(y>=f&&c.currentTime!==h||!h)&&p(h),y>g&&y<f?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(y)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Rn(y,0,h),c.began&&m("update"),t>=h&&(a=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(i=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 i=n=e.length;i--;)c.children[i].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 Co(t,e),c},c.tick=function(t){s=t,i||(i=s),g((s+(a-i))*Lo.speed)},c.seek=function(t){g(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,No.push(c),h(),xo())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){Ro(wo(t),c)},c.reset(),c.autoplay&&c.play(),c}function Mo(t,e){for(var i=e.length;i--;)Yn(t,e[i].animatable.target)&&e.splice(i,1)}function Ro(t,e){var i=e.animations,a=e.children;Mo(t,i);for(var s=a.length;s--;){var n=a[s],o=n.animations;Mo(t,o),o.length||n.children.length||a.splice(s,1)}i.length||a.length||e.pause()}Lo.version="3.2.1",Lo.speed=1,Lo.suspendWhenDocumentHidden=!0,Lo.running=No,Lo.remove=function(t){for(var e=wo(t),i=No.length;i--;){Ro(e,No[i])}},Lo.get=co,Lo.set=Co,Lo.convertPx=ao,Lo.path=function(t,e){var i=Fn.str(t)?Kn(t)[0]:t,a=e||100;return function(t){return{property:t,el:i,svg:go(i),totalLength:mo(i)*(a/100)}}},Lo.setDashoffset=function(t){var e=mo(t);return t.setAttribute("stroke-dasharray",e),e},Lo.stagger=function(t,e){void 0===e&&(e={});var i=e.direction||"normal",a=e.easing?jn(e.easing):null,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Fn.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=to(l?t[1]:t)||0,m=e.start||0+(l?h:0),g=[],f=0;return function(t,e,y){if(r&&(o=0),c&&(o=(y-1)/2),d&&(o=y-1),!g.length){for(var w=0;w<y;w++){if(s){var E=c?(s[0]-1)/2:o%s[0],v=c?(s[1]-1)/2:Math.floor(o/s[0]),I=E-w%s[0],b=v-Math.floor(w/s[0]),D=Math.sqrt(I*I+b*b);"x"===n&&(D=-I),"y"===n&&(D=-b),g.push(D)}else g.push(Math.abs(o-w));f=Math.max.apply(Math,g)}a&&(g=g.map((function(t){return a(t/f)*f}))),"reverse"===i&&(g=g.map((function(t){return n?t<0?-1*t:-t:Math.abs(f-t)})))}return m+(l?(u-h)/f:h)*(Math.round(100*g[e])/100)+p}},Lo.timeline=function(t){void 0===t&&(t={});var e=Lo(t);return e.duration=0,e.add=function(i,a){var s=No.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&No.splice(s,1);for(var r=0;r<n.length;r++)o(n[r]);var c=$n(i,Jn(Sn,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Fn.und(a)?d:lo(a,d),o(e),e.seek(c.timelineOffset);var l=Lo(c);o(l),n.push(l);var h=Po(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},Lo.easing=jn,Lo.penner=Gn,Lo.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var Oo=Lo,_o={duration:1e3,loop:!1,easing:"easeInOutSine"};function Fo(t,e){const i={};if(e.complete&&t.complete){const a=e.complete,s=t.complete;i.complete=t=>{a(t),s(t)}}return{...t,...e,...i}}function zo(t,e,i={}){const{left:a,top:s}=t.getBoundingClientRect(),{left:n,top:o}=e.getBoundingClientRect(),r=n-a,c=o-s;return new Promise((e=>{const a=Fo({targets:t,translateX:r,translateY:c,..._o,complete:()=>{e(!0)}},i);Oo(a)}))}var Vo=t("AnimeUtil",class{async movePoint(t,e,i={}){const a=Nn(e);if(!a)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistEndpointElement")),!1;const s=Pn(t,document.body);if(!s)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistAnimationElement")),!1;const{padding:n,width:o,height:r}=Tn(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,i);const d=await zo(s,a,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,i={}){return zo(t,e,i)}resize(t,e={}){return function(t,e={}){return new Promise((i=>{const a=Fo({scale:[1,.8,1],targets:t,..._o,complete:()=>{i(!0)}},e);Oo(a)}))}(t,e)}async moveAndResize(t,e,i={}){const a=await this.movePoint(t,e,i);return a&&await this.resize(e,{duration:500}),a}}),ko=t("FileUtil",class{calcOSSCatUrl(t,e,i){var a;let s="".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId).concat(t);const n=ibiz.hub.getApp(e.srfappid),o=i||n.model.defaultOSSCat||(null==(a=n.model.userParam)?void 0:a.DefaultOSSCat);return s=s.replace("/{cat}",o?"/".concat(o):""),s}calcFileUpDownUrl(t,e,i={},a={}){const{uploadParams:s,exportParams:n,osscat:o}=a;let r=this.calcOSSCatUrl(ibiz.env.uploadFileUrl,t,o),c=this.calcOSSCatUrl("".concat(ibiz.env.downloadFileUrl,"/%fileId%"),t,o),d={},l={};return s&&(d=he(s,i,e,t)),n&&(l=he(n,i,e,t)),r+=Dt.stringify(d,{addQueryPrefix:!0}),c+=Dt.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(!i.data)throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"));{let t=ibiz.util.file.getFileName(i);e&&(t=e),c(i.data,t)}}async fileUpload(t,e,i){const a=new FormData;a.append("file",e);const s=await ibiz.net.axios({url:t,method:"post",headers:i,data:a});if(200!==s.status)throw new o(ibiz.i18n.t("runtime.utils.fileUtil.fileUploadFailed"));return s.data}getFileName(t){let e="";const i=t.headers["content-disposition"];if(!i)return e;const a=Dt.parse(i,{delimiter:";"});return a&&a.filename&&(e=a.filename),e.startsWith('"')&&e.endsWith('"')&&(e=e.substring(1,e.length-1)),e}async chooseFileAndUpload(t,e,i,a={}){const{accept:s,multiple:n}=a,o=ibiz.util.file.calcFileUpDownUrl(t,e,i),r=await ibiz.util.file.chooseFile(s,n),c=[],d={Authorization:"Bearer ".concat(mt(u.TOKEN))};for(let t=0;t<r.length;t++){const e=await ibiz.util.file.fileUpload(o.uploadUrl,r[t],d);c.push(e)}return Promise.all(c)}chooseFile(t="",e=!1){return new Promise((i=>{const a=document.createElement("input");a.type="file",a.accept=t,a.multiple=e,a.webkitdirectory=!1,a.addEventListener("change",(t=>{i(t.target.files)})),document.body.appendChild(a),a.click(),document.body.removeChild(a)}))}}),Uo=t("ShortCutUtil",class{constructor(){this.$ShortCut={items:[],mode:"vertical"},this.evt=new ht,this.initShortCut()}get data(){return this.$ShortCut.items}get mode(){return this.$ShortCut.mode}initShortCut(){const t=window.localStorage.getItem("IBizShortCut");t&&(this.$ShortCut=JSON.parse(t))}saveShortCut(){this.evt.emit("change",[...this.$ShortCut.items]),window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}setShortCutMode(t){this.$ShortCut.mode=t,window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}onChange(t){this.evt.on("change",t)}offChange(t){this.evt.off("change",t)}async calcShortCutKey({context:t,appViewId:e}){const i=await ibiz.hub.config.view.get(e);let a="".concat(t.srfappid,"-").concat(t.srfuserid,"-").concat(e);if(i.appDataEntityId){const e=Ae(i.appDataEntityId);a+="-".concat(e,"-").concat(t[e])}return a}addShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t.key));e>-1?this.$ShortCut.items.splice(e,1,t):this.$ShortCut.items.push(t),this.saveShortCut()}removeShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t));e>-1&&(this.$ShortCut.items.splice(e,1),this.saveShortCut())}changeIndex(t,e){const{length:i}=this.$ShortCut.items;if(e<0||e>=i||t<0||t>=i)throw new Error(ibiz.i18n.t("runtime.utils.shortCut.invalidIndexNewIndex",{newIndex:t,oldIndex:e,length:i}));const a=this.$ShortCut.items.splice(e,1)[0];this.$ShortCut.items.splice(t,0,a),this.saveShortCut()}isExist(t){return this.$ShortCut.items.findIndex((e=>e.key===t))>=0}}),Bo=t("BIReportUtil",class{async openDesignPage(t,e,i){i.mode||(i.mode="DATA");const a=it(t);let s={};if("DATA"===i.mode){const t=ibiz.hub.getApp(ibiz.env.appId);try{Object.assign(a,{pssysbireport:i.reportId});const n=await t.deService.exec("pssysbireport","get",a,e);n.data&&(s=this.translateReportToConfig(n.data))}catch(t){throw new o(t.message)}}else"UI"===i.mode&&(s=i.reportPanel.generator.config);const n=ibiz.overlay.createModal("iBizBIReportDesign",{dismiss:t=>n.dismiss(t),context:a,viewParams:e,config:s},{width:"90%",height:"90%",footerHide:!0});n.present();return await n.onWillDismiss()}translateReportToConfig(t){const e={};let i={};t.bireportuimodel&&(i=JSON.parse(t.bireportuimodel)),e.selectChartType=(null==i?void 0:i.selectChartType)||"NUMBER",e.reportTag="bi_report",e.selectCubeId=t.pssysbicubeid;const a={};t.pssysbireportitems&&t.pssysbireportitems.length>0&&t.pssysbireportitems.forEach((t=>{var e,i;"MEASURE"===t.birepitemtype&&(a.measure||(a.measure=[]),a.measure.push({pssysbischemeid:t.pssysbischemeid,pssysbicubemeasureid:t.pssysbicubemeasureid,pssysbicubeid:t.pssysbicubeid,codename:null==(e=t.pssysbicubemeasureid)?void 0:e.split(".").pop()})),"DIMENSION"===t.birepitemtype&&(a.dimension||(a.dimension=[]),a.dimension.push({pssysbischemeid:t.pssysbischemeid,pssysbicubedimensionid:t.pssysbicubedimensionid,pssysbicubeid:t.pssysbicubeid,codename:null==(i=t.pssysbicubedimensionid)?void 0:i.split(".").pop()}))}));const s={caption:t.pssysbireportname};return Object.keys(a).length>0&&Object.assign(s,{data:a}),i.style&&Object.assign(s,{style:i.style}),e.propertyData=s,e}});var Wo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},s={}){const n=it(e);n.srfsimple&&delete n.srfsimple;const r=await ibiz.hub.config.view.get(t);if(!r)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t}));if((n.srfkey||0===i.srfuf)&&r.appDataEntityId){const t=Ae(r.appDataEntityId);n.srfkey&&(n[t]=n.srfkey,n.srfkey=void 0),0===i.srfuf&&(n[t]=void 0,delete i.srfuf)}if(r.redirectView){return Ke(await ibiz.hub.getAppView(t),n,i,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,i),{ok:!0}):this.openIndexViewTab(r,n,i,s);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,n,i);case"POPUP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopup"));case"POPUPMODAL":return this.openModal(r,n,i);case"POPUPAPP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopupapp"));case"POPOVER":return this.openPopover(r,n,i,s);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,n,i);case"USER":return this.openUserCustom(r,n,i);default:return this.openIndexViewTab(r,n,i)}}openIndexViewTab(t,e,i={},a={}){return ibiz.openView.root(t.id,e,i,a)}openIndexViewTabByModal(t,e,i={}){return ibiz.openView.rootByModal(t.id,e,i)}async openModal(t,e,i={}){return ibiz.openView.modal(t.id,e,i)}async openPopover(t,e,i={},a={}){const{event:s,modalOption:n}=a;if(!s)throw new o(ibiz.i18n.t("runtime.command.app.missingEvent"));return ibiz.openView.popover(t.id,s,e,i,{...n})}async openDrawer(t,e,i={}){return ibiz.openView.drawer(t.id,e,i)}async openUserCustom(t,e,i={}){return ibiz.openView.custom(t.id,e,i)}};Wo.TAG="ibiz.app-view.open";var Go=t("OpenAppViewCommand",Wo),jo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},s={}){const n=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!n)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationFunction",{appFuncId:t}));const{navigateContexts:r,navigateParams:c,appFuncType:d}=n,l=e.clone();Object.assign(l,he(r,i,e));const h=he(c,i,e);switch(Object.assign(h,i),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 a(n,ibiz.i18n.t("runtime.command.app.noFindApplicationFunctionYype",{appFuncType:d}))}}async openAppView(t,e,i,a){if(!t.appViewId)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t.appViewId}));return ibiz.commands.execute(Go.TAG,t.appViewId,e,i,a)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,i){throw ibiz.log.warn("openPdAppFunc",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}executeJavaScript(t,e,i){throw ibiz.log.warn("executeJavaScript",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}custom(t,e,i){throw ibiz.log.warn("custom",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}};jo.TAG="ibiz.app-func.exec";var Ko=t("AppFuncCommand",jo);function Ho(){new Ko,new Go}var Xo=t("Application",class{constructor(t,e){this.model=t,this.subAppRef=e,this.deName2DeCodeName=new Map,this.appBISchemeMap=new Map,this.appBICubeMap=new Map,this.appBIReportMap=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(e&&e.serviceId?e.serviceId:this.appId)}),this.configCache=new Ja(this.appId,"PSSysApp",t.codeName),this.deService=new fn(t),this.codeList=new Qa(t),this.authority=new ls(t)}get appId(){return this.model.appId||ibiz.env.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}getAppUtil(t,e="DEFAULT"){const i=this.model.appUtils||[];let a;return a="CUSTOM"===e?i.find((e=>e.utilTag===t)):i.find((e=>e.id===t)),a}async getUIAction(t){const[,e]=t.split("@");if(e){const i=(await ibiz.hub.getAppDataEntity(e,this.appId)).appDEUIActions.find((e=>e.id===t));if(i)return i}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var i,a;let s=null==(i=this.model.deopprivs)?void 0:i.find((e=>e.name===t));if(!s&&e){s=null==(a=(await ibiz.hub.getAppDataEntity(e,this.appId)).deopprivs)?void 0:a.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.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 mn(ibiz.appData.mqtttopic,y(),this.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}destroy(){this.codeList.destroy()}}),qo=class{parse(t){return t}},Yo=class{constructor(){this.appMenu=new qo}},Qo=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t=""){let e="";if(t&&-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}getCustomOption(t){var e;const{appViewParams:i,userParam:a}=t;let s=null==(e=null==i?void 0:i.find((t=>"modaloption"===t.id)))?void 0:e.value;!s&&a&&(s=a.modalOption);let n={};if(s)try{n=JSON.parse(s)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.hub.failedParse",{error:t}))}return{modalOption:n}}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const i=this.calcAppViewId(t);this.viewConfigs.set(i,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(ibiz.i18n.t("runtime.hub.noExist",{id: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,...this.getCustomOption(t)})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},Jo=class{constructor(){this.view=new Qo}},$o=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))($o||{})),Zo=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Zo||{})),tr=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(tr||{})),er=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t.DRAFT="DRAFT",t))(er||{})),ir=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(ibiz.i18n.t("runtime.controller.utils.counter.decrement"));this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),ar=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new ir(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),sr=t("CTXState",class{}),nr=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new ht(3e3),this.controllersMap=new Map,this.state=new sr}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}}),or=t("ActivityCounter",class extends ir{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())}}),rr=t("UIActionButtonState",class{constructor(t,e,i){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=i,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await Se(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:i,actionTarget:a,uiactionMode:s,uiactionTag:n}=t;this.dataAccessAction=e,this.actionTarget=a,1===i?this.noPermissionHidden=!1:6===i&&(this.visible=!1),[2,6].includes(i)&&this.dataAccessAction&&(this.visible=!1),(a&&"NONE"!==a||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0,"SINGLEKEY"!==a&&"MULTIKEY"!==a||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e,i){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.actionTarget&&"NONE"===this.actionTarget?this.permitted=await a.authority.calcByNoDataAccessAction(this.dataAccessAction,t,i||this.appDeName):(this.appDeName&&i&&!i.includes(this.appDeName)&&ibiz.log.warn(ibiz.i18n.t("runtime.controller.utils.buttonState.isFinitenconsistency",{uiActionId:this.uiActionId,appDeName:this.appDeName,appDeId:i})),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e,i||this.appDeName))}async update(t,e,i){this.isInit||await this.init(),await this.calcPermission(t,e,i),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!e||this.noKeyDisabled&&!e.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),cr=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,i){await Promise.all(this.children.map((a=>a.update(t,e,i))))}async init(){await Promise.all(this.children.map((t=>t.init())))}}),dr=t("QXEventEx",class extends ht{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((i=>{i(t,...e)}))}async asyncEmit(t,...e){const i=super.asyncEmit(t,...e),a=this.anyEventFns.map((i=>i(t,...e))),s=Promise.all(a),n=await i,o=await s;return n.concat(...o)}reset(){super.reset(),Et(this.anyEventFns)}}),lr=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new dr}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 hr(t){return window.location.hash.split("/").length>2*t+2}function ur(t,e){return(!Z(t)&&""!==t||!Z(e)&&""!==e)&&t!==e}function pr(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof os&&(e=e.getOrigin()),e}function mr(t,e,i){const a=[];return t.forEach((t=>{const{valueRuleType:s}=t,n=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&n)"REG"===n.ruleType||"REGEX"===n.ruleType?a.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):"SCRIPT"===n.ruleType&&a.push({validator:(t,e,i,a)=>{if(!e)return!0;try{ei.execScriptFn({rule:t,value:e,callback:i,source:a},n.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=i||e;a.push({validator:(e,i,a,s)=>{if(dt(s[t]))return!0;const{isPast:n,infoMessage:c}=ii(t,s,r.groupCond);return n||a(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),a}function gr(t){const e=[],{maxLength:i,minLength:a}=t,{maxValue:s,minValue:n}=t;return i&&e.push({validator:(t,e,a)=>{if(Z(e)||!(e.length>i))return!0;a(new Error(ibiz.i18n.t("runtime.controller.utils.valueRule.length",{maxLength:i,length:e.length})))}}),a&&e.push({validator:(t,e,i)=>{if(Z(e)||!(e.length<a))return!0;i(new Error("内容长度必须大于等于".concat(a,",当前长度为").concat(e.length)))}}),Z(s)||e.push({validator:(t,e,i)=>{if(!(!Z(e)&&vt(e)&&e>s))return!0;i(new Error("值必须小于等于".concat(s)))}}),Z(n)||e.push({validator:(t,e,i)=>{if(!(!Z(e)&&vt(e)&&e<n))return!0;i(new Error("值必须大于等于".concat(n)))}}),e}var fr=t("ValueExUtil",class{static mergeDefault(t){return nt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(Z(e)||""===e)return"";const{valueType:i,objectNameField:a,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(i)){if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.valueEx.objectNameField"));const t=a.toLowerCase();return"OBJECTS"===i?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===i?e.join(s):"".concat(e)}});function yr(t,e){var i;const{name:s,valueType:n,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(Z(n)&&Z(r))return;if("RESET"===n)return null;const u=d[s];if(!ot(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 Ct().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(i=ibiz.appData)?void 0:i.context))throw new o(ibiz.i18n.t("runtime.controller.utils.valueDefault.noExist"));return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return ut();default:throw new a({},ibiz.i18n.t("runtime.controller.utils.valueDefault.nosupported",{valueType:n}))}}}var wr="asyncimportdata2",Er="importdata2";async function vr(t,e,i,a){ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")});const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(wr);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ja(a,e)+n}const o=await ibiz.net.request(n,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});var r;await(r=o.data.asyncacitonid,new Promise((t=>{const e=i=>{const a=i.messageid||i.data.asyncacitonid;if(r!==a)return;const s=i.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","DATAIMPORT")}async function Ir(t,e,i,a){const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(Er);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ja(a,e)+n}const o={isAsync:!1};try{const t=await ibiz.net.request(n,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED","DATAIMPORT"),Object.assign(o,t.data)}catch(t){t instanceof Error&&(o.errorMessage=t.message)}return o}async function br(t){const e={isAsync:ibiz.env.enableMqtt};if(ibiz.env.enableMqtt)vr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);else{const i=await Ir(t.selectedFile,t.appDataEntity,t.dataImport,t.context);Object.assign(e,i)}return e}async function Dr(t,e,i){if(!ibiz.util.getExcelUtil)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.noExist"));const a=await ibiz.util.getExcelUtil();if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.loadError"));try{return a.exportJsonToExcel({header:t,data:e,filename:i,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function Cr(t){var e;const i=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),a=null==(e=i.appDEDataImports)?void 0:e.find((e=>e.id===t.deDataImportId));if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.importData"));return{deDataImport:a,appDataEntity:i}}async function Ar(t){const{deDataImportId:e,appDataEntityId:i,context:a,params:s}=t,n=t.dataImportViewId||"AppDataUploadView";let o=null;try{o=await ibiz.hub.config.view.get(n)}catch(e){if(t.dataImportViewId)throw e}if(o)return a.srfappdataentityid=i,a.srfdedataimportid=e,ibiz.commands.execute(Go.TAG,o.id,a,s,{openMode:"POPUPMODAL"});const{deDataImport:r,appDataEntity:c}=await Cr({deDataImportId:e,appDataEntityId:i,appId:a.srfappid}),d=r.enableCustomized?"DataImport2":"DataImport",l=ibiz.overlay.createModal(d,{dismiss:()=>l.dismiss(),dataImport:r,appDataEntity:c,context:a,params:s},{width:"auto",placement:"center"});l.present(),await l.onWillDismiss()}async function Pr(t,e,i){let a="/".concat(t.codeName2.toLowerCase(),"/importtemplate");if((null==e?void 0:e.codeName)&&(a+="?srfimporttag=".concat(e.codeName)),i){a=ja(i,t)+a}const s=await ibiz.net.request(a,{responseType:"blob"});if(200===s.status){const t=ibiz.util.file.getFileName(s),e=new Blob([s.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}async function Tr(t){return new Promise((e=>{E({accept:".xlsx, .xls",multiple:!1,onSelected:async i=>{const a=await br({selectedFile:i[0],appDataEntity:t.appDataEntity,dataImport:t.dataImport,context:t.context});e(a)},onCancel:()=>{e({cancel:!0})}})}))}async function Nr(t){var e;let i="/".concat(t.appDataEntity.codeName2.toLowerCase());if(t.context){i=ja(t.context,t.appDataEntity)+i}const a="".concat(i,"/asyncimportdata2"),s={srfossfileid:t.fileId,srfimportschemaid:t.schemaId},n=(null==(e=t.dataImport)?void 0:e.id)||t.appDataEntity.defaultAppDEDataImportId;n&&Object.assign(s,{srfimporttag:n}),await ibiz.net.request(a,{method:"get",params:s}),ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")})}function xr(t){var e,i,a,s;let n={system_tag:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,data_entity_tag:null==(i=t.appDataEntity)?void 0:i.codeName,import_tag:(null==(a=t.dataImport)?void 0:a.id)||(null==(s=t.appDataEntity)?void 0:s.defaultAppDEDataImportId),owner_type:"PERSONAL"};return n=tt(n,t.data),n}async function Sr(t,e){const i=ibiz.hub.getApp(e.srfappid),a=await ibiz.hub.getAppDataEntity(t,e.srfappid);let s="/jsonschema/".concat(a.name);0===a.dynaSysMode&&ibiz.appData&&(s+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await i.net.get(s)).data}var Lr=t("VIEW_MSG_PREFIX","VIEW_MSG"),Mr=t("ViewMsgController",class t{constructor(t,e=""){this.msgGroupId=t,this.viewMsgMap=new Map,this.tag="",this.tag="".concat(Lr,"_").concat(e)}async init(t){var e,i;const a=ibiz.hub.getApp(t.srfappid).model,s=null==(e=a.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new o(ibiz.i18n.t("runtime.controller.utils.viewMsg.message",{msgGroupId:this.msgGroupId}));this.msgGroup=s;const n=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(i=a.appViewMsgs)||i.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(ibiz.i18n.t("runtime.controller.utils.viewMsg.noFound",{message:n.join(",")}))}getDeFieldName(t,e){var i,a;if(e)return null==(a=null==(i=xe(t,e))?void 0:i.name)?void 0:a.toLowerCase()}static async fetchDataSet(t,e,a){const{appDataEntityId:s,appDEDataSetId:n}=t;if(!n)throw new i(t,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfigured"));const o=await ibiz.hub.getApp(e.srfappid).deService.exec(s,n,e,a);return o.data.length?o.data:[]}getMsgRemoveModeStorage(t){return 1!==t.removeMode?null:localStorage.getItem(t.key)}setMsgRemoveModeStorage(t){1===t.removeMode&&localStorage.setItem(t.key,"1")}async calcViewMsgVisible(t,e,i,a){const{enableMode:s,dataAccessAction:n,appDataEntityId:o,appId:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===s&&n){const t=ibiz.hub.getApp(i.srfappid);return!!await t.authority.calcByDataAccessAction(n,i,e,o)}if("DELOGIC"===s&&o&&r&&c){const t=Te(c,await ibiz.hub.getAppDataEntity(o,r));if(t){return!!(await Us(t,i,e,a)).data}}if("SCRIPT"===s&&d){return!!ei.execScriptFn({data:e,context:i,params:a},d,{isAsync:!1,singleRowReturn:!0})}return!0}async calcViewMessages(t,e){const i=this.msgGroup.appViewMsgGroupDetails,a=[];return(null==i?void 0:i.length)&&await Promise.all(i.map((async i=>{const s=this.viewMsgMap.get(i.appViewMsgId);if(1===s.dynamicMode){const n=await this.calcDynaMsgs(i,t,e);await Promise.all(n.map((async i=>{i.visible=await this.calcViewMsgVisible(s,i.data||{},t,e)}))),a.push(...n)}else{const n=this.calcStaticMsg(i);n.visible=await this.calcViewMsgVisible(s,n.data||{},t,e),a.push(n)}}))),a.filter((t=>t.visible&&!this.getMsgRemoveModeStorage(t)))}calcStaticMsg(t){const{position:e}=t,i=this.viewMsgMap.get(t.appViewMsgId),{codeName:a,title:s,message:n,removeMode:o,position:r,messageType:c,layoutPanel:d,sysCss:l}=i,{userTag:h,userTag2:u,userTag3:p,userTag4:m}=i,g=e||r,f={key:"".concat(this.tag,"_").concat(a),title:s,message:n,position:g,messageType:c,removeMode:o,visible:!0,layoutPanel:d,sysCss:l,extraParams:{userTag:h,userTag2:u,userTag3:p,userTag4:m}};return f.data={env:f},f}async calcDynaMsgs(e,a,s){const n=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u,layoutPanel:p}=n;if(!o)throw new i(n,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));const m=await ibiz.hub.getAppDataEntity(o,a.srfappid),g={...s},f=this.getDeFieldName(m,r);f&&(g.sort="".concat(f,",asc"));const y=await t.fetchDataSet(n,a,g);if(!y.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(m,c),v=this.getDeFieldName(m,u),I=this.getDeFieldName(m,h),b=this.getDeFieldName(m,l),D=this.getDeFieldName(m,d);return y.map((t=>{const e={};v&&!Z(t[v])&&(e.position=t[v]),E&&!Z(t[E])&&(e.title=t[E]),I&&!Z(t[I])&&(e.message=t[I]),b&&!Z(t[b])&&(e.messageType=t[b]),D&&!Z(t[D])&&(e.removeMode=t[D]),Z(t.srfkey)||(e.key="".concat(this.tag,"_").concat(t.srfkey)),p&&(e.layoutPanel=p);const i=tt(w,e);return i.data={...t,env:i},i}))}});var Rr="__self",Or=t("BaseController",class{constructor(t,e,i,a){this.model=t,this.params=i,this.ctx=a,this.id=ut(),this.state={},this.name="",this.evt=new lr(this.getEventArgs.bind(this)),this.mountCounter=new or(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.state.context=e,this.preprocessModel(t),this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}get context(){return this.state.context}preprocessModel(t){}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(Rr),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(Rr)||this.mountCounter.attend(Rr)}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(){}}),_r=t("ViewController",class extends Or{constructor(t,e,i,a){super(ibiz.util.layoutPanel.fill(t),d.create({},e),i||{},new nr(a)),this.session={},this.modal=new vi({}),this.providers={},this.engines=[],this.error={},this.slotProps={},this.counters={},this.viewLoading=new ar,this.isCloseView=!1,a&&a.registerController(this.model.name,this),this.ctx.init(this),this.initEngines(),this.handleViewError=this.handleViewError.bind(this)}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(ibiz.i18n.t("runtime.controller.common.view.viewActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewPause",{name:this.model.name,id:this.model.id}))}initEngines(){const t=ke(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn(ibiz.i18n.t("runtime.controller.common.view.noFoundViewEngine"),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 $a.getCounterByRef(t,this.context,{...this.params});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={},this.state.isClosing=!1,this.state.hasError=!1,this.state.isShortCut=!1}async onCreated(){this.state.isLoading=!0,await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{ot(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 ki(t);this.providers[t.name]=e;const i=ze(this.model);i&&await Promise.all(i.map((async t=>{const e=await ki(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const a=Ve(this.model);a.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(a),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()))),ibiz.mc.error.on(this.handleViewError),this.state.isLoading=!1}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(),await this.initShortCut()}async initShortCut(){const{model:t,context:e}=this,i=await ibiz.util.shortCut.calcShortCutKey({context:e,appViewId:t.id});this.state.isShortCut=ibiz.util.shortCut.isExist(i)}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(ibiz.i18n.t("runtime.controller.common.view.viewDestroy",{name:this.model.name,id:this.model.id})),ibiz.mc.error.off(this.handleViewError)}handleContextParams(){if(this.context.srfappid=this.model.appId||ibiz.env.appId,Z(this.context.srfsessionid)||et(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}this.context.srfviewid=this.id;const t=this.model.appViewNavContexts;let e={};ct(t)&&(e=he(t,this.params,this.context)),Object.assign(this.context,e),Object.prototype.hasOwnProperty.call(this.context,"srfreadonly")||Object.assign(this.context,{srfreadonly:!1});const i=this.model.appViewNavParams;let a={};ct(i)&&(a=he(i,this.params,this.context)),Object.assign(this.params,a),this.engines.forEach((t=>{t.handleContextParams()})),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let i;for(const a of this.engines)if(i=await a.call(t,e),void 0!==i)break;return i}async callUIAction(t,e){const i=this.call(t,e);if(void 0===i)throw new o(ibiz.i18n.t("runtime.controller.common.view.noSupportBehavior",{key:t}));return i}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,codeName:e}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Mr(t,"".concat(e,"_").concat(this.modal.mode)),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){var e,i;const[a,...s]=t,n={title:a.title,desc:a.message,options:{showClose:0!==a.removeMode,showConfirmButton:0!==a.removeMode,customClass:(null==(e=a.sysCss)?void 0:e.cssName)||""}};if(a.layoutPanel&&n.options){const t=new v("view-message").m("alert");n.options.customClass="".concat(n.options.customClass||""," ").concat(t),n.options.message=()=>ibiz.render.renderCtrlShell(a.layoutPanel,this.context,this.params,{data:a.data})}a.extraParams.userTag&&Object.assign(n,{confirmButtonText:a.extraParams.userTag});try{"WARN"===a.messageType?await ibiz.modal.warning(n):"ERROR"===a.messageType?await ibiz.modal.error(n):await ibiz.modal.info(n)}finally{null==(i=this.viewMsgController)||i.setMsgRemoveModeStorage(a)}s.length&&this.alertViewMessage(s)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}handleViewError(t){const{type:e,data:i}=t;"ERROR"===e&&i instanceof s&&i.tag===this.id&&(this.error=i,this.state.hasError=!0)}}),Fr=(t("AppDataUploadViewController",class extends _r{initState(){super.initState()}async onCreated(){await super.onCreated();const{srfappdataentityid:t,srfdedataimportid:e,srfappid:i}=this.context,{appDataEntity:a,deDataImport:s}=await Cr({appDataEntityId:t,deDataImportId:e,appId:i});this.state.appDataEntity=a,this.state.deDataImport=s}downloadTemplate(){const{appDataEntity:t,deDataImport:e}=this.state;Pr(t,e,this.context)}async selectAndImport(){const t=await Tr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context});return!0===t.isAsync&&this.closeView(),t}async asyncImportData2(t){return Nr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context,...t})}}),t("MobViewController",class extends _r{}),t("WFStepTraceViewController",class extends _r{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),i=null==(t=this.ctx.parent)?void 0:t.view;if(i&&i.model.appDataEntityId){const t=await e.deService.getService(i.context,i.model.appDataEntityId),a=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(a);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")}if(this.model.cssStyle){const t={};this.model.cssStyle.split(";").filter(Boolean).forEach((e=>{const[i,a]=e.split(":");i&&a&&(t[i.trim()]=a.trim()),Object.assign(this.style,t)}))}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,i){const{navigateContexts:a,navigateParams:s}=this.model;let n={};a&&t&&(n=he(a,t,i,e));const o=Object.assign(e.clone(),n);let r={};return s&&t&&(r=he(s,t,i,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 fr.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),zr=(t("CodeListEditorController",class extends Fr{get convertToCodeItemText(){return!!this.parent.model.convertToCodeItemText}async loadCodeList(t){const{context:e,params:a}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let i=[];return i=await t.codeList.get(this.model.appCodeListId,e,a),i}throw new i(this.model,ibiz.i18n.t("runtime.controller.common.editor.editorNoConfigured",{editorType:this.model.editorType}))}}),t("ControlController",class extends Or{constructor(t,e,i,a){if(super(t,d.create({},e),new I({},i),a),this.controlParams={},this.providers={},this.triggerKey="",this.awaitActiveCbs=new Map,this.delayCbs=new Map,this.registerToCtx(),this.controlPanel=Ee(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=it(e))}this.updateContextParams({}),this.handleControlParams()}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 ki(this.controlPanel);this.providers[this.controlPanel.name]=t}if(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)})),this.model.appDataEntityId){const t=Ae(this.model.appDataEntityId);this.triggerKey="".concat(this.view.name,"@").concat(t,"@").concat(this.model.controlType,"@").concat(this.model.codeName)}this.onDEDataChange=this.onDEDataChange.bind(this),ibiz.mc.command.change.on(this.onDEDataChange)}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){ibiz.mc.command.change.off(this.onDEDataChange),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:i}=this.model;let a={};ct(e)&&(a=he(e,this.params,this.context)),Object.assign(this.context,a);let s={};ct(i)&&(s=he(i,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,this.awaitActiveCbs.size>0&&this.awaitActiveCbs.forEach((t=>{t()})),this.awaitActiveCbs.clear(),ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentPause",{name:this.model.name,id:this.model.id}))}handlerAbilityParams(t){const e=this.context.clone(),i={...this.params};let a=this.getData()||[];return(null==t?void 0:t.data)&&(a=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(i,t.viewParam),{context:e,params:i,data:a}}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={};ct(t)&&(e=he(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())}findCtrlMsgByTag(t){let e;const{ctrlMsg:i}=this.model;return i&&i.ctrlMsgItems&&(e=i.ctrlMsgItems.find((e=>e.name===t))),e}actionNotification(t,e){let i,a="";if(this.findCtrlMsgByTag("".concat(t,"_HIDDEN")))return;const o=this.findCtrlMsgByTag(t);if(o&&o.content){i=Z(o.timeout)?void 0:o.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),a=ei.execScriptFn(t,"`".concat(o.content,"`"),{isAsync:!1,singleRowReturn:!0})}if(!a&&ibiz.i18n){const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();a=ibiz.i18n.t(e,""),a===e&&(a="")}if(!a&&(null==e?void 0:e.default)&&(a=e.default),!a&&(null==e?void 0:e.error)&&(a=a||e.error.message),a){if(null==e?void 0:e.error){if(e.error instanceof s&&500!==e.error.status)throw e.error;throw ibiz.log.error(e.error),new n(a,i)}ibiz.message.success(a,i,0===i)}}onDEDataChange(t){ibiz.log.debug("onDEDataChange",t)}emitDEDataChange(t,e){const i=e instanceof os?e.$origin:e,a={triggerKey:this.triggerKey};switch(t){case"create":ibiz.mc.command.create.send(i,a);break;case"update":ibiz.mc.command.update.send(i,a);break;case"remove":ibiz.mc.command.remove.send(i,a);break;default:throw new o(ibiz.i18n.t("runtime.controller.common.control.unsupportedType",{type:t}))}}doNextActive(t,e){if(Z(e.delay)&&(e.delay=300),!1===this.state.activated)this.awaitActiveCbs.set(e.key,t);else if(e.delay){const i=this.delayCbs.get(e.key);clearTimeout(i);const a=setTimeout((()=>{t(),clearTimeout(this.delayCbs.get(e.key))}),e.delay);this.delayCbs.set(e.key,a)}else t()}})),Vr=t("MDControlController",class extends zr{constructor(){super(...arguments),this.isSetSort=!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=[],this.state.hideNoDataImage=!1}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)})),this.isSetSort||this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}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 i=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(i.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:i,sortQuery:a,noSort:s}=this.state,n={...this.params};return i&&(n.page=e-1,n.size=i),!s&&a&&(n.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,i=!0===t.isLoadMore;e?this.state.curPage=1:i&&(this.state.curPage+=1);const{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),n=await this.service.fetch(a,s);"number"==typeof n.total&&(this.state.total=n.total),"number"==typeof n.totalPages&&(this.state.totalPages=n.totalPages),i?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(){this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{await Cn(a.map((async t=>{s=await this.handleItemRemove(t,e,i),this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.common.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(e){throw await this._evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0),a.forEach((t=>{this.emitDEDataChange("remove",t)}))}async handleItemRemove(t,e,i){let a=!1;const s=Ae(this.model.appDataEntityId);if(0!==t.srfuf){const n=e.clone();n[s]=t.srfkey,await this.service.remove(n,i),a=!0}return a}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,i;const{selectedData:a}=this.state;b(a,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==(i=this.quickToolbarController)||i.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,i=e.filter((e=>e.srfkey!==t.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){const{appDataEntityId:t,dedataImportId:e}=this.model;if(!t||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));await Ar({appDataEntityId:t,deDataImportId:e,context:this.context,params:this.params})}async exportData(t){}onDEDataChange(t){var e;if(!Z(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if(!t.data||t.data.srfdecodename!==(null==(e=this.dataEntity)?void 0:e.codeName))return;let i=!1;const{srfkey:a}=t.data;switch(t.subtype){case"OBJECTCREATED":i=!0;break;case"OBJECTUPDATED":case"OBJECTREMOVED":-1!==this.state.items.findIndex((t=>t.srfkey===a))&&(i=!0)}i&&this.doNextActive((()=>this.load({isInitialLoad:!!ibiz.env.isMob})),{key:"refresh"})}}),kr=t("CustomAppMenuController",class{constructor(t,e){this.model=t,this.menu=e,this.type="personal",this.ownerType="",this.ownerId="",this.context=e.context,this.params=e.params,this.init()}init(){var t;this.type="personal",this.ownerId=this.context.srfpersonid;const e=ibiz.hub.getApp(this.context.srfappid).getAppUtil("DYNAMENU","CUSTOM");e?this.util=new Js(e):this.config=new Ja(this.model.appId,"menu","menu_".concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase()))}getResourceTag(){var t;const e="".concat(this.context.srfappid,"_menu_").concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase());switch(this.type){case"personal":return"".concat(e,"_").concat(this.context.srfpersonid);case"data":return"".concat(e,"_").concat(this.ownerType,"_").concat(this.ownerId);default:return e}}async loadCustomModelData(){let t;if(t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t&&t.model){return JSON.parse(t.model)}return[]}async resetCustomModelData(){return this.saveCustomModelData([])}async saveCustomModelData(t,e={}){const i={model:JSON.stringify(t)};return this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},i):await this.config.save(i),t}}),Ur=t("AppMenuController",class extends zr{constructor(t,e,i,a){super(t,e,i,a),this.itemProviders={},this.customController=null,this.saveConfigs=[],this.flattenAllItems(),t.enableCustomized&&(this.customController=new kr(t,this))}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)})),this.customController&&await this.loadCustomMenusModel()}async loadCustomMenusModel(){const t=await this.customController.loadCustomModelData();t&&0!==t.length?this.saveConfigs=t:this.saveConfigs=[]}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await Ta(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,a=!0,s={}){const n=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));this.evt.emit("onClick",{eventArg:t,event:e});const r=this.itemProviders[t];if(r&&r.onClick)return r.onClick(n,e,this);if(!n.appFuncId)throw new i(n,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const c=this.context.clone();c.srfappid=n.appId||ibiz.env.appId,this.routeDepth&&a&&Object.assign(c,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(Ko.TAG,n.appFuncId,c,this.params,s)}initMenuItemState(t){var e;const i={permitted:!0,visible:!0};if(t.hidden)i.visible=!1;else{let a=!0;t.accessKey&&(a=this.app.authority.calcByResCode(t.accessKey));let s=a;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}i.permitted=a,i.visible=s}return this.state.menuItemsState[t.id]=i,i}flattenAllItems(){const t=[],e=i=>{i.forEach((i=>{t.push(i),i.appMenuItems&&i.appMenuItems.length>0&&e(i.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 i;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(i=e.appMenuItems)?void 0:i.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),Br=(t("AppMenuIconViewController",class extends Ur{async onClickMenuItem(t,e){const a=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));if(this.evt.emit("onClick",{eventArg:t,event:e}),!a.appFuncId)throw new i(a,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(Ko.TAG,a.appFuncId,s,this.params)}}),t("CalendarService",class extends cs{async search(t,e={}){const{sysCalendarItems:i}=this.model;if(!i)return[];const a=i.map((async i=>{const a=i.appDEDataSetId||"fetchdefault",s=t.clone(),n=this.handleRequestParams(i,e);return i.maxSize&&(n.size=i.maxSize),this.exec2(a,s,n,void 0,i.appDataEntityId)}));return(await Promise.all(a)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:i}=this.model;if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));const a=i[e];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));return t.map((t=>new nn(a,t)))}async exec2(t,e,i={},a={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,i,a)}handleRequestParams(t,e){const i=it(e),{srfstartdate:a,srfenddate:s}=i;return Object.assign(i,{["n_".concat(t.beginTimeAppDEFieldId,"_gtandeq")]:a,["n_".concat(t.endTimeAppDEFieldId,"_ltandeq")]:s}),delete i.srfstartdate,delete i.srfenddate,i}}));t("CalendarController",class extends Vr{initState(){var t,e;super.initState(),this.state.selectedDate=new Date,this.state.size=1e3,this.state.legends=[],this.state.calendarTitle=this.model.logicName||"",this.state.showDetail=(null==(e=null==(t=this.model.controlParam)?void 0:t.ctrlParams)?void 0:e.SHOWDETAIL)||!1}async onCreated(){await super.onCreated(),this.service=new Br(this.model),await this.service.init(this.context),this.initViewScheduler(),this.initCalendarLegends()}initCalendarLegends(){const{sysCalendarItems:t}=this.model;if(!t)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));t.forEach((t=>{const{id:e,name:i,bkcolor:a,color:s}=t;this.state.legends.push({id:e,name:i,bkcolor:a,color:s})}))}initViewScheduler(){const t=Ve(this.model);0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async onDestroyed(){await super.onDestroyed(),this.viewScheduler&&this.viewScheduler.destroy()}async setActive(t){this._evt.emit("onActive",{data:t?[t]:[]}),t&&await this.openData(t)}async openData(t){var e,a,s;const n=this.context.clone();n[((null==(a=null==(e=t.deData)?void 0:e.srfdecodename)?void 0:a.toLowerCase())||Ae(this.model.appDataEntityId)).toLowerCase()]=t.deData.srfkey;const o=await(null==(s=this.viewScheduler)?void 0:s.triggerCustom("".concat(t.itemType.toLowerCase(),"_opendata"),{context:n,params:this.params,data:[t.deData],event:void 0,view:this.view,ctrl:this}));if(-1===o)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:t.itemType.toLowerCase()}));return{cancel:!o||o.ok}}calcShowMode(t){this.state.hideNoDataImage=!1;const e=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===e&&0===t.length&&(this.state.hideNoDataImage=!0),"MIXIN"===e&&0===t.length&&(this.state.hideNoDataImage=!0)}async load(t={}){const e=!0===t.isInitialLoad,{context:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(i,a)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.calcShowMode(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 i=t.beginTime,a=e.beginTime;let s=0;return Ct(i).isAfter(a)?s=-1:Ct(i).isBefore(a)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{calendarStyle:i}=this.model;let{srfstartdate:a,srfenddate:s}=t;if(!a||!s){switch(i){case"DAY":a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),s=new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1);break;case"WEEK":const t=e.getDay(),n=t>0?1-t:-6;a=new Date(e.getFullYear(),e.getMonth(),e.getDate()+n),s=new Date(new Date(a.getFullYear(),a.getMonth(),a.getDate()+7).getTime()-1);break;case"MONTH":a=new Date(e.getFullYear(),e.getMonth(),1),s=new Date(new Date(e.getFullYear(),e.getMonth()+1,1).getTime()-1);break;default:ibiz.log.warn("日历".concat(i,"样式暂未支持"))}return{srfstartdate:Ct(a).format("YYYY-MM-DD HH:mm:ss"),srfenddate:Ct(s).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:s}}async getFetchParams(t={}){const{curPage:e,size:i,sortQuery:a,noSort:s}=this.state,n={...this.params};if(!s&&a&&(n.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),i&&(n.page=e-1,n.size=i),t&&Object.assign(n,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(n);Object.assign(n,t)}return n}async onRowClick(t){if(!t)return void this.setSelection([]);const{selectedData:e}=this.state,i=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});Ct.extend(xt),Ct.extend(Lt),Ct.extend(Rt),Ct.extend(_t),Ct.extend(zt);var Wr="$default_group",Gr=class{constructor(t,e){var a;this.model=t,this.chartGenerator=e,this.catalogField="",this.catalogFields=[],this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:s,caption:n,id:o,userParam:r}=t;if(!t.catalogField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingClassification"));if(!t.valueField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingValue"));if(e.model.controlParam&&(null==(a=e.model.controlParam.ctrlParams)?void 0:a.CATALOGFIELDS))try{const t=JSON.parse(e.model.controlParam.ctrlParams.CATALOGFIELDS);Array.isArray(t)&&(this.catalogFields=t)}catch(t){throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"))}this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:c,chartYAxisId:d}=s||{};this.xAxisIndex=R(c),this.yAxisIndex=R(d),this.seriesName=n||o,this.staticOptions=this.calcStaticOptions(),r&&(this.seriesUserParam=$r(r))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,i=!1){if(Z(e))return;if(Z(t))return e;const a=this.chartGenerator.codeListMap.get(t);if(null==a?void 0:a.length){const t=a.find((t=>t.value===e));return t?t.text:"未定义"}return i?void 0:e}prepareChartData(t,e,i,a){var s;this.groupField&&(e["".concat(this.groupField,"_value")]=e[this.groupField],Object.assign(e,{[this.groupField]:a})),this.catalogField&&(e["".concat(this.catalogField,"_value")]=e[this.catalogField],Object.assign(e,{[this.catalogField]:i}));const n=new dn(e,this.model,i,a);t[a].get(i).chartData=n,null==(s=this.chartDataArr)||s.push(n)}handleMultiCatalogGroup(t,e){let i=[];if(0===t.length)i=e.map((t=>({text:t.text,value:t.value})));else for(let a=0;a<t.length;a++)if(e.length>0)for(let s=0;s<e.length;s++)i.push({text:"".concat(t[a].text,"_").concat(e[s].text),value:e[s].value});else i.push({text:t[a].text,value:t[a].value});return i}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:i,catalogCodeListId:a}=this.model;return t.forEach((t=>{let s=Wr;if(this.groupField){const e=this.translateVal(i,t[this.groupField]);if(Z(e))return;s=e}if(!e[s])if(e[s]=new Map,this.catalogFields.length>0){let t=[];const i=[];this.catalogFields.forEach((t=>{const{codelistId:e}=t;if(e&&this.autoCompleteCategory){const t=this.chartGenerator.codeListMap.get(e);i.push(it(t))}}));for(let e=0;e<i.length;e++)t=this.handleMultiCatalogGroup(t,i[e]);t.forEach((t=>{e[s].set(t.text,{value:0}),this.prepareChartData(e,{[this.valueField]:0,[this.catalogField]:t.value},t.text,s)}))}else if(a&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(a).forEach((t=>{e[s].set(t.text,{value:0}),this.prepareChartData(e,{[this.valueField]:0,[this.catalogField]:t.value},t.text,s)}))}let n="";if(this.catalogFields.length>0){const e=[];if(this.catalogFields.forEach((i=>{const a=this.translateVal(i.codelistId,t[i.codename],!0);a&&e.push(a)})),e.length!==this.catalogFields.length)return;n=e.join("_")}else n=this.translateVal(a,t[this.catalogField],!0);n&&(e[s].get(n)||e[s].set(n,{value:0}),e[s].get(n).value=M(e[s].get(n).value,t[this.valueField]||0),e[s].get(n).chartData?this.prepareChartData(e,Object.assign(t,{[this.valueField]:e[s].get(n).value}),n,s):this.prepareChartData(e,t,n,s))})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const i=t[e],a=this.calcSeriesData(i);let s={...this.staticOptions,data:a};return e!==Wr&&(s.name=e),this.seriesUserParam&&(s=rt(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{var a;this.chartGenerator.model.controlParam&&"ROW"===(null==(a=this.chartGenerator.model.controlParam.ctrlParams)?void 0:a.MODE)?e.push([t.value,i,t.chartData]):e.push([i,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),i=this.calcGroupData(e);return this.addTimeData(i),this.calcGroupSeries(i)}getChartDataByParams(t){var e,i,a;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[Wr].get(t.name))?void 0:e.chartData:null==(a=null==(i=this.groupData)?void 0:i[t.seriesName].get(t.name))?void 0:a.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(it(t))}));const{groupMode:i}=this.model;return i&&e.forEach((t=>{let e="";if("DAY"===i||"YEAR"===i||"MONTH"===i){if("DAY"===i?e="YYYY-MM-DD":"YEAR"===i?e="YYYY":"MONTH"===i&&(e="YYYY-MM"),t[this.catalogField]){const i=Ct(t[this.catalogField]).format(e);t[this.catalogField]=i}}else if("QUARTER"===i){if(t[this.catalogField]){const e="".concat(Ct(t[this.catalogField]).format("YYYY"),"-").concat(Ct(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===i&&t[this.catalogField]){const e="".concat(Ct(t[this.catalogField]).format("YYYY"),"-").concat(Ct(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((i=>{const a=t[i];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(a.keys()).sort(((t,e)=>Ct(t).diff(Ct(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(a.keys()).sort(((t,e)=>{const[i,a]=t.split("-"),[s,n]=e.split("-");return i!==s?parseInt(i,10)-parseInt(s,10):parseInt(a,10)-parseInt(n,10)})));const n=new Map;s.forEach((t=>{n.set(t,a.get(t))})),t[i]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const i=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{i.push(Ct(e))}))}));const a=Ct.max(i),s=Ct.min(i);if("DAY"===e){let e=s;const i=a;for(;null==e?void 0:e.isSameOrBefore(i,"day");){const i=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const i=a.year();for(;e<=i;){const i=e.toString();Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const i=a.clone().startOf("month");for(;e.isSameOrBefore(i);){const i=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=i.split("-"),[n]=a.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++)for(let i=1;i<=4;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=i.split("-"),[n]=a.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++){const i=Ct("".concat(e,"-12-31")).isoWeek();for(let a=1;a<=i;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}}this.sortTimeData(t)}},jr=class extends Gr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:a}=this.model;return a&&(t.step="middle"),t}},Kr=class extends Gr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},Hr=class extends Gr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},Xr=class extends Gr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},qr=class extends Gr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},Yr=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 i=this.indicator[t];(!i||i.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})))}}},Qr=class extends Gr{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=t.map((t=>it(t))),i=this.calcGroupData(e);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Yr(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(i).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,i=this.chartGenerator.radarMap.get(this.catalogField),a=Object.keys(e).map((t=>{const a=e[t],s=i.indicatorKeys.map((t=>a.has(t)?a.get(t).value:0));return{name:t===Wr?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:a};return this.seriesUserParam&&(s=rt(s,this.seriesUserParam)),s}},Jr=t=>{const e=/function\s*\(\s*|\s*function\s*\(\s*/,i={};return Object.keys(t).forEach((a=>{if(It(t[a])&&e.test(t[a])){const e="return ".concat(t[a]);i[a]=new Function(e)()}else bt(t[a])?i[a]=Jr(t[a]):Array.isArray(t[a])?i[a]=t[a].map((t=>"object"!=typeof t?t:Jr(t))):i[a]=t[a]})),i};function $r(t){const e={};return t&&Object.keys(t).forEach((i=>{const a=i.indexOf(".");if(-1===a)return;const s=i.slice(a+1);if(s)try{e[s]=JSON.parse(t[i])}catch(a){e[s]=t[i]}})),Jr(e)}var Zr=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:i,chartXAxises:a,chartYAxises:s,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),i&&(this.staticOptions.legend=this.calcLegendOption(i)),(null==a?void 0:a.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(a)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),n&&(this.chartUserParam=$r(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new jr(t,this);break;case"bar":e=new Kr(t,this);break;case"scatter":e=new qr(t,this);break;case"pie":e=new Xr(t,this);break;case"funnel":e=new Hr(t,this);break;case"radar":e=new Qr(t,this);break;default:ibiz.log.error(ibiz.i18n.t("runtime.controller.control.chart.noSupportSequence",{seriesType:t.seriesType}))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:i,subTitle:a,titlePos:s}=t,n={show:e,text:i,subtext:a,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:i}=t,a={};a.show=e;const s=null==i?void 0:i.toLowerCase();return"left"===s||"right"===s?(a.left=s,a.top="middle",a.orient="vertical"):"bottom"===s&&(a.top=s),a}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:i,dataShowMode:a,userParam:s}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:i,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===a?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===a&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===a?45:0}};s&&(n=rt(n,$r(s))),e.push(n)})),e}handleAxisLayout(t,e,i,a,s=!0){return t.map((t=>s?{value:t.text,textStyle:{padding:[0,e*(i-1-a),0,0]}}:{value:t.text,textStyle:{padding:[e*(i-1-a),0,0,0]}}))}handleAxisLevel(t,e,i){const a=[];if(0===e)return i;let s=1;for(let e=0;e<t.length;e++)s*=t[e].data.length;for(let t=0;t<s;t++)a.push(...i);return a}mergeAxisData(t,e){return t&&Array.isArray(t)?[...t,...e]:[t,...e]}handleSeriesModelCoordinateAxis(t,e){const{xAxisParam:i,yAxisParam:a}=e,s=[],n=[];for(let e=0;e<t.length;e++){const o=it(i),r=it(a);Object.assign(o,{gridIndex:e}),Object.assign(r,{gridIndex:e}),r.axisLabel.formatter=function(t){return 0===t?"{top|".concat(t,"}"):"{bottom|".concat(t,"}")},e!==t.length-1&&(o.name="",o.axisLine.show=!1,o.axisLabel.show=!1,o.axisTick.show=!1),r.showTitle&&Object.assign(r,{name:t[e].serieText}),s.push(o),n.push(r)}this.chartUserParam.xAxis=s,this.chartUserParam.yAxis=n}async initMultiCatalogxAxis(t,e){var i,a,s,n,o,r,c,d,l;const{controlParam:h}=this.model;if(h&&(null==(i=h.ctrlParams)?void 0:i.ZONE)){const t=null==(a=this.model.dechartSerieses)?void 0:a.length;if(t){const e=90/t,i=[];for(let a=0;a<t;a++){const t=a*e+5,s=100-(e+t);i.push({top:"".concat(t,"%"),bottom:"".concat(s,"%"),containLabel:!0})}this.chartUserParam&&(this.chartUserParam.grid=i,this.handleSeriesModelCoordinateAxis(this.model.dechartSerieses,{xAxisParam:(null==(s=this.chartUserParam)?void 0:s.xAxis)||{},yAxisParam:(null==(n=this.chartUserParam)?void 0:n.yAxis)||{}}))}}if(h&&(null==(o=h.ctrlParams)?void 0:o.CATALOGFIELDS))try{const i=JSON.parse(h.ctrlParams.CATALOGFIELDS),a=[];let s=!0,n=!0,o=0;if(Array.isArray(i)){const u=ibiz.hub.getApp(t.srfappid);if(this.chartUserParam){let t={};t="ROW"===(null==(r=h.ctrlParams)?void 0:r.MODE)?Array.isArray(this.chartUserParam.yAxis)?this.chartUserParam.yAxis[this.chartUserParam.yAxis.length-1]:this.chartUserParam.yAxis:Array.isArray(this.chartUserParam.xAxis)?this.chartUserParam.xAxis[this.chartUserParam.xAxis.length-1]:this.chartUserParam.xAxis,t&&(s=void 0===t.name||!!t.name,n=void 0===(null==(c=t.axisLabel)?void 0:c.show)||(null==(d=t.axisLabel)?void 0:d.show))}this.chartUserParam&&this.chartUserParam.grid&&Array.isArray(this.chartUserParam.grid)&&(o=this.chartUserParam.grid.length-1),await Promise.all(i.slice(0,-1).map((async(s,r)=>{var c;if("codelist"===s.mode&&s.codelistId){const d=await u.codeList.get(s.codelistId,t,e);if(d)if("ROW"===(null==(c=h.ctrlParams)?void 0:c.MODE)){const t=this.handleAxisLayout(d,40,i.length,r),e=this.handleAxisLevel(a,r,t);a.push({show:n,gridIndex:o,type:"category",data:e,position:"left"})}else{const t=this.handleAxisLayout(d,24,i.length,r,!1),e=this.handleAxisLevel(a,r,t);a.push({show:n,gridIndex:o,type:"category",data:e,position:"bottom"})}}})));const p=i.map((t=>t.name)).join("/");let m=i.length;n||(m=1),s||(m-=1),this.chartUserParam&&(this.chartUserParam.grid||(this.chartUserParam.grid={}),"ROW"===(null==(l=h.ctrlParams)?void 0:l.MODE)?(0===m?Object.assign(this.chartUserParam.grid,{bottom:45}):Object.assign(this.chartUserParam.grid,{left:40*(m+1)}),a.push({type:"category",gridIndex:o,show:s,data:[{value:p.split("").join("\n"),textStyle:{padding:[0,40*m,0,0]}}],position:"left"}),this.chartUserParam.yAxis&&(this.chartUserParam.yAxis=this.mergeAxisData(this.chartUserParam.yAxis,a))):(0===m?Object.assign(this.chartUserParam.grid,{bottom:30}):Object.assign(this.chartUserParam.grid,{bottom:24*(m+1)}),a.push({type:"category",gridIndex:o,show:s,data:[{value:p,textStyle:{padding:[24*m,0,0,0]}}],position:"bottom"}),this.chartUserParam.xAxis&&(this.chartUserParam.xAxis=this.mergeAxisData(this.chartUserParam.xAxis,a))))}}catch(t){throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"))}}async init(t,e){await this.loadCodeList(t,e),await this.initMultiCatalogxAxis(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 i,a,s;if(this.codeListMap.clear(),!(null==(i=this.model.dechartSerieses)?void 0:i.length))return;const n=ibiz.hub.getApp(t.srfappid),o=async i=>{if(!i||this.codeListMap.has(i))return;const a=await n.codeList.get(i,t,e);this.codeListMap.set(i,a)};if(null==(s=null==(a=this.model.controlParam)?void 0:a.ctrlParams)?void 0:s.CATALOGFIELDS)try{const t=JSON.parse(this.model.controlParam.ctrlParams.CATALOGFIELDS);Array.isArray(t)&&await Promise.all(t.map((async t=>{"codelist"===t.mode&&await o(t.codelistId)})))}catch(t){throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"))}await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:i}=t;await o(i),await o(e)})))}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((i=>{const a=e.length,s=i.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const n=e.length-1;for(let t=a;t<=n;t++)this.seriesGeneratorIndexMap.set(t,i)})),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=rt(this.staticOptions,this.options),this.chartUserParam&&(this.options=rt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noFindSequence",{seriesIndex:t.seriesIndex}));return e.getChartDataByParams(t)}},tc=t("ChartService",class extends cs{}),ec=(t("ChartController",class extends Vr{initState(){super.initState(),this.state.size=1e3,this.state.showGrid=!1,this.state.gridHeaders=[],this.state.gridData=[],this.state.gridPosition="bottom"}async onCreated(){await super.onCreated(),this.service=new tc(this.model),await this.service.init(this.context),this.generator=new Zr(this.model),await this.generator.init(this.context,this.params),this.parseGridParam(),this.resizeChart=this.resizeChart.bind(this),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const i=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),i}parseGridParam(){this.model.dechartDataGrid&&(this.model.dechartDataGrid.dataGridPos?this.state.gridPosition=this.model.dechartDataGrid.dataGridPos.toLocaleLowerCase():this.state.gridPosition="bottom",!0===this.model.dechartDataGrid.showDataGrid&&(this.state.showGrid=!0))}computeTotal(t){let e=0;return this.state.items.forEach((i=>{const a=Number(i[t]);Number.isNaN(a)||(e+=Number(a))})),e}handleSingleSerieGridData(){const t=this.generator.seriesGenerators[0],{catalogField:e,valueField:i,groupData:a}=t,s=t.chartGenerator.entity.appDEFields,n=s.find((t=>t.id===e)),o=s.find((t=>t.id===i)),r=[{id:e,name:null==n?void 0:n.logicName},{id:i,name:null==o?void 0:o.logicName},{id:"srfpercent",name:"百分比"}];this.state.gridHeaders=r;const c=[],d=this.computeTotal(i);if(a&&a.$default_group){const t=a.$default_group;for(const[a,s]of t){const t=Number.isNaN(Number(s.value))?0:Number(s.value);let n="";n=0===d||Number.isNaN(Number(s.value))?"0%":"".concat(Math.round(t/d*100),"%");const o={[e]:a,[i]:t,srfpercent:n};c.push(o)}}this.state.gridData=c}handleMultipleSerieGridData(){const t=[],e=[];this.generator.seriesGenerators.forEach((i=>{const{catalogField:a,valueField:s,groupData:n}=i,o=i.chartGenerator.entity.appDEFields;if(t.findIndex((t=>t.id===a))<0){const e=o.find((t=>t.id===a.toLowerCase()));t.push({id:a,name:null==e?void 0:e.logicName})}const r=o.find((t=>t.id===s.toLowerCase()));if(t.push({id:s,name:null==r?void 0:r.logicName}),n&&n.$default_group){const t=n.$default_group;for(const[i,n]of t){const t=Number.isNaN(Number(n.value))?0:Number(n.value),o=e.findIndex((t=>t[a]===i));if(o<0){const n={[a]:i,[s]:t};e.push(n)}else Object.assign(e[o],{[s]:t})}}})),this.state.gridHeaders=t,this.state.gridData=e}computeGridData(){this.generator&&this.generator.seriesGenerators&&(1===this.generator.seriesGenerators.length?this.handleSingleSerieGridData():this.handleMultipleSerieGridData())}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.state.showGrid&&this.computeGridData(),this.updateChart()}updateChart(){if(!this.chart)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noInitialised"));if(!this.options)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noCalculated"));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 zr{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):""),this.setBrowserTabTitle()}))}setBrowserTabTitle(){"ROUTE"!==this.view.modal.mode&&"ROUTE_MODAL"!==this.view.modal.mode||ibiz.util.setBrowserTitle(this.state.caption)}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.session={},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)}}),ic=class{};function ac(t,e){const{srcDEUILogicParamId:i,srcFieldName:s,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(o){case"SRCDLPARAM":c=t.params[i];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=it(ibiz.env);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:o}))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:ei.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:r}),c),t}return c}var sc=class extends ic{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=ac(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.currentConditionValue"));const t=null!=s[this.value]?s[this.value]:e[this.value];r=t,o=qe(n,this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.sourceDataObjectAttribute"));const e=ac(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});r=e,o=qe(n,this.op,e);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.currentTime"));default:r=this.value,o=qe(n,this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditionalTypeName",{name:this.model.name,type:this.type,dstField:this.dstField}),n,ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},nc=class t extends ic{constructor(e){super(),this.model=e;const i=e.deuilogicLinkConds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new sc(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let s="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditional"));for(let i=0;i<this.conds.length;i++){const n=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}const n=this.notMode?!s:s;return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.connectionConditionGroup",{name:this.model.name,id:this.model.id}),n),n}},oc=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:i}=this.model;0===(e||0)&&i&&(this.groupCond=new nc(i))}async exec(t){const{linkMode:e}=this.model,{context:i,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,i,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousTermination"));case 3:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousRejection"));case 9:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.exceptionHandling"));default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.logicalLinkTypes",{linkMode:e}))}}},rc=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new oc(t)))}},cc=class extends rc{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data,t.setLastReturn(t.params[n])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDEUILogicParamId:n}),t.params[n])}},dc=class extends rc{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:a,dstAppDataEntityId:s}=this.model,{data:n,parameters:o}=t;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceBehavior"));let r=[n];if(a){const e=t.params[a];r=e instanceof Array?e:[e]}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityInterfaceAction",{id:this.model.id,dstAppDEUIActionId:e,dstAppDataEntityId:s,dstDEUILogicParamId:a})),await Mc.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:r},this.model.appId)}},lc=class extends rc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeStartupNode",{id:this.model.id}))}},hc=class extends rc{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:i,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(i);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.unsupportedEndNode",{returnType:e}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEndNode",{id:this.model.id,returnType:e}),t.result)}}},uc=class extends rc{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const i of e){let e;switch(i.dstDEUILogicParamId&&"DEBUG"===ibiz.env.logLevel&&(e=it(t.params[i.dstDEUILogicParamId])),i.paramAction){case"SETPARAMVALUE":await this.setParamValue(i,t);break;case"RESETPARAM":await this.resetParam(i,t);break;case"COPYPARAM":await this.copyParam(i,t);break;case"BINDPARAM":await this.bindParam(i,t);break;case"RENEWPARAM":await this.renewParam(i,t);break;case"APPENDPARAM":await this.appendParam(i,t);break;case"SORTPARAM":await this.sortParam(i,t);break;default:throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:i.paramAction}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodePreparationParameter",{id:this.model.id,paramAction:i.paramAction,dstDEUILogicParamId:i.dstDEUILogicParamId}),e,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[i.dstDEUILogicParamId])}}setParamValue(t,e){const{dstFieldName:i,dstDEUILogicParamId:a}=t;if(!a)throw new o(ibiz.i18n.t("runtime.uiLogic.noTargetParameter"));let s=i;e.isEntityParam(a)&&(s=null==s?void 0:s.toLowerCase());const n=ac(e,t);if(s)try{ei.execScriptFn({srcVal:n,dstParam:e.params[a]},"dstParam.".concat(i," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.targetParameter",{dstFieldName:i}),e.params[a]),t}else e.params[a]=n}copyParam(t,e){const{dstDEUILogicParamId:i}=t,a=ac(e,t);e.params[i]=it(a)}bindParam(t,e){const i=ac(e,t);e.params[t.dstDEUILogicParamId]=i}resetParam(t,e){const{dstDEUILogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDEUILogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDEUILogicParamId:i,dstIndex:a,srcIndex:s,srcSize:n}=t,o=ac(e,t),r=a||0,c=s||0,d=n||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:i,dstFieldName:a,dstSortDir:s}=t,n=a;e.params[i].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},pc=class extends rc{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:a,invokeParamId:s}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceObject"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredOperatingParameters"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredCallMethod"));const n=t.params[s];if(!n)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundOperationParameter",{invokeParamId:s}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInterfaceObject",{invokeCtrlId:a}));if(!r[e]||!J(r[e]))throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInvokeMethod",{invokeMethod:e}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetInvocation",{id:this.model.id,invokeCtrlId:a,invokeMethod:e}),n),await r[e](n)}},mc=class extends rc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const s=ac(t,this.model);t.params[e]=s,t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.bindingParameters",{id:this.model.id,dstDEUILogicParamId:e}),s)}},gc=class extends rc{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 i(this.model,ibiz.i18n.t("runtime.uiLogic.missingMessageTypeConfiguration"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingButtonTypeConfiguration"));let{title:o,message:r}=this.model;if(n){const e=t.params[n];e.title&&(o=e.title),e.message&&(r=e.message)}const c=this.typeMap[e],d={type:c,title:o||ibiz.i18n.t("runtime.uiLogic.message"),desc:r};let l=[];switch(s){case"YESNO":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.yes"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.no"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["yes","no"];break;case"OK":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.showConfirmButton=!0,d.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.cancel"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["ok","cancel"];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.noSupportItem",{name:s}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeMessagePopup",{id:this.model.id,type:c,message:r}));const h=await ibiz.modal.confirm(d);t.setLastReturn(l[h?0:1])}},fc=class extends rc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeFrontendPlugin",{id:this.model.id,sysPFPluginId:this.model.sysPFPluginId}));const e=await oa(this.model);e&&await e.exec(this.model,t)}},yc=class extends rc{async exec(t){const{dstDEUILogicParamId:e,name:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));const s=t.params[e];ibiz.log.info(ibiz.i18n.t("runtime.uiLogic.logicalNodeOperation",{name:a}),s)}},wc=class extends rc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeResetParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},Ec=class extends rc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const s=ac(t,this.model);t.params[e]=it(s),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.copyParameter",{id:this.model.id,dstDEUILogicParamId:e}),s)}},vc=class extends rc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const r=ac(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.appendedArray",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},Ic=class extends rc{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const n=s,o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[n]-e[n]:e[n]-t[n])),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeSortedArrayParameters",{id:this.model.id,dstFieldName:s,dstSortDir:a,dstDEUILogicParamId:e}),o)}},bc=class extends rc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeRebuildParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},Dc=class extends rc{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingfilter"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(a,e,t.context,o);c.ok&&(t.params[n]=c.data,t.setLastReturn(t.params[s])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDataSet",{id:this.model.id,dstAppDataEntityId:a,dstAppDEDataSetId:e,retDEUILogicParamId:n}),t.params[n])}},Cc=class extends rc{async exec(t){const{errorInfo:e}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeThrowingExceptions",{id:this.model.id,errorInfo:e})),new o(e)}},Ac=class extends rc{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:a,fireCtrlId:s}=this.model;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredTriggerObject"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEvent"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEventParameters"));const n=t.params[s];if(!n)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundTriggerObject",{fireCtrlId:s}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundEventParameterObject",{eventParamId:a}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetEventTriggerLogic",{id:this.model.id,fireCtrlId:s,eventName:e}),r),await n.evt.emit(e,r)}},Pc=class extends rc{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityConfigured"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityLogicConfigured"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noIncomingLogic"));const r=t.params[s];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.passedParameter",{dstDEUILogicParamId:s}));const c=await ks(e,a,t.context,r,t.params);n&&(t.params[n]=c,t.setLastReturn(t.params[n])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeExecutingEntityLogic",{id:this.model.id,dstAppDELogicId:e,dstAppDataEntityId:a,retDEUILogicParamId:n}),c)}},Tc=class extends rc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDirectCode",{id:this.model.id}),this.model.code),await ei.asyncExecScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"")}},Nc=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model,{parameters:a}=t,{context:s,params:n,data:o}=a,r=ibiz.hub.getApp(i.appId);if("layoutPanel"!==i.codeName){if(i.default)i.entityListParam?t.params[e]=o||[]:t.params[e]=o&&o.length>0?o[0]:{};else if(i.activeContainerParam)t.params[e]=a.ctrl||a.view;else if(i.activeCtrlParam)t.params[e]=a.ctrl;else if(i.ctrlParam){const s=a.view.getController(i.codeName.toLowerCase());s?t.params[e]=s:ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.viewLogicInitializationParameter",{codeName:i.codeName}))}else if(i.activeViewParam)t.params[e]=a.view;else if(i.appGlobalParam){let a=ibiz.util.getGlobalParam();i.paramFieldName&&(a.hasOwnProperty(i.paramFieldName)||(a[i.paramFieldName]={}),a=a[i.paramFieldName]),t.params[e]=a}else if(i.applicationParam)t.params[e]=r;else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]=[];else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.navContextParam)t.params[e]=s;else if(i.navViewParamParam)t.params[e]=ibiz.util.getRouterParams();else if(i.routeViewSessionParam){let s=a.view.getTopView().state;i.paramFieldName&&(s.hasOwnProperty(i.paramFieldName)||(s[i.paramFieldName]={}),s=s[i.paramFieldName]),t.params[e]=s}else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.viewNavDataParam)t.params[e]=n;else if(i.viewSessionParam){let s=a.view.state;i.paramFieldName&&(s.hasOwnProperty(i.paramFieldName)||(s[i.paramFieldName]={}),s=s[i.paramFieldName]),t.params[e]=s}else i.filterParam?t.params[e]={}:i.envParam?t.params[e]=ibiz.env:i.sessionParam&&(t.params[e]=t.session);ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.calculateInterfaceLogicParameters",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}else t.params[e]=a.view.layoutPanel.panelItems}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.restablishInterfaceLogic",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}},xc=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 i(t,ibiz.i18n.t("runtime.uiLogic.noLogicalNodesConfigured"));t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new lc(t);break;case"END":i=new hc(t);break;case"DEACTION":i=new cc(t);break;case"DEUIACTION":i=new dc(t);break;case"PREPAREJSPARAM":i=new uc(t);break;case"RESETPARAM":i=new wc(t);break;case"COPYPARAM":i=new Ec(t);break;case"BINDPARAM":i=new mc(t);break;case"VIEWCTRLINVOKE":i=new pc(t);break;case"MSGBOX":i=new gc(t);break;case"DEBUGPARAM":i=new yc(t);break;case"APPENDPARAM":i=new vc(t);break;case"SORTPARAM":i=new Ic(t);break;case"RENEWPARAM":i=new bc(t);break;case"DEDATASET":i=new Dc(t);break;case"THROWEXCEPTION":i=new Cc(t);break;case"VIEWCTRLFIREEVENT":i=new Ac(t);break;case"DELOGIC":i=new Pc(t);break;case"PFPLUGIN":i=new fc(t);break;case"RAWJSCODE":i=new Tc(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Nc(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 ec(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:a}=this.model;if(!a||!this.nodes.has(a))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{const t=this.nodes.get(a);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:i}=t;for(let a=0;a<i.length;a++){const s=i[a];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!0!==t.model.parallelOutput))break}}},Sc=new Map;async function Lc(t,e,i){const a=ibiz.hub.getApp(i.context.srfappid),s=await a.getDEUILogic(t,e);if(!s)throw new o(ibiz.i18n.t("runtime.uiLogic.interfaceLogic",{appDataEntityId:e,deUILogicId:t}));Sc.has(s)||Sc.set(s,new xc(s)),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.startExecutingInterfaceLogic",{appDataEntityId:e,name:s.name}));const n=Sc.get(s),r=await n.exec(i);return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.endExecutionInterfaceLogic",{appDataEntityId:e,name:s.name})),r}var Mc=t("UIActionUtil",class{static async exec(t,e,i){const a=await Se(t,i);if(!a)throw new o(ibiz.i18n.t("runtime.uiAction.noFoundBehaviorModel",{actionId:t}));if("SINGLEDATA"===a.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await sa(a)).exec(a,e)}static async execAndResolved(t,e,i){var a,s;const n=await this.exec(t,e,i);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==(a=e.view.parentView)||a.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}(await Se(t,i)).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"))}}),Rc=t("UIActionProviderBase",class{async exec(t,e){const a={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{view:s}=e;t.closeEditView&&(s.state.isClosing=!0);const{appDEUILogicId:n,appDataEntityId:o,uilogicAttachMode:r}=t;if("REPLACE"===r){if(!n)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return await Lc(n,o,e),a}if(!await this.isConfirm(t,e))return this.returnError(a,s);const c=await this.execAction(t,e);if(Object.assign(a,c),!0===a.cancel)return this.returnError(a,s);if("AFTER"===t.uilogicAttachMode){if(!n)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));await Lc(n,o,this.mergeArgsByResult(e,a))}const d=this.mergeArgsByResult(e,a);if(t.closeEditView)this.doNextAction(t,d,t.appId);else{const e=await this.doNextAction(t,d,t.appId);if(e&&(Object.assign(a,e),!0===e.cancel))return this.returnError(a,s)}return a}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t,e){return e.state.isClosing=!1,Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const i=this.calcMessage("confirm",t,e);return!t.enableConfirm||!i||ibiz.confirm.warning({title:ibiz.i18n.t("runtime.uiAction.operationConfirmation"),desc:i})}async doNextAction(t,e,i){const a=t.nextId;if(a)return Mc.exec(a,e,i)}async handleParams(t,e,i,a){let s=[];const n=Ae(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[i[0]];break;case"MULTIDATA":s=i;break;case"MULTIKEY":s=n&&i.length>0?i.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=i[0]||{};s=n?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:i}=t,a=i||n,s=e||"srfkey";c.unshift({key:a,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&i.length>0,l=he(c,d?me(c,i):i[0]||{},a,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:he(h,d?me(h,i):i[0]||{},a,r)}}calcMessage(t,e,i){let a,s;const{confirmMsg:n,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":a=n,s=o;break;case"success":a=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||a);t!==s.lanResTag&&(a=t)}if(a){const{data:t}=i,e={...i};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,ei.execScriptFn(e,"`".concat(a,"`"),{isAsync:!1,singleRowReturn:!0})}}handleViewOptionParams(t){if(t.modaloption)try{const e=JSON.parse(t.modaloption);return delete t.modaloption,{modalOption:e}}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.uiAction.viewParameterModalOption",{error:t}))}return{}}}),Oc=t("BackendUIActionProvider",class extends Rc{async execAction(t,e){const{context:a,params:s,data:n,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new i(t,ibiz.i18n.t("runtime.uiAction.noEntityOrBehavior"));const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,a,n,s),p={...h},m=t.frontAppViewId;if(m){const t=this.handleViewOptionParams(h),e=await ibiz.commands.execute(Go.TAG,m,l,h,{event:o,...t});if(!(null==e?void 0:e.ok))return r.cancel=!0,r;if((null==e?void 0:e.ok)&&e.data){0===u.length&&u.push({});const t=e.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((e=>{e.srfactionparam=t}))}}const g=ibiz.hub.getApp(null==a?void 0:a.srfappid),f=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),y=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),w=await g.deService.exec(c,d,l,y?f:f[0],p);if(w.ok){const i=this.calcMessage("success",t,e);i&&ibiz.message.success(i)}return Object.assign(r,{data:pt(w.data)?w.data:[w.data],nextContext:l,nextParams:p}),r}}),_c=t("SysUIActionProvider",class extends Rc{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:i}=e,a=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===a)return{closeView:!0};return await i.callUIAction(a,e)||{}}}),Fc=t("FrontUIActionProvider",class extends Rc{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=C.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 i(t,ibiz.i18n.t("runtime.uiAction.noConfiguredopenView"));const{resultContext:a,resultParams:l}=await this.handleParams(t,s,o,n),h=this.handleViewOptionParams(l),u=await ibiz.commands.execute(Go.TAG,e,a,l,{event:r,noWaitRoute:c,...h});(null==u?void 0:u.ok)||(d.cancel=!0),(null==u?void 0:u.ok)&&u.data&&(d.data=u.data,d.nextContext=a,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=await this.doOther(t,e);break;case"EDITFORM":d=await this.openEditForm(t,e);break;default:throw new a(t,ibiz.i18n.t("runtime.uiAction.frontProcessingModes",{frontProcessType:t.frontProcessType}))}return d}async doOther(t,e){const{scriptCode:a,uiactionTag:s}=t,{context:n,params:o,data:r,event:c,view:d}=e;if("ShortCut"===s){return await d.callUIAction(s,e)||{}}if(a){return await ei.asyncExecScriptFn({context:n,params:o,data:r,el:null==c?void 0:c.target,view:d},a)||{}}throw new i(t,ibiz.i18n.t("runtime.uiAction.missingConfigurationScriptCode"))}async executePrint(t,e){var i;const{resultContext:a,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(i=n.appDEPrints)?void 0:i.find((e=>e.id===t.appDEPrintId));if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.physicalPrint"));{let t="";if(!a||!a[n.codeName.toLowerCase()])throw new o(ibiz.i18n.t("runtime.uiAction.dataPrimaryKey"));t+="/".concat(n.deapicodeName2,"/printdata/").concat(a[n.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:r.codeName,...s}});if(!e.ok)throw new o(ibiz.i18n.t("runtime.uiAction.printFailure"));if(s&&s.srfcontenttype){const t=ibiz.util.file.getFileName(e),i=URL.createObjectURL(e.data),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){const{resultContext:a,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),{appDataEntityId:n,appDEDataImportId:o,frontAppViewId:r}=t;if(!n||!o)throw new i(t,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));return await Ar({appDataEntityId:n,deDataImportId:o,dataImportViewId:r,context:a,params:s}),{refresh:!0,refreshMode:1}}async executeDataExport(t,e){var i;const{resultParams:a}=await this.handleParams(t,e.context,e.data,e.params),s=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),n=null==(i=s.appDEDataExports)?void 0:i.find((e=>e.id===t.appDEDataExportId));if(!n)throw new o(ibiz.i18n.t("runtime.uiAction.noEntityExportsFound"));{const t="/".concat(s.deapicodeName2,"/exportdata/fetchdefault?srfexporttag=").concat(n.codeName),i={page:0,size:n.maxRowCount?n.maxRowCount:1e3,...e.params,...a},r=await ibiz.net.request(t,{method:"post",data:i});if(200!==r.status)throw new o(ibiz.i18n.t("runtime.uiAction.exportRequestFailed"));{let t="".concat(s.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([r.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}}async openEditForm(t,e){const i={},{context:a,params:s,data:n,event:r}=e;if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.lackNativeEvent"));const{resultContext:c,resultParams:d}=await this.handleParams(t,a,n,s),l=this.handleViewOptionParams(d).modalOption||{},h=tt({autoClose:!0},l);let u=!1;const p=ibiz.overlay.createPopover("IBizControlShell",{context:c,params:d,modelData:t.deeditForm,onSaveSuccess:t=>{i.data=[t.args],p&&p.dismiss(),u=!0}},h);return p.present(r.target),await p.onWillDismiss(),u||(i.cancel=!0),i}}),zc=t("WFWithdrawUIActionProvider",class extends Rc{async execAction(t,e){const{view:i}=e;let a=!1;return await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.uiAction.withdrawalConfirmed")})&&i&&(await i.call("WFWithdraw",e),a=!0),{refresh:!1,closeView:a}}}),Vc=class extends Rc{async execAction(t,e){return await ibiz.confirm.info({title:ibiz.i18n.t("runtime.uiAction.logout"),desc:ibiz.i18n.t("runtime.uiAction.wantLogout")})&&await ibiz.hub.controller.logout(),{}}};function kc(){const t=new Fc;ia("FRONT",(()=>t));const e=new Oc;ia("BACKEND",(()=>e));const i=new _c;ia("SYS",(()=>i));const a=new zc;ia("DEUIACTION_WFWithdraw",(()=>a));const s=new Vc;ia("SYS_Logout",(()=>s))}var Uc=t("ToolbarController",class extends zr{constructor(){super(...arguments),this.allToolbarItems=[],this.itemProviders={}}get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new cr,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,i={}){if("DEUIACTION"===t.itemType){const a=t.uiactionId,s=await Se(a,t.appId);if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.toolbar.noFound",{actionId:a}));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(i,n.params),await Mc.execAndResolved(a,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async initToolbarItemProviders(){await Promise.all(this.allToolbarItems.map((async t=>{const e=await La(t);e&&(this.itemProviders[t.id]=e)})))}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if(this.allToolbarItems.push(t),t.itemType){const e=t,i=new rr(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,i)}if(t.controlLogics)for(let e=0;e<t.controlLogics.length;e++){const i=t.controlLogics[e],a=this.state.buttonsState[t.id];if(i.itemName===t.id&&"ITEMVISIBLE"===i.triggerType&&a){a.visible=!1;break}}}),{childrenFields:["detoolbarItems"]}),await this.initToolbarItemProviders(),this.state.manualCalcButtonState?await this.state.buttonsState.init():await this.calcButtonState(void 0,this.model.appDataEntityId)}async onItemClick(t,e,i){const a="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:a?"extra":"deuiaction"}),a||await this.doUIAction(t,e,i)}async calcButtonState(t,e){let i=t;if(t&&t instanceof os&&(i=t.getOrigin()),await this.state.buttonsState.update(this.context,i,e),this.allToolbarItems.forEach((t=>{const e=this.state.buttonsState[t.id];t.hiddenItem&&(e.visible=!1)})),this.scheduler){const t={};i&&(t.data=[i]),r(this.model,(e=>{const i=this.state.buttonsState[e.id];if(i){if(i.visible){const a=this.scheduler.triggerItemVisible(e.id,t);void 0!==a&&(i.visible=a)}if(!i.disabled){const a=this.scheduler.triggerItemEnable(e.id,t);void 0!==a&&(i.disabled=!a)}}}),{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)}}),Bc=t("ContextMenuController",class extends Uc{}),Wc=(t("DashboardController",class extends zr{constructor(){super(...arguments),this.providers={},this.portlets={},this.enableDynamic=!1}initState(){super.initState()}async onCreated(){this.model.enableCustomized=!0,await super.onCreated(),await this.initPortlets(this.model.controls),"true"===this.controlParams.enabledynamic&&(this.enableDynamic=!0);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=pr(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const i=["CHART","APPMENU","TOOLBAR","LIST","REPORTPANEL"];await Promise.all(t.map((async t=>{var a;if(t.controlType&&i.includes(t.controlType))return;const s=await ta(t);if(s){this.providers[t.id]=s;const i=await s.createController(t,this,e);this.portlets[t.id]=i,(null==(a=t.controls)?void 0:a.length)&&await this.initPortlets(t.controls,i)}})))}async initPortletsConfig(t={}){Object.keys(t).forEach((e=>{const i=this.portlets[e];i&&(i.config=t[e],i.state.title=i.config.srftitle,Object.assign(i.params,i.config))}))}async resetPortlets(){Object.keys(this.portlets).forEach((t=>{this.portlets[t].resetConfig()})),this.evt.emit("onResetPortlet",void 0)}async loadAllDynaPortlet(){var t;const e=ibiz.hub.getApp(ibiz.env.appId),i=await e.deService.exec("psappportlet","fetchdefault",this.context,{size:1e3,n_pssysappid_eq:e.model.codeName,n_dynamodelflag_noteq:0});return i&&(null==(t=i.data)?void 0:t.length)>0?i.data:[]}async loadDynaPortletById(t){const e=ibiz.hub.getApp(ibiz.env.appId),i=it(this.context);Object.assign(i,{psappportlet:t});const a=await e.deService.exec("psappportlet","get",i,this.params);if(a&&a.data&&a.data.controlmodel){const t=JSON.parse(a.data.controlmodel);return await ibiz.hub.translationModelToDsl(t,"CTRL")}}async dataChangeNotify(t){await Cn(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t,e){this.model=t,this.dashboard=e,this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.portletConfig={},this.type="personal",this.ownerType="",this.ownerId="",this.context=e.context,this.params=e.params,this.init(e.controlParams)}init(t){var e,i;if(this.type="personal",this.ownerId=this.context.srfpersonid,t.type&&(this.type=t.type),t.owner_type&&(this.ownerType=t.owner_type),t.owner_id&&(this.ownerId=this.context[t.owner_id]),"true"===t.multimode&&(this.type="dynamic"),this.model.appDynaDashboardUtilId){const t=ibiz.hub.getApp(this.context.srfappid);this.util=new Js(t.getAppUtil(this.model.appDynaDashboardUtilId))}else this.config=new Ja(this.model.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(i=this.model.codeName)?void 0:i.toLowerCase()))}getResourceTag(){var t,e;const i="".concat(this.context.srfappid,"_dashboard_").concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase());switch(this.type){case"personal":return"".concat(i,"_").concat(this.context.srfpersonid);case"data":return"".concat(i,"_").concat(this.ownerType,"_").concat(this.ownerId);case"dynamic":return"".concat(i,"_").concat(this.context.srfdynadashboardid);default:return i}}async loadCustomModelData(){let t;return t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),t.config&&(this.portletConfig=t.config),{model:this.customModelData,config:this.portletConfig}}async resetCustomModelData(){return this.portletConfig={},this.saveCustomModelData([])}async saveCustomModelData(t,e={}){let i;Object.assign(this.portletConfig,e);const a={model:t,colNum:this.layoutColNum,rowH:this.layoutRowH,config:this.portletConfig};return i=this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},a):await this.config.save(a),i&&(this.customModelData=t),{model:t,config:this.portletConfig}}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),Gc=t("PortletPartController",class{constructor(t,e,i){this.config={},this.model=t,this.dashboard=e,this.parent=i,this.state=this.createState(),this.state.context=d.create({},this.dashboard.context),this.params=new I({},this.dashboard.params)}get context(){return this.state.context}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get contentController(){const{contentControlId:t}=this.model;if(t)return this.dashboard.getController(t)}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e,title:i,titleLanguageRes:a}=this.model;if(t){const{width:t,height:e}=Ie(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),this.state.title=a?ibiz.i18n.t(a.lanResTag,i):i,this.config={srftitle:this.state.title},Object.assign(this.params,this.config),await this.initActionStates()}createState(){return new Wc}refresh(){}async setConfig(t){this.config=t,t.srftitle&&(this.state.title=t.srftitle),k(this.params,t),this.dashboard.evt.emit("onConfigChange",{name:this.model.id,config:this.config})}resetConfig(){const{title:t,titleLanguageRes:e}=this.model;this.params=new I({},this.dashboard.params),this.state.title=e?ibiz.i18n.t(e.lanResTag,t):t,this.config={srftitle:this.state.title},Object.assign(this.params,this.config)}onDataChange(t){let e=t.data[0];e&&e instanceof os&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(this.context,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 i=new cr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rr(t.id,this.dashboard.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.dashboard.context),this.state.actionGroupState=i;const{appDataEntityId:a}=this.dashboard.view.model;a&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,i=[]){var a,s;const n=t.uiactionId,o={context:this.context,params:this.params,data:i,view:this.dashboard.view,ctrl:this,event:e},r=await Mc.exec(n,o,t.appId);if(r.closeView)this.dashboard.view.closeView();else if(r.refresh)switch(r.refreshMode){case 1:this.refresh();break;case 2:null==(a=this.dashboard.view)||a.callUIAction("Refresh");break;case 3:null==(s=this.dashboard.view.getTopView())||s.callUIAction("Refresh")}}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(this.context,t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=be(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)}}),jc=(t("ContainerPortletController",class extends Gc{}),t("ViewPortletController",class extends Gc{get contentController(){const{portletAppView:t}=this.model;if(t&&t.name)return this.dashboard.getController(t.name)}refresh(){this.contentController&&this.contentController.callUIAction("Refresh")}}),t("MenuPortletController",class extends Gc{}),t("ChartPortletController",class extends Gc{refresh(){this.contentController&&this.contentController.refresh()}}),t("ActionBarPortletController",class extends Gc{}),t("HtmlPortletController",class extends Gc{}),t("ListPortletController",class extends Gc{refresh(){this.contentController&&this.contentController.refresh()}}),t("RawItemPortletController",class extends Gc{}),t("ReportPortletController",class extends Gc{refresh(){this.contentController&&this.contentController.refresh()}}),t("DataViewControlService",class extends cs{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new sn(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new sn(e,e);this.dataUIMap.set(e,a)}))}})),Kc=t("DataViewControlController",class extends Vr{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=[];const{enablePagingBar:t}=this.model;this.state.enablePagingBar=t}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new jc(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 i=new cr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.context,void 0,this.model.appDataEntityId),t.groupActionGroupState=i}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:i}=this.model;if(i)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[i],a=this.state.groups.find((t=>t.key===e));a&&a.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var i,a;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof os&&(s=s.getOrigin()),s&&(null==(i=e.groupActionGroupState)||i.update(this.context,s,this.model.appDataEntityId))):null==(a=e.groupActionGroupState)||a.update(this.context,void 0,this.model.appDataEntityId)}));else{const i=this.state.groups.find((e=>-1!==e.children.indexOf(t)));i&&(null==(e=i.groupActionGroupState)||e.update(this.context,i.selectedData[0],this.model.appDataEntityId))}}calcShowMode(t){const{enablePagingBar:e}=this.model;this.state.hideNoDataImage=!1,this.state.enablePagingBar=e;const i=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===i&&(this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===i&&0===t.length&&(this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),this.calcShowMode(e),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let i=0;i<e.length;i++)"ACTIONITEM"===e[i].itemType&&(t=e[i]);return t}getOptItemAction(t){var e;const a=new cr,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroup"));if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroupAction")),a;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new rr(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.getOrigin())}return a}async onActionClick(t,e,i){const a=t.uiactionId;await Mc.execAndResolved(a,{context:this.context,params:this.params,data:[e],view:this.view,event:i},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(e))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}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 i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(e)}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,key:i.value,children:t})})),this.state.groups=n}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const i={...this.params,srfgroup:e};Mc.execAndResolved("new",{context:this.context,params:i,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,i){const a=t.uiactionId,s={...this.params,srfgroup:i.key};await Mc.execAndResolved(a,{context:this.context,params:s,data:i.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:a,minorSortDir:s}=this.model,n=a&&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 i(t,ibiz.i18n.t("runtime.controller.control.dataView.sortingItems"));const r={caption:o,key:t.appDEFieldId};n&&a===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),Hc=t("ExpBarControlController",class extends zr{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 i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName: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 i=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),a=[];null==i||i.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("、"))}}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&&hr(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:i,params:a}=t,s=this.getNavViewMsg(e[0],i,a);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,i,a){const{navDER:s,navFilter:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?Ae(c):void 0,navFilter:n,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:o,navParams:r},l={context:i,params:a,data:e},{resultContext:h,resultParams:u}=ge(d,l),p=Object.assign(i.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(ibiz.i18n.t("runtime.controller.control.expBar.multiNode"))}getNavViewMsg(t,e,i){const a=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,i);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:a,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())}}),Xc=(t("CalendarExpBarController",class extends Hc{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 i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName: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 i=new Date(e.beginTime);this.xDataController.setSelectDate(i)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:i,params:a}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return i.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:i,params:a,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends Hc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName: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 i;return e&&e.forEach((e=>{e.id===t&&(i=e)})),i}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,i){const a=t._id,s=t._deData||t,n=this.getNodeModel(t._nodeId);if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.expBar.noFindNodeModel",{nodeId:t._nodeId}));const r=this.prepareParams(n,s,e,i);return r.context.currentSrfNav=a,this.state.srfnav=a,{key:a,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,i)=>{0===i?e.push(t):e.push("".concat(e[i-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 Hc{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,i,a){var s;const{context:n,params:o}=super.prepareParams(t,e,i,a);if(e._seriesModelId){const i=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(i){const{navigateContexts:t,navigateParams:s}=i,r=he(t,e,a,n),c=he(s,e,a,o);return{context:Object.assign(n.clone(),r),params:c}}}return{context:n,params:o}}getNavViewMsg(t,e,i){var a;let s;if(t._seriesModelId){const e=null==(a=this.XDataModel.dechartSerieses)?void 0:a.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const n=this.prepareParams(this.XDataModel,t,e,i);return{key:t._uuid,context:n.context,params:n.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends zr{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[],this.counters={}}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new os,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await Cn(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(),await this.initCounter(),this.dataChangeNotify=A(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,a=void 0){await Promise.all(t.map((async t=>{const s=await Ki(t,this.model);if(!s)return;if(e.details[t.id])throw new i(t,ibiz.i18n.t("runtime.controller.control.form.initializationException",{id:t.id,detailType:t.detailType}));e.providers[t.id]=s;const n=await s.createController(t,e,a);if(e.details[t.id]=n,"FORMITEM"===t.detailType&&e.formItems.push(n),"MDCTRL"===t.detailType&&e.formMDCtrls.push(n),Fe(t))return;const o=_e(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)||ur(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){if((null==e?void 0:e.error)&&e.error instanceof P){const{details:t}=e.error;t.forEach((t=>{this.setDetailError(t.name,t.errorInfo)}))}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)}async onDestroyed(){await super.onDestroyed(),Object.values(this.counters).forEach((t=>t.destroy()))}async initCounter(){this.counters={};const{appCounterRefs:t}=this.model;if(t&&t.length>0){const e=this.context[Ae(this.model.appDataEntityId)];try{await Promise.all(t.map((async t=>{const i=await $a.getCounterByRef(t,this.context,e?{srfcustomtag:e,...this.params}:{...this.params});this.counters[t.id]=i})))}catch(t){console.error(t)}}}setDetailError(t,e){const i=this.details[t],a=null==i?void 0:i.state;a&&(a.error=e)}})),qc=class extends rs{setDefault(t,e,i,a){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:n,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===a?n:r,h="create"===a?o:c,u=s.id.toLowerCase(),p=yr({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:i});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Yc=t("SearchFormService",class extends qc{async getDraft(t,e={}){let i={ok:!0,status:200,data:this.getFilteredData({...e})};return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new sn(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((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}}),Qc=(t("SearchFormController",class extends Xc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Ja(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 Yc(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 i=this.state.data[e];null!=i&&""!==i&&(t[e]=i)})),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,i=!1;const a=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===a,i="BOTTOM"!==a,"NONE"===t&&(e=!0,i=!0);const s=t=>{let a,n="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(a=t[e],n=e,!0))),a&&a.length>0){const o=[];a.forEach((t=>{e&&"control_buttons_right"===t.id||i&&"control_buttons_bottom"===t.id||(o.push(t),s(t))})),o.length<a.length&&(t[n]=o)}};(i||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(ibiz.i18n.t("runtime.controller.control.form.searchTerms"));e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o(ibiz.i18n.t("runtime.controller.control.form.saveSearch"));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,this.readonly=!1,this.enableReadonly=!0;let e,i,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)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!(!this.context||!this.enableReadonly)&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),Jc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Jc||{})),$c=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))($c||{})),Zc=t("FormDetailController",class{constructor(t,e,i){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=i,this.state=this.createState(),this.state.context=this.context}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:i,capLanguageRes:a}=this.model;if(t){const{width:e,height:i}=Ie(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName),a&&a.lanResTag&&(this.model.caption=ibiz.i18n.t(a.lanResTag,this.model.caption))}createState(){var t;return new Qc(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 i;this.parent&&!this.parent.state.visible||null==(i=this.model.defdgroupLogics)||i.forEach((i=>{const a=i.relatedDetailNames||[];if(e||T(a,t))try{const t=si(this.data,i);switch(i.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=be(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=be(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}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})}}),td=t("FormButtonState",class extends Qc{constructor(){super(...arguments),this.loading=!1}}),ed=(t("FormButtonController",class extends Zc{constructor(){super(...arguments),this.actionState=null}createState(){var t;return new td(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){const t=this.model.uiactionId;t&&(this.actionState=new rr(this.model.id,this.form.context.srfappid,t))}async formStateNotify(t){if(this.actionState){const t=Ae(this.form.model.appDataEntityId);await this.actionState.update(this.context,this.data,t)}await super.formStateNotify(t)}calcDetailDisabled(t){super.calcDetailDisabled(t),this.actionState&&(this.state.disabled=!(!this.state.disabled&&!this.actionState.disabled))}calcDetailVisible(t){super.calcDetailVisible(t),this.actionState&&(this.state.visible=!(!this.state.visible||!this.actionState.visible))}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 Mc.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 Qc{constructor(){super(...arguments),this.showMask=!1}})),id=(t("FormDRUIPartController",class extends Zc{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new ed(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),T(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;ct(e)&&(t=Object.assign(t,he(e,this.data,this.form.params,this.form.context)));const i=he(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(i))this.navContext=t,this.navParams=i,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=ut(),this.navContext=t,this.navParams=i}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(ibiz.i18n.t("runtime.controller.control.form.relationshipInterface"),t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends Qc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),ad=t("FormGroupPanelController",class extends Zc{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 id(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(this.form.context,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 i=new cr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rr(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await Mc.execAndResolved(i,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),sd=t("FormItemState",class extends Qc{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)})}}),nd=(t("FormItemController",class extends Zc{constructor(t,e,i){super(t,e,i),this.rules=[],this.state.enableReadonly="SEARCHFORM"!==this.form.getControlType()}createState(){var t;return new sd(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(){var t,e;await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:i}=this.model;i||(this.state.enableCondDisabled=!0),!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly&&(null==(t=this.model.editor)?void 0:t.readOnly)&&(this.state.readonly=(null==(e=this.model.editor)?void 0:e.readOnly)||!1),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Wi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=Ii(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...mr(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...gr(this.model.editor)),this.rules.length>0&&(this.validator=new At({[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 i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&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&&("string"==typeof this.data[this.name]?dt(this.data[this.name].trimEnd()):dt(this.data[this.name])))return this.state.error=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption: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})}}),class extends Qc{constructor(){super(...arguments),this.actionGroupState=null}}),od=t("FormMDCtrlController",class extends Zc{createState(){var t;return new nd(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,2)}get enableDelete(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(this.form.context,t)}}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new cr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rr(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await Mc.execAndResolved(i,{context:this.context,params:this.params,data:[this.data],view:this.form.view,event:e},t.appId)}refresh(){}async validate(){return!0}}),rd=(t("FormMDCtrlMDController",class extends od{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 i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));"GRID"===t.controlType&&x(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await ki(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 a(this.model,ibiz.i18n.t("runtime.controller.control.form.multiDataAddData",{contentType:this.model.contentType}));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.form.mdControllerNoExist"))}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 nd{}),cd=(t("FormMDCtrlFormController",class extends od{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map,this.items=[]}createState(){var t;return new rd(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await ki(t);e&&(this.formProvider=e);const{appDataEntityId:a}=this.model.contentControl;this.deName=Ae(a)}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.items=e.data,this.state.items=this.items.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const i={...this.params};return{id:t.srfkey,context:e,params:i}})))}async updateData(){var t;const{appDataEntityId:e}=this.model.contentControl,i=await ibiz.hub.getAppDEService(this.model.appId,e,this.context),a=null==(t=this.state.items)?void 0:t.map(((t,e)=>{const i=this.items.find((e=>e.srfkey===t.id));return i.srfordervalue=e+1,i}));i.isLocalMode&&a&&await i.exec("update",this.context,a)}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onLoadSuccess",(e=>{var i,a;const s=null==(i=e.data)?void 0:i[0],n=null==(a=this.state.items)?void 0:a.find((e=>e.id===t));n&&s&&(n.title=s.srfmajortext||"")})),e.evt.on("onSaveSuccess",(e=>{const i=e.data[0],a=this.state.items.find((e=>e.id===t));a&&i&&(a.title=i.srfmajortext||"",a.context[this.deName]!==i.srfkey&&(a.context[this.deName]=i.srfkey)),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async validate(){return-1===(await Promise.all(Array.from(this.formMap.values()).map((t=>t.validate())))).findIndex((t=>!t))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.form.noFoundFormController",{id:t}));await e.remove({silent:!0}),this.formMap.delete(t);const i=this.state.items.findIndex((e=>e.id===t));-1!==i&&this.state.items.splice(i,1)}create(t){const e=this.context.clone(),i={...this.params};this.state.items||(this.state.items=[]);const a={id:ut(),context:e,params:i};void 0!==t?this.state.items.splice(t,0,a):this.state.items.push(a)}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 od{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1,this.repeaterMap=new Map}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 a(this.model,ibiz.i18n.t("runtime.controller.control.form.repeaterNoSupported",{detailStyle: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=it(e)}setRepeaterController(t,e){this.repeaterMap.set(t,e)}async validate(){return-1===(await Promise.all(Array.from(this.repeaterMap.values()).map((t=>t.validate())))).findIndex((t=>!t))}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,i)=>t!==i));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends id{})),dd=(t("FormPageController",class extends ad{createState(){var t;return new cd(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Qc{})),ld=(t("FormRawItemController",class extends Zc{createState(){var t;return new dd(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Qc{})),hd=(t("FormTabPageController",class extends Zc{createState(){var t;return new ld(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends Qc{constructor(){super(...arguments),this.activeTab=""}})),ud=(t("FormTabPanelController",class extends Zc{createState(){var t;return new hd(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}getCounter(t){const{counters:e}=this.form;return e&&e[t]?e[t]:null}}),t("EditFormService",class extends qc{async get(t,e={}){var i;let a=await this.exec((null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"update"),a}async getDraft(t,e={}){var i;let a=await this.exec((null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}async remove(t,e={}){var i;return await this.exec((null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var i;const a=e instanceof os?e.getOrigin():e,s=this.getFilteredData(a);let n=await this.exec((null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create",t,s);return n=this.handleResponse(n),n}async update(t,e){var i;const a=e instanceof os?e.getOrigin():e,s=this.getFilteredData(a);let n=await this.exec((null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update",t,s);return n=this.handleResponse(n),n}async goBack(t,e){var a;const s=null==(a=this.model.goBackControlAction)?void 0:a.appDEMethodId;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.lackBehavior"));let n=await this.exec(s,t,e instanceof os?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,i={},a={}){Object.assign(a,{srfupdateitem:!0});let s=await this.exec(t,e,i,a);return s=this.handleResponse(s),s}async wfStart(t,e,i){var a;const s=(null==(a=this.model.wfstartControlAction)?void 0:a.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,i instanceof os?i.getOrigin():i)}async wfSubmit(t,e,i){var a;const s=this.model;let n="";n=e.type?e.type:(null==(a=s.wfsubmitControlAction)?void 0:a.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,i instanceof os?i.getOrigin():i)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const i=e,a=i.id.toLowerCase(),s=i.fieldName||e.appDEFieldId;let n;n=s?new sn(a,s,{isOriginField:!0,dataType:i.dataType}):new sn(a,a,{isOriginField:t.includes(a)}),this.dataUIMap.set(a,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((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}})),pd=(t("EditFormController",class extends Xc{constructor(){super(...arguments),this.oldData=new os}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new ud(this.model),await this.service.init(this.context),this.autoSave=U(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:i}=this.handlerAbilityParams(t);let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:i}),a=await this.service.getDraft(e,i)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=a.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=it(this.context),e=it(this.params),i=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(i&&this.params[i]){t[Ae(this.model.appDataEntityId)]=this.params[i],delete e[i],delete this.params[i],delete e.srfcopymode,delete this.params.srfcopymode}let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:e}),a=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return a.data.srfkey=void 0,a.data.tempsrfkey=ut(),this.state.modified=!1,this.state.data=a.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",{args:a.data}),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Pe(this.context,Ae(this.model.appDataEntityId)))return this.loadDraft();const{context:e,params:i}=this.handlerAbilityParams(t),a=it(i);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:a}),s=await this.service.get(e,a)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),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",{args:s.data}),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 S(500,this.save.bind(this),[t])}if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));e||await this.startLoading();const{context:i,data:a}=this.handlerAbilityParams(t),s=a[0],n=0===s.srfuf;let r;try{await this.evt.emit("onBeforeSave",{args:s}),r=n?await this.service.create(i,s):await this.service.update(i,s)}catch(t){throw await this.evt.emit("onSaveError",{args:t}),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):x(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",{args:r.data}),this.view.state.isClosing||this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:this.data.srfmajortext||""})}),this.emitDEDataChange(n?"create":"update",r.data),this.data}async remove(t){const{context:e,params:i}=this.handlerAbilityParams(t);let a,s=!1;if(await this.evt.emit("onBeforeRemove",{args:this.data}),1===this.data.srfuf){if(!0!==(null==t?void 0:t.silent)){if(s=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.controller.control.form.deletion")}),!s)return!1}await this.startLoading();try{a=await this.service.remove(e,i)}catch(e){throw await this.evt.emit("onRemoveError",{args:e}),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e}),e}finally{await this.endLoading()}s=a.ok}return this.emitDEDataChange("remove",this.data),this.state.data=new os,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",{args:this.data}),this.actionNotification("REMOVESUCCESS"),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&&x(this.data,t.data),this.data}async updateFormItem(t){var e;const i=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.form.itemUpdate",{formItemUpdateId:t}));const{appDEMethodId:a,defiupdateDetails:s,customCode:n,scriptCode:r,showBusyIndicator:c}=i,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),n&&r)t=ei.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},i=await this.service.updateFormItem(a,this.context,e);t=i.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(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processStarted")})}async wfSubmit(t){if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processSubmitted")})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=d.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}async immediateAutoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=d.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((i=>{Array.isArray(t[i])?b(t[i],this.oldData[i])||(e[i]=t[i]):t[i]===this.oldData[i]&&i!==t.srfkeyfield||(e[i]=t[i])})),e.srfuf=t.srfuf,new os(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)}onDEDataChange(t){var e;if("OBJECTUPDATED"===t.subtype&&(Z(t.triggerKey)||t.triggerKey!==this.triggerKey)&&this.model.appDataEntityId){const i=Ae(this.model.appDataEntityId);if(!t.data||(null==(e=t.data.srfdecodename)?void 0:e.toLowerCase())!==i||t.data.srfkey!==this.data.srfkey)return;this.doNextActive((()=>this.load()),{key:"load"})}}}),t("GridColumnController",class{constructor(t,e){var i;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(i=this.deGridDataItem)?void 0:i.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 ei.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),md=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,this.oldData=t.clone(),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=>{let i;this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.fieldName],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})}))}getDiffData(){const t={};return Object.keys(this.data).forEach((e=>{this.data[e]===this.oldData[e]&&e!==this.data.srfkeyfield||(t[e]=this.data[e])})),t.srfuf=this.data.srfuf,t.srfkey=this.data.srfkey,new os(t,this.oldData.$dataUIMap)}}),gd=t("GridService",class extends cs{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const a=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 i(t,ibiz.i18n.t("runtime.controller.control.grid.corresponding",{deField:s}));n=new sn(a,o,{isOriginField:!0,dataType:r.dataType})}else n=new sn(a,a);this.dataUIMap.set(a,n)}))}}async updateGridEditItem(t,e,i={},a={}){const s=await this.app.deService.getService(e,this.model.appDataEntityId);Object.assign(a,{srfupdateitem:!0});let n=await s.exec(t,e,i,a);return n=this.handleResponse(n),n}}),fd={string:25,number:6,integer:9,date:5};var yd=t("GridController",class extends Vr{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.showPercent=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计",this.dataExportParam={},this.allExportColumns=[],this.allExportCodelistMap=new Map,this.formatValue=(t,e="")=>{const i="".concat(e);if(!t)return i;if(Ct(i,t,!0).isValid()){return Ct(i).format(t)}return ibiz.util.text.format(i,t)}}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 enableRowEditOrder(){return!!this.model.enableRowEditOrder}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;const{hideHeader:t,enablePagingBar:e}=this.model;this.state.hideHeader=t,this.state.enablePagingBar=e}async onCreated(){this.addSchemaColumn="true"===this.controlParams.enablejsonschema,this.showPercent="true"===this.controlParams.showpercent,await this.initByEntitySchema(),await super.onCreated(),this.service=new gd(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=A(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup(),await this.initExportData()}calcShowMode(t){const{hideHeader:e,enablePagingBar:i}=this.model;this.state.hideNoDataImage=!1,this.state.hideHeader=e,this.state.enablePagingBar=i;const a=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===a&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===a&&0===t.length&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await Sr(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var i;if(!t.properties)return;const{properties:a}=t;if(!(Object.keys(a).length>0))return;const s={};null==(i=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||i.forEach((t=>{s[t.codeName.toLowerCase()]=t.id}));const n=[];Object.keys(a).forEach((t=>{if(!s[t]){let e;switch(a[t].type){case"string":e="string","date-time"===a[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:a[t].type}))}n.push({key:t,description:a[t].description,type:e})}}));const o=[],r=[];return n.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:t.key,id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,hideDefault:!0,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:t.key,id:t.key,valueType:"SIMPLE",dataType:fd[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:i}=e;this.model=it(this.model),this.model.degridColumns=[...this.model.degridColumns||[],...t],this.model.degridDataItems=[...this.model.degridDataItems||[],...i]}}async initExportData(){var t;if(this.model.dedataExportId&&(this.dataExport=null==(t=this.dataEntity.appDEDataExports)?void 0:t.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport))),this.allExportColumns.length>0)this.allExportColumns.forEach((t=>{t.codeListItems&&this.allExportCodelistMap.set(t.appDEFieldId,t.codeListItems)})),this.dataExportParam.fields=this.allExportColumns.map((t=>t.appDEFieldId)),this.dataExportParam.header=this.allExportColumns.map((t=>t.caption));else{Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&this.allExportCodelistMap.set(t,this.fieldColumns[t].codeListItems)}));const{degridColumns:t=[]}=this.model;this.dataExportParam.fields=t.map((t=>t.id)),this.dataExportParam.header=t.map((t=>t.caption))}}async fillExportCodelistMap(){if(this.model.dedataExportId)return;const t=async(t,e)=>{const i=await e.loadCodeList();this.allExportCodelistMap.set(t,i)},e=[];for(const[i,a]of this.allExportCodelistMap)if(!a){const a=this.fieldColumns[i];a.codeListItems?this.allExportCodelistMap.set(i,a.codeListItems):e.push(t(i,a))}e.length>0&&await Promise.all(e)}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:a}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.attributeColumns"));const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new i(this.groupFieldColumn.model,ibiz.i18n.t("runtime.controller.control.grid.noCodeTable",{groupFieldName:s}));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.configureFirstColumn",{groupFieldName:s}));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===a){if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.requiresCodeTable"));if(this.groupFieldColumn.model.appCodeListId!==e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.noMatchCodeTable",{groupFieldName:s}))}this.calcColumnFixed()}sortItems(t){const e=this.model.orderValueAppDEFieldId;e&&this.enableRowEditOrder&&(t.forEach((t=>{const i=t[e];if(Z(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>t[e]-i[e])))}async afterLoad(t,e){this.sortItems(this.state.items),await super.afterLoad(t,e),await Cn(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1);const i=e.map((t=>{const e=new md(t,this);return this.gridStateNotify(e,"LOAD"),e}));return t.isLoadMore?this.state.rows.push(...i):this.state.rows=i,await this.updateRows(this.state.rows),this.calcGroupData(this.state.items),await this.loadRemoteAgg(),this.calcAggResult(this.state.items),this.calcShowMode(this.state.items),this.calcTotalData(),e}async updateRows(t){for(const e of t)await Promise.all([...Object.values(e.uaColStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId))),...Object.values(e.uiActionGroupStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId)))])}calcGroupData(t){const{enableGroup:e,groupMode:i}=this.model;if(e){const e=new Map,a="CODELIST"===i,s=this.groupFieldColumn.model.id;a&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const i=t[s];a||e.has(i)||e.set(i,[]),e.has(i)&&e.get(i).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==i?void 0:i.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:a}=this.model;if("ALL"!==t)return;if(!a||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.missingConfiguration"));const s=await this.getFetchParams();delete s.sort;const n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,a,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 i=e.calcFieldAgg(t);i&&(this.state.aggResult[e.model.id]=i)}))}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 i=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==i&&e.children.splice(i,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:i}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(i))return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.newRows"));if("row"===i){if(this.state.rows.find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.common.md.firstComplete"))}const a={...this.params},s=this.calcDefaultValue({},!0);let n;Object.assign(a,s);try{n=await this.service.getDraft(this.context,a)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=n.data;L(r,s),this.state.items.unshift(r);const c=new md(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===i&&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,i=this.findRowState(t);if(!i)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!i.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(i.processing)return void await S(500,this.save.bind(this),[t]);if(!await this.validate(i))throw new o(ibiz.i18n.t("runtime.controller.control.grid.saveCancel"));let a;this.model.enableRowEditChangedOnly&&(t=i.getDiffData());const s=Ae(this.model.appDataEntityId),n=this.context.clone();n[s]=t.srfkey;try{a=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:i.data,rowState:i}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,a.data),i.data=a.data,i.oldData=a.data.clone(),i.modified=!1,this.gridStateNotify(i,"SAVE"),await this._evt.emit("onSaveSuccess",void 0),this.emitDEDataChange(e?"create":"update",a.data)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await Cn(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const i=await qi(t,this.model);if(!i)return;this.providers[t.codeName]=i;const a=await i.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=a,t.enableRowEdit&&(this.editColumns[t.codeName]=a)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=a:"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=[],0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"===t.columnType||t.hiddenDataItem||2===t.hideMode||this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,hideMode:t.hideMode||0,uaColumn:"UAGRIDCOLUMN"===t.columnType,adaptive:"STAR"===t.widthUnit})}),{childrenFields:["degridColumns"]});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=this.mergeGridColumnStates(this.state.columnStates,e.schemaColumnStates):!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=this.mergeGridColumnStates(this.state.columnStates,e.defaultColumnStates))}this.calcColumnFixed()}mergeGridColumnStates(t,e){const i=[];return t.length>0&&t.forEach((t=>{const a=e.find((e=>e.key===t.key));a?i.push(a):i.push(t)})),i}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:i,frozenLastColumn:a}=this.model;this.hasAdaptiveColumn=!1,t.forEach(((t,s)=>{t.adaptive&&(this.hasAdaptiveColumn=!0),t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":i&&s<i?t.fixed="left":a&&s>=e-a&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||ur(t.data[e],i)){t.data[e]=i,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 Cn(Object.values(this.editColumns).map((async i=>i.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((i=>{i.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(ibiz.i18n.t("runtime.controller.control.grid.noSupportRowEditing"));this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)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(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data.srfuf){t.cacheData=it(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let i;t&&(i=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(i,e)}async updateGridEditItem(t,e){var i;const a=null==(i=this.model.degridEditItemUpdates)?void 0:i.find((t=>t.id===e));if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.grid.updateColumns",{updateId:e}));const{appDEMethodId:s,degeiupdateDetails:n,customCode:r,scriptCode:c}=a,d=n.map((t=>t.id));let l;if(r&&c)l=ei.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},i=await this.service.updateGridEditItem(s,this.context,e);l=i.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),i=await this.getFetchParams(null==t?void 0:t.viewParam);let a;await this.startLoading();try{a=await this.service.fetch(e,i)}finally{await this.endLoading()}return a.data}async findAllExportColumns(t){var e;const i=ibiz.hub.getApp(this.context.srfappid),a=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=i.codeList.getCodeList(t.codeListId),e.codeListItems=await i.codeList.get(t.codeListId,this.context)),e}));return a?Promise.all(a):[]}formatExcelData(t){const{fields:e=[]}=this.dataExportParam,i=it(t.map((t=>e.reduce(((e,i)=>(e[i]=t[i],e)),{}))));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;let a=t[e];const s=this.allExportColumns.find((t=>t.appDEFieldId===e)),n=this.fieldColumns[e],o=(null==s?void 0:s.format)||(null==n?void 0:n.valueFormat),r=(null==n?void 0:n.model.unitName)||"";a=this.allExportCodelistMap.get(e)?(null==(i=this.allExportCodelistMap.get(e).find((i=>i.value===t[e])))?void 0:i.text)||a:this.formatValue(o,a)+r,t[e]=a}))})),i}async getExportData(t){var e;const{type:i}=t;let a=[];if(i&&"activatedPage"!==i)if("maxRowCount"===i||"customPage"===i){const{size:s}=this.state,{startPage:n,endPage:o}=t,r="customPage"===i?{page:0,offset:(n-1)*s,size:(o-n+1)*s}:{size:(null==(e=this.dataExport)?void 0:e.maxRowCount)||1e3,page:0};a=await this.loadData({viewParam:r})}else"selectedRows"===i&&(a=this.getData());else a=this.state.rows.map((t=>t.data));if(0===a.length)throw new o(ibiz.i18n.t("runtime.controller.control.grid.exported"));return a}async exportData(t){const{header:e}=this.dataExportParam;if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.grid.tabularColumns"));await this.fillExportCodelistMap();const i=await this.getExportData(t.params),a=this.formatExcelData(i).map((t=>Object.values(t)));await Dr(e,a,this.model.logicName)}calcDefaultValue(t,e){const i={};return Object.values(this.editColumns).forEach((a=>{const{createDV:s,createDVT:n,updateDV:o,updateDVT:r}=a.editItem,c=e?n:r,d=e?s:o,l=yr({name:a.fieldName,valueType:c,defaultValue:d,valueFormat:a.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(i[a.fieldName]=l)})),i}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((i=>i.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){3!==t.hideMode&&(t.hidden=!t.hidden,this.calcColumnFixed(),this.saveColumnStates())}setGroupParams(t){t.sort?(this.state.sortQuery=t.sort,this.isSetSort=!0):this.state.sortQuery="",t.columnstates?(this.state.columnStates=this.mergeGridColumnStates(this.state.columnStates,t.columnstates),this.calcColumnFixed()):this.initColumnStates()}changeColumnStateSort(t,e,i){const a=this.state.columnStates.find((e=>e.key===t));a&&(this.state.columnStates.splice(i,1),this.state.columnStates.splice(e,0,a),this.calcColumnFixed(),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))}actionNotification(t,e){if((null==e?void 0:e.error)&&(null==e?void 0:e.rowState)&&e.error instanceof P){const{details:t}=e.error,{errors:i}=e.rowState;t.forEach((t=>{i[t.name]=t.errorInfo}))}super.actionNotification(t,{...e||{}})}async onDragChange(){const t=this.model.orderValueAppDEFieldId,e=this.state.rows.map((t=>t.data));let i;const a=[];e.forEach((e=>{var s;void 0===i?(i=e[t]||100,e[t]||(e[t]=i,a.push(e))):((!e[t]||i>=e[t])&&(e[t]=(s=i)+(100-s%100),a.push(e)),i=e[t])})),this.updateChangedItems(a)}async updateChangedItems(t){try{await Promise.all(t.map((async t=>{const e=Ae(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.update(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.data)}})))}finally{await this.afterLoad({},this.state.items)}}calcTotalData(){if(!this.showPercent)return;const t={};Object.values(this.fieldColumns).forEach((e=>{const i=e.model.id,a=this.state.items.map((t=>t[i])).reduce(((t,e)=>M(t,e)),0);a&&(t[i]=a)})),this.state.totalResult=t}}),wd=t("GridFieldColumnController",class extends pd{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=U(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const i=new cr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rr(t.id,this.grid.context.srfappid,e);i.addState(t.id,a)}})),t.uiActionGroupStates[this.model.codeName]=i}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,i){const{userParam:a}=this.model;if(!a)return{context:e,params:i};const{navigateContexts:s,navigateParams:n}=we(a);let o={};s&&t&&(o=he(s,t,i,e));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=he(n,t,i,e));return{context:r,params:{...i,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const i=this.model.linkValueItem||"srfkey",s=t.data[i];if(null==s)throw new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.pickedUpData",{valueItem:i}));const{linkAppViewId:n}=this.model;if(!n)return;const o=ri(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...o}),c=it(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Go.TAG,n,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const i=this.model.deuiactionId;await Mc.execAndResolved(i,{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 i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}calcFieldAgg(t){const{aggField:e,aggMode:i,aggValueFormat:s,unitName:n}=this.model,o=e||this.model.id;let r;if("ALL"===this.grid.model.aggMode){if(!this.grid.state.remoteAggResult)return;r=this.grid.state.remoteAggResult[o]||""}else{if(Z(i)||"NONE"===i)return;if(t=t.filter((t=>!Z(t[o]))),"PAGE"!==this.grid.model.aggMode)throw new a(this.grid.model,ibiz.i18n.t("runtime.controller.control.grid.aggregateMode",{aggMode:this.grid.model.aggMode}));switch(i){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>M(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>M(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 a(this.model,ibiz.i18n.t("runtime.controller.control.grid.noSupportedMode",{aggMode:i}))}}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.formattingError",{aggValue:r}))}return c&&n&&(c+=n),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return fr.toText(this.model,t);const e="".concat(dt(t)?"":t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,i){const a=t.uiactionId;await Mc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),Ed=(t("GridUAColumnController",class extends pd{initActionStates(t){var e;const{deuiactionGroup:a}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.behaviorGroup"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const s=new cr;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new rr(t.id,this.grid.context.srfappid,e);s.addState(t.id,i)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,i){const a=t.uiactionId;await Mc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),t("GridFieldEditColumnController",class extends wd{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=Oe(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Wi(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=Ii(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...mr(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...gr(this.editItem.editor)),this.rules.length>0&&(this.validator=new At({[this.fieldName]:this.rules}))}async setRowValue(t,e,i){i=i||this.fieldName,await this.grid.setRowValue(t,i,e)}async dataChangeNotify(t,e){const{resetItemNames:i}=this.editItem;let a=!1;i&&i.length>0&&i.forEach((t=>{e.includes(t)&&(a=!0)})),a&&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(ibiz.i18n.t("runtime.controller.control.grid.checksumErrors",{codeName:this.editItem.codeName,fieldName: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 i=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const i=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const i=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);i&&(t.editColStates[this.fieldName].readonly=i)}calcEnableCond(t){const{enableCond:e}=this.editItem,i=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return i;case 2:return!i;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&!0===t.editColStates[e].required&&("string"==typeof t.data[e]?dt(t.data[e].trimEnd()):dt(t.data[e])))return t.errors[e]=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption:this.model.caption||""}),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(i){const{errors:a}=i;return t.errors[e]=a[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends pd{}),t("ListService",class extends cs{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new sn(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new sn(e,e);this.dataUIMap.set(e,a)}))}})),vd=(t("ListController",class extends Vr{initState(){super.initState(),this.state.noSort=!0===this.model.noSort;const{enablePagingBar:t}=this.model;this.state.enablePagingBar=t}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new Ed(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}calcShowMode(t){const{enablePagingBar:e}=this.model;this.state.hideNoDataImage=!1,this.state.enablePagingBar=e;const i=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===i&&(this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===i&&0===t.length&&(this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async afterLoad(t,e){return await this.handleDataGroup(),this.calcShowMode(e),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,i=new Map;e.forEach((e=>{const a=i.get(e[t])||[];a.push(e),i.set(e[t],a)}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:i}=this.state,a=[],s=ibiz.hub.getApp(this.context.srfappid),n=await s.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const s=i.filter((i=>i[t]===e.value));a.push({caption:e.text,key:e.value,children:[...s]}),o.push(e.value)}));const r=i.filter((e=>-1===o.indexOf(e[t])));r.length>0&&a.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=a}}}),t("PanelController",class extends zr{constructor(t,e,i,a,s){super(t,e,i,a),this.hooks={validate:new lt},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),this.hooks.validate.clear(),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async validate(t){const e=[];return await this.hooks.validate.call({result:e,parentId:t}),e.every((t=>t))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,i=void 0){t&&await Promise.all(t.map((async t=>{var a,s;const n=await Ji(t,e.model,e.view.model);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,i);e.panelItems[t.id]=o,(null==(a=t.panelItems)?void 0:a.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 i=await this.prepareData();if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.panel.panelData"));const a=this.convertData(i);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=a,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=Ge(this.model),i=e.map((t=>t.id)),a=new cn(e,t);return a._evt.on("change",(t=>{i.includes(t)&&this.dataChangeNotify([t])})),a}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)}})),Id=(t("ViewLayoutPanelController",class extends vd{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 i=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=i(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=i(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,this.readonly=!1;let e,i,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)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!!this.context&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),bd=(t("PanelItemController",class{constructor(t,e,i){this.model=t,this.panel=e,this.parent=i,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState(),this.state.context=this.panel.context}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(){var t;!!(null==(t=this.model.panelItemGroupLogics)?void 0:t.find((t=>"PANELVISIBLE"===t.logicCat)))&&(this.state.visible=!1),this.panel.hooks.validate.tapPromise((async t=>{t.parentId&&t.parentId!==this.dataParent.model.id||t.result.push(await this.validate())})),await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:i}=this.model;if(t){const{width:e,height:i}=Ie(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName)}destroy(){}async validate(){return!0}createState(){var t;return new Id(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 i=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var i;this.parent&&!this.parent.state.visible||null==(i=this.model.panelItemGroupLogics)||i.forEach((i=>{const a=i.relatedItemNames||[];if(e||T(a,t))try{const t=ni(this.data,i);switch(i.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=be(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=be(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 zr{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,i=this.context.clone(),a={...this.params};t&&Object.assign(i,he(t,this.params,this.context)),e&&Object.assign(a,he(e,this.params,this.context)),this.state.context=i,this.state.params=a}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")}}),t("ItemsValueOPs",["EXISTS","NOTEXISTS"])),Dd=/^N_(.\w+)_(.\w+)$/;function Cd(t){var e;return"SIMPLE"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Ad(t){var e;return"HIDDEN"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Pd(t){const e=t.split("__")[1].match(Dd);return{field:e[1],op:e[2]}}var Td=["ISNULL","ISNOTNULL","EXISTS","NOTEXISTS"],Nd=/\$\{[^}]*\}/,xd=t("SearchBarFilterController",class{constructor(t,e,i,a){var s;let n;this.model=t,this.appDataEntity=e,this.context=i,this.params=a,this.noEditor=!1,this.type="FIELD",this.hidden=Ad(t),t.appDEFieldId&&(n=xe(this.appDataEntity,t.appDEFieldId)),this.fieldName=n?n.codeName.toLowerCase():t.id,this.key=this.fieldName,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?Td.includes(this.valueOP):!this.model.editor}get valueItem(){return this.editor?this.editor.valueItem:void 0}async init(){if(!this.noEditor){if(!this.model.editor)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.searchBar.missingModel"));this.editorProvider=await Wi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}calcEditorProps(t){const e={};let i=t.value;return t.disabled&&Nd.test(i)&&(i=i.replace("${context.srfpersonid}","当前用户"),i=i.replace("${context.srforgid}","当前组织")),this.valueItem&&(e[this.valueItem]=t.valueItem),{value:i,data:e}}onEditorChange(t,e,i){this.valueItem&&i===this.valueItem?t.valueItem=e:t.value=e}}),Sd=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[i]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),i)}async updateBatch(t){const e=this.convertFrontDataToBack(t),i=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(i),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}))}},Ld="",Md={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"]},Rd={};function Od(t,e){if(t.enumSource)return{appId:Ld,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Rd["".concat(t.type,"_").concat(e)]}async function _d(t,e,i){var a;if(!t.properties)return[];const{properties:s}=t;if(!(Object.keys(s).length>0))return[];const n={};null==(a=(await ibiz.hub.getAppDataEntity(e,i)).appDEFields)||a.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[];Object.keys(s).forEach((t=>{if(!n[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(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:s[t].type}))}o.push({key:t,description:s[t].description,type:e,enumSource:s[t].enumSource})}}));const r=[];return o.forEach((t=>{const e=Md[t.type];e?e.forEach((e=>{t&&r.push({appId:Ld,appDEFieldId:n[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Ld,valueOP:e},editor:Od(t,e)})})):ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:""}),t.type)})),r}Object.keys(Md).forEach((t=>{Md[t].forEach((e=>{if(Td.includes(e))return;const i="".concat(t,"_").concat(e);Rd[i]||("date"!==t||["IN","NOTIN"].includes(e)?Rd[i]={appId:Ld,editorType:"TEXTBOX",id:i}:Rd[i]={appId:Ld,editorType:"DATEPICKER",id:i})}))}));var Fd=/^N_(.\w+)_(.\w+)$/,zd=t("SearchBarFilterItemsController",class extends xd{constructor(t,e,i,a){super(t[0],e,i,a),this.filterModels=t,this.allFields=[],this.subFilterCMap=new Map,this.type="ITEMS"}calcKey(t,e){return"".concat(t.toUpperCase(),"_").concat(e.toUpperCase())}async initMinorAppDE(){var t;const e=this.filterModels[0].appDEFieldId;let i="";if(null==(t=this.appDataEntity.appDEMethodDTOs)||t.find((t=>{var a;const s=null==(a=t.appDEMethodDTOFields)?void 0:a.find((t=>t.appDEFieldId===e));return!!s&&(i=s.refAppDataEntityId,!0)})),!i)throw new o(ibiz.i18n.t("runtime.controller.control.searchBar.noFoundEntity",{targetField:e}));this.minorAppDE=await ibiz.hub.getAppDataEntity(i,this.context.srfappid)}async initAllFields(){var t;const e=new Map;this.filterModels.forEach((t=>{var i;const a=(null==(i=t.defsearchMode.codeName)?void 0:i.split("__")[1]).match(Fd),s=a[1],n=a[2],o=it(t);o.defsearchMode.valueOP=n,o.id=s;const r=new xd(o,this.appDataEntity,this.context,this.params);this.subFilterCMap.set(this.calcKey(s,n),r),r.hidden||(e.has(s)||e.set(s,{name:s,label:"",valueOPs:[],fieldName:s}),e.get(s).valueOPs.push(n))})),null==(t=this.minorAppDE.appDEFields)||t.forEach((t=>{const i=t.codeName.toUpperCase();e.has(i)&&(e.get(i).label=t.logicName)})),this.allFields=Array.from(e.values()),await Promise.all(Array.from(this.subFilterCMap.values()).map((t=>t.init())))}async init(){await this.initMinorAppDE(),await this.initAllFields(),this.hidden=Array.from(this.subFilterCMap.values()).every((t=>t.hidden))}getSubFilterController(t,e){return this.subFilterCMap.get(this.calcKey(t,e))}});function Vd(){return[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}]}function kd(t){const e={pass:!1};let i=!1,a=!1;return r(t[0],(t=>{a||("FIELD"===t.nodeType?(i=!0,a=!t.field||!t.valueOP||!Td.includes(t.valueOP)&&Z(t.value)):a="ITEMS"===t.nodeType?!t.field||!t.valueOP:!t.logicType)})),i&&!a&&(e.pass=!0),e}function Ud(t,e){let i;if("GROUP"===t.nodeType){const a={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(a.searchconds=t.children.map((t=>Ud(t,e)))),i=a,t.notMode&&(a.notmode=t.notMode)}else if("FIELD"===t.nodeType){const e={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(e.value=t.valueItem),i=e}else{const a={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(a.searchconds=t.children.map((t=>Ud(t,e)))),i=a}return(null==e?void 0:e.after)&&e.after(t,i),i}function Bd(t,e){const{pass:i}=kd(t);if(!i)return;return t.map((t=>Ud(t,e)))}function Wd(t){var e,i;let a;if("GROUP"===t.condtype){const i={logicType:t.condop,nodeType:"GROUP",children:[]};(null==(e=t.searchconds)?void 0:e.length)&&(i.children=t.searchconds.map((t=>Wd(t)))),a=i,t.notmode&&(i.notMode=t.notmode)}else if("DEFIELD"===t.condtype){const e={nodeType:"FIELD",field:t.fieldname,value:t.value,valueOP:t.condop};t.valueItem&&(e.valueItem=t.valueItem),a=e}else{const e={nodeType:"ITEMS",field:t.fieldname,valueOP:t.condop,children:[]};(null==(i=t.searchconds)?void 0:i.length)&&(e.children=t.searchconds.map((t=>Wd(t)))),t.simple&&(e.simple=t.simple),a=e}return!0===t.hidden&&(a.hidden=!0),a}function Gd(t){let e;if("GROUP"===t.nodeType){const i={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(i.searchconds=t.children.map((t=>Gd(t)))),e=i,t.notMode&&(i.notmode=t.notMode)}else if("FIELD"===t.nodeType){const i={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(i.valueItem=t.valueItem),e=i}else{const i={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(i.searchconds=t.children.map((t=>Gd(t)))),t.simple&&(i.simple=t.simple),e=i}return!0===t.hidden&&(e.hidden=!0),e}function jd(t){const{pass:e}=kd(t);if(!e)return;return t.map(Gd)}var Kd=t("SearchBarFilterSimpleItemsController",class extends xd{constructor(t,e,i,a){super(t,e,i,a),this.noEditor=!1,this.key=this.model.id,this.type="SIMPLE_ITEMS";const s=Pd(t.defsearchMode.codeName);this.subFieldName=s.field,this.subValueOP=s.op}addSimpleFilterNode(t){Object.assign(t,{simple:!0,field:this.fieldName,nodeType:"ITEMS",valueOP:this.valueOP,children:[{nodeType:"FIELD",field:this.subFieldName,valueOP:this.subValueOP,value:null}]})}}),Hd=/\$\{[^}]*\}/,Xd=(t("SearchBarController",class extends zr{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!1,this.enableStorage=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")||this.ctx.getController("treegrid")}setStorageKeyFn(t){this.storageKeyFn=t}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.state.advancedQuickSearch=!1,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.state.quickSearchPlaceHolder="",this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){this.addSchemaFilters="true"===this.controlParams.enablejsonschema,this.enableStorage="true"===this.controlParams.storage,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.initAdvancedQuickSearch()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Sd(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 Sr(this.model.appDataEntityId,this.context);if(!e)return;const i=await _d(e,this.model.appDataEntityId,this.model.appId),a=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===i.findIndex((e=>{var i;return e.appDEFieldId===t.appDEFieldId&&(!(null==(i=t.defsearchMode)?void 0:i.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&a.push(t)})),i.length>0&&(this.model=it(this.model),this.model.searchBarFilters=i.concat(...a),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("、"),this.state.quickSearchPlaceHolder=this.placeHolder)}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}findFilterController(t,e){return this.filterControllers.find((i=>i.fieldName===t&&(!i.valueOP||i.valueOP===e)))}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query,this.state.advancedQuickSearch&&this.state.quickSearchFieldNames.length&&(e.queryconds=this.state.quickSearchFieldNames.map((t=>"n_".concat(t,"_like"))))),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=he(ei.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const i=this.calcFilters();return i&&(e.searchconds=i),e}resetFilter(){this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;if(null==(t=this.searchBarFilters)?void 0:t.length){const t=new Map;this.searchBarFilters.forEach((e=>{var i;if((null==(i=e.defsearchMode)?void 0:i.valueOP)&&bd.includes(e.defsearchMode.valueOP)){if(Cd(e))return void this.filterControllers.push(new Kd(e,this.appDataEntity,this.context,this.params));const i="".concat(e.appDEFieldId,"_").concat(e.defsearchMode.valueOP);return t.has(i)||t.set(i,[]),void t.get(i).push(e)}const a=new xd(e,this.appDataEntity,this.context,this.params);this.filterControllers.push(a)})),t.size>0&&t.forEach((t=>{const e=new zd(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 Bd(this.state.filterNodes,{after:(t,e)=>{"FIELD"===t.nodeType&&F(t.value)&&Hd.test(t.value)&&(e.value=ei.execSingleLine("`".concat(t.value,"`"),{...this.getEventArgs()}))}})}async initSearBarGroups(t=!1){var e;if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const i={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&&(i.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(i.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(i.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(i.show="1"===e.valid_flag)}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.searchBar.JSONFormat",{data:t.data}),e)}return t.defaultGroup&&(i.defaultSelect=!0),i})));const i=await this.service.fetch();if(i.ok&&i.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)x(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,i)=>e.order>this.state.searchBarGroups[t].order?i: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){if(this.enableStorage){const t=null==(e=this.storageKeyFn)?void 0:e.call(this);if(t){const e=localStorage.getItem(t);if(e){if(this.state.searchBarGroups.find((t=>t.name===e)))return void(this.hasDefaultSelect=!0)}}}this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){var t;if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){if(this.enableStorage){const e=null==(t=this.storageKeyFn)?void 0:t.call(this);if(e){const t=localStorage.getItem(e);if(t){const e=this.state.searchBarGroups.find((e=>e.name===t));if(e)return void this.handleGroupClick(e)}}}const e=this.state.searchBarGroups.find((t=>t.defaultSelect));e&&this.handleGroupClick(e)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:jd(this.state.filterNodes),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(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}));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&&(x(t,e.data),t.saved=!0),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}))}}}}async handleGroupClick(t){var e;if(this.enableStorage){const i=null==(e=this.storageKeyFn)?void 0:e.call(this);i&&t.name&&localStorage.setItem(i,t.name)}if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(x(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>Wd(t)));this.state.filterNodes=e}else this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}];r(this.state.filterNodes[0],(t=>{"FIELD"===t.nodeType&&t.field&&t.valueOP&&F(t.value)&&Hd.test(t.value)&&(t.disabled=!0)})),this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}initAdvancedQuickSearch(){var t;2===this.model.quickSearchMode&&(null==(t=this.model.searchBarQuickSearchs)?void 0:t.length)&&(this.state.advancedQuickSearch=!0,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.model.searchBarQuickSearchs.forEach((t=>{const e=xe(this.appDataEntity,t.appDEFieldId),i=e.codeName.toLowerCase();this.state.quickSearchItems.push({fieldName:i,label:e.logicName}),this.state.quickSearchFieldNames.push(i)})),this.calcQuickSearchPlaceHolder())}calcQuickSearchPlaceHolder(){if(this.state.advancedQuickSearch)if(this.state.quickSearchFieldNames.length){const t=[];this.state.quickSearchItems.forEach((e=>{this.state.quickSearchFieldNames.includes(e.fieldName)&&t.push(e.label)})),this.state.quickSearchPlaceHolder=t.join("、")}else this.state.quickSearchPlaceHolder=this.placeHolder}}),t("TabExpPanelController",class extends zr{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="",this.state.expViewParams={}}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&&hr(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const i=this.getNavViewMsg(t);!0===e&&(i.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:i}),this.evt.emit("onTabChange",{tab:t})}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:i,navigateContexts:a,navigateParams:s,appDataEntityId:n}=t,o={deName:Ae(n),navFilter:i,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:a,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=ge(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d,...this.state.expViewParams}}}getNavViewMsg(t){const{context:e,params:i}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:i,viewId:t.embeddedAppDEViewId,isCache:this.isCache,modalOptions:{replace:!0}}}refresh(){const t=this.getNavViewMsg(this.activeTabViewPanelModel);t.key+=ut(),this.evt.emit("onNavViewChange",{navViewMsg:t})}}),t("TreeService",class extends cs{async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const s=Re(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:i});if(0===s.length)return;(await Cn(s.map((async i=>{const a=Me(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Le(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,s){const n=0===Re(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,i,o)];break;case"DE":r=await this.getDENodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.gantt.noSupport",{treeNodeType:t.treeNodeType}))}const{rootNode:c}=t,d=c&&!this.model.rootVisible;return n||await Promise.all(r.map((async(e,i)=>{var a;if(this.calcExpand(t,i)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(e._id)||d){const t=await this.fetchChildNodes(e,s);e._children=t}}))),r}async getStaticNodeData(t,e,i,a){const s=this.calcStaticExpand(t);return new an(t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf,defaultExpand:s})}getNodeRSFilterParams(t,e,i){const{parentValueLevel:a,navigateContexts:s,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...i.params},l={...i.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<a;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=Me(this.model,h._nodeId);t&&t.appDataEntityId&&(p=Ae(t.appDataEntityId)),u=h._value}const{resultContext:g,resultParams:f}=ge({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,g),Object.assign(d,f),{context:l,params:d,navContext:g,navParams:f}}async getDENodeDatas(t,e,i,a){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.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,s)=>{const n=this.calcExpand(t,s);return new en(t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d,defaultExpand:n})}))}return[]}async getCodeListNodeDatas(t,e,i,a){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map(((e,s)=>{const n=this.calcExpand(t,s);return new Zs(t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r,defaultExpand:n})}))}return[]}async removeItem(t,e,i={}){var a;const s=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.execWithEntityId(t,s,e,void 0,i)}async execWithEntityId(t,e,i,a,s){const n=this.handleCustomRequestHeader();return await this.app.deService.exec(t,e,i,a,s,n)}calcExpand(t,e){const{expandFirstOnly:i,expanded:a}=t;return!!a&&(!i||i&&0===e)}calcStaticExpand(t){const{expandFirstOnly:e,expanded:i}=t;return!!i||!!e}})),qd=t("TreeController",class extends Vr{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)),i=[];null==t||t.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("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,i;(null==(i=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:i.length)&&(this.contextMenus[t.decontextMenu.id]=new Bc(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 Xd(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 $a.getCounterByRef(e,this.context,{...this.params}))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Re(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var i;if(null==(i=t.parentDER1N)?void 0:i.pickupDEFName){const i=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==i?void 0:i.treeNodeType)&&i.appDataEntityId&&e.push({minorEntityId:i.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 i=t.decontextMenu;if(null==(e=null==i?void 0:i.detoolbarItems)?void 0:e.length){let e=0;const a=[];r(i,(t=>{if("DEUIACTION"===t.itemType){e+=1;const i=t;200===i.actionLevel&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:a[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let i;e&&await this.startLoading();try{i=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,i),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),i}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(),i=!!e.query;let a;this.state.isLoading=!0;try{a=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:i,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=a:this.state.rootNodes=a,await this.afterLoadNodes(a),a}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 i;const a=null==(i=this.contextMenuInfos[t._nodeId])?void 0:i.clickTBUIActionItem;if(a)return this.doUIAction(a.uiactionId,t,e,a.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect&&!t._disableSelect){const{selectedData:e}=this.state,i=e.filter((e=>e._id!==t._id));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const i=this.state.expandedKeys.includes(t._id);if(e&&!i)this.state.expandedKeys.push(t._id);else if(!e&&i){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)),i=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(i)}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,i,a){const s=this.getEventArgs(),n=this.parseTreeNodeData(e),o=await Mc.exec(t,{...s,...n,event:i},a);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 i;(null==(i=t._children)?void 0:i.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?a._parent:a,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 i=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==i.length&&await Promise.all(i.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,i){var a,s;const n=this.getNodeModel(t._nodeId);if("inner"===i){const t=this.getNodeModel(e._nodeId);return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId)&&!!(null==t?void 0:t.allowDrop)}if((null==(a=t._parent)?void 0:a._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 i=this.dropNodeRss.get(t);return null==i?void 0:i.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,a){var s,n,o;"inner"!==a||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===a?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"===a||(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"===a)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let i=d._children.indexOf(e);"next"===a&&(i+=1),d._children.splice(i,0,t)}("inner"===a||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:g}=h;if(!0===g){if(!p)throw new i(h,ibiz.i18n.t("runtime.controller.control.tree.sortAttribute"));const e=p.toLowerCase(),a="ASC"===m,s=[...d._children];a||s.reverse();const n=t=>t+(100-t%100),o=t=>t[e]||0;let c;s.forEach(((i,a)=>{const d=i._deData;void 0===c?i===t&&(c=0===a?100:n(o(s[a-1]._deData)),d[e]=c,-1===r.indexOf(i)&&r.push(i)):(c>=o(d)&&(d[e]=n(c),r.push(i)),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 i=this.getNodeModel(t._nodeId);let a=t._deData;t._changedOnly&&(a=t.getDiffData());const s=Ae(i.appDataEntityId),n=this.context.clone();n[s]=a.srfkey;const o=await e.deService.exec(i.appDataEntityId,"update",n,a);o.data&&(t._deData=o.data,t._oldDeData=o.data.clone())})))}async modifyNodeText(t,e){const a=this.getNodeModel(t._nodeId);if(!a.allowEditText)throw new i(a,ibiz.i18n.t("runtime.controller.control.tree.editMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.tree.nodeData"));t._text=e,await this.updateDeNodeData([t]),this.emitDEDataChange("update",t._deData)}async handleItemRemove(t,e,i){let a=!1;const s=this.getNodeModel(t._nodeId);if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeNode"));const n=s.appDataEntityId;if(n){const s=Ae(n);if(0!==t.srfuf){const o=e.clone();o[s]=t.srfkey,await this.service.removeItem(n,o,i),a=!0}}return a}onDEDataChange(t){if(!Z(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if("OBJECTCREATED"===t.subtype)return;const e=t.data,i=this.state.items.find((t=>"DE"===t._nodeType&&t._deData&&t._deData.srfdecodename===e.srfdecodename&&t._deData.srfkey===e.srfkey));i&&this.doNextActive((()=>this.refreshNodeChildren(i,!0)),{key:"refresh".concat(i._id)})}}),Yd=t("WizardPanelService",class extends rs{async initialize(t,e={},i={}){var a;const s=null==(a=this.model.initControlAction)?void 0:a.appDEMethodId;let n=await this.exec(s,t,e,i);return n=this.handleResponse(n),n}async finish(t,e={},i={}){var a;const s=null==(a=this.model.finishControlAction)?void 0:a.appDEMethodId;let n=await this.exec(s,t,e,i);return n=this.handleResponse(n),n}}),Qd=(t("WizardPanelController",class extends zr{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}getData(){return[this.formData]}initState(){super.initState(),this.state.buttonsState=new cr}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,i,a,s;t.firstForm&&(this.firstForm=t);const n="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),o=null==(a=null==(i=this.model.dewizard)?void 0:i.dewizardSteps)?void 0:a.find((e=>e.id===t.dewizardStepId)),r=null==o?void 0:o.stepTag;this.stepTags[n]=r,null==(s=t.stepActions)||s.forEach((e=>{const i="".concat(t.formTag,"@").concat(e),a=new rr(i,this.context.srfappid);a.visible=!this.getStepScriptCode(t,e),this.state.buttonsState.addState(i,a)}))})),this.state.buttonsState.init(),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Yd(this.model),await this.service.init(this.context);const{deeditForms:i}=this.model;i&&i.length>0&&await Promise.all(i.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const i=await ki(t);i&&(this.providers[e]=i)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardForm",{activeFormTag:t})),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.formController",{activeFormTag:t}));return e}async onFormMounted(t,e){const i=e.ctrl;this.formControllers.set(t,i),i.evt.on("onFormDataChange",(t=>{this.calcButtonState(t.data[0])}));const a=await i.load();this.calcButtonState(i.data),Object.assign(this.formData,a)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const i=Ae(this.model.appDataEntityId);!this.context[i]&&e&&e.srfkey&&(this.context[i]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.noConfiguration"));const i=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardFormIdentifier",{tag:t}));return i}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){let t;try{t=await this.service.initialize(this.context,{},this.params)}catch(t){throw this.actionNotification("INITIALIZEERROR",{error:t}),t}const e=Ae(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(){try{await this.service.finish(this.context,this.formData,this.params)}catch(t){throw this.actionNotification("FINISHERROR",{error:t}),t}this.evt.emit("onFinishSuccess",void 0),this.actionNotification("FINISHESUCCESS")}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(ibiz.i18n.t("runtime.controller.control.wizardPanel.noPreviousForm"));this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save({silent:!0});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,i=this.model.dewizard.dewizardForms;if(t&&i){const i=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),a=t[i+1];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextStep"));const s=this.getWizardFormByTag(a.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextForm"));this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save({silent:!0}),await this.finish()}getStepScriptCode(t,e){switch(e){case"PREV":return t.goPrevEnableScriptCode;case"NEXT":return t.goNextEnableScriptCode;case"FINISH":return t.goFinishEnableScriptCode}}async calcButtonState(t){var e;const{activeWizardForm:i}=this;if(i){let a=t;a&&a instanceof os&&(a=a.getOrigin()),null==(e=i.stepActions)||e.forEach((t=>{const e=this.state.buttonsState["".concat(i.formTag,"@").concat(t)],s=this.getStepScriptCode(i,t);e&&s&&(e.visible=!!ei.execScriptFn({view:this.view,context:this.context,params:this.params,data:a,env:ibiz.env},s,{isAsync:!1,singleRowReturn:!0}))}))}}}),t("MDCtrlService",class extends cs{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new sn(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new sn(e,e);this.dataUIMap.set(e,a)}))}})),Jd=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),$d=(t("MDCtrlController",class extends Vr{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 Qd(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(){this.doNextActive((()=>this.load({isInitialLoad:!0})),{key:"refresh"})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new Jd(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 Jd(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,i){const a=t.uiactionId;await Mc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.view,event:i},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:i}=this.model;e&&this.initUIActionGroup(t,e),i&&this.initUIActionGroup(t,i)}initUIActionGroup(t,e){var i;(null==(i=e.uiactionGroupDetails)?void 0:i.length)||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new cr;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const i=new rr(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.data.getOrigin()),t.uaColStates[e.id]=a}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(new Jd(e,this)))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}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 i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(new Jd(e,this))}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,key:i.value,children:t})})),this.state.groups=n}}),t("KanbanService",class extends jc{async updateGroup(t,e){var i;const a=(null==(i=this.model.updateGroupControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async moveOrderItem(t,e,i){const a=this.model.moveControlAction.appDEMethodId,s=it(e.getOrigin());Object.assign(s,i);let n=await this.exec(a,t,s,{srfupdateitem:!0});return n=this.handleResponse(n),n}})),Zd=(t("KanbanController",class extends Kc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new $d(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.readonly=!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly),this.state.draggable=this.enableEditOrder||this.enableEditGroup,this.state.uaState={}}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortingProperties"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortDirection"));const s="ASC"===a;t.forEach((t=>{const i=t[e];if(Z(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>s?t[e]-i[e]:i[e]-t[e]))}async afterLoad(t,e){var i;this.sortItems(this.state.items),super.afterLoad(t,e);const a=[];return null==(i=this.model.dedataViewItems)||i.forEach((t=>{"ACTIONITEM"===t.itemType&&t.deuiactionGroup&&t.deuiactionGroup.uiactionGroupDetails&&a.push(...t.deuiactionGroup.uiactionGroupDetails)})),a&&a.length>0&&e.forEach((t=>{const e=new cr;a.forEach((t=>{const i=t.uiactionId;if(i){const a=new rr(t.id,this.context.srfappid,i);e.addState(t.id,a)}})),this.state.uaState[t.srfkey]=e})),e.forEach((t=>{this.state.uaState[t.srfkey]&&Object.keys(this.state.uaState[t.srfkey]).length>0&&this.state.uaState[t.srfkey].update(this.context,t.getOrigin(),this.model.appDataEntityId)})),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,i){this.setSelectGroup(i.key),super.onGroupToolbarClick(t,e,i)}async onGroupActionClick(t,e,i,a){this.setSelectGroup(a.key);const s={...this.params,srfgroup:a},n=t.uiactionId;await Mc.execAndResolved(n,{context:this.context,params:s,data:[e],view:this.view,event:i},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o(ibiz.i18n.t("runtime.controller.control.kanban.groupedOn"));return super.handleDataGroup()}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(e)}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,color:i.color,key:i.value,children:t})})),this.state.groups=n}async onDragChange(t){var e;if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.adjustmentsGroup"));const{from:a,to:s,fromIndex:n,toIndex:o}=t,r=this.model.groupAppDEFieldId,c=this.model.minorSortAppDEFieldId,d=this.state.groups.find((t=>t.key===a)),l=this.state.groups.find((t=>t.key===s));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.noAllowReorder"));const e=d.children[n];return e[r]=t.to,this.updateChangedItems([e])}const h=[...l.children];if(!(null==(e=this.model.moveControlAction)?void 0:e.appDEMethodId))throw new i(this.model,ibiz.i18n.t("runtime.controller.common.md.noMoveDataCconfig"));this.state.updating=!0;const u=it(d.children[n]),p=d.children.splice(n,1);if(l.children.splice(o,0,...p),t.from!==t.to){u[r]=t.to;const e=ibiz.hub.getApp(this.model.appId),a=Ae(this.model.appDataEntityId),s=this.context.clone();s[a]=u.srfkey;try{await e.deService.exec(this.model.appDataEntityId,"update",s,u);const t=this.state.items.findIndex((t=>t.srfkey===u[this.dataEntity.keyAppDEFieldId]));-1!==t&&this.state.items.splice(t,1,u)}catch(t){throw this.state.updating=!1,new i(this.model,ibiz.i18n.t("runtime.controller.common.md.changeGroupError"))}}const m=((t,e,i,a,s)=>{let n={};const o=a[e];if(o)n={srftargetkey:o.srfkey,srfmovetype:e<a.length-1||s?"MOVEBEFORE":"MOVEAFTER"};else{let t=[];if(a.length>0&&(t=a),t.length>0){const e=t.reduce(((t,e)=>{const a=t[c]>e[c];return a&&t[this.dataEntity.keyAppDEFieldId]!==i.srfkey||a||e[this.dataEntity.keyAppDEFieldId]===i.srfkey?t:e}));e&&e[this.dataEntity.keyAppDEFieldId]!==i.srfkey&&(n={srftargetkey:e.srfkey,srfmovetype:"MOVEAFTER"})}}return n})(0,o,u,h,t.from!==t.to);try{const{ok:t,result:e}=await this.moveOrderItem(u,m);t&&(Array.isArray(e)&&e.length>0?e.forEach((t=>{const e=this.state.items.findIndex((e=>e.srfkey===t[this.dataEntity.keyAppDEFieldId]));-1!==e&&(this.state.items[e][c]=t[c])})):await this.refresh())}catch(t){this.state.updating=!1,this.actionNotification("MOVEERROR",{error:t})}finally{await this.afterLoad({},this.state.items),this.state.updating=!1}}async moveOrderItem(t,e){const i=Ae(this.model.appDataEntityId),a=this.context.clone();if(a[i]=t.srfkey,!e.srftargetkey||!e.srfmovetype)return ibiz.log.error(ibiz.i18n.t("runtime.controller.common.md.computeMoveMetaError")),{ok:!1};return{ok:!0,result:(await this.service.moveOrderItem(a,t,e)).data}}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=Ae(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.updateGroup(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.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,i){const a=this.state.groups.find((e=>e.key===t));a&&(a[e]=i)}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 i=t.split("quicktoolbar_")[1];this.setGroupController(i,"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 i=t.split("batchtoolbar_")[1];this.setGroupController(i,"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 Xd{})),tl=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=>{let i;this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.name],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})})))}}),el=t("TreeGridExController",class extends qd{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 Zd(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 Ca(t);if(!e)return;this.providers[t.codeName]=e;const i=await e.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=i:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=i)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{2!==t.hideMode&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,hideMode:t.hideMode||0,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,i)=>{t.uaColumn&&(t.fixed=i+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 tl(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(ibiz.i18n.t("runtime.controller.common.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(e.processing)return void await S(500,this.save.bind(this),[t]);const a=this.getNodeModel(t._nodeId),{appDataEntityId:s,updateAppDEActionId:n}=a,r=0===t._deData.srfuf;if(r)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noSupportCreation"));if(!n)throw new i(a,ibiz.i18n.t("runtime.controller.control.treeGridEx.updateBehavior"));const c=Ae(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 Cn(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((i=>{i.gridStateNotify(t,e)}))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||ur(t.data[e],i)){t.data[e]=i,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Cn(Object.values(this.columns).map((async i=>i.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const i={};return Object.values(this.fieldColumns).forEach((a=>{const s=a.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=yr({name:a.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(i[a.name]=h)})),i}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)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(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data._deData.srfuf){t.cacheData=it(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}}),il=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){}}),al=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:a,detreeNodeDataItems:s,detreeNodeEditItems:n}=e,o=null==a?void 0:a.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 i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.noConfigured",{name: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 i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.editItem",{name: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 Wi(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 i=new cr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.name]=i}}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 i=this.nodeColumn.linkValueItem||"srfkey",a=t.data[i];if(null==a)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noPickedUp",{valueItem:i}));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const n=ri(t.data),r=Object.assign(this.context.clone(),{srfkey:a,...n}),c=it(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:i}=we(d);let a={};e&&t.data&&(a=he(e,t.data,c,r)),Object.assign(r,a);let s={};i&&t.data&&(s=he(i,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute(Go.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const i=this.nodeColumn.deuiactionId;await Mc.execAndResolved(i,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return fr.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=Ct(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 i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(this.context,t.data._deData)}}async setRowValue(t,e,i){i=i||this.name,await this.treeGrid.setRowValue(t,i,e)}}),sl=(t("TreeGridExFieldColumnController",class extends il{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 al(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 i=this.nodeColumnControllerMap.get(t.data._nodeId);i&&i.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends il{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 i=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));i&&this.nodeColumnMap.set(t.id,i)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const i=this.nodeColumnMap.get(t.data._nodeId);i.deuiactionGroup&&(e=i.deuiactionGroup)}return e}initActionStates(t){var e;const i=this.getUIActionGroup(t);if(!i)return void ibiz.log.warn(ibiz.i18n.t("runtime.controller.control.treeGridEx.behaviorGroup",{id:this.model.id}));if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new cr;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new rr(t.id,this.treeGrid.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.model.id]=a}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,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(this.context,t.data._deData)}}}),t("TreeGridController",class extends yd{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 a=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(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnsSchema"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnMode"));this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=a.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends gd{}),t("MEditViewPanelService",class extends cs{})),nl=(t("MEditViewPanelController",class extends Vr{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new sl(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 i=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(i.appDataEntityId){const a=await ibiz.hub.getAppDataEntity(i.appDataEntityId,i.appId);this.parameters=i&&a?[{parameterName:null==(t=a.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=a.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const i=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,i),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===i.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,i={id:t[e]?t[e]:"mockId:".concat(ut()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:a,pathName:s}=e;t[a]&&!Object.is(t[a],"")&&Object.assign(i.context,{[s]:t[a]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(i,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(i,{srfmajortext:ibiz.i18n.t("runtime.controller.control.meditViewPanel.DraftNew")})})),i}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 i=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(i=!0),await this.handleDelete(t),i&&(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 i=this.state.panelUiItems.findIndex((t=>t.id===e));if(i<0)throw new o(ibiz.i18n.t("runtime.controller.control.meditViewPanel.dataExist"));const a=this.state.panelUiItems[i];a.id.startsWith("mockId:")?this.state.panelUiItems[i]=this.handlePanelItemParams(t):a.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[i].id)}}),t("MapService",class extends cs{async init(t){await super.init(t)}async fetchAll(t,e={}){var i;const a=[];if(null==(i=this.model.sysMapItems)?void 0:i.length){const i=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 i=ei.execSingleLine(r);if(i){const{navigateContexts:a,navigateParams:s}=we(i);a&&Object.assign(c,he(a,e,t)),s&&Object.assign(d,he(a,e,t))}}const l=await i.deService.exec(n,o,c,d);l.data&&a.push(...l.data.map((t=>new rn(t,s))))})))}return new p(a,200)}})),ol=(t("MapController",class extends Vr{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new nl(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:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);i.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(i,a);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 i=await super.afterLoad(t,e),a=[],s=[];return i.forEach((t=>{"REGION"===t._itemStyle?a.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=a,i}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 i=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=i;break;case"strareacode":this.state.strAreaCode="true"===i;break;case"jsonbaseurl":this.state.jsonBaseUrl=i}}))}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 rs{async fetch(t,e={}){this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(this.dataEntity.deapicodeName2,"/report?srfreporttag=").concat(this.model.codeName);let a=await ibiz.net.request(i,{method:"post",data:e});return a=this.handleResponse(a),a}})),rl=class{constructor(t,e){this.config={},this.model=t,this.reportPanel=e}async initConfig(){}init(t){this.protoRef=t}load(t={}){return Promise.resolve(t)}},cl=class extends rl{async initConfig(){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)}},dl=class extends rl{},ll=class extends rl{async initConfig(){this.config=this.translateReportToConfig(this.model)}load(t={}){return this.protoRef&&this.protoRef.refresh("ALL"),Promise.resolve(t)}translateReportToConfig(t){const e={},i={},a={caption:t.logicName,data:i},{appDEReport:s}=t;console.log(s),e.reportTag=s.id;const n=s.appBISchemeId.split(".").pop();e.selectedSchemeId=n;const{appBICubeId:o,appBIReportDimensions:r,appBIReportMeasures:c,reportUIModel:d}=s.appBIReport;if(e.selectCubeId="".concat(n,".").concat(o),d){const t=JSON.parse(d);e.selectChartType=t.selectChartType,a.style=t.style}else e.selectChartType="NUMBER";return c&&c.length>0&&c.forEach((t=>{i.measure||(i.measure=[]),i.measure.push({pssysbischemeid:n,pssysbicubemeasureid:"".concat(n,".").concat(o,".").concat(t.measureTag),pssysbicubeid:"".concat(n,".").concat(o),codename:t.measureTag})})),r&&r.length>0&&r.forEach((t=>{i.dimension||(i.dimension=[]),i.dimension.push({pssysbischemeid:n,pssysbicubedimensionid:"".concat(n,".").concat(o,".").concat(t.dimensionTag),pssysbicubeid:"".concat(n,".").concat(o),codename:t.dimensionTag,pscodelistid:t.appCodeListId})})),e.propertyData=a,e}},hl=class{static getInstance(t,e){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.reportType"));switch(t.appDEReport.reportType){case"USER":return new cl(t,e);case"USER2":return new dl(t,e);case"DESYSBIREPORTS":case"SYSBICUBE":case"DESYSBICUBES":case"ALLSYSBICUBES":case"SYSBIREPORT":case"SYSBICUBEREPORTS":case"ALLSYSBIREPORTS":return new ll(t,e);default:throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.noImplemented",{reportType:t.appDEReport.reportType}))}}},ul=(t("ReportPanelController",class extends zr{get _evt(){return this.evt}get isBIReport(){return"DESYSBIREPORTS"===this.state.reportType||"SYSBICUBE"===this.state.reportType||"DESYSBICUBES"===this.state.reportType||"ALLSYSBICUBES"===this.state.reportType||"SYSBIREPORT"===this.state.reportType||"SYSBICUBEREPORTS"===this.state.reportType||"ALLSYSBIREPORTS"===this.state.reportType}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=hl.getInstance(this.model,this),this.generator&&await this.generator.initConfig(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new ol(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={}){if(this.state.reportType&&this.isBIReport)return{};await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam),a=await this.service.fetch(e,i);this.state.data=a.data,await this.afterLoad(t,a.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(){var t;return this.isBIReport?(null==(t=this.generator.protoRef)?void 0:t.state.items)||[]:[this.state.data]}async refresh(){this.isBIReport?this.generator.load():this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}async openReportDesignPage(){if(this.state.reportType&&this.isBIReport){const t=ibiz.overlay.createModal("iBizBIReportDesign",{dismiss:e=>t.dismiss(e),context:this.context,viewParams:this.params,config:this.generator.config},{width:"90%",height:"90%",footerHide:!0});t.present();return await t.onWillDismiss()}return{ok:!1,data:[]}}}),t("GanttService",class extends Xd{async getNodeDraft(t,e,i,a){var s;const{appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},l=await this.app.deService.exec(n,"getdraft",o,r),{data:h}=l;return(null==(s=null==e?void 0:e.parentDER1N)?void 0:s.pickupDEFName)&&i&&(h[e.parentDER1N.pickupDEFName]=i._value),new un(this.model,t,i,{data:l.data,leaf:!0,navContext:c,navParams:d,defaultExpand:!1})}async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const s=Re(this.model,{parentId:t._nodeId,hasQuery:i});if(0===s.length)return;(await Cn(s.map((async i=>{const a=Me(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Le(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,s){const n=0===Re(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,i,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.gantt.noSupport",{treeNodeType: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,i,a){const s=this.calcStaticExpand(t);return new hn(this.model,t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf,defaultExpand:s})}async getDEGanttNodeDatas(t,e,i,a){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.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,s)=>{const n=this.calcExpand(t,s);return new un(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d,defaultExpand:n})}))}return[]}async getCodeListGanttNodeDatas(t,e,i,a){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map(((e,s)=>{const n=this.calcExpand(t,s);return new pn(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r,defaultExpand:n})}))}return[]}})),pl=(t("GanttController",class extends el{initState(){super.initState(),this.state.ganttStyle={},this.state.sliderDraggable=!0}handleControlParams(){super.handleControlParams(),this.controlParams.sliderdraggable&&(this.state.sliderDraggable="true"===this.controlParams.sliderdraggable)}onDataChange(t){}async initService(){this.service=new ul(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}async onCreated(){await super.onCreated(),this.initViewScheduler()}initViewScheduler(){const t=this.model.appViewLogics||[];0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async setActive(t){const e=this.parseTreeNodeData(t);return"DE"===t._nodeType&&await this.onNodeDataActive(e),this.evt.emit("onActive",{...e,nodeData:t})}async onNodeDataActive(t){(await this.openData(t)).cancel||this.refreshNodeChildren(t.data[0],!0)}async refresh(){this.doNextActive((async()=>{const t=await this.load({isInitialLoad:!1}),e=this.model.rootVisible?t:t[0]._children;e&&await this.handleDefaultExpandNodes(e)}),{key:"refresh"})}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.notFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?a._parent:a,n=await this.loadNodes(s);await this.handleDefaultExpandNodes(n),this.evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async handleDefaultExpandNodes(t){for(let e=0;e<t.length;e++){const i=t[e];if(this.state.expandedKeys.includes(i._id)){const t=i.srfkey?"srfkey":"_id",e=this.state.items.find((e=>e[t]===i[t])),a=await this.loadNodes(e);await this.handleDefaultExpandNodes(a)}}}async openData({data:t,context:e,params:a}){var s,n;const o=t[0],r=this.getNodeModel(o._nodeId),{appDataEntityId:c}=r;e[Ae(c).toLowerCase()]=null==(s=o._deData)?void 0:s.srfkey;const d=await(null==(n=this.viewScheduler)?void 0:n.triggerCustom("".concat(r.id.toLowerCase(),"_opendata"),{context:e,params:a,data:t,event:void 0,view:this.view,ctrl:this}));if(-1===d)throw new i(r,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:r.id.toLowerCase()}));return{cancel:!d||!d.ok}}async setRowValue(t,e,i){const{beginDataItemName:a,endDataItemName:s}=this.model;if(!Object.prototype.hasOwnProperty.call(t.data,e)||ur(t.data[e],i)){t.data[e]=i,e===a?t.data._beginDataItemValue=i:e===s&&(t.data._endDataItemValue=i),t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async modifyNodeTime(t,{begin:e,end:i}){if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.noNode"));const a=this.getRowState(t._id);if(!a)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));const{beginDataItemName:s,endDataItemName:n}=this.model;this.setRowValue(a,s,e),this.setRowValue(a,n,i),await this.save(a.data)}async save(t){if(this.state.isSimple)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(e.processing)return void await S(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:a}=i,s=0===t._deData.srfuf,n=Ae(a),r=this.context.clone();r[n]=t._deData.srfkey;const c=ibiz.hub.getApp(this.context.srfappid);let d;try{d=await c.deService.exec(a,s?"create":"update",r,t._deData)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(s?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=d.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this.evt.emit("onBeforeRemove",void 0),await this.startLoading();let s,n=!1;try{const o=ibiz.hub.getApp(this.context.srfappid);await Cn(a.map((async t=>{if("DE"===t._nodeType){const a=e.clone(),r=this.getNodeModel(t._nodeId);if(r&&0!==t._deData.srfuf){const{appDataEntityId:e}=r;if(a[Ae(e)]=t.srfkey,await o.deService.exec(e,"remove",a,i),!s&&t._parent){const e=this.getNodeData(t._parent._id);s=e}n=!0}this.afterRemove(t)}}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.common.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),n&&s&&!(null==t?void 0:t.notRefresh)&&await this.refreshNodeChildren(s)}catch(e){throw await this.evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this.evt.emit("onRemoveSuccess",void 0)}afterRemove(t){var e;const i=this.state.items.findIndex((e=>e._uuid===t._uuid));if(-1!==i&&this.state.items.splice(i,1),this.state.rows[t._uuid]&&delete this.state.rows[t._uuid],t._parent){const i=this.getNodeData(t._parent._id),a=i._children.findIndex((e=>e._uuid===t._uuid));-1!==a&&(null==(e=i._children)||e.splice(a,1))}}async newRow(t={}){var e;const{data:i}=t,{editShowMode:a}=ibiz.config.grid;if("row"===a){if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.common.md.firstComplete"))}let s,n;if(i){const t=Array.isArray(i)?i[0]:i;n=this.getNodeData(t._id),s=this.getNodeModel(n._nodeId)}else n=this.state.rootNodes[0],s=Le(this.model);if(s){let t,i;if(Re(this.model,{parentId:s.id,hasQuery:!1}).forEach((e=>{const a=this.getNodeModel(e.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&(t=e,i=a)})),i){let s;try{s=await this.service.getNodeDraft(i,t,n,{hasQuery:!1,context:this.context.clone(),params:this.params})}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const o=this.calcDefaultValue(s,!0);Object.assign(s,o);const r=this.getRowState(n._id);(null==(e=n._children)?void 0:e.length)?n._children.push(s):n._children=[s],this.state.items.push(s);const c=new tl(s,this);this.state.rows[s._uuid]=c,this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(c,!0),this.evt.emit("onNewRow",{row:r}),this.actionNotification("GETDRAFTSUCCESS",{data:s})}}}async onNodeDrop(t,e,a){var s,n;"inner"!==a||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const o=[],r=this.getNodeModel(t._nodeId),c="inner"===a?e:e._parent;let d=this.getNodeModel(e._nodeId);if("inner"===a||(null==(s=e._parent)?void 0:s._id)!==(null==(n=t._parent)?void 0:n._id)){const e=this.findDropNodeRS(c._nodeId,r.appDataEntityId);e&&(t._deData[e.pickupDEFName]=c._value,o.push(t),d=this.getNodeModel(e.childDETreeNodeId)),t._parent=c,t._nodeId=d.id}const{sortAppDEFieldId:l,sortDir:h,allowOrder:u}=d;if(!0===u){if(!l)throw new i(d,ibiz.i18n.t("runtime.controller.control.tree.sortAttribute"));const e=l.toLowerCase(),a="ASC"===h,s=c._children;a||s.reverse();const n=t=>t+(100-t%100),r=t=>t[e]||0;let u;s.forEach(((i,a)=>{const c=i._deData;void 0===u?i===t&&(u=0===a?100:n(r(s[a-1]._deData)),c[e]=u,-1===o.indexOf(i)&&o.push(i)):(u>=r(c)&&(c[e]=n(u),o.push(i)),u=r(c))}))}await this.updateDeNodeData(o)}onDEDataChange(t){}}),t("HubController",class{constructor(){this.session={}}async login(t,e,i,a,s){return await ibiz.appUtil.login(t,e,i,a,s)}async logout(t){return await ibiz.appUtil.logout(t)}async changePwd(t,e,i){return await ibiz.appUtil.changePwd(t,e,i)}async switchOrg(t,e,i){return await ibiz.appUtil.switchOrg(t,e,i)}async switchTheme(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}async switchLanguage(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}})),ml=class{constructor(){this.evt=new ht,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new us}async init(){this.listenMessage()}listenMessage(){ibiz.mc.command.asyncAction.on((async t=>{if(!t.data||"ASYNCACTION"!==t.subtype)return;if(t.data.actiontype&&"ASYNCCHATCOMPLETION"===t.data.actiontype)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=>{$(t[e])&&(t[e]=Ct(t[e]).format("YYYY-MM-DD HH:mm:ss"))})),!_(t.actionresult))try{const e=JSON.parse(t.actionresult);t.actionresult=e}catch(t){}if(!_(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",it(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",it(t)),this.evt.emit("dataChange")}noticeResult(t){ibiz.notice.showAsyncAction(t)}};function gl(t){if(""===t)return!1;const e=(new DOMParser).parseFromString(t,"text/html");return Array.from(e.body.childNodes).some((t=>1===t.nodeType))}var fl=class{constructor(){this.evt=new ht,this.total=0,this.unreadCount=0,this.page=0,this.size=20,this.messages=[],this.unreadOnly=!1,this.service=new Ys,this.ns=null,this.provider=null}async init(){this.listenMqtt(),await this.refreshUnreadCount()}async load(){try{await this.fetch(!1)}catch(t){ibiz.log.error(t)}}async loadMore(){await this.fetch(!0)}async refreshUnreadCount(){try{this.unreadCount=await this.service.getUnreadNum(),this.evt.emit("unreadCountChange",this.unreadCount)}catch(t){ibiz.log.error(t)}}toggleUnReadOnly(t){const e=void 0===t?!this.unreadOnly:t;this.unreadOnly!==e&&(this.unreadOnly=e,this.evt.emit("unreadOnlyChange",this.unreadOnly),this.load())}async fetch(t=!1){!1===t?this.page=0:this.page+=1;const e={page:this.page,size:this.size,sort:"timestamp,desc"};this.unreadOnly&&(e.searchconds=[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]);const i=await this.service.fetch(e);this.total=i.total,t?this.messages.push(...i.data):this.messages=i.data,this.evt.emit("dataChange")}listenMqtt(){ibiz.mc.command.internalMessage.on((async t=>{var e;ibiz.log.debug("mqtt internalMessage: ",t),"INTERNALMESSAGE"===t.subtype&&(t.content&&ibiz.notification.default({isHtmlDesc:gl(t.content),desc:t.content,position:"bottom-right",class:null==(e=this.ns)?void 0:e.b("notice"),onClick:()=>{const e=ibiz.env.isMob?t.mobileurl:t.url;this.provider&&this.provider.openViewByUrl(e)}}),this.refreshUnreadCount())}))}async markRead(t){const e=this.messages.find((e=>e.id===t.id));e&&"RECEIVED"===e.status&&(await this.service.markRead(t.id),e.status="READ",this.unreadCount-=1,this.evt.emit("unreadCountChange",this.unreadCount),this.unreadOnly?this.load():this.evt.emit("dataChange"))}async batchMarkRead(){await this.service.batchMarkRead(),await this.fetch(),this.unreadCount=0,this.evt.emit("unreadCountChange",this.unreadCount)}async get(t){return(await this.service.get(t)).data}},yl=class{constructor(){this.evt=new ht,this.total=0,this.asyncAction=new ml,this.internalMessage=new fl}async init(){this.internalMessage.evt.on("unreadCountChange",(()=>{this.total=this.internalMessage.unreadCount,this.evt.emit("totalChange",this.total)})),await this.internalMessage.init(),await this.asyncAction.init()}},wl=class{constructor(){this.convert=new Yo,this.controller=new pl,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.drcontrols=new Map,this.dataEntities=new Map,this.config=new Jo,this.notice=new yl,this.defaultAppIndexViewName="Index"}calcAppViewId(t=""){let e="";if(t&&-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerSubAppDrControls(t,e){this.drcontrols.has(t)||this.drcontrols.set(t,[]);const i=this.drcontrols.get(t);null==i||i.push(e)}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,i=-1){i<=0&&(i=50);const a=this.calcAppViewId(t);if(this.view2appMap.has(a)){const t=this.view2appPriorityMap.get(a);if(t&&t<i)return}this.view2appMap.set(a,e),-1!==i&&this.view2appPriorityMap.set(a,i)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppBISchemes(t=[],e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppBISchemes(e,t):[]}async getAppAppBICubes(t,e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppAppBICubes(e,t):[]}async getAppBIReports(t,e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppBIReports(e,t):[]}async getAppView(t){const e=this.calcAppViewId(t),i=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(i,e);return this.registerAppView(t),t}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}getSubAppDrControl(t,e){if(!this.drcontrols.has(e))return;return this.drcontrols.get(e).find((e=>e.uniqueTag===t))}async loadAppView(t,e,i){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,i)}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const i=this.dataEntities.get(e);if(-1===t.indexOf(".")){const e=Array.from(i.values()).find((e=>e.codeName===t));if(e)return e}else if(i.has(t))return i.get(t)}if(this.modelLoaderProvider){let i;return i=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(i,e),i}throw new o(ibiz.i18n.t("runtime.service.noFound",{id:t}))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o(ibiz.i18n.t("runtime.utils.firstregister"));const e=await this.modelLoaderProvider.getApp(t),i=await this.modelLoaderProvider.getSubAppRef(t),a=new Xo(e,i);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Ja(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,i){return(await this.getAppAsync(t)).deService.getService(i,e)}async translationModelToDsl(t,e){if(this.modelLoaderProvider)return this.modelLoaderProvider.translationModelToDsl(t,e)}reset(){this.appMap.clear(),this.configCache=void 0}destroy(){ibiz.hub.getAllApps().forEach((t=>{t.destroy()}))}},El=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:i,engineCat:a}=t,s="".concat(a,"_").concat(i),n=this.viewEngines.get(s);if(n)return n(...e);ibiz.log.error(ibiz.i18n.t("runtime.engine.correspondingEngine",{key:s}),t)}}),vl=t("ViewEngineBase",class{constructor(t){this.view=t,this.enabledDataAccAction=!1,this.init(),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 searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get tabSearchForm(){return this.view.getController("tabsearchform")}get viewLayoutPanel(){return this.view.layoutPanel}init(){}handleContextParams(){this.view.params.srfdataaccaction&&(this.enabledDataAccAction=Ha(this.view.params.srfdataaccaction),delete this.view.params.srfdataaccaction)}async onCreated(){const{childNames:t,modal:e}=this.view;e.hooks.shouldDismiss.tapPromise((async t=>{this.view.state.isLoading&&(t.allowClose=!1)})),t.push("captionbar","toolbar"),this.calcDynamicLayout()}calcDynamicLayout(){const t=this.calcRemoveLayoutModel();ibiz.log.debug(ibiz.i18n.t("runtime.engine.deleteModel",{codeName:this.view.model.codeName,name:t.join(";")})),this.removeLayoutModel(t)}calcRemoveLayoutModel(){const{model:t}=this.view,e=[];!1===t.showCaptionBar&&e.push("view_captionbar");return["lefttoolbar","righttoolbar","footertoolbar"].forEach((i=>{ye(t,i)||e.push(i)})),this.calcViewHeaderVisible()||e.push("view_header"),ibiz.env.isMob?(this.calcViewFooterVisible()||e.push("view_footer"),this.isExistAndInLayout("lefttoolbar")||this.isExistAndInLayout("righttoolbar")||!1!==t.showCaptionBar||e.push("view_toolbar")):ye(t,"toolbar")||e.push("view_toolbar","toolbar"),e}removeLayoutModel(t,e=this.view.model.viewLayoutPanel){if(!e)return;const i=e.rootPanelItems||e.panelItems||[],a=i.findIndex((e=>t.includes(e.id)));-1!==a&&i.splice(a,1),i.forEach((e=>{"CONTAINER"===e.itemType&&this.removeLayoutModel(t,e)}))}async onMounted(){const{model:t,childNames:e}=this.view;ibiz.log.debug(ibiz.i18n.t("runtime.engine.childComponentsMounted",{id:t.id,childName:e.join(";")}))}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData();if("ShortCut"===t)return this.onShortCut(e);if("ToggleFilter"===t)return this.toggleFilter(),null;if("Search"===t){const t=this.searchForm||this.tabSearchForm;return await t.search(),null}if("Reset"===t){const t=this.searchForm||this.tabSearchForm;return await t.reset(),null}}async onShortCut(t){const{data:e}=t,{context:i,model:a,params:s,modal:n}=this.view;if(["EMBED","POPOVER"].includes(n.mode))throw new Error(ibiz.i18n.t("runtime.engine.minimization",{mode:n.mode}));const o=await ibiz.util.shortCut.calcShortCutKey({context:i,appViewId:a.id});if(!ibiz.util.shortCut.isExist(o)){const t=e&&e[0].srfmajortext||a.caption;return ibiz.util.shortCut.addShortCut({key:o,caption:t,icon:a.sysImage,appViewId:a.id,context:d.create(i),params:{...s},openMode:n.mode,fullPath:window.location.hash}),this.view.state.isShortCut=!0,this.view.closeView(),null}return ibiz.util.shortCut.removeShortCut(o),this.view.state.isShortCut=!1,null}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 i=D(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:a}=this.view,s=ye(a,t);let n=!(!i||!s);if("TOOLBAR"===(null==s?void 0:s.controlType)){const t=s.detoolbarItems;n=!!(n&&t&&t.length>0)}return n}calcViewFooterVisible(){let t=!1;return this.isExistAndInLayout("footertoolbar")&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:i,params:a}=this.view;if(!t)throw new o(ibiz.i18n.t("runtime.engine.loadEntityData"));const s=ibiz.hub.getApp(i.srfappid),n=await s.deService.exec(t,"get",i,a,void 0,{srfdataaccaction:this.enabledDataAccAction}),{data:r}=n;r&&(this.enabledDataAccAction&&await this.handleEntityPrivilege(r,this.view.context),this.view.state.srfactiveviewdata=r,Object.prototype.hasOwnProperty.call(r,"srfreadonly")&&(this.view.context.srfreadonly=r.srfreadonly),e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}async handleEntityPrivilege(t,e){const{appDataEntityId:i}=this.view.model;if(!t.srfdataaccaction)return;const a=ibiz.hub.getApp(e.srfappid);(await a.authority.getService(i)).setDataAccAction({srfkey:t.srfkey,srfsessionid:e.srfsessionid},t.srfdataaccaction)}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),Il=(t("MDViewEngine",class extends vl{get xdataControlName(){return this.view.model.xdataControlName}get tabToolbar(){return this.view.getController("tabtoolbar")}get tabSearchBar(){return this.view.getController("tabsearchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar","tabtoolbar","tabsearchform","tabsearchbar"),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,i;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId),null==(i=this.tabToolbar)||i.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=>{var e,i;null==(e=this.toolbar)||e.calcButtonState(void 0,this.xdataControl.model.appDataEntityId),null==(i=this.tabToolbar)||i.calcButtonState(void 0,this.xdataControl.model.appDataEntityId),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 i=!!this.searchForm;e.state.keepAlive=i,e.state.visible=i&&!!t.expandSearchForm}if(this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchForm&&this.tabSearchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchBar&&this.tabSearchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault){const t=this.searchBar||this.tabSearchBar;t&&t.hasDefaultSelect&&("grid"===this.xdataControlName||"treegrid"===this.xdataControlName)?t.setDefaultSelect():this.load()}}handleContextParams(){super.handleContextParams(),this.view.context.srfsimple||(this.view.context.srfsimple=!0)}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"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):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):"GetAllData"===t?this.xdataControl.state.items:super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:s,event:n}=t,o=(t.context||this.view.context).clone();o.srfpaginationviewid=this.view.id;const r=t.params||this.view.params;o[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||Ae(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("opendata",{context:o,params:r,data:s,event:n,view:this.view}));if(-1===c)throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicOpendata"));return{cancel:!c||!c.ok}}async newData(t){var e,a,s;const{data:n,event:o,copyMode:r}=t;if(!(null==(a=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:a.find((t=>"newdata"===t.id))))throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));const c=it(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 i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));return{cancel:!d||!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()),this.tabSearchForm&&Object.assign(t,this.tabSearchForm.getFilterParams()),this.tabSearchBar&&Object.assign(t,this.tabSearchBar.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 i=ye(t,"searchbar");return!(!i.enableQuickSearch&&!i.enableGroup&&!0!==i.enableFilter)}calcRemoveLayoutModel(){const{model:t}=this.view,e=super.calcRemoveLayoutModel();return ye(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),document.title),bl=class{constructor(){this.layoutPanel=new oi,this.theme=new wn,this.text=new bi,this.hbs=new de,this.rawValue=new bn,this.action=Mc,this.error=new Bt,this.viewStack=new Dn,this.anime=new Vo,this.shortCut=new Uo,this.file=new ko,this.biReport=new Bo,this.error.register(new Ut)}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)}setBrowserTitle(t){const e=ibiz.hub.getApp();let i="";i=ibiz.env.AppTitle?ibiz.env.AppTitle:e.model.title?e.model.title:Il,document.title=t?"".concat(i," - ").concat(t):i}getGlobalParam(){throw new o(ibiz.i18n.t("runtime.global.noImplemented"))}getRouterParams(){throw new o(ibiz.i18n.t("runtime.global.noImplementedRouting"))}},Dl=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}destroy(){}},Cl=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const i=this.constructorMap.get(t.logicType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.logicType",{logicType:t.logicType}));return i(t,e)}},Al=class extends Dl{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,i){this.convertScriptArgs=e;const a=this.logic.scriptCode;this.scriptFn=ei.createScriptFn(t,a,i),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Pl=class extends Dl{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return Lc(e,a,t)}},Tl=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 i=this.createTrigger(t);this.triggers.set(t.id,i),i.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()),nt(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((i=>{i.match(t)&&e.push(i)})),e}triggerAndExecute(t,e={}){const i=this.getMatchTriggers(t);if(i.length>0){const t=this.getExecuteParams(e);return i.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,i){const a={itemName:t,triggerType:e},s=this.triggerAndExecute(a,i);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 i=this.triggers.get(t);if(!i)return-1;const a=this.getExecuteParams(e);return i.execute(a)}triggerControlEvent(t,e,i){const a={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(a,i)}},Nl=class extends Tl{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},xl=class extends Tl{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Sl=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const i=this.constructorMap.get(t.triggerType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.trigger.noSupportedType",{triggerType:t.triggerType}));return i(t,e)}},Ll=class{constructor(){this.executorFactory=new Cl,this.triggerFactory=new Sl}createViewScheduler(t){return new xl(t)}createControlScheduler(t){return new Nl(t)}},Ml=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(ibiz.i18n.t("runtime.logicScheduler.trigger.noExecutorBound",{id:this.logic.id}))}destroy(){this.executor=void 0}},Rl=class extends Ml{},Ol=class extends Ml{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.triggerType"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env","view"],(t=>{const{context:e,params:i,data:a,view:s}=t;return{context:e,params:i,data:(null==a?void 0:a[0])||{},env:ibiz.env,view:s}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,i;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(i=this.logic.itemName)?void 0:i.toLowerCase())}execute(t){return!!this.executor.execute(t)}},_l=class extends Ml{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.trigger.timerLacks"));this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.parameterCallback"));const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Fl=class extends Dl{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:a,params:s,...n}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noActionableData"));let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.defaultOpendataViewLogic"));const d=c.refAppViewId;if(!d)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noActuallyReference"));const l=c.navigateContexts||[],h=Object.assign(a,he(l,r[0],s,a));let u={};const p=c.navigateParams;return ct(p)&&(u=he(p,r[0],s,a)),ibiz.commands.execute(Go.TAG,d,h,u,{...n,openMode:c.openMode})}async calcOpenViewRef(t,e){const a=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=a.formTypeAppDEFieldId||a.dataTypeAppDEFieldId;if(!s)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.attributeConfiguration",{codeName:a.codeName}));const{data:n}=e,r=n[0][s];if(!r)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.entityAttributeValues"));const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.editViews",{formTypeValue: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=Ae(c.parentView.model.appDataEntityId),a=t.batchAddAppViews;if(p=null==a?void 0:a.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.selectionView"))}else{if(h)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.noSupportedBatchAddOnly"));if(p=u,!p||!p.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.newdataViewLogic"))}let m={},g={};const f=(null==r?void 0:r[0])||{},y=p.navigateContexts;ct(y)&&(m=he(y,f,n,s)),m=Object.assign(s,m);const w=p.navigateParams;if(ct(w)&&(g=he(w,f,n,s)),n.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&f&&(g[t]=f.srfkey,g.srfcopymode=!0)}g.srfuf=0;const E=await ibiz.commands.execute(Go.TAG,p.refAppViewId,m,g,{...o,openMode:p.openMode});return l&&E.data&&await this.doBatchAdd(t,E.data,s,p,e.view),E}async getWizardNewViewRef(t,e){var a;const{wizardAppView:s,newDataAppViews:n}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.indexEntity"));const l=await ibiz.commands.execute(Go.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(a=l.data)?void 0:a[0];if(!h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.checkOne"));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(ibiz.i18n.t("runtime.logicScheduler.executor.entitiesAssociated",{indexType:u}));return p}async doBatchAdd(t,e,a,s,n){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,a.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new i(c,ibiz.i18n.t("runtime.logicScheduler.executor.relationships"));let h="";if(null==d||d.forEach((t=>{const e=Ae(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.foreignKey",{pickParentDeName: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,i]=e.split(":");t&&i&&(u[t]=i)}}ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.mappingProperties"),u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((i=>{const a=u[i];e[a]=t[i]})),e}));ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.newCreationData"),m);const g=ibiz.hub.getApp(a.srfappid).deService;await g.exec(c.id,"Create",a,m)}}},zl=class extends Ml{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>hi[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Vl=class extends Ml{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>pi[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},kl=class extends Dl{execute(t){if(!this.logic.appDEUIActionId)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.missingTrigger"));Mc.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.urlReg=/^http[s]?:\/\/[^\s]*/,this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Pt.dirname(this.url.pathname)}dir(t){return this.urlReg.test(t)?t:this.url.origin+Pt.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.urlReg.test(t)?t:this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,i)=>{const a=document.createElement("link");a.setAttribute("type","text/css"),a.setAttribute("rel","stylesheet"),a.setAttribute("href",e),a.onload=t,a.onerror=i,document.head.appendChild(a)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,i){this.tag=t,this.repo=e,this.config=i}}),t("en",{runtime:{common:{unrealized:"unrealized"},command:{app:{noFindApplicationFunction:"An app feature called {appFuncId} cannot be found",noFindApplicationFunctionYype:"Unsupported application function type: {appFuncType}",noFindApplicationView:"The application view [{appViewId}] does not exist",unsupportedPopup:"Unsupported view opening modes: POPUP",unsupportedPopupapp:"Unsupported view opening modes: POPUPAPP",missingEvent:"Bubble opening missing event"}},controller:{common:{control:{componentActivation:"Component [{name}] ({id}) is active",componentPause:"Component [{name}] ({id}) is pause",unsupportedType:"Unsupported entity data change type: {type}",uncheckedData:"Unchecked data",dataDeletion:"data deletion",confirmDataDeletion:"Confirm deletion of data?",noImportModel:"No import model is configured!"},md:{rowData:"Row data does not exist",simpleMode:"Simple mode, no saving",dataDeleted:"Data [{str}] deleted successfully!",noChange:"The value has not changed",firstComplete:"Please complete the current line in the line editor first",noMoveDataCconfig:"No move data behavior config",changeGroupError:"Failed to switch the group",computeMoveMetaError:"Error in calculating target position and movement type"},editor:{editorNoConfigured:"Editor type [{editorType}], code table not configured"},view:{viewActivation:"View [{name}] ({id}) is active",viewPause:"View [{name}] ({id}) is pause",viewDestroy:"View [{name}] ({id}) is destroy",noFoundViewEngine:"The View Engine implementation was not found:",noSupportBehavior:"No engine support for pre-built interface behavior {key}"}},control:{menu:{noFindMenu:"Cannot find menu item named {id}",noConfigured:"No application functionality configured"},calendar:{missingViewLogic:"Missing {itemType}_opendata view logic",noFoundModel:"Calendar item model not found"},chart:{noConfiguredX:"Sequence is not configured with X-axis",noConfiguredY:"Sequence is not configured with Y-axis",missingClassification:"Missing classification attribute configuration",missingValue:"Missing value attribute configuration",noSupportSequence:"Charts do not support sequence types at this time {seriesType}",noFindSequence:"Cannot find generator for {seriesIndex} sequence!",noInitialised:"The chart object is not properly initialised",noCalculated:"Options have not been calculated.",classificationNotArray:"The configured classification attribute value is not an array",classificationNotString:"The configured classification attribute value is not an string",errorJson:"JSON parsing error"},dataView:{noBehaviourGroup:"No interface behaviour group is configured for the action",noBehaviourGroupAction:"No interface behaviour is configured for the action item interface behaviour group",propertiesNoConfigured:"Grouping properties are not configured",tableNoConfigured:"The grouping code table is not configured",sortingItems:"Items with sorting enabled must be associated with an entity attribute"},expBar:{unableMore:"Unable to get multiple data widgets [{xdataControlName}] controller",multiNode:"Multi-node views are implemented by subclasses",noFindNodeModel:"Cannot find node model for {nodeId}"},form:{formCompletion:"Please check the form completion!",savedSuccessfully:"{srfmajortext}Saved successfully!",prompt:"prompt",deletion:"Confirm deletion?",itemUpdate:"No {formItemUpdateId} form item update was found.",processStarted:"Process started successfully",processSubmitted:"Process submitted successfully",lackBehavior:"Lack of return operation entity behavior",initializationException:"Initialization Exception: Form member [{id}]({detailType}) already exists, duplicate form item identifier Please check configuration!",relationshipInterface:"Receive data change events from the relationship interface",fillIn:"Please fill in {caption} ",unconfiguredWidgets:"Multi-data widgets unconfigured content widgets",noFoundFormController:"No form controller corresponding to {id} found",multiDataAddData:"Multi-data widget type {contentType} does not support adding data at the moment",mdControllerNoExist:"mdController does not exist",repeaterNoSupported:"Repeater styles are not supported at this time {detailStyle}",searchTerms:"No search terms found to apply",saveSearch:"No saved search criteria found"},gantt:{noNode:"Not entity gantt node data",nonentity:"Non-entity node data cannot be saved",noSupport:"{treeNodeType} node type not supported"},grid:{unsupported:"Unsupported types {type}",attributeColumns:"Attribute columns with no grouping attributes configured",noCodeTable:"The attribute column {groupFieldName} of the grouping attribute does not have a configuration code table",configureFirstColumn:"Please configure the grouping attribute column {groupFieldName} as the first column",requiresCodeTable:"Code table grouping mode requires code table configuration",noMatchCodeTable:"The grouping code table does not match the code table for the attribute column {groupFieldName}",convertedValue:"The sort attribute of {srfmajortext} cannot be converted to a value",missingConfiguration:"Missing configuration of aggregated entities or aggregated datasets",newRows:"New rows are not supported",saveCancel:"Row data validation failed, save cancel",noSupportRowEditing:"The current form does not support row editing, and you cannot toggle on row editing.",lineEditing:"Only one line can be open for line editing at the same time",updateColumns:"No {updateId} edit columns found for update",exported:"No exported data",tabularColumns:"No tabular columns",corresponding:"Corresponding table data item not found [{deField}].",pickedUpData:"The value of {valueItem} is not picked up in the row data.",noSupportedMode:"Attribute column aggregation mode {aggMode} is not supported yet.",remoteAggregation:"Remote aggregation is not supported yet",aggregateMode:"Aggregate mode is not supported yet {aggMode}",formattingError:"{aggValue} value formatting error",checksumErrors:"{codeName}Checksum errors, {fieldName}",behaviorGroup:"The action column does not have an interface behavior group configured",interfaceBehavior:"No interface behavior is configured for the action column interface behavior group"},kanban:{sortingProperties:"Sorting properties are not configured",sortDirection:"Sort direction is not configured",groupedOn:"Kanban components must be grouped on",adjustmentsGroup:"The current Kanban does not allow adjustments to the grouping!",noAllowReorder:"Current Kanban does not allow reordering!"},meditViewPanel:{DraftNew:"Draft - New",dataExist:"Edit View Panel widget UI data does not exist"},panel:{panelData:"Panel data not captured"},reportPanel:{reportType:"Report panel generator factory parameter error, report panel does not specify report type",noImplemented:"Specify the report {reportType} type report panel generator not implemented yet",noReportUIModel:"The report ui model is not configured"},searchBar:{noFoundEntity:"Cannot find the associated entity corresponding to the attribute {targetField}.",missingModel:"Missing editor model",JSONFormat:"{data} non-standard JSON format:"},toolbar:{noFound:"Interface behavior model {actionId} not found"},tree:{noFoundTreeData:"Cannot find corresponding tree node data",sortAttribute:"Missing Configuration Sort Attribute",editMode:"The tree node is not configured for edit mode: name",nodeData:"Not entity tree node data",noFoundTreeNode:"Tree node not found"},treeGrid:{columnsSchema:"TreeTable Unvalued Columns Schema",columnMode:"Tree table without parent column mode"},treeGridEx:{noConfigured:"The node is not configured with a data item that corresponds to the table column {name}",editItem:"Edit item model corresponding to table column {name} was not found",noPickedUp:"The value of {valueItem} is not picked up in the row data.",behaviorGroup:"The {id} action column does not have an interface behavior group configured.",noSupportCreation:"Does not support the creation of new",updateBehavior:"Tree nodes are not configured to update entity behavior"},wizardPanel:{wizardForm:"Cannot find the wizard form for {activeFormTag}.",formController:"Cannot find a form controller for {activeFormTag}.",noConfiguration:"There is no Configuration Wizard form collection",wizardFormIdentifier:"Cannot find the wizard form with the {tag} identifier.",noPreviousForm:"No previous form",nextStep:"Cannot find next wizard step",nextForm:"Cannot find the next wizard form"}},utils:{buttonState:{isFinitenconsistency:"Inconsistency between entity {appDeName} of {uiActionId} interface behavior and entity {appDeId} of data"},counter:{decrement:"Decrement cannot be called for a count of 0!"},dataFileUtil:{startImport:"Start importing. Please refer to the application notification for detailed progress and results",noExist:"ibiz.util.getExportExcel does not exist",loadError:"Export module loading error",importData:"No corresponding import data model was found"},valueDefault:{noExist:"appdata.context does not exist",nosupported:"Default value type [{valueType}] not supported"},valueEx:{objectNameField:"Missing objectNameField"},valueRule:{length:"The length of the content must be less than or equal to {maxLength}, the current length is {length}."},viewMsg:{message:"Cannot find model for view message group {msgGroupId}",noFound:"No {message} view message model found",unconfigured:"Unconfigured entity dataset",unconfiguredEntities:"Application entities not configured"}}},deLogic:{deLogicLink:{connectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",entityConnectionConditional:"Entity Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",missingConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataMissingConditionValue:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",noSupportedTime:"Conditional value type [current time] is not supported at this time",entityLogicalConnection:"Entity Logical Connection Condition Item: {name} - Condition Value Type: {type} - Source Attribute Name: {dstField} - Source Object Value:",comparisonCondition:"-comparison condition: {op}",comparisonValue:"-comparison value",compareResults:"-Compare and contrast results:"},deLogicNode:{missingTargetParameter:"Missing target parameter object or source parameter object configuration",additionalParameter:"Entity logic node (appended to the array): {id} - additional parameter:",addedValue:"-Added value:",logicNodeParameterName:"Entity Logic Node (Binding Parameters): {id} - Parameter Name: {dstDELogicParamId} - Value:",copyParameter:"Entity logic node (copy parameter): {id} - parameter name: {dstDELogicParamId} - value:",dataSet:"Entity Logic Node (Data Set): {id} - Dataset Entity Id: {dstAppDataEntityId} - Dataset Id: {dstAppDEDataSetId} - Parameter Name: {retDELogicParamId} - Value:",unspecifiedEntity:"Unspecified application entity",unspecifiedBehavior:"Behavior of unspecified entities",entityActions:"Entity Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDELogicParamId} - Value:",unsupportedReturnType:"Unsupported end node return type: {returnType}",endNode:"Entity logic node (end node): {id} - return value type: {returnType} - return value:",noSupportedLogic:"Logic handling of parameter actions {paramAction} is not supported at this time.",preparationParameter:"Entity Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDELogicParamId} - Source Parameter (value):",targetParameter:"-Target parameter (value):",missingConfiguration:"Missing target parameter object configuration",rebuildParameter:"Entity Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDELogicParamId}",resetParameter:"Entity logic node (reset parameter): {id} - reset parameter: {dstDELogicParamId}",missingParameterProperty:"Missing target parameter object or target property configuration",sortedArrayParameters:"Entity Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDELogicParamId} - Sorted Array:",startupNode:"Entity logical node (startup node): {id}",throwsException:"Entity Logic Node (throws exception): {id} - Error Code: {errorCode} - Error Message: {errorInfo}",environmentVariables:"Unsupported logical parameter types: system environment variables",fileObjectListVariable:"Unsupported logical parameter type: file object list variable",fileObjectVariables:"Unsupported logical parameter types: file object variables",filterObjectVariables:"Unsupported logical parameter types: filter object variables",finalDataVariables:"Unsupported logical parameter types: final data variables",rawDataObjects:"Unsupported logical parameter types: Raw Data Objects",operationSessionVariables:"Unsupported Logical Parameter Types: Operation Session Variables",calculateEntity:"Calculated entity logic parameter, identifier: {tag}",value:"-value:",recreatingVariables:"Unsupported logical parameter types recreating variables",reEstablish:"Re-establish the entity logic parameter, identifier: {tag}",expressionEmpty:"Expression is empty",sourceValueType:"The source value type {srcValueType} is not supported yet.",fetchingAttribute:"Fetching the attribute {srcField} from the source parameter reports an error, source parameter:",noScriptCode:"Script code mode has no script code configured",noConfigurationLogicNode:"The entity logic does not have a configuration logic node",unsupportedLogical:"Unsupported logical node types: {logicNodeType}",noSetStartNode:"No start node set",startExecuting:"Start executing entity logic, logic identifier: {id} - logic name: {name}",endExecution:"End execution entity logic, logic identifier: {id} - logic name: {name}",noFoundEntityLogic:"{dataEntityId} entity logic not found {deDELogicId}"}},engine:{correspondingEngine:"There is no {key} corresponding engine",logicOpendata:"Missing view logic for opendata",logicNewdata:"Missing view logic for newdata",deleteModel:"{codeName} Delete model: {name}",childComponentsMounted:"The child components of {id}: {childName} are mounted.",minimization:"The current view is opened in [{mode}], minimization is not supported!",loadEntityData:"The view has no entities and cannot load entity data"},global:{noImplemented:"Getting application global variables is not implemented",noImplementedRouting:"Getting view routing parameter variables is not implemented"},hub:{failedParse:"View parameter modalOption failed to parse: {error}",noExist:"View [{id}] does not exist"},logicScheduler:{executor:{noConfiguredLogic:"No entity interface logic is configured",missingTrigger:"Missing trigger application entity interface behavior id in logic",noActionableData:"There is no actionable data for opendata!",defaultOpendataViewLogic:"opendata view logic is not configured to open the view by default",noActuallyReference:"The default open view for opendata view logic does not actually reference the view",attributeConfiguration:"{codeName}[Multiple Form Entity] or [Index Entity] missing type attribute configuration",entityAttributeValues:"Data Source No Form Type Applied Entity Attribute Values",editViews:"No edit views were found for the entity associated with the form type {formTypeValue}.",selectionView:"Selection view that needs to be opened for batch add was not found",noSupportedBatchAddOnly:"batchAddOnly is not supported yet.",newdataViewLogic:"The newdata view logic is not configured to default to a new data view",indexEntity:"Missing Default Index Entity Selection View",checkOne:"Please check one piece of data",entitiesAssociated:"No edit view found for entities associated with index type {indexType}",relationships:"Entities do not have a collection of relationships from!",foreignKey:"No foreign key attribute found for {pickParentDeName} in the current entity",mappingProperties:"Batch New Conversion Mapping Properties",newCreationData:"Batch new creation data",logicType:"Logic type {logicType} Not supported yet!",noImplementedMethod:"Method not implemented."},trigger:{triggerType:"The trigger type for the predefined logical type {type} can only be a script",noSupportedType:"Trigger type {triggerType} Not supported yet!",noExecutorBound:"{id} No executor bound.",timerLacks:"Timer lacks timing intervals",parameterCallback:"Timer missing default parameter callback"}},model:{utils:{noFoundApplication:"Application not found",unconfiguredPlugins:"Apply unconfigured plug-ins",noFound:"Plugin not found {id}"},view:{engineClassifications:"Unsupported engine classifications: {engineType}"}},platform:{failedDownload:"Failed to download file",fileStreamData:"File stream data does not exist"},register:{helper:{adapter:"Cannot find the adapter corresponding to the system counter plugin {pluginKey}.",customizedSystemAdapter:"Cannot find the adapter corresponding to the customized system counter {codeName}.",noFoundSystemCounter:"Adapter for system counter type {counterType} is not found.",applicationMenu:"Cannot find the adapter corresponding to the application menu item plugin {pluginKey}.",asynchronousAction:"Find the adapter that does not correspond to the asynchronous action type {actiontype}.",matchedPlugin:"Not matched to plugin [{pluginId}] model",customRegistration:"Cannot find an adapter with a custom registration ID of [{registerKey}].",widgetPlugin:"Cannot find the adapter corresponding to the widget plugin {pluginKey}.",widgetStyleType:"Cannot find the adapter corresponding to the widget style: [{controlStyle}] for the widget type: [{controlType}].",widgetType:"Cannot find an adapter for widget type {controlType}.",entityBehaviorPlugin:"Cannot find the adapter corresponding to the entity behavior plugin {pluginKey}.",entityBehaviorMethod:"Find adapters that donnot have an entity behavior method type of {methodType}",editorPlugin:"Cannot find the adapter corresponding to the editor plugin {pluginKey}.",editorStyleType:"Cannot find the adapter corresponding to editor style: [{editorStyle}] for editor type: [{editorType}].",editorTypePredefinedType:"Cannot find an adapter corresponding to editorType: [{editorType}] for predefinedType: [{predefinedType}].",editorType:"Cannot find the adapter corresponding to editor type {editorType}.",formMemberPlugin:"Cannot find the adapter corresponding to the form member plugin {pluginKey}.",formMemberType:"Cannot find an adapter for form member type {detailType}.",tableColumnPlugin:"Cannot find the adapter corresponding to the table column plugin {pluginKey}.",tableColumnType:"Cannot find an adapter for table column type {key}.",messageType:"Cannot find the adapter corresponding to the message type {content_type}.",panelMemberPlugin:"The adapter corresponding to the panel member plugin {pluginKey} could not be found.",panelContainerPredefined:"Cannot find an adapter with panel container predefined type {predefinedType}, registered key {key}",panelMemberDirectContent:"Cannot find adapter with panel member direct content predefined type {predefinedType}, registered key {key}",panelMemberType:"The adapter corresponding to the panel member type {itemType} could not be found.",portalWidgetPlugin:"Cannot find the adapter corresponding to the portal widget plugin {pluginKey}.",portalWidgetMemberType:"Adapter corresponding to portal widget member type {portletType} not found",treeTableColumnPlugin:"Cannot find the adapter corresponding to the tree table column plugin {pluginKey}.",interfaceBehaviorPlugin:"Cannot find the adapter corresponding to the interface behavior plugin {pluginKey}.",interfaceBehaviorMode:"Find the adapter that does not correspond to the interface behavior mode {uiactionMode}.",frontEndPluginNode:"Cannot find interface logic front-end plugin node, plugin {pluginKey} corresponding adapter",viewPlugin:"Cannot find the adapter corresponding to the view plugin {pluginKey}.",correspondViewTypeStyle:"Cannot find an adapter for view type: [{viewType}] corresponding to view style: [{viewStyle}].",toolbarItem:"Cannot find the adapter corresponding to the toolbar item plugin {pluginKey}.",acItem:"Cannot find the adapter corresponding to the ac item plugin {pluginKey}."}},service:{noConfiguredPrimary:"Entity [{codeName}] is not configured with a primary key field",noConfiguredField:"Entity [{codeName}] is not configured with a primary text field",convertedNumber:"{value} cannot be converted to a number.",subRelationships:"Sub-relationships not configured with a nested relational dataset will result in a recursive query death loop, please configure it!",unsupportedMethod:"Unsupported application entity method input attribute type: {type}",noFoundUsernamePassword:"Anonymous login configuration username or password not found",loginFailure:"Login Failure",logoutFailure:"Logout failure",noFound:"Application entity not found [{id}]",mainState:"{codeName} entity does not exist, the main state is not enabled, or the main state collection is empty, return true",operationIdentifier:"Operation identifier {dataAccessAction} main state calculation started",matchMasterState:"Match master state",masterStatePermissions:"Collection of allowed master state permissions",noMatchedState:"Returns false if the main state is not matched.",permissionCalculation:"Operation identifier {dataAccessAction} end of permission calculation: {result}",noFindCodeList:"Cannot find {tag} code list",noConfiguredCounters:"Application counters not configured!",lackEntityLogic:"Lack of entity handling logic",createBehavior:"The create behavior does not pass data",updateBehavior:"The update behavior does not pass data",deletionDeletion:"Currently, only [DER1N] relationship type association deletion deletion is supported.",unableDelete:"Unable to delete [{logicName}-{srfmajortext}], data referenced by [{modelLogicName}-{msg}].",noSupportedDataSource:"Data source type {dataSetType} not supported yet",sourceCodeTable:"No data is specified for the source code table",requestMethods:"Unsupported request methods: {requestMethod}",noConfiguredRequestMethod:"Request method not configured",unsupportedBehaviorTypes:"Unsupported Behavior Types [{actionType}]",noFoundServiceMethod:"Service method not found: {id}",UnsupportedServiceMethod:"Unsupported service method types: {methodType}",noSupportedMethod:"The 「{id}」 method is not supported by {codeName}.",noFoundStorageEntity:"Application function [{name}] storage entity not found [{stoageAppDataEntityId}]",noExist:"Application function [{name}] does not exist",noFoundEntity:"Storage Entity Not Found [{stoageAppDataEntityId}]",noImplemented:"「{methodName}」 is not implemented.",noImplementedCounter:"Counter loading method not implemented",noFoundCounterBehavior:"Get counter behavior not found!",createPrimaryKeyData:"Failed to create new joint primary key data with existing primary key {srfkey}",updatePrimaryKeyData:"Failed to update joint primary key data with existing primary key {srfkey}",noExistNoUpdated:"Data does not exist and cannot be updated!",dataNoExistNoUpdated:"Data [{srfdename}-{srfmajortext}({srfkey})] does not exist and cannot be updated!",noDeleted:"The following data 「{notRemoveKey}」 was not found and could not be deleted!",noAttributeName:"No attribute name is specified",noContextParameterName:"No context parameter name is specified",conditionalObjects:"Unrecognizable Conditional Objects",mustArray:"The value must be an array",unsupportedQueryTypes:"Unsupported query types: {condType}",predefinedType:"Predefined type {predefinedType} is not supported at this time.",dynamicCodeTable:"The return value of a dynamic code table data property is not an object-formatted string and cannot be converted!",unconfiguredDataset:"Unconfigured dataset",processedWithout:"Execution of 「{funcName}」 cannot be processed without 「srfkey」.",noExistProcessed:"Execution of 「{funcName}」 does not exist and 「srfsessionid」 cannot be processed.",missingDetreeColumnId:"Model exception missing detreeColumnId or dataItemName."},uiAction:{noEntityOrBehavior:"No entity or entity behavior configured",noConfiguredopenView:"Not configured to open the view",frontProcessingModes:"Unsupported front processing modes [{frontProcessType}]",missingConfigurationScriptCode:"Custom types are missing configuration script code",dataPrimaryKey:"Data primary key not found",printFailure:"print failure",physicalPrint:"No physical print items found",exportRequestFailed:"Export request failed",noEntityExportsFound:"No entity exports found",lackNativeEvent:"Lack of native JS event objects",wantLogout:"Are you sure you want to log out?",logout:"Logout",operationConfirmation:"Operation Confirmation",viewParameterModalOption:"View parameter modalOption failed to parse: {error}",withdrawalConfirmed:"Is the execution of the withdrawal confirmed?",noFoundBehaviorModel:"No interface behavior model found for {actionId}."},uiLogic:{interfaceConnectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",connectionConditionGroup:"Interface Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",currentConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataObjectAttribute:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",currentTime:"Conditional value type [current time] is not supported at this time",interfaceConnectionConditionalTypeName:"Interface Logic Connection Condition Item: {name} - Condition Value Type: {type} - Source Property Name: {dstField} - Source Object Value:",asynchronousTermination:"Unsupported logical connection type: asynchronous termination",asynchronousRejection:"Unsupported logical connection type: asynchronous rejection",exceptionHandling:"Unsupported Logical Connection Type: Exception Handling",logicalLinkTypes:"Unsupported logical link types:{linkMode}",missingTargetParameter:"Missing target parameter object or source parameter object configuration",appendedArray:"Interface logic node (appended to the array): {id} - additional parameter:",bindingParameters:"Interface Logic Node (Binding Parameters): {id} - Parameter Name: {dstDEUILogicParamId} - Value:",copyParameter:"Interface logic node (copy parameter): {id} - parameter name: {dstDEUILogicParamId} - value:",missingfilter:"Missing configuration filter parameters",interfaceLogicNodeDataSet:"Interface Logic Node (Data Set): {id} - Dataset Entity Identifier: {dstAppDataEntityId} - Dataset Identifier: {dstAppDEDataSetId} - Parameter Name: {retDEUILogicParamId} - Value:",interfaceLogicNodeEntityActions:"Interface Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDEUILogicParamId} - Value:",noConfiguredInterfaceBehavior:"Interface behavior not configured",interfaceLogicNodeEntityInterfaceAction:"Interface Logic Node (Entity Interface Action): {id} - Interface Action Identifier: {dstAppDEUIActionId} - Entity to which the Interface Action belongs: {dstAppDataEntityId} - Target Logic Parameter Object: {dstDEUILogicParamId}",logicalNodeOperation:"Logical node {name} operation parameter value:",unsupportedEndNode:"Unsupported end node return value types: {returnType}",interfaceLogicNodeEndNode:"Interface logic node (end node): {id} - return value type: {returnType} - return value:",noEntityConfigured:"No entity configured",noEntityLogicConfigured:"No entity logic configured",noIncomingLogic:"No incoming logic parameters are configured",passedParameter:"Passed parameter {dstDEUILogicParamId} not found",interfaceLogicNodeExecutingEntityLogic:"Interface logic node (executing entity logic): {id} - entity logic identifier: {dstAppDELogicId} - entity to which the entity logic belongs: {dstAppDataEntityId} - parameter name: {retDEUILogicParamId} - value:",missingMessageTypeConfiguration:"Missing message type configuration",missingButtonTypeConfiguration:"Missing button type configuration",interfaceLogicNodeMessagePopup:"Interface logic node (message popup): {id} - message type: {type} - message: {message}",message:"messages",yes:"yes",no:"no",determine:"Determine",cancel:"Cancel",noSupportItem:"{name} is currently not supported",interfaceLogicNodeFrontendPlugin:"Interface Logic Node (Frontend Plugin): {id} - Plugin Id: {sysPFPluginId}",interfaceLogicNodePreparationParameter:"Interface Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDEUILogicParamId} - Source Parameter (value):",noTargetParameter:"No target parameter object id",targetParameter:"Assigning a value to the target parameter attribute {dstFieldName} reports an error, target parameter:",interfaceLogicNodeDirectCode:"Interface logic node (direct code): {id}-direct code:",interfaceLogicNodeRebuildParameter:"Interface Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"Interface Logic Node (Reset Parameter): {id} - Reset Parameter: {dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"Interface Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDEUILogicParamId} - Sorted Array:",interfaceLogicNodeStartupNode:"Interface logic node (startup node): {id}",interfaceLogicNodeThrowingExceptions:"Interface Logic node (throwing exceptions): {id} - error message: {errorInfo}",noConfiguredTriggerObject:"No trigger object is configured",noConfiguredEvent:"The event name parameter is not configured",noConfiguredEventParameters:"No event parameters are configured",noFoundTriggerObject:"Trigger object not found {fireCtrlId}",noFoundEventParameterObject:"Event parameter object not found {eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"Interface logic node (view widget event trigger logic): {id} - name of the calling view widget: {fireCtrlId} - name of the triggering event: {eventName} - triggering parameters:",noConfiguredInterfaceObject:"No interface object is configured",noConfiguredOperatingParameters:"No operating parameters are configured",noConfiguredCallMethod:"No call method is configured",noFoundOperationParameter:"The operation parameter {invokeParamId} was not found.",noFoundInterfaceObject:"Interface object {invokeCtrlId} was not found.",noFoundInvokeMethod:"The invoke method {invokeMethod} was not found.",interfaceLogicNodeViewWidgetInvocation:"Interface logic node (view widget invocation): {id} - name of the invoking view widget: {invokeCtrlId} - name of the invoking method: {invokeMethod} - trigger parameter:",viewLogicInitializationParameter:"View logic initialization parameter, {codeName} specified widget object not found",calculateInterfaceLogicParameters:"Calculate interface logic parameters, identifier: {tag}",restablishInterfaceLogic:"Re-establish the interface logic parameters, identifying: {tag}",interfaceLogic:"Interface logic {deUILogicId} for entity {appDataEntityId} not found",startExecutingInterfaceLogic:"Start executing the interface logic, entity: {appDataEntityId} - logic name: {name}",endExecutionInterfaceLogic:"End execution interface logic, entity: {appDataEntityId} - logic name: {name}",noLogicalNodesConfigured:"The interface logic has no logical nodes configured"},utils:{anime:{noExistEndpointElement:"The endpoint element does not exist",noExistAnimationElement:"Animation element does not exist",noClone:"Cannot clone a null or undefined element."},errorHandler:{noPermissionless:"No permissionless error handler registered",noProcessor:"No processor was found that can handle this error"},fileUtil:{fileUploadFailed:"File upload failed"},handlebars:{noInitHandlebars:"handlebars not init"},modal:{externalClosureCapability:"External closure capability not registered",shouldDismissResult:"The result of shouldDismiss is false, closing the interrupt."},openRedirectView:{parseSrfnavctxParameter:"Failed to parse srfnavctx parameter in redirection [{urlStr}].",missingEntityName:"Entity name missing from redirection parameter",noFoundSpecifiedEntity:"CodeName not found for the specified entity: {deName}",unsupportedLinkUrl:"Unsupported linkUrl format: {linkUrl}",noConfiguredActualReference:"Actual reference view not configured",redirectingViewReferences:"Redirecting view references there:",redirectionIdentifier:"Redirection identifier [{rdTag}] or [{deRdTag}] or workflow [{wfRdTag}] corresponding to view not found",noMatchActualReferenceView:"Identifies that [{rdTag}] did not match the actual reference view",redirectionView:"Redirection view [{name}] custom category attribute [{typeFieldId}] value is null"},script:{errorReportingScript:"Error Reporting Script"},shortCut:{invalidIndexNewIndex:"Invalid index newIndex: {newIndex}, oldIndex: {oldIndex}, current array length {length}"},uiDomain:{transactionOpen:"Transaction has been opened, only one transaction can be opened for a single interface domain.",currentTransaction:"The current transaction has not been committed and cannot be closed directly."},uiDomainManager:{invalidInterfaceDomain:"Invalid interface domain identifier [{id}]"},verify:{contentConform:"Content must conform to value rules",scopeRules:"Content length must conform to scope rules",valueNull:"The value is null",regularRules:"The value must conform to the regular rules",rangeRules:"Values must conform to the value range rules",scriptRules:"The value must conform to the script rules",emptyLogicGroups:"Empty logic groups were found and the logic could not be executed properly!",unsupportedLogicTypes:"Unsupported logic types {logicType}",emptyLogicGroupsProperly:"Empty logic groups were found and the logic could not be executed properly!",valueOperations:"Value operations: {op}, not yet supported",noCompared:"{value} and {value2} cannot be compared.",conditionalValues:"Conditional values for range comparisons do not exist or are not strings"},firstregister:"Please register the model loading adapter first"},deAction:{responseDataError:"Response data exception [data]: {error}"}}}),t("zhCn",{runtime:{common:{unrealized:"未实现"},command:{app:{noFindApplicationFunction:"找不到叫{appFuncId}的应用功能",noFindApplicationFunctionYype:"未支持的应用功能类型:{appFuncType}",noFindApplicationView:"应用视图[{appViewId}]不存在",unsupportedPopup:"未支持的视图打开模式: POPUP",unsupportedPopupapp:"未支持的视图打开模式: POPUPAPP",missingEvent:"气泡打开缺少event"}},controller:{common:{control:{componentActivation:"部件[{name}]({id})激活",componentPause:"部件[{name}]({id})暂停",unsupportedType:"不支持的实体数据变更类型: {type}",uncheckedData:"未选中数据",dataDeletion:"数据删除",confirmDataDeletion:"确认删除数据?",noImportModel:"没有配置导入模型!"},md:{rowData:"行数据不存在",simpleMode:"简单模式,不保存",dataDeleted:"数据[{str}]删除成功!",noChange:"值没有发生改变",firstComplete:"请先完成当前行编辑中的行的操作",noMoveDataCconfig:"无移动数据行为配置",changeGroupError:"切换分组失败",computeMoveMetaError:"计算目标位置和移动类型发生错误"},editor:{editorNoConfigured:"编辑器类型[{editorType}],未配置代码表"},view:{viewActivation:"视图[{name}]({id})激活",viewPause:"视图[{name}]({id})暂停",viewDestroy:"视图[{name}]({id})销毁",noFoundViewEngine:"未找到视图引擎实现:",noSupportBehavior:"没有引擎支持预置界面行为{key}"}},control:{menu:{noFindMenu:"找不到名为{id}的菜单项",noConfigured:"没有配置应用功能"},calendar:{missingViewLogic:"缺少{itemType}_opendata的视图逻辑",noFoundModel:"未找到日历项模型"},chart:{noConfiguredX:"序列没有配置X坐标轴",noConfiguredY:"序列没有配置Y坐标轴",missingClassification:"缺少分类属性配置",missingValue:"缺少值属性配置",noSupportSequence:"图表暂未支持序列类型{seriesType}",noFindSequence:"找不到{seriesIndex}序列的generator!",noInitialised:"chart对象没有正确初始化",noCalculated:"options还没计算",classificationNotArray:"配置的分类属性值不是一个数组",classificationNotString:"配置的分类属性值不是一个字符串",errorJson:"JSON解析错误"},dataView:{noBehaviourGroup:"操作项没有配置界面行为组",noBehaviourGroupAction:"操作项界面行为组没有配置界面行为",propertiesNoConfigured:"分组属性没有配置",tableNoConfigured:"分组代码表没有配置",sortingItems:"启用排序的项必须关联实体属性"},expBar:{unableMore:"无法获取多数据部件[{xdataControlName}]控制器",multiNode:"多节点视图由子类实现",noFindNodeModel:"找不到{nodeId}的节点模型"},form:{formCompletion:"请检查表单填写!",savedSuccessfully:"{srfmajortext}保存成功",prompt:"提示",deletion:"确认删除吗?",itemUpdate:"没找到{formItemUpdateId}表单项更新",processStarted:"流程启动成功",processSubmitted:"流程提交成功",lackBehavior:"缺少返回操作实体行为",initializationException:"初始化异常: 表单成员[{id}]({detailType})已存在,表单项标识重复请检查配置",relationshipInterface:"接收到关系界面的数据变更事件",fillIn:"请填写{caption}",unconfiguredWidgets:"多数据部件未配置内容部件",noFoundFormController:"没有找到对应{id}的表单控制器",multiDataAddData:"多数据部件类型{contentType}暂不支持添加数据",mdControllerNoExist:"mdController不存在",repeaterNoSupported:"暂不支持重复器样式{detailStyle}",searchTerms:"没有找到可以应用的搜索条件",saveSearch:"没有找到保存的搜索条件"},gantt:{noNode:"不是实体甘特节点数据",nonentity:"非实体节点数据不能保存",noSupport:"{treeNodeType}节点类型未支持"},grid:{unsupported:"未支持的类型{type}",attributeColumns:"没有配置分组属性的属性列",noCodeTable:"分组属性的属性列{groupFieldName}没有配置代码表",configureFirstColumn:"请将分组属性列{groupFieldName}配置为第一列",requiresCodeTable:"代码表分组模式需要配置代码表",noMatchCodeTable:"分组代码表与属性列{groupFieldName}的代码表不一致",convertedValue:"{srfmajortext}的排序属性无法转换成数值",missingConfiguration:"缺少配置聚合实体或聚合数据集",newRows:"不支持新建行",saveCancel:"行数据校验不通过,保存取消",noSupportRowEditing:"当前表格不支持行编辑,无法切换开启行编辑",lineEditing:"同时只能有一行开启行编辑",updateColumns:"没找到{updateId}编辑列更新",exported:"无导出数据",tabularColumns:"无表格列",corresponding:"未找到对应的表格数据项[{deField}]",pickedUpData:"未在行数据中取到 {valueItem} 的值",noSupportedMode:"暂未支持属性列聚合模式{aggMode}",remoteAggregation:"远程聚合暂未支持",aggregateMode:"暂未支持聚合模式{aggMode}",formattingError:"{aggValue} 值格式化错误",checksumErrors:"{codeName}校验报错,{fieldName}",behaviorGroup:"操作列没有配置界面行为组",interfaceBehavior:"操作列界面行为组没有配置界面行为"},kanban:{sortingProperties:"排序属性没配置",sortDirection:"排序方向没配置",groupedOn:"看板部件必须开启分组",adjustmentsGroup:"当前看板不允许调整分组!",noAllowReorder:"当前看板不允许调整次序!"},meditViewPanel:{DraftNew:"草稿--新建",dataExist:"编辑视图面板部件UI数据不存在"},panel:{panelData:"未获取到面板数据"},reportPanel:{reportType:"报表面板生成器工厂参数错误,报表面板未指定报表类型",noImplemented:"指定报表{reportType}类型报表面板生成器暂未实现",noReportUIModel:"未配置指定报表界面模型"},searchBar:{noFoundEntity:"找不到属性{targetField}对应的关联实体",missingModel:"缺少编辑器模型",JSONFormat:"{data}非标准JSON格式:"},toolbar:{noFound:"没有找到界面行为模型{actionId}"},tree:{noFoundTreeData:"找不到对应的树节点数据",sortAttribute:"缺少配置排序属性",editMode:"树节点没有配置编辑模式:名称",nodeData:"不是实体树节点数据",noFoundTreeNode:"未找到树节点"},treeGrid:{columnsSchema:"树表格无值列模式",columnMode:"树表格无父值列模式"},treeGridEx:{noConfigured:"节点没有配置对应表格列{name}的数据项",editItem:"没有找到对应表格列{name}的编辑项模型",noPickedUp:"未在行数据中取到 {valueItem} 的值",behaviorGroup:"{id}操作列没有配置界面行为组",noSupportCreation:"暂不支持新建",updateBehavior:"树节点没有配置更新实体行为"},wizardPanel:{wizardForm:"找不到{activeFormTag}的向导表单",formController:"找不到{activeFormTag}的表单控制器",noConfiguration:"没有配置向导表单集合",wizardFormIdentifier:"找不到标识为{tag}的向导表单",noPreviousForm:"没有上一个表单",nextStep:"找不到下一个向导步骤",nextForm:"找不到下一个向导表单"}},utils:{buttonState:{isFinitenconsistency:"{uiActionId}界面行为的实体{appDeName}和数据的实体{appDeId}不一致"},counter:{decrement:"错误的调用!decrement不能对count为0调用"},dataFileUtil:{startImport:"开始导入,详细进度和结果请看应用通知",noExist:"ibiz.util.getExportExcel不存在",loadError:"导出模块加载错误",importData:"没有找到对应的导入数据模型"},valueDefault:{noExist:"appdata.context不存在",nosupported:"默认值类型[{valueType}]未支持"},valueEx:{objectNameField:"缺少objectNameField"},valueRule:{length:"内容长度必须小于等于{maxLength},当前长度为{length}"},viewMsg:{message:"找不到视图消息组{msgGroupId}的模型",noFound:"没有找到{message}视图消息模型",unconfigured:"未配置实体数据集",unconfiguredEntities:"未配置应用实体"}}},deLogic:{deLogicLink:{connectionConditional:"界面连接条件逻辑组未配置逻辑项",entityConnectionConditional:"实体逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",missingConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataMissingConditionValue:"当前条件值类型为[源数据对象属性],缺少配置条件值",noSupportedTime:"暂未支持条件值类型为[当前时间]",entityLogicalConnection:"实体逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",comparisonCondition:"-对比条件:{op}",comparisonValue:"-对比值:",compareResults:"-对比结果:"},deLogicNode:{missingTargetParameter:"缺少目标参数对象或者源参数对象配置",additionalParameter:"实体逻辑节点(附加到数组):{id}-附加参数:",addedValue:"-附加值:",logicNodeParameterName:"实体逻辑节点(绑定参数):{id}-参数名称:{dstDELogicParamId}-值:",copyParameter:"实体逻辑节点(拷贝参数):{id}-参数名称:{dstDELogicParamId}-值:",dataSet:"实体逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDELogicParamId}-值:",unspecifiedEntity:"未指定应用实体",unspecifiedBehavior:"未指定实体行为",entityActions:"实体逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDELogicParamId}-值:",unsupportedReturnType:"暂未支持的结束节点返回值类型: {returnType}",endNode:"实体逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noSupportedLogic:"暂未支持逻辑处理参数操作{paramAction}",preparationParameter:"实体逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDELogicParamId}-源参数(值):",targetParameter:"-目标参数(值):",missingConfiguration:"缺少目标参数对象配置",rebuildParameter:"实体逻辑节点(重新建立参数):{id}-重建参数:{dstDELogicParamId}",resetParameter:"实体逻辑节点(重置参数):{id}-重置参数:{dstDELogicParamId}",missingParameterProperty:"缺少目标参数对象或目标属性配置",sortedArrayParameters:"实体逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDELogicParamId}-排序后数组:",startupNode:"实体逻辑节点(启动节点):{id}",throwsException:"实体逻辑节点(抛出异常):{id}-错误代码:{errorCode}-错误信息:{errorInfo}",environmentVariables:"未支持的逻辑参数类型: 系统环境变量",fileObjectListVariable:"未支持的逻辑参数类型: 文件对象列表变量",fileObjectVariables:"未支持的逻辑参数类型: 文件对象变量",filterObjectVariables:"未支持的逻辑参数类型: 过滤器对象变量",finalDataVariables:"未支持的逻辑参数类型: 最后数据变量",rawDataObjects:"未支持的逻辑参数类型: 原始数据对象",operationSessionVariables:"未支持的逻辑参数类型: 操作会话变量",calculateEntity:"计算实体逻辑参数,标识:{tag}",value:"-值:",recreatingVariables:"未支持的逻辑参数类型重新建立变量",reEstablish:"重新建立实体逻辑参数,标识:{tag}",expressionEmpty:"表达式为空",sourceValueType:"暂未支持源值类型{srcValueType}",fetchingAttribute:"从源参数取属性{srcField}报错,源参数:",noScriptCode:"脚本代码模式没有配置脚本代码",noConfigurationLogicNode:"实体逻辑没有配置逻辑节点",unsupportedLogical:"未支持的逻辑节点类型: {logicNodeType}",noSetStartNode:"未设置起始节点",startExecuting:"开始执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",endExecution:"结束执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",noFoundEntityLogic:"{dataEntityId}找不到实体逻辑{deDELogicId}"}},engine:{correspondingEngine:"没有{key}对应的引擎",logicOpendata:"缺少opendata的视图逻辑",logicNewdata:"缺少newdata的视图逻辑",deleteModel:"{codeName}删除模型:{name}",childComponentsMounted:"{id}的子组件:{childName}都已mounted",minimization:"当前视图打开方式为 [{mode}], 不支持最小化!",loadEntityData:"该视图没有实体,无法加载实体数据"},global:{noImplemented:"获取应用全局变量没有实现"},hub:{failedParse:"视图参数modalOption 解析失败:{error}",noExist:"视图[{id}]不存在"},logicScheduler:{executor:{noConfiguredLogic:"没有配置实体界面逻辑",missingTrigger:"逻辑中缺少触发应用实体界面行为id",noActionableData:"opendata没有可操作数据!",defaultOpendataViewLogic:"opendata视图逻辑没有配置默认打开视图",noActuallyReference:"opendata视图逻辑的默认打开视图没有实际引用视图",attributeConfiguration:"{codeName}[多表单实体] or [索引实体]缺少类型属性配置",entityAttributeValues:"数据源无表单类型应用实体属性值",editViews:"没有找到与表单类型{formTypeValue}相关的实体的编辑视图",selectionView:"没有找到批添加需要打开的选择视图",noSupportedBatchAddOnly:"batchAddOnly暂未支持",newdataViewLogic:"newdata视图逻辑没有配置默认新建数据视图",indexEntity:"缺少默认索引实体选择视图",checkOne:"请选中一条数据",entitiesAssociated:"没有找到与索引类型{indexType}相关的实体的编辑视图",relationships:"实体没有从关系集合!",foreignKey:"没有找到{pickParentDeName}在当前实体的外键属性",mappingProperties:"批量新建转换映射属性",newCreationData:"批量新建创建数据",logicType:"逻辑类型 {logicType} 暂未支持!",noImplementedMethod:"方法未执行。"},trigger:{triggerType:"预定义逻辑类型{type}的触发器类型只能是脚本",noSupportedType:"触发器类型 {triggerType} 暂未支持!",noExecutorBound:"{id}没有绑定executor",timerLacks:"定时器缺少定时间隔",parameterCallback:"定时器缺少默认参数回调"}},model:{utils:{noFoundApplication:"未找到应用",unconfiguredPlugins:"应用未配置插件",noFound:"未找到插件{id}"},view:{engineClassifications:"未支持的引擎分类:{engineType}"}},platform:{failedDownload:"下载文件失败",fileStreamData:"文件流数据不存在"},register:{helper:{adapter:"找不到系统计数器插件{pluginKey}对应的适配器",customizedSystemAdapter:"找不到自定义系统计数器{codeName}对应的适配器",noFoundSystemCounter:"找不系统计数器类型{counterType}对应的适配器",applicationMenu:"找不到应用菜单项插件{pluginKey}对应的适配器",asynchronousAction:"找不异步操作类型{actiontype}对应的适配器",matchedPlugin:"未匹配到插件[{pluginId}]模型",customRegistration:"找不到自定义注册标识为[{registerKey}]对应的适配器",widgetPlugin:"找不到部件插件{pluginKey}对应的适配器",widgetStyleType:"找不到部件类型:[{controlType}]的部件样式:[{controlStyle}]对应的适配器",widgetType:"找不到部件类型{controlType}对应的适配器",entityBehaviorPlugin:"找不到实体行为插件{pluginKey}对应的适配器",entityBehaviorMethod:"找不实体行为方法类型为{methodType}的适配器",editorPlugin:"找不到编辑器插件{pluginKey}对应的适配器",editorStyleType:"找不到编辑器类型:[{editorType}]的编辑器样式:[{editorStyle}]对应的适配器",editorTypePredefinedType:"找不到编辑器类型:[{editorType}]的预置类型:[{predefinedType}]对应的适配器",editorType:"找不到编辑器类型{editorType}对应的适配器",formMemberType:"找不到表单成员类型{detailType}对应的适配器",tableColumnPlugin:"找不到表格列插件{pluginKey}对应的适配器",tableColumnType:"找不到表格列类型{key}对应的适配器",messageType:"找不站内信类型{content_type}对应的适配器",panelMemberPlugin:"找不到面板成员插件{pluginKey}对应的适配器",panelContainerPredefined:"找不到面板容器预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberDirectContent:"找不到面板成员直接内容预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberType:"找不到面板成员类型{itemType}对应的适配器",portalWidgetPlugin:"找不到门户部件插件{pluginKey}对应的适配器",portalWidgetMemberType:"找不到门户部件成员类型{portletType}对应的适配器",treeTableColumnPlugin:"找不到树表格列插件{pluginKey}对应的适配器",interfaceBehaviorPlugin:"找不到界面行为插件{pluginKey}对应的适配器",interfaceBehaviorMode:"找不界面行为模式{uiactionMode}对应的适配器",frontEndPluginNode:"找不到界面逻辑前端插件节点,插件{pluginKey}对应的适配器",viewPlugin:"找不到视图插件{pluginKey}对应的适配器",correspondViewTypeStyle:"找不到视图类型:[{viewType}]的视图样式:[{viewStyle}]对应的适配器",toolbarItem:"找不到工具栏项插件{pluginKey}对应的适配器",acItem:"找不到自填列表项插件{pluginKey}对应的适配器"}},service:{noConfiguredPrimary:"实体[{codeName}]未配置主键字段",noConfiguredField:"实体[{codeName}]未配置主文本字段",convertedNumber:"{value}不能转换成数字",subRelationships:"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!",unsupportedMethod:"未支持的应用实体方法输入属性类型: {type}",noFoundUsernamePassword:"未找到匿名登录配置用户名或密码",loginFailure:"登录失败",logoutFailure:"登出失败",noFound:"未找到应用实体[{id}]",mainState:"{codeName}实体不存在、未启用主状态或者主状态集合为空,返回true",operationIdentifier:"操作标识{dataAccessAction}主状态计算开始",matchMasterState:"匹配主状态",masterStatePermissions:"允许的主状态权限集合",noMatchedState:"没匹配主状态,返回false",permissionCalculation:"操作标识{dataAccessAction}权限计算结束:{result}",noFindCodeList:"找不到{tag}代码表",noConfiguredCounters:"未配置应用计数器!",lackEntityLogic:"缺少实体处理逻辑",createBehavior:"create行为没有传data",updateBehavior:"update行为没有传data",deletionDeletion:"目前只支持[DER1N]关系类型关联删除删除",unableDelete:"无法删除[{logicName}-{srfmajortext}], 数据被[{modelLogicName}-{msg}]引用",noSupportedDataSource:"数据来源类型{dataSetType}暂未支持",sourceCodeTable:"没有指定数据来源代码表",requestMethods:"未支持的请求方式: {requestMethod}",noConfiguredRequestMethod:"未配置请求方式",unsupportedBehaviorTypes:"未支持的行为类型[{actionType}]",noFoundServiceMethod:"未找到服务方法: {id}",UnsupportedServiceMethod:"未支持的服务方法类型: {methodType}",noSupportedMethod:"{codeName}未支持「{id}」方法",noFoundStorageEntity:"应用功能[{name}]未找到存储实体[{stoageAppDataEntityId}]",noExist:"应用功能[{name}]不存在",noFoundEntity:"未找到存储实体[{stoageAppDataEntityId}]",noImplemented:"「{methodName}」未实现",noImplementedCounter:"未实现计数器加载方法",noFoundCounterBehavior:"未找到获取计数器行为!",createPrimaryKeyData:"新建联合主键数据失败,已有主键为{srfkey}的数据",updatePrimaryKeyData:"更新联合主键数据失败,已有主键为{srfkey}的数据",noExistNoUpdated:"数据不存在,无法更新!",dataNoExistNoUpdated:"数据[{srfdename}-{srfmajortext}({srfkey})]不存在,无法更新!",noDeleted:"未找到以下数据「{notRemoveKey}」,无法删除!",noAttributeName:"没有指定属性名称",noContextParameterName:"没有指定上下文参数名称",conditionalObjects:"无法识别的条件对象",mustArray:"值必须为数组",unsupportedQueryTypes:"暂未支持的查询条件类型: {condType}",predefinedType:"预定义类型{predefinedType}暂不支持",dynamicCodeTable:"动态代码表数据属性返回值不为对象格式的字符串,无法转换!",unconfiguredDataset:"未配置数据集",processedWithout:"执行「{funcName}」不存在「srfkey」无法处理",noExistProcessed:"执行「{funcName}」不存在「srfsessionid」无法处理",missingDetreeColumnId:"模型异常缺少detreeColumnId或者dataItemName"},uiAction:{noEntityOrBehavior:"未配置实体或实体行为",noConfiguredopenView:"未配置打开视图",frontProcessingModes:"未支持的前台处理模式[{frontProcessType}]",missingConfigurationScriptCode:"自定义类型缺少配置脚本代码",dataPrimaryKey:"没有找到数据主键",printFailure:"打印失败",physicalPrint:"没有找到实体打印项",exportRequestFailed:"导出请求失败",noEntityExportsFound:"没有找到实体导出项",lackNativeEvent:"缺少原生JS事件对象",logout:"退出登录",wantLogout:"您确定要退出登录吗?",operationConfirmation:"操作确认",viewParameterModalOption:"视图参数modalOption 解析失败:{error}",withdrawalConfirmed:"是否确认执行撤回操作?",noFoundBehaviorModel:"没找到{actionId}的界面行为模型"},uiLogic:{interfaceConnectionConditional:"界面连接条件逻辑组未配置逻辑项",connectionConditionGroup:"界面逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",currentConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataObjectAttribute:"当前条件值类型为[源数据对象属性],缺少配置条件值",currentTime:"暂未支持条件值类型为[当前时间]",interfaceConnectionConditionalTypeName:"界面逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",asynchronousTermination:"未支持的逻辑连接类型: 异步结束",asynchronousRejection:"未支持的逻辑连接类型: 异步拒绝",exceptionHandling:"未支持的逻辑连接类型: 异常处理",logicalLinkTypes:"未支持的逻辑连接类型:{linkMode}",missingTargetParameter:"缺少目标参数对象或者源参数对象配置",appendedArray:"界面逻辑节点(附加到数组):{id}-附加参数:",bindingParameters:"界面逻辑节点(绑定参数):{id}-参数名称:{dstDEUILogicParamId}-值:",copyParameter:"界面逻辑节点(拷贝参数):{id}-参数名称:{dstDEUILogicParamId}-值:",missingfilter:"缺少配置过滤参数",interfaceLogicNodeDataSet:"界面逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDEUILogicParamId}-值:",interfaceLogicNodeEntityActions:"界面逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDEUILogicParamId}-值:",noConfiguredInterfaceBehavior:"未配置界面行为",interfaceLogicNodeEntityInterfaceAction:"界面逻辑节点(实体界面行为):{id}-界面行为标识:{dstAppDEUIActionId}-界面行为所属实体:{dstAppDataEntityId}-目标逻辑参数对象:{dstDEUILogicParamId}",logicalNodeOperation:"逻辑节点{name}操作参数值:",unsupportedEndNode:"暂未支持的结束节点返回值类型: {returnType}",interfaceLogicNodeEndNode:"界面逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noEntityConfigured:"没有配置实体",noEntityLogicConfigured:"没有配置实体逻辑",noIncomingLogic:"没有配置传入逻辑参数",passedParameter:"没有找到传入参数{dstDEUILogicParamId}",interfaceLogicNodeExecutingEntityLogic:"界面逻辑节点(执行实体逻辑):{id}-实体逻辑标识:{dstAppDELogicId}-实体逻辑所属实体:{dstAppDataEntityId}-参数名称:{retDEUILogicParamId}-值:",missingMessageTypeConfiguration:"缺少消息类型的配置",missingButtonTypeConfiguration:"缺少按钮类型的配置",interfaceLogicNodeMessagePopup:"界面逻辑节点(消息弹窗):{id}-消息类型:{type}-消息:{message}",message:"消息",yes:"是",no:"否",determine:"确定",cancel:"取消",noSupportItem:"{name}暂未支持",interfaceLogicNodeFrontendPlugin:"界面逻辑节点(前端插件):{id}-插件标识:{sysPFPluginId}",interfaceLogicNodePreparationParameter:"界面逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDEUILogicParamId}-源参数(值):",noTargetParameter:"没有目标参数对象id",targetParameter:"给目标参数属性{dstFieldName}赋值报错,目标参数:",interfaceLogicNodeDirectCode:"界面逻辑节点(直接代码):{id}-直接代码:",interfaceLogicNodeRebuildParameter:"界面逻辑节点(重新建立参数):{id}-重建参数:{dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"界面逻辑节点(重置参数):{id}-重置参数:{dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"界面逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDEUILogicParamId}-排序后数组:",interfaceLogicNodeStartupNode:"界面逻辑节点(启动节点):{id}",interfaceLogicNodeThrowingExceptions:"界面逻辑节点(抛出异常):{id}-错误信息:{errorInfo}",noConfiguredTriggerObject:"没有配置触发对象",noConfiguredEvent:"没有配置事件名称参数",noConfiguredEventParameters:"没有配置事件参数",noFoundTriggerObject:"没有找到触发对象{fireCtrlId}",noFoundEventParameterObject:"没有找到事件参数对象{eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"界面逻辑节点(视图部件事件触发逻辑):{id}-调用视图部件名称:{fireCtrlId}-触发事件名称:{eventName}-触发参数:",noConfiguredInterfaceObject:"没有配置界面对象",noConfiguredOperatingParameters:"没有配置操作参数",noConfiguredCallMethod:"没有配置调用方法",noFoundOperationParameter:"没有找到操作参数{invokeParamId}",noFoundInterfaceObject:"没有找到界面对象{invokeCtrlId}",noFoundInvokeMethod:"没有找到调用方法{invokeMethod}",interfaceLogicNodeViewWidgetInvocation:"界面逻辑节点(视图部件调用):{id}-调用视图部件名称:{invokeCtrlId}-调用方法名称:{invokeMethod}-触发参数:",viewLogicInitializationParameter:"视图逻辑初始化参数,未找到{codeName}指定部件对象",calculateInterfaceLogicParameters:"计算界面逻辑参数,标识:{tag}",restablishInterfaceLogic:"重新建立界面逻辑参数,标识:{tag}",interfaceLogic:"找不到实体{appDataEntityId}的界面逻辑{deUILogicId}",startExecutingInterfaceLogic:"开始执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",endExecutionInterfaceLogic:"结束执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",noLogicalNodesConfigured:"界面逻辑没有配置逻辑节点"},utils:{anime:{noExistEndpointElement:"终点元素不存在",noExistAnimationElement:"动画元素不存在",noClone:"不能克隆空或未定义的元素"},errorHandler:{noPermissionless:"没有注册无权限错误处理器",noProcessor:"没有找到能处理该错误的处理器"},fileUtil:{fileUploadFailed:"文件上传失败"},handlebars:{noInitHandlebars:"handlebars未初始化"},modal:{externalClosureCapability:"外部关闭能力未注册",shouldDismissResult:"shouldDismiss结果为false,关闭中断"},openRedirectView:{parseSrfnavctxParameter:"重定向[{urlStr}] 中 srfnavctx 参数解析失败",missingEntityName:"重定向参数缺少实体名称",noFoundSpecifiedEntity:"未找到指定实体的codeName: {deName}",unsupportedLinkUrl:"未支持的linkUrl格式:{linkUrl}",noConfiguredActualReference:"未配置实际引用视图",redirectingViewReferences:"重定向视图引用有:",redirectionIdentifier:"未找到重定向标识[{rdTag}]或[{deRdTag}]或工作流[{wfRdTag}]对应视图",noMatchActualReferenceView:"标识[{rdTag}]未匹配到实际引用视图",redirectionView:"重定向视图[{name}]自定义类别属性[{typeFieldId}]值为空"},script:{errorReportingScript:"报错脚本"},shortCut:{invalidIndexNewIndex:"无效的索引 newIndex: {newIndex}, oldIndex: {oldIndex}, 当前数组长度为 {length}"},uiDomain:{transactionOpen:"事务已经开启, 单个界面域只能开启一个事务",currentTransaction:"当前事务未提交,不可以直接关闭事务"},uiDomainManager:{invalidInterfaceDomain:"无效的界面域标识[{id}]"},verify:{contentConform:"内容必须符合值规则",scopeRules:"内容长度必须符合范围规则",valueNull:"值为空",regularRules:"值必须符合正则规则",rangeRules:"值必须符合值范围规则",scriptRules:"值必须符合脚本规则",emptyLogicGroups:"发现空逻辑组,逻辑无法正常执行!",unsupportedLogicTypes:"未支持的逻辑类型{logicType}",emptyLogicGroupsProperly:"发现空逻辑组,逻辑无法正常执行!",valueOperations:"值操作:{op},暂未支持",noCompared:"{value} 和 {value2} 无法比较大小",conditionalValues:"范围比较的条件值不存或者不是字符串"},firstregister:"请先注册模型加载适配器"},deAction:{responseDataError:"响应数据异常 [data]: {error}"}}})}}}));
|
|
1
|
+
System.register(["@ibiz-template/core","lodash-es","ramda","qx-util","qs","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var i,a,s,n,o,r,c,d,l,h,u,p,m,g,f,y,w,E,v,b,I,D,C,A,P,T,N,x,S,L,M,R,O,F,_,z,V,k,U,B,W,G,j,K,H,X,q,Y,Q,J,$,Z,tt,et,it,at,st,nt,ot,rt,ct,dt,lt,ht,ut,pt,mt,gt,ft,yt,wt,Et,vt,bt,It,Dt,Ct,At,Pt,Tt,Nt;return{setters:[function(t){i=t.RuntimeModelError,a=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.isBase64Image,g=t.updateKeyDefine,f=t.Net,y=t.getToken,w=t.NOOP,E=t.selectFile,v=t.Namespace,b=t.IBizParams,I=t.isElementSame,D=t.findRecursiveChild,C=t.StringUtil,A=t.debounceAndAsyncMerge,P=t.EntityError,T=t.isOverlap,N=t.BitMask,x=t.mergeInLeft,S=t.awaitTimeout,L=t.mergeDefaultInLeft,M=t.plus,R=t.isBase64,O=t.base64ToStr,F=t.toNumberOrNil},function(t){_=t.isEmpty,z=t.isNil,V=t.isString,k=t.isArray,U=t.isObject,B=t.merge,W=t.debounce,G=t.camelCase,j=t.eq,K=t.gt,H=t.gte,X=t.findIndex,q=t.lt,Y=t.lte,Q=t.upperFirst,J=t.snakeCase,$=t.kebabCase,Z=t.isFunction,tt=t.isNumber},function(t){et=t.isNil,it=t.mergeRight,at=t.isEmpty,st=t.clone,nt=t.equals,ot=t.where,rt=t.mergeLeft,ct=t.isNotNil,dt=t.mergeDeepRight},function(t){lt=t.notNilEmpty,ht=t.isNilOrEmpty,ut=t.AsyncSeriesHook,pt=t.QXEvent,mt=t.createUUID,gt=t.isArray,ft=t.getCookie,yt=t.setCookie,wt=t.clearCookie,Et=t.ascSort,vt=t.descSort,bt=t.clearAll,It=t.isNumber,Dt=t.isString,Ct=t.isObject},function(t){At=t.default},function(t){Pt=t.default},function(t){Tt=t.default},function(t){Nt=t.default}],execute:function(){t({SearchCondEx2filterNode:jd,asyncImportData:Ir,asyncImportData2:Sr,calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:i}=t;let a;if(e||i){switch(a={display:"flex"},e){case"TOP":Object.assign(a,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(a,{"align-items":"center"});break;case"BOTTOM":Object.assign(a,{"align-items":"flex-end"})}switch(i){case"LEFT":Object.assign(a,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(a,{"justify-content":"center"});break;case"RIGHT":Object.assign(a,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(a,{"justify-content":"space-between"})}}return a},calcDeCodeNameById:Te,calcDynaClass:Ce,calcDynaSysParams:async function(t,e,i={}){const a=i.appId||e.srfappid,s=i.viewParams||{},n={},o=await ibiz.hub.getAppDataEntity(t,a);if(s.srfkey)n.srfkey=s.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(n.srfkey=t)}if(s.srfparentkey&&s.srfparentdename)n.srfparentkey=s.srfparentkey,n.srfparentdename=s.srfparentdename;else{const t=Ka(e,o);if(t&&t.keys.length>1){const i=t.keys[t.keys.length-2];n.srfparentkey=s.srfparentkey||e[i],n.srfparentdename=s.srfparentdename||i}}return n},calcFilterModelBySchema:zd,calcGridLayoutPos:function(t){const{layout:e,colXS:i,colXSOffset:a,colSM:s,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,i)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:i&&-1!==i?i:void 0});return{xs:l(i,a),sm:l(s,n),md:l(o,r),lg:l(c,d)}},calcImportSchemaData:Lr,calcItemVisible:async function(t,e,i,a,s,n){const{enableMode:o,dataAccessAction:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===o&&r){const t=ibiz.hub.getApp(e.srfappid);return!!await t.authority.calcByDataAccessAction(r,e,n,a)}if("DELOGIC"===o&&c&&a&&s){const t=xe(c,await ibiz.hub.getAppDataEntity(a,s));if(t){return!!(await Ws(t,e,n,i)).data}}if("SCRIPT"===o&&d){return!!ai.execScriptFn({data:n,context:e,params:i},d,{isAsync:!1,singleRowReturn:!0})}},calcItemVisibleByCounter:function(t,e){const{enableMode:i,counterId:a}=t;if(!e||!a)return;if("COUNT_GTE_ZERO"===i)return e.getCounter(a)>=0;if("COUNT_GT_ZERO"===i)return e.getCounter(a)>0},calcLayoutHeightWidth:De,calcMainStateOPPrivsStrs:Pe,calcNavParams:ye,calcResPath:Ha,calcSearchCondExs:Hd,calcSearchConds:Gd,calcThresholdRange:function(t,e){return t.find((t=>{if(!t.beginValue&&!t.endValue)return t.value==e;let i=!0;t.beginValue&&(i=t.includeBeginValue?e>=t.beginValue:e>t.beginValue);let a=!0;return t.endValue&&(a=t.includeEndValue?e<=t.endValue:e<t.endValue),i&&a}))},compare:Je,compareNumber:$e,contains:Ze,convertNavData:pe,convertNavDataByArray:ge,convertObjectToNavParams:ue,createImportSchema:async function(t){const e=Lr(t);return await ibiz.net.request("extension/import_schemas",{method:"post",data:e})},deleteImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"delete"})},downloadImportTemplate:Nr,execDELogic:Us,execDELogicAction:Ws,execDELogicById:Bs,execFieldLogics:js,execUILogic:Rc,exportData:Ar,fetchImportSchemas:async function(t){var e;const i={n_import_tag_eq:t.appDataEntity.defaultAppDEDataImportId,n_system_tag_eq:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,n_data_entity_tag_eq:t.appDataEntity.codeName};return await ibiz.net.request("extension/import_schemas/fetch_cur_user",{method:"post",data:i})},fieldValueToBoolean:qa,filterFieldLogics:Se,filterNode2SearchCond:Wd,filterNode2SearchCondEx:Kd,filterValueRules:Di,findAppDEMethod:Ie,findChildFormDetails:ze,findDELogic:xe,findEditItem:_e,findFieldById:Le,findModelChild:we,formatMultiData:fe,generateEditorRules:yr,generateRules:fr,getAcItemProvider:async function(t){let e;const{itemSysPFPluginId:i,appId:a}=t;if(i){const t=await Ri(i,a);if(t&&(s=t,e=ibiz.register.get("".concat(Oa,"_").concat(s))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.acItem",{pluginKey:t}))}var s;return e},getAllPanelField:Ke,getAppCounterProvider:zi,getAppMenuItemProvider:xa,getAppViewRef:function(t,e){var i,a;let s=t.appViewRefs||[];(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)?void 0:a.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(i=t.actiontype||"DEFAULT",ibiz.register.get("".concat(ha,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.asynchronousAction",{actiontype:t.actiontype}))},getChildNodeRSs:Fe,getControl:Ee,getControlPanel:be,getControlProvider:Bi,getControlsByView:ke,getCtrlTeleportParams:function(t){var e,i,a,s;const n=null==(i=null==(e=t.controlParam)?void 0:e.ctrlParams)?void 0:i.TELEPORTTAG,o="true"===(null==(s=null==(a=t.controlParam)?void 0:a.ctrlParams)?void 0:s.TELEPORTFLAG);return{teleportTag:n,teleportFlag:o}},getDEMethodProvider:Da,getDERedirectToView:Ye,getDataImportModels:Pr,getDeACMode:async function(t,e,i){var a;const s=await ibiz.hub.getAppDataEntity(e,i);return null==(a=s.appDEACModes)?void 0:a.find((e=>e.id===t))},getDefaultDataImport:function(t){var e;if(t.defaultAppDEDataImportId)return null==(e=t.appDEDataImports)?void 0:e.find((e=>e.id===t.defaultAppDEDataImportId))},getDefaultValue:Er,getEditorProvider:ji,getEntitySchema:Mr,getErrorViewProvider:function(t){let e;e||(i=t,e=ibiz.register.get("".concat(La,"_").concat(i)));var i;return e},getFormDetailProvider:Xi,getGridColumnProvider:Qi,getImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"get"})},getInternalMessageProvider:function(t){const e=(i=t.content_type||"DEFAULT",ibiz.register.get("".concat(Sa,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.messageType",{content_type:t.content_type}))},getMatchResPath:Ka,getOriginData:gr,getOriginFilterNodes:Ud,getPFPlugin:function(t,e){const a=ibiz.hub.getApp(e);if(!a)throw new i(a,ibiz.i18n.t("runtime.model.utils.noFoundApplication"));const{model:s}=a;if(!s.appPFPluginRefs)throw new i(s,ibiz.i18n.t("runtime.model.utils.unconfiguredPlugins"));const n=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!n)throw new Error(ibiz.i18n.t("runtime.model.utils.noFound",{id:t}));return n},getPanelItemProvider:Zi,getPlatformProvider:Ea,getPlatformType:ga,getPortletProvider:ia,getRootNode:Re,getToolbarItemProvider:Ra,getTreeGridExColumnProvider:Pa,getTreeNode:Oe,getUIActionById:Me,getUIActionItemsByActionLevel:function(t,e){const i=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const a=t;a.actionLevel===e&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),i},getUIActionProvider:oa,getUILogicNodeProvider:ca,getViewEngines:Be,getViewLogics:Ue,getViewProvider:async function(t){let e;const{viewType:i,viewStyle:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Ri(s,n);if(t&&(e=la(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.viewPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=la("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.correspondViewTypeStyle",{viewType:i,viewStyle:a}),t)}e||(e=la(i));e||(e=la("DEFAULT"));return e},getWFContext:di,getWFSubmitViewId:function(t,e){var i;const{type:a,sequenceflowview:s,sequenceflowmobview:n}=e,o=(null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)||t.appViewRefs,r=a?"WFUTILACTION@".concat(a.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:Pn,hasDeCodeName:Ne,hasSubRoute:pr,importData:Dr,importData2:Cr,install:function(){const{ibiz:t}=window;t.util=new Cl,t.hub=new vl,t.register=new Bt,t.config=new Ut,t.auth=new ps,t.engine=new bl,t.uiDomainManager=new Dn,t.markOpenData=new $s,qo(),Bc(),Qs(),Va(),ibiz.scheduler=new Rl,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new _l(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new _l(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new _l(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new zl(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Fl(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new kl(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Ul(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Tl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Nl(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Nl(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Vl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new Bl(t,e))),function(){const t=new pa;ya("Browser",(()=>t))}(),t.platform=Ea()},installCommand:qo,isDataContainer:We,isFormDataContainer:Ve,isHiddenFilter:Td,isSimpleItems:Pd,isValueChange:mr,matchMainState:Ae,openDataImport:Tr,openRedirectView:Xe,parseSubFieldInfo:Nd,parseUserParams:ve,parseViewProtocol:He,presetAppCounterProvider:Va,presetDEMethodProvider:Qs,presetUIActionProvider:Bc,registerAcItemProvider:function(t,e){ibiz.register.register("".concat(Oa,"_").concat(t),e)},registerAppCounterProvider:Fi,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Ta,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ha,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(ki,"_").concat(t),e)},registerDEMethodProvider:ba,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Wi,"_").concat(t),e)},registerErrorViewProvider:function(t,e){ibiz.register.register("".concat(La,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Ki,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(qi,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Sa,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Ji,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:ya,registerPortletProvider:function(t,e){ibiz.register.register("".concat(ta,"_").concat(t),e)},registerToolbarItemProvider:function(t,e){ibiz.register.register("".concat(Ma,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(Ca,"_").concat(t),e)},registerUIActionProvider:sa,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(ra,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(da,"_").concat(t),e)},selectAndImport:xr,strContain:ti,testCond:Qe,toLocalOpenWFRedirectView:async function(t,e,i={}){const a=await qe(t,e,i);await ibiz.commands.execute(Ko.TAG,a.viewId,a.context,a.params,a.opts)},updateImportSchema:async function(t){const e=Lr(t),i="extension/import_schemas/".concat(e.id);return await ibiz.net.request(i,{method:"put",data:e})},validateFilterNodes:Bd,verifyDeRules:si,verifyFormGroupLogic:oi,verifyPanelGroupLogic:ri});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function xt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var St={exports:{}};!function(t,e){t.exports=function(t,e,i){var a=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 i;1===e.length&&e[0].length>0&&(e=e[0]),i=(e=e.filter((function(t){return t})))[0];for(var a=1;a<e.length;a+=1)e[a].isValid()&&!e[a][t](i)||(i=e[a]);return i};i.max=function(){var t=[].slice.call(arguments,0);return a("isAfter",t)},i.min=function(){var t=[].slice.call(arguments,0);return a("isBefore",t)}}}(St);var Lt=xt(St.exports),Mt={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(Mt);var Rt=xt(Mt.exports),Ot={exports:{}};!function(t,e){var i,a;t.exports=(i="month",a="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)===a?this.add(3*t,i):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)===a){var r=this.quarter()-1;return n?this.month(3*r).startOf(i).startOf("day"):this.month(3*r+2).endOf(i).endOf("day")}return o.bind(this)(t,e)}})}(Ot);var Ft=xt(Ot.exports),_t={exports:{}};!function(t,e){var i,a;t.exports=(i="week",a="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(a).add(1,a).date(e),o=s(this).endOf(i);if(n.isBefore(o))return 1}var r=s(this).startOf(a).date(e).startOf(i).subtract(1,"millisecond"),c=this.diff(r,i,!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)}})}(_t);var zt=xt(_t.exports),Vt={exports:{}};!function(t,e){var i;t.exports=(i="day",function(t,e,a){var s=function(t){return t.add(4-t.isoWeekday(),i)},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()),i);var e,n,o,r=s(this),c=(e=this.isoWeekYear(),o=4-(n=(this.$u?a.utc:a)().year(e).startOf("year")).isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,i));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 i=this.$utils(),a=!!i.u(e)||e;return"isoweek"===i.p(t)?a?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)}})}(Vt);var kt=xt(Vt.exports),Ut=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},this.pickerEditor={overflowMode:"auto"}}},Bt=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 i=this.providers.get(t);if(i)return i(...e)}}),Wt=t("DefaultErrorHandler",class{handle(t){return t instanceof i||t instanceof a?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error(ibiz.i18n.t("runtime.utils.errorHandler.noPermissionless")):404===t.status?ibiz.mc.error.send(t):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}}),Gt=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error(ibiz.i18n.t("runtime.utils.errorHandler.noProcessor"),t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),jt=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,i){return i.fn?e?i.fn(t):i.inverse(t):e?i.hash.yes=!0:i.hash.no=!1}};jt.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var Kt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Ht=class extends Kt{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const i=t.filter((t=>!!t)).length===t.length;return jt.handleJudgmentExecute(this,i,e)}},Xt=class extends Kt{constructor(t){super(t,"camelCase")}onExecute(t){return t?G(t):""}},qt=class extends Kt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Yt=class extends Kt{constructor(t){super(t,"eq")}onExecute(t,e,i){const a=j(t,e);return jt.handleJudgmentExecute(this,a,i)}},Qt=class extends Kt{constructor(t){super(t,"gt")}onExecute(t,e,i){const a=K(t,e);return jt.handleJudgmentExecute(this,a,i)}},Jt=class extends Kt{constructor(t){super(t,"gte")}onExecute(t,e,i){const a=H(t,e);return jt.handleJudgmentExecute(this,a,i)}},$t=class extends Kt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,i,a){let s=!1;return s=k(t)?!j(X(t,(t=>j(t[e],i))),-1):t.hasOwnProperty(e)&&(s=j(t[e],i)),jt.handleJudgmentExecute(this,s,a)}},Zt=class extends Kt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},te=class extends Kt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},ee=class extends Kt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},ie=class extends Kt{constructor(t){super(t,"lt")}onExecute(t,e,i){const a=q(t,e);return jt.handleJudgmentExecute(this,a,i)}},ae=class extends Kt{constructor(t){super(t,"lte")}onExecute(t,e,i){const a=Y(t,e);return jt.handleJudgmentExecute(this,a,i)}},se=class extends Kt{constructor(t){super(t,"neq")}onExecute(t,e,i){const a=!j(t,e);return jt.handleJudgmentExecute(this,a,i)}},ne=class extends Kt{constructor(t){super(t,"not")}onExecute(t,e){const i=at(t)||et(t);return jt.handleJudgmentExecute(this,i,e)}},oe=class extends Kt{constructor(t){super(t,"or")}onExecute(...t){var e;const i=t[t.length-1];t.pop();const a=t.find((t=>!!t));if(i.fn){const t=(null==(e=i.data)?void 0:e.root)||{};return a?i.fn(t):i.inverse(t)}return a||""}},re=class extends Kt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?Q(t):""}},ce=class extends Kt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?J(t):""}},de=class extends Kt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?$(t):""}},le=class extends Kt{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var he=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 i;return this.hsb=t.default||t,this.p=null,i=this.hsb,new Ht(i),new Xt(i),new qt(i),new Yt(i),new Qt(i),new Jt(i),new Zt(i),new te(i),new ee(i),new ie(i),new ae(i),new se(i),new ne(i),new oe(i),new re(i),new ce(i),new de(i),new le(i),new $t(i),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(ibiz.i18n.t("runtime.utils.handlebars.noInitHandlebars"));return this.hsb.compile(t)(e)}});function ue(t){const e=[],i=/^%(.+)%$/;for(const a in t){let s=!0,n=t[a];lt(t[a])&&i.test(t[a])&&(s=!1,n=t[a].substring(1,t[a].length-1)),e.push({key:a.toLowerCase(),rawValue:s,value:n})}return e}function pe(t,...e){if(!t||_(t))return{};return ge(Array.isArray(t)?t:ue(t),...e)}function me(t,e){const i=e.split(".");let a;const s=t.find((t=>{if(ht(t))return!1;if(i.length>1){a=t;for(let t=0;t<i.length;t++){const e=i[t];if(!a||!a[e]&&!Object.prototype.hasOwnProperty.call(a,e)){a=void 0;break}a=a[e]}return void 0!==a}return t[e]||Object.prototype.hasOwnProperty.call(t,e)}));return{find:!!s,value:i.length>1?a:null==s?void 0:s[e]}}function ge(t,...e){const i=/\$\{[^}]*\}/g,a={};for(const s of t)if(s.rawValue)a[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(i);if(null!==t){let i=s.value;t.forEach((t=>{const{find:a,value:s}=me(e,t.slice(2,-1).toLowerCase());a&&(i=i.replace(t,"".concat(z(s)?"":s)))})),a[s.key.toLowerCase()]=i}else{const{find:t,value:i}=me(e,s.value.toLowerCase());t&&(a[s.key.toLowerCase()]=i)}}return a}function fe(t,e){const i={};if(!t)return i;const a=Array.isArray(t)?t:ue(t),s=e[0];return a.forEach((t=>{const{rawValue:a,value:n}=t;!a&&n&&Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=e.map((t=>t[n])).join(";"))})),i}function ye(t,e){const{deName:i,navFilter:a,pickupDEFName:s,navContexts:n,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(i&&(h[i]=p),a&&(u[a]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=pe(n,d,c,r),g=pe(o,d,c,r);return Object.assign(h,m),Object.assign(u,g),{resultContext:h,resultParams:u}}function we(t,e){if(t&&e){const i=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(i)return i}return null}function Ee(t,e){var i,a;let s=t.controls||[];return(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.controls)?void 0:a.length)&&(s=s.concat(t.viewLayoutPanel.controls)),s.find((t=>t.name===e||t.codeName===e||t.id===e))}function ve(t){const e={},i={},a={};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(i,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:n});break;default:Object.assign(a,{key:n})}}}return{navigateContexts:e,navigateParams:i,other:a}}function be(t){let e;if(t.controlRenders){const i=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==i?void 0:i.layoutPanel}return e}function Ie(t,e){const i=t.appDEMethods;if(i&&e){const t=we(i,e);if(t)return t;const a=i.find((t=>{switch(t.methodType){case"DEACTION":{const{actionTag:i}=t;return(null==i?void 0:i.toLowerCase())===e.toLowerCase()}case"FETCH":{const{dataSetTag:i}=t;return"fetch".concat(null==i?void 0:i.toLowerCase())===e.toLowerCase()}default:return!1}}));if(a)return a}return null}function De(t){const{width:e,height:i,widthMode:a,heightMode:s}=t,n={width:"",height:""};return"FULL"===a?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===a?"%":"px")),"FULL"===s?n.height="100%":i&&i>0&&(n.height=i>0&&i<=1?"".concat(100*i,"%"):"".concat(i,"PERCENTAGE"===s?"%":"px")),n}function Ce(t,e){const i=[],a=ai.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return V(a)?i.push(a):k(a)?i.push(...a):U(a)&&Object.keys(a).forEach((t=>{a[t]&&i.push(t)})),i}function Ae(t,e){const{mainStateAppDEFieldIds:i,demainStates:a}=t;if(i&&a){const t=[];return i.forEach((i=>{t.push(e[i])})),a.find((e=>{const{stateValue:i,state2Value:a,state3Value:s}=e;let n=!0;const o=[i,a,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function Pe(t,e){const i=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:a,opprivAllowMode:s}=t,n=(null==a?void 0:a.map((t=>t.name)))||[];let o=[];if(s)o=n;else{o=[...i.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function Te(t){return t.split(".").pop()}function Ne(t,e){const i=Te(e);return lt(t[i])}function xe(t,e){var i;return null==(i=e.appDELogics)?void 0:i.find((e=>e.id===t))}function Se(t,e){var i,a;const s=[];return null==(i=t.appDEFields)||i.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==(a=t.appDELogics)?void 0:a.filter((t=>s.includes(t.id))))||[]}function Le(t,e){var i;return null==(i=t.appDEFields)?void 0:i.find((t=>t.id===e))}async function Me(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Re(t){return t.detreeNodes.find((t=>t.rootNode))}function Oe(t,e){return t.detreeNodes.find((t=>t.id===e))}function Fe(t,e){const i=e.parentId||Re(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===i&&(a=t.searchMode,s=e.hasQuery,3===a||(s?1===a:2===a));var a,s}))}function _e(t,e){var i;return null==(i=t.degridEditItems)?void 0:i.find((t=>t.codeName===e))}function ze(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Ve(t){return"MDCTRL"===t.detailType}function ke(t){const{viewLayoutPanel:e}=t,i=t.controls||[];return e&&i.push(...e.controls||[]),i}function Ue(t){const{viewLayoutPanel:e}=t,i=t.appViewLogics||[];return e&&i.push(...e.appViewLogics||[]),i}function Be(t){const{viewLayoutPanel:e}=t,i=t.appViewEngines||[];return e&&i.push(...e.appViewEngines||[]),i.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn(ibiz.i18n.t("runtime.model.view.engineClassifications",{engineType:t.engineType})),!1)))}function We(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Ge=["panelItems","panelTabPages","rootPanelItems"];function je(t){let e=[];for(const i of Ge)if(t[i]&&t[i].length&&t[i].length>0){e=t[i];break}const i=[];return e.length&&(i.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{We(t)||i.push(...je(t))}))),i}function Ke(t){return je(t)}function He(t){const e=new URL(t),i={},a={};let s="";if(e.searchParams.size>0){const s=e.searchParams.get("srfnavctx");if(s){try{Object.assign(i,JSON.parse(s))}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.parseSrfnavctxParameter",{urlStr:t}),e)}e.searchParams.delete("srfnavctx")}e.searchParams.forEach(((t,e)=>{a[e]=t}))}const n=e.pathname.replace("//","").split("/"),[o,r]=n;return s=r||o,{context:i,params:a,viewId:s}}async function Xe(t,e,i={},a={}){return async function(t,e,i={},a={}){let s;try{s=await Ye(t,e,i,a)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const i=window.open(t,"_blank");i&&(i.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Ko.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,i,a)}async function qe(t,e,i={}){const a=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(a+1,e.length)),n=At.parse(s,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.missingEntityName"));const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.noFoundSpecifiedEntity",{deName: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")),i=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=i}return n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),{context:t,params:n,opts:i,viewId:l.id}}async function Ye(t,e,a={},s={}){var n;const r=pe(t.appViewNavContexts||[],a,e);e=Object.assign(e.clone(),r);const c=pe(t.appViewNavParams||[],a,e);Object.assign(a,c);const d=t.appDataEntityId,l=Te(d);let h=(null==(n=s.data)?void 0:n[0])||{};e[l]=h[l]||e[l]||a[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,a);if(t.ok){h=t.data;let i=h.linkurl;if(i){if(e.srfprocessinstanceid&&(i+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==i.indexOf("appredirectview?")&&(i=i.slice(i.indexOf("appredirectview?"))),i.startsWith("http://")||i.startsWith("https://"))return{type:"url",url:i};if(i.startsWith("appredirectview?")){return{type:"view",...await qe(e,i,s)}}throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.unsupportedLinkUrl",{linkUrl:i}))}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(d,t.appId),f=await async function(t,e,i,a){let s="";const n=e.typeAppDEFieldId;if(n){const{codeName:i}=Le(t,n),s=a[i.toLowerCase()];if(lt(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn(ibiz.i18n.t("runtime.utils.openRedirectView.redirectionView",{name:e.name,typeFieldId:n}),a)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=i.srfwf;if(lt(r))return lt(i.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(i.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=Le(t,t.indexTypeAppDEFieldId);c=a[e.toLowerCase()]}if(ht(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Le(t,t.formTypeAppDEFieldId);c=a[e.toLowerCase()]}s=lt(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return s}(g,t,a,h);let y="";if(!f.startsWith("view://")){const n=f.split(":"),o=2===n.length?f:n.slice(0,2).join(":"),r="".concat(g.name.toUpperCase(),":").concat(f),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===f||e===o}));if(d){if(y=d.refAppViewId,d.openMode&&(s.openMode=d.openMode),y)return{type:"view",viewId:y,context:e,params:a,opts:{...s,data:[h]}};throw new i(d,ibiz.i18n.t("runtime.utils.openRedirectView.noConfiguredActualReference"))}throw ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.redirectingViewReferences"),null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:i})=>({viewId:t,tag:e,title:i})))),new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.redirectionIdentifier",{rdTag:f,deRdTag:r,wfRdTag:o}))}{const t=He(f);Object.assign(e,t.context),Object.assign(a,t.params),y=t.viewId}if(y)return{type:"view",viewId:y,context:e,params:a,opts:{...s,data:[h]}};throw new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.noMatchActualReferenceView",{rdTag:f}))}function Qe(t,e,i){if(Object.is(e,"IN"))return Ze(t,i);if(Object.is(e,"NOTIN"))return!Ze(t,i);switch(e){case"EQ":return"".concat(t)==="".concat(i);case"NOTEQ":return"".concat(t)!=="".concat(i);case"LT":return Je(t,i)<0;case"LTANDEQ":return Je(t,i)<=0;case"GT":return Je(t,i)>0;case"GTANDEQ":return Je(t,i)>=0;case"ISNULL":return ht(t);case"ISNOTNULL":return lt(t);case"TESTNULL":return et(t);case"IN":return Ze(t,i);case"NOTIN":return!Ze(t,i);case"LIKE":return ti(t,i);case"LEFTLIKE":return ti(t,i,"start");case"RIGHTLIKE":return ti(t,i,"end");default:throw new o(ibiz.i18n.t("runtime.utils.verify.valueOperations",{op:e}))}}function Je(t,e){const i=Number(t),a=Number(e);if(!Number.isNaN(i)&&!Number.isNaN(a))return $e(i,a);const s=new Date(t).getTime(),n=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(n))return $e(s,n);throw new o(ibiz.i18n.t("runtime.utils.verify.noCompared",{value:t,value2:e}))}function $e(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Ze(t,e){if(!e||"string"!=typeof e)throw new o(ibiz.i18n.t("runtime.utils.verify.conditionalValues"));if(t){return e.split(",").includes("".concat(t))}return!1}function ti(t,e,i){if(!t||!e)return!1;const a="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),n=a.indexOf(s);switch(i){case"start":return 0===n;case"end":return n+s.length===a.length;default:return-1!==n}}var ei={singleRowReturn:!1,isAsync:!0},ii=t("ScriptFunction",class{constructor(t,e,i=ei){this.argKeys=[],this.options=i;const a=this.formatCode(e,i);this.calcArgKeys(t,i);const s=new Function(...this.argKeys,a);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.utils.script.errorReportingScript"),a),t}}}formatCode(t,e){let i=t;return e.singleRowReturn&&(i="return (".concat(i,")")),e.isAsync&&(i="return (async function() { ".concat(i,"} )();")),i}calcArgKeys(t,e){const i=e.presetParams?Object.keys(e.presetParams):[];i.push(...t);i.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util","ctrl"),this.argKeys=Array.from(new Set(i))}convertArgs(t){const{presetParams:e}=this.options,i=e?it(e,t):t;i.document=document,i.selector=t=>document.getElementsByClassName(t);const a=[];return this.argKeys.forEach((t=>{void 0===i[t]&&this.fillDefaultParams(t,i),a.push(i[t])})),a}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 i=e.view;if(i)switch(t){case"parent":e.parent=i.parentView;break;case"topView":e.topView=i.getTopView();break;case"parentView":e.parentView=i.parentView;break;case"topViewSession":e.topViewSession=i.getTopView().session;break;case"viewSession":e.viewSession=i.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),ai=t("ScriptFactory",class{static createScriptFn(t,e,i){return new ii(t,e,i)}static execScriptFn(t,e,i){return this.createScriptFn(Object.keys(t),e,i).exec(t)}static async asyncExecScriptFn(t,e,i={}){return await this.createScriptFn(Object.keys(t),e,{...i,isAsync:!0}).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function si(t,e,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(t){return"GROUP"===t.condType}(i)){const s=i.conds;s&&s.length>0&&(a.isPast=function(t,e,i="AND",a=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===i;for(let a=0,n=t.length;a<n;a++){const n=e(t[a],a);if("AND"===i){if(!n){s=!1;break}}else if("OR"===i&&n){s=!0;break}}return a?!s:s}(s,(i=>{const{isPast:s,infoMessage:n}=si(t,e,i);return a.infoMessage=n,s}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{t=(null==i?void 0:i.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){Object.is(s,"CURTIME")&&(i="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){i=n[i=i?i.toLowerCase():""]?n[i]:i}(et(a)||at(a))&&(a=ibiz.i18n.t("runtime.utils.verify.contentConform"));const c=Qe(t,e,i);if(!c&&r)throw new o(a);return!c}(e[t],i.condOp,i.paramValue,i.ruleInfo,i.paramType,e,i.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){ht(n)&&(n=ibiz.i18n.t("runtime.utils.verify.rangeRules"));if(ht(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return n=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(ni(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(i){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!=a)if(s){if(c>a){if(r)throw new o(n);return!0}}else if(c>=a){if(r)throw new o(n);return!0}return n="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"REGEX"===t.condType}(i))a.isPast=!ni(e[t],i.regExCode,i.ruleInfo,i.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){ht(n)&&(n=ibiz.i18n.t("runtime.utils.verify.scopeRules"));if(ht(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return n=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}const c=t.length;if(null!==e)if(i){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!==a)if(s){if(c>a){if(r)throw new o(n);return!0}}else if(c>=a){if(r)throw new o(n);return!0}return n="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:s,regExCode:n,scriptCode:r,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===s)a.isPast=!ni(e[t],n,a.infoMessage,i.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:n}=function(t,e,i,a,s){ht(a)&&(a=ibiz.i18n.t("runtime.utils.verify.scriptRules"));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=ai.execScriptFn({value:t,data:n},i,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(a="",!c&&s)throw new o(a);return{isPast:c,infoMessage:r||a}}(e[t],e,r,a.infoMessage,i.keyCond);a.isPast=s,a.infoMessage=n||a.infoMessage}}}catch(t){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function ni(t,e,i,a){ht(i)&&(i=ibiz.i18n.t("runtime.utils.verify.regularRules"));if(ht(t)){if(a)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return i=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(!new RegExp(e).test(t)){if(a)throw new o(i);return!0}return i="",!1}function oi(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.defdlogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroups"));let s=!0;if("AND"===e.groupOP){s=void 0===a.find((e=>!oi(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>oi(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Qe(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}function ri(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.panelItemLogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroupsProperly"));let s=!0;if("AND"===e.groupOP){s=void 0===a.find((e=>!ri(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>ri(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Qe(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}var ci=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 i=st(this.cache.get(e));t.viewLayoutPanel=i,t.appCounterRefs&&(i.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(i.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(i.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(i.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(i.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:i}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(i)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:i,blankMode:a,mainMenuAlign:s}=t;let n="";a?n="BLANK_MODE":s&&(n=s.toUpperCase());let o="";return o=""!==n?"".concat(e,"_").concat(i,"_").concat(n):"".concat(e,"_").concat(i),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function di(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var li=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))(li||{})),hi=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))(hi||{})),ui=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(ui||{})),pi=t("StudioViewEvents",class{});pi.onViewMounted="onMounted",pi.onViewDestroyed="onDestroyed";var mi=t("StudioPanelEvents",class{});mi.onClick="onClick",mi.onChange="onChange",mi.onEnter="onEnter",mi.onLeave="onLeave";var gi=t("StudioControlEvents",class{});gi.onBeforeLoad="onBeforeLoad",gi.onLoadSuccess="onLoadSuccess",gi.onLoadError="onLoadError",gi.onBeforeLoadDraft="onBeforeLoadDraft",gi.onLoadDraftSuccess="onLoadDraftSuccess",gi.onLoadDraftError="onLoadDraftError",gi.onBeforeSave="onBeforeSave",gi.onSaveSuccess="onSaveSuccess",gi.onSaveError="onSaveError",gi.onBeforeRemove="onBeforeRemove",gi.onRemoveSuccess="onRemoveSuccess",gi.onRemoveError="onRemoveError",gi.CLICK="onClick";var fi=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.FIRST_RECORD="FirstRecord",t.LAST_RECORD="LastRecord",t.PREV_RECORD="PrevRecord",t.NEXT_RECORD="NextRecord",t.LOAD_MORE="LoadMore",t.SHOTR_CUT="ShortCut",t))(fi||{})),yi=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))(yi||{})),wi=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))(wi||{})),Ei=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.ROUTE_MODAL="ROUTE_MODAL",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Ei||{})),vi=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))(vi||{})),bi=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(bi||{})),Ii=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new ut,beforeDismiss:new ut},this._dismiss=t=>{ibiz.log.error(ibiz.i18n.t("runtime.utils.modal.externalClosureCapability"),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={};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),!1===e.allowClose?(ibiz.log.debug(ibiz.i18n.t("runtime.utils.modal.shouldDismissResult")),!1):(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function Di(t,e){return t.filter((t=>{const{checkMode:i}=t,a=t.deformItemName||t.degridEditItemName;return 2!==i&&a===e}))}var Ci=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")}}),Ai=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,i){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==i)return!1;let a=-1;if(e==i?a=0:e>i&&(a=1),"EQ"===t||"ABSEQ"===t)return 0===a;if("GT"===t)return a>0;if("GTANDEQ"===t)return a>=0;if("LT"===t)return a<0;if("LTANDEQ"===t)return a<=0;if("NOTEQ"===t)return 0!==a}if("LIKE"===t)return null!=e&&null!=i&&-1!==e.toString().toUpperCase().indexOf(i.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=i&&0===e.toString().toUpperCase().indexOf(i.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Pi=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Ti=class extends Pi{parse(t){const e=t.length;let i=!0,a=!1,s=!1;for(let n=0;n<e;n++)if(i){const e=t[n];this.setCondOp(e),i=!1,a=!0}else if(a){const e=t[n];this.setParam(e),a=!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}},Ni=class t extends Pi{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const i=e.length;let a=!0,s=!0,n=!1;for(let r=0;r<i;r++){if(a&&s){if("!"===e[r]){this.setNotMode(!0),a=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,a=!1,n=!0}else if(n){const i=e[r];if(!(i instanceof Array))throw new o(ibiz.i18n.t("runtime.service.mustArray"));i.forEach((e=>{if(e.length>0){const i=e[0].toString();if("!"===i||"OR"===i||"AND"===i){const i=new t;i.parse(e),this.childCondList.push(i)}else{const t=new Ti;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},xi=class extends Ni{},Si=class extends Ti{},Li=class t extends Ai{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,i,a){if(e instanceof Ni){const t=e.getChildPSModelCondBases();if(null==t||at(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,i,a)){if(!s){n=!0;break}}else if(s){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Ti){at(e.getParam())&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noAttributeName"),e);const s=i[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||at(o)?n=e.getValue():(at(r)&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noContextParameterName")),t.PARAMTYPE_WEBCONTEXT===o?n=a.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=a.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,n)}return ibiz.log.warn(ibiz.log.warn(ibiz.i18n.t("runtime.service.conditionalObjects")),e),!1}createPSModelSingleCond(){return new Si}createPSModelGroupCond(){return new xi}};Li.PARAMTYPE_DATACONTEXT="DATACONTEXT",Li.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Mi=t("PSDEDQCondEngine",Li);async function Ri(t,e){var i;const a=null==(i=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:i.find((e=>e.pluginCode.toLowerCase()===t));if(a)return await ibiz.plugin.loadPlugin(a),"".concat(a.pluginType,"_").concat(a.pluginCode);ibiz.log.error(ibiz.i18n.t("runtime.register.helper.matchedPlugin",{pluginId:t}))}var Oi=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Fi(t,e){ibiz.register.register("".concat(Oi,"_").concat(t),e)}function _i(t){return ibiz.register.get("".concat(Oi,"_").concat(t))}async function zi(t){let e;const{codeName:i,counterType:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Ri(s,n);if(t&&(e=_i(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.adapter",{pluginKey:t}))}if("CUSTOM"===a){if(e=_i(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.customizedSystemAdapter",{codeName:i}))}if(e=_i(a),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.noFoundSystemCounter",{counterType:a}))}var Vi=class{static getRegisterKey(t,e){switch(t){case Ji:return this.calcKeyByView(e);case Ki:case qi:case ki:return this.calcKeyByCtrl(e);default:return""}}static calcKeyByView(t){const{controlItemModel:e,controlModel:i,viewModel:a}=t;let s="";return(null==a?void 0:a.codeName)&&(s+="".concat(a.codeName.toUpperCase())),(null==i?void 0:i.codeName)&&(s+="@".concat(i.codeName.toUpperCase())),(null==e?void 0:e.id)&&(s+="@".concat(e.id.toUpperCase())),s}static calcKeyByCtrl(t){const{controlModel:e,controlItemModel:i}=t;let a="",s="APP";if(e){const{appDataEntityId:t,controlType:i,codeName:n}=e;t&&(s=Te(t).toUpperCase()),i&&(a+="@".concat(i.toUpperCase())),n&&(a+="@".concat(n.toUpperCase()))}return(null==i?void 0:i.codeName)&&(a+="@".concat(i.codeName.toUpperCase())),a=s+a,a}},ki=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Ui(t){return ibiz.register.get("".concat(ki,"_").concat(t))}async function Bi(t){let e;const{controlType:i,controlStyle:a,sysPFPluginId:s,appId:n}=t,o=Vi.getRegisterKey(ki,{controlModel:t});if(e=Ui(o),e)return e;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Ri(s,n);if(t&&(e=Ui(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Ui("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetStyleType",{controlType:i,controlStyle:a}),t)}if(e=Ui(i),e)return e;"DATAINFOBAR"!==i&&ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetType",{controlType:i}))}var Wi=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Gi(t){return ibiz.register.get("".concat(Wi,"_").concat(t))}async function ji(t){let e;const{editorType:i,editorStyle:a,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Ri(n,o);if(t&&(e=Gi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Gi("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorStyleType",{editorType:i,editorStyle:a}),t)}if(s){let n="".concat(s,"_").concat(i);if(a&&"DEFAULT"!==a&&(n+="_".concat(a)),e=Gi(n),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorTypePredefinedType",{editorType:i,predefinedType:s}),t)}if(e=Gi(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorType",{editorType:i}))}var Ki=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function Hi(t){return ibiz.register.get("".concat(Ki,"_").concat(t))}async function Xi(t,e){let i;const{detailType:a,sysPFPluginId:s,appId:n}=t,o=Vi.getRegisterKey(Ki,{controlItemModel:t,controlModel:e});if(i=Hi(o),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Ri(s,n);if(t&&(i=Hi(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberPlugin",{pluginKey:t}))}if(i=Hi(a),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberType",{detailType:a}))}var qi=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Yi(t){return ibiz.register.get("".concat(qi,"_").concat(t))}async function Qi(t,e){let i;const{columnType:a,enableRowEdit:s,sysPFPluginId:n,appId:o}=t,r=Vi.getRegisterKey(qi,{controlItemModel:t,controlModel:e});if(i=Yi(r),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:r})),n){const t=await Ri(n,o);if(t&&(i=Yi(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnPlugin",{pluginKey:t}))}const c=s?"".concat(a,"_EDIT"):a;if(i=Yi(c),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:c}))}var Ji=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function $i(t){return ibiz.register.get("".concat(Ji,"_").concat(t.toUpperCase()))}async function Zi(t,e,i){var a;let s;const{itemType:n,sysPFPluginId:o,appId:r,controlRenders:c}=t,d=Vi.getRegisterKey(Ji,{controlItemModel:t,controlModel:e,viewModel:i});if(s=$i(d),s)return s;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:d})),o){const t=await Ri(o,r);if(t&&(s=$i(t)),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberPlugin",{pluginKey:t}))}if(c&&c.length>0)s=$i("PREDEFINE_RENDER");else{if("CONTAINER"===n){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(s=$i(i),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelContainerPredefined",{predefinedType:e,key:i}))}if("RAWITEM"===n){const e=(null==(a=t.rawItem)?void 0:a.predefinedType)||"DEFAULT",i="RAWITEM_".concat(e);if(s=$i(i),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberDirectContent",{predefinedType:e,key:i}))}if("FIELD"===n){const{editor:e}=t;if(e&&e.predefinedType){if(s=$i("FIELD_".concat(e.predefinedType.toUpperCase())),s)return s}}s=$i(n)}if(s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberType",{itemType:n}))}var ta=t("PORTLET_PROVIDER_PREFIX","PORTLET");function ea(t){return ibiz.register.get("".concat(ta,"_").concat(t))}async function ia(t){let e;const{portletType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Ri(a,s);if(t&&(e=ea(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetPlugin",{pluginKey:t}))}if(e=ea(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetMemberType",{portletType:i}))}var aa=t("UIACTION_PROVIDER_PREFIX","UIACTION");function sa(t,e){ibiz.register.register("".concat(aa,"_").concat(t),e)}function na(t){return ibiz.register.get("".concat(aa,"_").concat(t))}async function oa(t){let e;const{uiactionMode:i,sysPFPluginId:a,appId:s,uiactionTag:n}=t;if(a){const t=await Ri(a,s);if(t&&(e=na(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorPlugin",{pluginKey:t}))}if(e=na("".concat(i,"_").concat(n)),e)return e;if(e=na(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorMode",{uiactionMode:i}))}var ra=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function ca(t){let e;const{sysPFPluginId:i,appId:a}=t,s=await Ri(i,a);if(s){if(e=ibiz.register.get("".concat(ra,"_").concat(s)),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.frontEndPluginNode",{pluginKey:s}))}}var da=t("VIEW_PROVIDER_PREFIX","VIEW");function la(t){return ibiz.register.get("".concat(da,"_").concat(t))}var ha=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var ua=t("PlatformProviderBase",class{back(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}init(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}async login(t,e,i){return ibiz.auth.login(t,e)}async download(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(i.data){const t=e;return c(i.data,t),Promise.resolve(!0)}throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"))}}),pa=t("BrowserPlatformProvider",class extends ua{});var ma=window.navigator.userAgent.toLowerCase();function ga(){return/Android|Adr/i.test(ma)?"Android":/iPhone|iPod|iPad/i.test(ma)?"IOS":/MicroMessenger/i.test(ma)?"WeChat":/DingTalk/i.test(ma)?"DingTalk":/miniProgram/i.test(ma)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var fa=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function ya(t,e){ibiz.register.register("".concat(fa,"_").concat(t),e)}function wa(t){return ibiz.register.get("".concat(fa,"_").concat(t))}function Ea(){const t=wa(ga());return t||wa("Browser")}var va=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function ba(t,e){ibiz.register.register("".concat(va,"_").concat(t),e)}function Ia(t){return ibiz.register.get("".concat(va,"_").concat(t))}async function Da(t){let e;const{methodType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Ri(a,s);if(t&&(e=Ia(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.entityBehaviorPlugin",{pluginKey:t}))}if(e=Ia(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.entityBehaviorMethod",{methodType:i}))}var Ca=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Aa(t){return ibiz.register.get("".concat(Ca,"_").concat(t))}async function Pa(t){let e;const{columnType:i,appId:a,renderSysPFPluginId:s}=t;if(s){const t=await Ri(s,a);if(t&&(e=Aa(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.treeTableColumnPlugin",{pluginKey:t}))}if(e=Aa(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:i}))}var Ta=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Na(t){return ibiz.register.get("".concat(Ta,"_").concat(t))}async function xa(t){let e;const{sysPFPluginId:i,appId:a,itemType:s}=t;if(i){const t=await Ri(i,a);if(t&&(e=Na(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.applicationMenu",{pluginKey:t}))}return e=Na(s),e}var Sa=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var La=t("ERROR_VIEW_PROVIDER_PREFIX","ERROR_VIEW");var Ma=t("TOOLBAR_ITEM_PROVIDER_PREFIX","TOOLBAR_ITEM");async function Ra(t){let e;const{sysPFPluginId:i,appId:a}=t;if(i){const t=await Ri(i,a);if(t&&(s=t,e=ibiz.register.get("".concat(Ma,"_").concat(s))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.toolbarItem",{pluginKey:t}))}var s;return e}var Oa=t("AC_ITEM_PROVIDER_PREFIX","AC_ITEM");var Fa=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new pt,this.data={},this.countChange=this.countChange.bind(this)}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load(),this.model.appDataEntityId&&ibiz.mc.command.change.on(this.countChange)}countChange(t){const e=t.data;if(this.model.appDataEntityId){const t=Te(this.model.appDataEntityId);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}setParams(t,e){t&&(this.context=st(t)),e&&(this.params=st(e))}interval(){this.destroyInterval(),this.model.timer&&(this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer))}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o(ibiz.i18n.t("runtime.service.noImplementedCounter"))}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&<(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(),ibiz.mc.command.change.off(this.countChange)}}),_a=t("AppDECounter",class extends Fa{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const a=this.model.getAppDEActionId;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundCounterBehavior"));this.action=a,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}}),za=t("AppDECounterProvider",class{createCounter(t){return new _a(t)}});function Va(){Fi("DEDR",(()=>new za))}var ka=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const i=new Mi;return 1===e.length?i.parse(this.calcCond(e)[0]):e.length>1&&i.parse(["AND",this.calcCond(e)][0]),this.map.set(t,i),i}return null}static calcCond(t){const e=[];return t.forEach((t=>{const i=[];if("GROUP"===t.condType){const e=t;e.notMode&&i.push("!"),i.push(t.condOp);const a=e.dedqconditions;if(a){const t=this.calcCond(a);i.push(t)}}else{if("SINGLE"!==t.condType)throw new a(t,ibiz.i18n.t("runtime.service.unsupportedQueryTypes",{condType:t.condType}));{const e=t;i.push(e.condOp),i.push(e.fieldName),e.condValue?e.vartypeId?i.push({type:e.vartypeId,value:e.condValue}):i.push(e.condValue):i.push("")}}e.push(i)})),e}});ka.map=new WeakMap;var Ua=t("DynamicCodeListCache",class{constructor(t){if(this.cache=new Map,this.isPredefined=!1,this.context=d.create(),this.params={},this.evt=new pt,this.commonKeys=["query","queryconds","searchconds"],this.codeList=t,this.codeList.enableCache){this.codelistChange=this.codelistChange.bind(this);const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&ibiz.mc.command.change.on(this.codelistChange)}}setParams(t,e){t&&(this.context=d.create({},{...t})),e&&(this.params=st(e))}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new a(this.codeList,ibiz.i18n.t("runtime.service.predefinedType",{predefinedType:t}))}else this.initPromise=void 0})(),this.initPromise}convertData(t,e,i){const a={},{valueAppDEFieldId:s,textAppDEFieldId:n,iconClsAppDEFieldId:o,iconClsXAppDEFieldId:r,iconPathAppDEFieldId:c,iconPathXAppDEFieldId:d,disableAppDEFieldId:l,dataAppDEFieldId:h,clsAppDEFieldId:u,colorAppDEFieldId:p,thresholdGroup:m,beginValueAppDEFieldId:g,endValueAppDEFieldId:f,incBeginValueMode:y,incEndValueMode:w,bkcolorAppDEFieldId:E}=this.codeList,v=s?t[s]:t.srfkey;if(a.id=v,a.value=v,a.text=n?t[n]:t.srfmajortext,(o||r||c||d)&&(a.sysImage={appId:this.codeList.appId},o&&(a.sysImage.cssClass=t[o]),r&&(a.sysImage.cssClassX=t[r]),c&&(a.sysImage.imagePath=t[c]),d&&(a.sysImage.imagePathX=t[d])),l&&(a.disableSelect=qa(t[l])),u&&(a.textCls=t[u]),p&&(a.color=t[p]),E&&(a.bkcolor=t[E]),h&&t[h])try{a.data=ai.execSingleLine(h,t)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.service.dynamicCodeTable"))}if(m){if(g&&(a.beginValue=t[g]),f&&(a.endValue=t[f]),y)switch(y){case 1:a.includeBeginValue=!0;break;case 2:a.includeBeginValue=0===e;break;case 3:a.includeBeginValue=e===i.length-1}if(w)switch(w){case 1:a.includeEndValue=!0;break;case 2:a.includeEndValue=0===e;break;case 3:a.includeEndValue=e===i.length-1}}return a}presetconvertData(t){const e={},{color:i,bkcolor:a,disabled:s,id:n,text:o,value:r,cls:c}=t;return e.value=r,e.color=i,e.bkcolor=a,e.text=o,e.id=n,e.disableSelect=s,e.cls=c,e.data=t,e}sortShoworder(t){return t.forEach((t=>{"showorder"in t||Object.assign(t,{showorder:1e3})})),t.sort(((t,e)=>t.showorder-e.showorder))}async load(t,e={}){const a={...e};this.commonKeys.forEach((t=>{delete a[t]})),this.setParams(t,a);const s=ibiz.hub.getApp(t.srfappid),{appDataEntityId:n,appDEDataSetId:o,minorSortAppDEFieldId:r,minorSortDir:c,pvalueAppDEFieldId:d,customCond:l}=this.codeList;if(r&&c&&Object.assign(a,{sort:"".concat(r.toLowerCase(),",").concat(c.toLowerCase())}),l){const e=pe(ai.execSingleLine(l),a,t);Object.assign(a,e)}if(a.size||(a.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 s.net.get("/dictionaries/codelist/".concat(t),a),i=[],{items:n}=e.data;return this.sortShoworder(n).length&&n.forEach((t=>{i.push(this.presetconvertData(t))})),Object.freeze(i)}if(!n)throw new i(this.codeList,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));if(!o)throw new i(this.codeList,ibiz.i18n.t("runtime.service.unconfiguredDataset"));const h=await s.deService.exec(n,o,t,void 0,a);let u=[];if(h.data.length)if(d){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach(((t,e)=>{u.push(this.convertData(t,e,h.data))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:i}=this.codeList,a={},s=[];return t.forEach(((i,s)=>{a[i[e]]=this.convertData(i,s,t)})),t.forEach((t=>{const n=a[t[i]];n?(n.children=n.children||[],n.children.push(a[t[e]])):s.push(a[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const i=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(i)){const t=this.cache.get(i);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(i)}const a=this.load(t,e),{cacheTimeout:s}=this.codeList,n=-1===s||et(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:a};this.cache.set(i,o);const r=await a;return o.items=r,delete o.promise,r}codelistChange(t){const e=t.data,{appDataEntityId:i}=this.codeList;if(i){const t=Te(i);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}async refresh(){const t=JSON.stringify(this.context)+JSON.stringify(this.params);this.cache.delete(t);const e=await this.get(this.context,this.params);this.evt.emit("change",e)}onChange(t,e=!0){this.evt.on("change",t);const i=JSON.stringify(this.context)+JSON.stringify(this.params),a=this.cache.get(i);e&<(a)&&t(a.items)}offChange(t){this.evt.off("change",t)}destroy(){const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&this.codeList.enableCache&&ibiz.mc.command.change.off(this.codelistChange)}});function Ba(t,e){if(null!=e){const{srfkey:t}=e;if(!et(t)&&!at(t))return!0}throw new o(ibiz.i18n.t("runtime.service.processedWithout",{funcName:t}))}function Wa(t,e){const{srfsessionid:i}=e;if(!et(i)&&!at(i))return!0;throw new o(ibiz.i18n.t("runtime.service.noExistProcessed",{funcName:t}))}var Ga=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 i=this.cacheMap.get(e.srfkey);i&&(i.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,st(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(ibiz.i18n.t("runtime.service.createPrimaryKeyData",{srfkey:e.srfkey}));try{Wa("add",t),(et(e.srfkey)||at(e.srfkey))&&(e.srfkey=mt()),e.srftempdate=(new Date).getTime();const i=()=>{this.cacheMap.set(e.srfkey,st(e)),ibiz.log.warn("add",e.srfkey,e)},a=this.getTransaction(t);return a?a.change(e.srfkey,(()=>{i()})):i(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Wa("get",t);const i=this.cacheMap.get(e);return ibiz.log.warn("get",e,i),st(i)}catch(t){return ibiz.log.error(t),null}}update(t,e){const i=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),i!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:e.srfkey}));try{Wa("update",t),Ba("update",e),e.srftempdate=(new Date).getTime();const a=this.cacheMap.get(i);if(a){const s=st(a);s.assign(e);const n=()=>{a.assign(e),i!==e.srfkey&&this.cacheMap.delete(i),this.cacheMap.set(e.srfkey,a),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{n()})):n(),s}throw new Error(ibiz.i18n.t("runtime.service.noExistNoUpdated"))}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Wa("delete",t);const i=e;if(this.cacheMap.has(i)){const e=this.cacheMap.get(i),a=()=>{this.cacheMap.delete(i),ibiz.log.warn("delete",i)},s=this.getTransaction(t);return s?s.change(i,(()=>{a()})):a(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Wa("add",t);const i=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},a=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(et(s.srfkey)||at(s.srfkey))&&(s.srfkey=mt()),s.srftempdate=(new Date).getTime();const n=st(s);a?a.change(n.srfkey,(()=>{i(n)})):i(n)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Wa("update",t);const i=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},a=this.getTransaction(t);for(let s=0;s<e.length;s++){const n=e[s];Ba("update",n);const r=n.srfkey;if(this.isUnionKey&&(this.calcUnionKey(n),r!==n.srfkey&&this.checkData(t,n.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:n.srfkey}));n.srftempdate=(new Date).getTime();const c=this.cacheMap.get(n.srfkey);if(!c)throw new Error(ibiz.i18n.t("runtime.service.dataNoExistNoUpdated",{srfdename:n.srfdename,srfmajortext:n.srfmajortext,srfkey:n.srfkey}));{const t=st(c);t.assign(n),e[s]=t,a?a.change(n.srfkey,(()=>{c.assign(n),i(c,r)})):(c.assign(n),i(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{const i=[];for(let a=0;a<e.length;a++){const s=e[a],n=this.delete(t,s);n&&i.push(n)}return i}catch(t){return ibiz.log.error(t),null}}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=nt(t.srfkey)),delete t.srfkey;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e[i]=nt(a)}return ot(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>we(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>et(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}}),ja=/\$\{(.*?)\}/g;function Ka(t,e){const i=(e.requestPaths||[]).map((t=>{const e=t.match(ja);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:i}=e;return 0===i.length||i.every(((e,a)=>a===i.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(i.length>0)return i[0]}function Ha(t,e){const i=Ka(t,e);if(i){if(i.keys.length>0){let{path:e}=i;return i.keys.forEach(((a,s)=>{e=s===i.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(a,"\\}")),""):e.replace("${".concat(a,"}"),t[a])})),e}return i.path}return""}var Xa=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(et(e.page)||at(e.page)||(this.page=e.page),et(e.size)||at(e.size)||(this.size=e.size),et(e.query)||at(e.query)||(this.query=e.query),!et(e.sort)&&!at(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 qa(t){if("boolean"==typeof t)return t;if("number"==typeof t)return t>0;if("string"!=typeof t)return!!t;switch(t){case"true":return!0;case"false":return!1;default:{const e=Number(t);return!Number.isNaN(e)&&e>0}}}function Ya(t){const e={};if(!t)return e;const i=t.split(",");return i&&i.length>0&&i.forEach((t=>{const[i,a]=t.split(":");e[i]=parseInt(a,10)})),e}function Qa(t){const e={};return t.forEach((t=>{e[t.srflistmapfield]=t,delete t.srflistmapfield})),e}function Ja(t){const e=[];return Object.keys(t).forEach((i=>{const a=t[i];a.srflistmapfield=i,e.push(a)})),e}var $a=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 i=t.codeItems;let a=[];return(null==i?void 0:i.length)&&(a=this.formatStaticItems(i,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(a)),a}setCodeList(t){const{id:e,codeName:i}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(i,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var i;let a=t.text;t.textLanguageRes&&(a=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:a,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?ai.execSingleLine(t.data):void 0,sysImage:t.sysImage,userData:t.userData,beginValue:t.beginValue,endValue:t.endValue,includeBeginValue:t.includeBeginValue,includeEndValue:t.includeEndValue};return(null==(i=t.codeItems)?void 0:i.length)&&(n.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(n)}))}async getDynamicCodeList(t,e,i={}){let a;const s=t.codeName;return this.cache.has(s)?a=this.cache.get(s):(a=new Ua(t),this.cache.set(s,a),await a.init()),a.get(e,i)}async get(t,e,i){const a=this.allCodeLists.get(t);if(!a)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,e,i):[]}async getCodeListInstance(t){let e;const i=this.allCodeLists.get(t);if(!i)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));if("DYNAMIC"===i.codeListType){const t=i.codeName;this.cache.has(t)?e=this.cache.get(t):(e=new Ua(i),this.cache.set(t,e),await e.init())}return e}destroy(){Array.from(this.cache.values()).forEach((t=>{t instanceof Ua&&t.destroy()}))}}),Za=t("ConfigService",class{constructor(t,e,i){this.appId=t,this.folder=e,this.tag=i,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||{}}}),ts=t("CounterService",class{static async getCounter(t,e,i){let a=t.id;if(i&&i.srfcustomtag&&(a=i.srfcustomtag),this.counterMap.has(a)){const t=this.counterMap.get(a);if(!1===t.isDestroyed)return t;this.counterMap.delete(a)}const s=(await zi(t)).createCounter(t);return await s.init(e,i),this.counterMap.set(a,s),s}static async getCounterByRef(t,e,a){const{appCounter:s}=t;if(!s)throw new i(t,ibiz.i18n.t("runtime.service.noConfiguredCounters"));return this.getCounter(s,e,a)}});ts.counterMap=new Map;var es=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:i}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(i))}async getWFLink(t,e){const i=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:a}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(i,"/usertasks/").concat(a,"/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,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(i,t)})}async wfSubmit(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(i,t)})}async wfWithdraw(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(i,t)})}async wfReassign(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepBefore(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepAfter(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(i,t)})}async wfSendBack(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(i,t)})}async wfSendCopy(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(i,t)})}async exec(t,e,i={},a={}){switch(t){case"wfstart":return this.wfStart(e,i,a);case"wfsubmit":return this.wfSubmit(e,i,a);case"reassign":return this.wfReassign(e,i,a);case"addstepbefore":return this.wfAddStepBefore(e,i,a);case"addstepafter":return this.wfAddStepAfter(e,i,a);case"sendback":return this.wfSendBack(e,i,a);case"sendcopy":return this.wfSendCopy(e,i,a);default:throw new o(ibiz.i18n.t("runtime.service.noImplemented",{methodName:t}))}}}),is=class{constructor(t){this.model=t}exportData(t,e,i,a){const s=Ha(i,this.model),n="".concat(s,"/").concat(this.model.deapicodeName2,"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:a,responseType:"blob"})}},as=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(as||{})),ss=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,i={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:st(i instanceof t?i._data:i)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const a=we(e.appDEFields||[],e.keyAppDEFieldId);if(a){const t=a.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(ibiz.i18n.t("runtime.service.noConfiguredPrimary",{codeName:e.codeName}));const s=we(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(ibiz.i18n.t("runtime.service.noConfiguredField",{codeName:e.codeName}));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:et(this.srfkey)?mt():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:i}=this,a={};Object.keys(e).forEach((t=>{a[t]={enumerable:!0,set(i){e[t]=i},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();a[s]={enumerable:!0,set(a){e[s]=i(a,t.stdDataType)},get:()=>e[s]},e[s]=i(e[s],t.stdDataType)})),Object.defineProperties(this,a)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e.srfordervalue=this.srfordervalue,e}assign(e){let i={};return e instanceof t?(i=e._data,this.srfordervalue=e.srfordervalue):i=e,Object.keys(i).forEach((t=>{void 0===i[t]&&delete i[t]})),Object.assign(this._data,i),this}convertVal(t,e){if(null==t)return t;if(et(e))return t;if(l.isNumber(e)){const e=et(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),ns=t("MethodDto",class{constructor(t,e,i,a){this.service=t,this.entity=e,this.isLocalMode=i,this.dto=a,this.dtoMap=new Map,a?(this.app=ibiz.hub.getApp(e.appId),this.fields=a.appDEMethodDTOFields||[]):this.fields=[]}async get(t,e,s=!1){if(!0===t.srfsimple&&!1===this.isLocalMode)return e=this.format(t,e);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:Qa(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const a=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=a.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const i=st(t);i[this.entity.codeName.toLowerCase()]=e.srfkey;const a={};h.parentAppDEFieldId&&(a[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,i,a)}else{if(r.entity.id===this.entity.id)throw new i(c,ibiz.i18n.t("runtime.service.subRelationships"));u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,i=[];for(let a=0;a<e.length;a++)i.push(await r.get(t,e[a],!0));n[d]=i}}break;default:throw new a(c,ibiz.i18n.t("runtime.service.unsupportedMethod",{type:c.type}))}}return{...e,...n}}async sets(t,e){if(!0===t.srfsimple&&!1===this.isLocalMode){if(e&&e.length>0){for(let i=0;i<e.length;i++)e[i]=this.format(t,e[i]);return e.map((t=>this.service.createEntity(t)))}return[]}const i=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const s=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[s])e[s]=Ja(e[s]);else{if(!a.refAppDataEntityId)return;const n=i.getDERConfig(a.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,a);n||o.service.local.clear();const r=e[s];if(r&&r.length>0){const i=e[this.entity.keyAppDEFieldId];a.refPickupAppDEFieldId&&r.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[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 i=ibiz.uiDomainManager.get(t.srfsessionid),a=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<a.length;s++){const n=a[s];if(!n.refAppDataEntityId)continue;if(0===i.getDERConfig(n.refAppDataEntityId).length){const a=await this.getFieldDto(t,n);a.entity.minorAppDERSs&&i.setDERConfig(n.refAppDataEntityId,a.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await a.calcRs(t,e)}}}format(t,e){const i={};for(let t=0;t<this.fields.length;t++){const a=this.fields[t],s=a.codeName.toLowerCase();"DTOS"===a.type&&a.listMap&&("[object Object]"===Object.prototype.toString.call(e[s])&&(i[s]=Ja(e[s])),"[object Array]"===Object.prototype.toString.call(e[s])&&(i[s]=Qa(e[s])))}return{...e,...i}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const i=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),a=we(i.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,i.id);s.isLocalMode=!0;const n=s.createMethodDto(a,{isLocalMode:!0});return this.dtoMap.set(e.codeName,n),n}}),os=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Ga(e),this.configCache=new Za(e.appId,"PSAppDataEntity",e.codeName),this.wf=new es(e),this.file=new is(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=Ie(this.model,t);if(!n)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundServiceMethod",{id:t}));const o=await Da(n);if(!o)throw new a(n,ibiz.i18n.t("runtime.service.UnsupportedServiceMethod",{methodType: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,i,a,s){const n=await this.getMethod(t);if(n)return n.exec(e,i,a,s);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}getDraft(t,e,i){return this.exec("GetDraft",t,e,i)}create(t,e,i){return this.exec("Create",t,e,i)}get(t,e,i){return this.exec("Get",t,e,i)}update(t,e,i){return this.exec("Update",t,e,i)}remove(t,e,i){return this.exec("Remove",t,e,i)}fetchDefault(t,e,i){return this.exec("FetchDefault",t,e,i)}getDraftTemp(t,e,i){return this.exec("GetDraftTemp",t,e,i)}createTemp(t,e,i){return this.exec("CreateTemp",t,e,i)}getTemp(t,e,i){return this.exec("GetTemp",t,e,i)}updateTemp(t,e,i){return this.exec("UpdateTemp",t,e,i)}removeTemp(t,e,i){return this.exec("RemoveTemp",t,e,i)}fetchTempDefault(t,e,i){return this.exec("FetchTempDefault",t,e,i)}async execAc(t,e,i,a={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,i,a);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}aiChatSse(t,e,i={},a={}){const s=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(e);return new Promise(((e,o)=>{s.net.sse("/".concat(n),{srfactag:"AIChat",...i},{headers:{"Content-Type":"application/json"},body:JSON.stringify(a),onmessage:e=>{if(e.data){const i=JSON.parse(e.data);t(i)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},i={}){const a=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return a.net.post(s,i,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const i=t[this.model.codeName.toLowerCase()],a="/".concat(this.model.deapicodeName2,"/ssechatcompletion").concat(e?"/histories":"").concat(i?"/".concat(i):"");return Ha(t,this.model)+a}newEntity(t){return t instanceof ss?t.clone():new ss(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 ns(this,this.model,null==e?void 0:e.isLocalMode,t)}}),rs=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],cs=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:et(this.srfkey)?mt():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 i=t.dataKey;this.linkProperty(e,i,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,i){const a=!i||i.isOriginField;rs.includes(t)||(a||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=st(this.$origin),i=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{i[t]=this[t]})),i}}),ds=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,i,a){const s=this.handleCustomRequestHeader(),n=await this.app.deService.exec(this.model.appDataEntityId,t,e,i,a,s);return await this.handleItemPrivilege(n.data,e),n}async handleItemPrivilege(t,e){const{enableItemPrivilege:i,appDataEntityId:a}=this.model;if(t&&i&&a){const i=await this.app.authority.getService(a);(Array.isArray(t)?t:[t]).forEach((t=>{i.setDataAccAction({srfkey:t.srfkey,srfsessionid:e.srfsessionid},t.srfdataaccaction)}))}}handleCustomRequestHeader(){const t={},{enableItemPrivilege:e}=this.model;return e&&Object.assign(t,{srfdataaccaction:!0}),t}handleResponse(t){return h(t)}toUIData(t){return new cs(t,this.dataUIMap)}}),ls=t("MDControlService",class extends ds{async fetch(t,e={}){var i;const a=(null==(i=this.model.fetchControlAction)?void 0:i.appDEMethodId)||"fetchdefault";let s=await this.exec(a,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var i;const a=(null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get";let s=await this.exec(a,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var i;const a=(null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft";let s=await this.exec(a,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var i;const a=(null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove";return await this.exec(a,t,void 0,e)}async create(t,e){var i;const a=(null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,i={}){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.headers["x-total-pages"]&&(e.totalPages=Number(e.headers["x-total-pages"]))),e.ok&&(gt(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),hs=t("DeAuthorityService",class{constructor(t){this.entityModel=t,this.dataAccActionMap=new Map}setDataAccAction(t,e){t.srfsessionid&&this.dataAccActionMap.set("".concat(t.srfsessionid,"-").concat(t.srfkey),e),this.dataAccActionMap.set(t.srfkey,e)}getDataAccAction(t){return this.dataAccActionMap.get(t)}async calcByDataAccessAction(t,e,i,a){if(a){if(!await this.calcDeDataAccAction(t,e,i))return!1}return!!await this.calcByDeMainState(t,e)}async calcMajorDataAccAction(t){const{minorAppDERSs:e}=this.entityModel;if(!e)return;const i=null==e?void 0:e.find((e=>{const i=Te(e.majorAppDataEntityId);return Object.prototype.hasOwnProperty.call(t,i)&&t[i]}));if(!i)return;const a=await ibiz.hub.getApp(t.srfappid),s=await a.authority.getService(i.majorAppDataEntityId);if(!s)return;const n=Te(i.majorAppDataEntityId);return s.getDataAccAction("".concat(t.srfsessionid,"-").concat(t[n]))||s.getDataAccAction("".concat(t[n]))}async calcDeDataAccAction(t,e,i){let a,s=!0;const{dataAccCtrlMode:n}=this.entityModel;switch(n){case 1:a=(null==e?void 0:e.srfdataaccaction)?Ya(e.srfdataaccaction):void 0;break;case 2:case 3:if(a=Ya(await this.calcMajorDataAccAction(i)),e&&e.srfdataaccaction){const t=Ya(e.srfdataaccaction);Object.assign(a,t)}}return a&&t&&!a[t]&&(s=!1),s}async calcByDeMainState(t,e={}){let i=!0;if(0===Object.keys(e).length)return i;const a=this.entityModel;if(!a.enableDEMainState||!a.demainStates)return ibiz.log.debug(ibiz.i18n.t("runtime.service.mainState",{codeName:a.codeName})),i;ibiz.log.debug(ibiz.i18n.t("runtime.service.operationIdentifier",{dataAccessAction:t}),e,a);const s=Ae(a,e);if(s){ibiz.log.debug(ibiz.i18n.t("runtime.service.matchMasterState"),s);const e=Pe(s,a);ibiz.log.debug(ibiz.i18n.t("runtime.service.masterStatePermissions"),e),i=e.includes(t)}else ibiz.log.debug(ibiz.i18n.t("runtime.service.noMatchedState")),i=!1;return ibiz.log.debug(ibiz.i18n.t("runtime.service.permissionCalculation",{dataAccessAction:t,result:i})),i}}),us=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(ibiz.i18n.t("runtime.service.noFound",{id:t}));const i=this.constructorCache.get(t);let a;a=i?await i(e):new hs(e),this.cache.set(t,a)}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 calcByNoDataAccessAction(t,e,i){if(this.enablePermission){const a=await ibiz.hub.getApp(this.appModel.appId),s=await a.getOPPriv(t,i);if(this.enablePermission&&(null==s?void 0:s.mapSysUniResCode)){if(!this.calcByResCode(s.mapSysUniResCode))return!1}else if(i){const a=await this.getService(i),s=Ya(await a.calcMajorDataAccAction(e));if(s&&t&&!s[t])return!1}}return!0}async calcByDataAccessAction(t,e,i,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(a){return(await this.getService(a)).calcByDataAccessAction(t,i,e,this.enablePermission)}return!0}}),ps=t("V7AuthService",class{get isAnonymous(){return"1"===ft(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error(ibiz.i18n.t("runtime.service.noFoundUsernamePassword")),!1;const i=await this.login(t,e);if(i){yt(u.IS_ANONYMOUS,"1",0,!0);const t=ft(u.TOKEN),e=ft(u.TOKEN_EXPIRES),i=ft(u.TOKEN_REMEMBER),a=ft(u.REFRESH_TOKEN);yt(u.TOKEN,t,0,!0),yt(u.TOKEN_EXPIRES,e,0,!0),yt(u.TOKEN_REMEMBER,i,0,!0),a&&yt(u.REFRESH_TOKEN,a,0,!0)}return i}async login(t,e,i,a){try{this.clearAuthData();const s=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:i},{},a),{data:n}=s;if(n&&n.token){const t=i?30:0;i&&yt(u.TOKEN_REMEMBER,"1",t,!0),yt(u.TOKEN,n.token,t,!0);const e=(new Date).getTime()+1e3*(n.expirein||7199);yt(u.TOKEN_EXPIRES,"".concat(e),t,!0),n.refresh_token&&yt(u.REFRESH_TOKEN,n.refresh_token,t,!0),wt(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.loginFailure"),desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),this.clearAuthData(),!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.logoutFailure"),desc:t.message||""})}return!1}async changePwd(t,e){try{return{ok:!0,result:await ibiz.net.post("/uaa/changepwd",{oldPwd:t,newPwd:e})}}catch(t){return{ok:!1,result:t}}}async extendLogin(){if(this.isAnonymous)return;const t=ft(u.TOKEN),e=ft(u.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=ft(u.TOKEN_REMEMBER),e=ft(u.REFRESH_TOKEN),i=t?30:0;let a;if(a=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),a.ok){t&&yt(u.TOKEN_REMEMBER,"1",i,!0),yt(u.TOKEN,a.data.token,i,!0);const e=(new Date).getTime()+1e3*(a.data.expirein||7199);yt(u.TOKEN_EXPIRES,"".concat(e),i,!0),a.data.refresh_token&&yt(u.REFRESH_TOKEN,a.data.refresh_token,i,!0),await this.loadAppData(),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}async refreshToken(){const t=ft(u.TOKEN_REMEMBER),e=ft(u.REFRESH_TOKEN);if(null!=e&&""!==e){const i=await ibiz.net.get("/uaa/refresh_token/".concat(e));if(i.ok){const e=t?30:0;t&&yt(u.TOKEN_REMEMBER,"1",e,!0),yt(u.TOKEN,i.data.token,e,!0);const a=(new Date).getTime()+1e3*(i.data.expirein||7199);yt(u.TOKEN_EXPIRES,"".concat(a),e,!0),i.data.refresh_token&&yt(u.REFRESH_TOKEN,i.data.refresh_token,e,!0),wt(u.IS_ANONYMOUS)}}}getAuthInfo(){const t=ft(u.TOKEN),e=!!ft(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)}clearAuthData(){wt(u.TOKEN),wt(u.TOKEN_EXPIRES),wt(u.TOKEN_REMEMBER),wt(u.REFRESH_TOKEN),wt(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0}}),ms=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return et(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),gs=t("MethodInput",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const s=i.appDEMethodInput;if(s){const i=we(e.appDEMethodDTOs||[],s.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}async format(t,e){return this.dto?this.dto.format(t,e):e}}),fs=t("MethodReturn",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const s=i.appDEMethodReturn;if(s){const i=we(e.appDEMethodDTOs||[],s.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const i=ibiz.hub.getApp(this.entity.appId),a=ibiz.uiDomainManager.get(t.srfsessionid);a&&!0!==a.state.rsInit&&(await this.dto.calcRs(t),a.calcParentRs(),a.state.rsInit=!0),a.dataChangeCompleted(),i.deService.clearTempCacheByRs({srfappid:i.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return ht(e)&&(e={}),new ss(this.entity,e)}async format(t,e){return this.dto?this.dto.format(t,e):e}}),ys=t("Method",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a,this.app=ibiz.hub.getApp(e.appId),this.input=new gs(t,e,i),this.result=new fs(t,e,i)}async request(t,e,a,s,n){const{actionType:o,requestMethod:r}=this.method;if("REMOTE"===o){const e=this.method.requestPath;let o=null;switch(r){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),a||s||{},{},n);break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),a||s,n);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),a||s||{},n);break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),a||s);break;default:throw new i(this.method,r?ibiz.i18n.t("runtime.service.requestMethods",{requestMethod:r}):ibiz.i18n.t("runtime.service.noConfiguredRequestMethod"))}return o}throw new i(this.method,ibiz.i18n.t("runtime.service.unsupportedBehaviorTypes",{actionType:o}))}mergeRequestPath(t,e){return e?"".concat(t).concat(e):"".concat(t)}calcPath(t){const e="/".concat(this.entity.deapicodeName2);return Ha(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}calcMultiData(t,e){let i="";return e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]),i.split(";")}}),ws=class{constructor(t,e,i,a){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:k(i)?i:[i],params:a}}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)}},Es=class{},vs=class extends Es{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];let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.missingConditionValue"));const t=null!=s[this.value]?s[this.value]:e[this.value];r=t,o=Qe(n[this.dstField],this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.sourceDataMissingConditionValue"));const e=t.params[this.srcParam];r=e[this.value],o=Qe(n[this.dstField],this.op,e[this.value]);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.noSupportedTime"));default:r=this.value,o=Qe(n[this.dstField],this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityLogicalConnection",{name:this.model.name,type:this.type,dstField:this.dstField}),n[this.dstField],ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},bs=class t extends Es{constructor(e){super(),this.model=e;const i=e.conds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new vs(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let s="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.connectionConditional"));for(let i=0;i<this.conds.length;i++){const n=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}const n=this.notMode?!s:s;return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityConnectionConditional",{name:this.model.name,id:this.model.id}),n),n}},Is=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new bs(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},Ds=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new Is(t)))}},Cs=class extends Ds{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDELogicParamId:s,retDELogicParamId:n}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.entityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDELogicParamId:n}),t.params[n])}},As=class extends Ds{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startupNode",{id:this.model.id}))}},Ps=class extends Ds{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:i,rawValue:s}=this.model;if(i){switch(i){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 a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedReturnType",{returnType:i}))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endNode",{id:this.model.id,returnType:i}),t.result)}}};function Ts(t,e){const{srcDELogicParamId:i,srcFieldName:s,srcValue:n,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[i],t.isEntityParam(i)&&(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=st(ibiz.env);break;case"EXPRESSION":if(!o)throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.expressionEmpty"));c=ai.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:r}))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:ai.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:d}),c),t}return c}var Ns=class extends Ds{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{let i,s;switch(e.dstDELogicParamId&&"DEBUG"===ibiz.env.logLevel&&(s=st(t.params[e.dstDELogicParamId])),e.paramAction){case"SETPARAMVALUE":i=this.setParamValue(e,t);break;case"RESETPARAM":i=this.resetParam(e,t);break;case"COPYPARAM":i=this.copyParam(e,t);break;case"BINDPARAM":i=this.bindParam(e,t);break;case"RENEWPARAM":i=this.renewParam(e,t);break;case"APPENDPARAM":i=this.appendParam(e,t);break;case"SORTPARAM":i=this.sortParam(e,t);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:e.paramAction}))}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.preparationParameter",{id:this.model.id,paramAction:e.paramAction,dstDELogicParamId:e.dstDELogicParamId}),s,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[e.dstDELogicParamId]),i})))}copyParam(t,e){const{dstDELogicParamId:i}=t,a=Ts(e,t);e.params[i]=st(a)}bindParam(t,e){const i=Ts(e,t);e.params[t.dstDELogicParamId]=i}setParamValue(t,e){const{dstFieldName:i,dstDELogicParamId:a}=t;let s=i;e.isEntityParam(a)&&(s=null==s?void 0:s.toLowerCase());const n=Ts(e,t);s?e.params[a][s]=n:e.params[a]=n}resetParam(t,e){const{dstDELogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDELogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDELogicParamId:i,dstIndex:a,srcIndex:s,srcSize:n}=t,o=Ts(e,t),r=a||0,c=s||0,d=n||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:i,dstFieldName:a,dstSortDir:s}=t,n=a.toLowerCase();e.params[i].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},xs=class extends Ds{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDELogicParamId:a,retDELogicParamId:s}=this.model,n=t.params[a],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(i,e,t.context,n);r.ok&&(t.params[s]=r.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.dataSet",{id:this.model.id,dstAppDataEntityId:i,dstAppDEDataSetId:e,retDELogicParamId:s}),t.params[s])}},Ss=class extends Ds{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const s=Ts(t,this.model);t.params[e]=s,ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.logicNodeParameterName",{id:this.model.id,dstDELogicParamId:e}),s)}},Ls=class extends Ds{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.resetParameter",{id:this.model.id,dstDELogicParamId:e}))}},Ms=class extends Ds{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.rebuildParameter",{id:this.model.id,dstDELogicParamId:e}))}},Rs=class extends Ds{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const s=Ts(t,this.model);t.params[e]=st(s),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.copyParameter",{id:this.model.id,dstDELogicParamId:e}),s)}},Os=class extends Ds{async exec(t){const{dstDELogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const n=s.toLowerCase(),o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[n]-e[n]:e[n]-t[n])),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.sortedArrayParameters",{id:this.model.id,dstFieldName:s,dstSortDir:a,dstDELogicParamId:e}),o)}},Fs=class extends Ds{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const r=Ts(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.additionalParameter",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},_s=class extends Ds{async exec(t){const{errorCode:e,errorInfo:i}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.throwsException",{id:this.model.id,errorCode:e,errorInfo:i})),new s({response:{status:e,statusText:i}})}},zs=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model;if(i.default)i.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(i.appGlobalParam)t.params[e]=st(ibiz.env);else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]={};else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.appContextParam)t.params[e]=t.parameters.context;else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.cloneParam)t.params[e]=st(t.data||{});else{if(i.envParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.environmentVariables"));if(i.fileListParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectListVariable"));if(i.fileParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectVariables"));if(i.filterParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.filterObjectVariables"));if(i.lastParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.finalDataVariables"));if(i.originEntity)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.rawDataObjects"));if(i.sessionParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.operationSessionVariables"))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.calculateEntity",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.reEstablish",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}},Vs=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 i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noScriptCode"));this.scriptFn=ai.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noConfigurationLogicNode"));t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new As(t);break;case"END":i=new Ps(t);break;case"DEACTION":i=new Cs(t);break;case"PREPAREPARAM":i=new Ns(t);break;case"DEDATASET":i=new xs(t);break;case"THROWEXCEPTION":i=new _s(t);break;case"BINDPARAM":i=new Ss(t);break;case"RESETPARAM":i=new Ls(t);break;case"COPYPARAM":i=new Rs(t);break;case"RENEWPARAM":i=new Ms(t);break;case"APPENDPARAM":i=new Fs(t);break;case"SORTPARAM":i=new Os(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new zs(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,a){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:a});const s=new ws(this.params,t,e,a);this.initLogicParams(s);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{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:i}=t;for(let a=0;a<i.length;a++){const s=i[a];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!0!==t.model.parallelOutput))break}}},ks=new Map;async function Us(t,e,i={},a={}){ks.has(t)||ks.set(t,new Vs(t)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startExecuting",{id:t.id,name:t.name}));const s=ks.get(t),n=await s.exec(e,i,a);return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endExecution",{id:t.id,name:t.name})),n}async function Bs(t,e,i,a,s){const n=await async function(t,e,i){return xe(t,await ibiz.hub.getAppDataEntity(e,i))}(t,e,i.srfappid);if(!n)throw new o(ibiz.i18n.t("runtime.deLogic.deLogicNode.noFoundEntityLogic",{dataEntityId:e,deDELogicId:t}));return Us(n,i,a,s)}async function Ws(t,e,i,a){const n=st(e),o=i?st(i):i,r=a?st(a):a;try{const e=await Us(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function Gs(t,e,i,a,s){const n=Se(t,e);if(n.length){(await Promise.all(n.map((t=>Us(t,i,a,s))))).forEach((t=>{Object.assign(a,t)}))}}async function js(t,e,i,a,s={}){if(a){if(!k(a))return Gs(t,e,i,a,s);await Promise.all(a.map((a=>Gs(t,e,i,a,s))))}}var Ks=t("DEActionMethod",class extends ys{async inputHandle(t,e){return k(e)?e:this.input.handle(t,e)}async inputFormat(t,e){const i=async e=>this.input.format(t,e);if(Array.isArray(e)){const t=[];for(let a=0;a<e.length;a++)t.push(await i(e[a]));return t}return i(e)}async exec(t,e,a,s){let n;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await js(this.entity,"change",t,e,a),"DELOGIC"===this.method.actionType){const s=xe(this.method.appDELogicId,this.entity);if(!s)throw new i(this.method,ibiz.i18n.t("runtime.service.lackEntityLogic"));n=await Ws(s,t,e,a)}else{e&&(e=this.isLocalMode?await this.inputFormat(t,e):await this.inputHandle(t,e));switch(this.method.actionTag?this.method.actionTag.toUpperCase():this.method.codeName.toUpperCase()){case"CREATE":n=await this.create(t,e,a||{},s);break;case"GET":n=await this.get(t,a,s);break;case"GETDRAFT":n=await this.getDraft(t,a,s);break;case"REMOVE":n=await this.remove(t,a);break;case"UPDATE":n=await this.update(t,e,a,s);break;case"CREATETEMP":n=await this.createTemp(t,e);break;case"GETTEMP":n=await this.getTemp(t,e);break;case"GETDRAFTTEMP":n=await this.getDraftTemp(t,a);break;case"REMOVETEMP":n=await this.removeTemp(t,e);break;case"UPDATETEMP":n=await this.updateTemp(t,e);break;default:{let i=this.calcPath(t);if(this.method.needResourceKey){let a=t[this.entity.codeName.toLowerCase()];z(a)&&(a=k(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),i="".concat(i,"/").concat(a)}const o=await this.request(i,t,e,a,s);o.data||ibiz.log.error(ibiz.i18n.t("runtime.deAction.responseDataError"),o),a&&a.srfupdateitem||(o.data=await this.result.handle(t,o.data)),n=o}}}return n.data&&await js(this.entity,"compute",t,n.data,a),n}async create(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.createBehavior"));if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const s=this.calcPath(t),n=await this.app.net.post(s,e,i,a);return n.data=await this.result.handle(t,n.data),n}async remove(t,e,i){if(this.isLocalMode){const i=this.calcMultiData(t,e);return i.length>1?this.removeBatchTemp(t,i):this.removeTemp(t,e)}const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i)}async update(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.updateBehavior"));if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const s=this.calcPath(t),n=await this.app.net.put("".concat(s,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i,a);return n.data=await this.result.handle(t,n.data),n}async get(t,e={},i={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i);return s.data=await this.result.handle(t,s.data),s}async getDraft(t,e,i){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get(this.mergeRequestPath(a,this.method.requestPath),e,i);return s.data=await this.result.handle(t,s.data),s}async createTemp(t,e){try{const i=this.createEntity(e);let a;a=k(i)?await Promise.all(i.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,i));const s=ibiz.uiDomainManager.get(t.srfsessionid);return s&&s.dataChange(),new p(a)}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 i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(i,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const a=this.service.local.delete(t,i);if(a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new p(a)}return new p(a,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,a){const s=ibiz.uiDomainManager.get(e.srfsessionid),n=s.transaction;let o=!1;!1===n.state.isOpen&&(n.open(),o=!0);try{let a=s.getDERConfigByMajor(this.entity.id);if(a.length>0){const s=this.service.local.get(e,t);a=Et(a,"removeOrder");for(const n of a){if("DER1N"!==n.rstype)throw new i(n,ibiz.i18n.t("runtime.service.deletionDeletion"));const{removeActionType:a,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=n,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=st(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(a){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const i=await l.remove(h,e);if(!1===i.ok)throw new Error(i.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 i=await l.updateTemp(h,e);if(!1===i.ok)throw new Error(i.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e=ibiz.i18n.t("runtime.service.unableDelete",{logicName:this.entity.logicName,srfmajortext:s.srfmajortext,modelLogicName:l.model.logicName,msg: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 i=this.createEntity(e);let a;if(a=k(i)?await Promise.all(i.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,i)),a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new p(a)}return new p(a,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);const a=this.service.local.get(t,i);return a?new p(a):new p(a,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){try{const i=this.service.local.deleteBatch(t,e);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}attach(t,e){const i=t.srfsessionid,a=ibiz.uiDomainManager.get(i).getDERConfig(this.entity.id);return a.length>0&&a.forEach((i=>{if(i.parentAppDEFieldId){const{majorAppDataEntityId:a,parentAppDEFieldId:s}=i,n=Te(a),o=s.toLowerCase(),r=t[n];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),Hs=class{create(t,e,i,a){return new Ks(t,e,i,a.localMode)}},Xs=t("FetchMethod",class extends ys{async exec(t,e,i,s){const n=e&&!k(e)?e:i||{};let o;if(this.isLocalMode){const e=ka.getCond(this.method),i=new Xa(t,n),a=await this.searchLocal(e,i);o=new p(a,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,n);break;case"REMOTE":{const a=this.calcPath(t);o=await this.request(a,t,e,i,s)}break;default:throw new a(this.method,ibiz.i18n.t("runtime.service.noSupportedDataSource",{dataSetType:this.method.dataSetType}))}const r=o.data||[];for(let e=0;e<r.length;e++)r[e]=await this.result.format(t,r[e]);o.data=r.map((t=>this.createEntity(t)))}return o.data&&await js(this.entity,"compute",t,o.data,n),o}async searchLocal(t,e,i=this.entity.quickSearchAppDEFieldIds){let a=this.service.local.getList();t?a.length>0&&(a=a.filter((i=>t.test(i,e)))):a.length>0&&e.query&&""!==e.query&&i&&(a=a.filter((t=>{const a=new RegExp(e.query);for(let e=0;e<i.length;e+=1){const s=t[i[e]];if(a.test(s))return!0}return!1}))),et(e.sortField)||at(e.sortField)||(a="DESC"===e.sortMode?vt(a,e.sortField):Et(a,e.sortField));const{page:s,size:n}=e,o=s*n,r=(s+1)*n-1;return a.slice(o,r).map((t=>st(t)))}async fetchCodeListSet(t,e){const{appCodeListId:a}=this.method;if(!a)throw new i(this.method,ibiz.i18n.t("runtime.service.sourceCodeTable"));const s=await this.app.codeList.get(a,t,e),{keyAppDEFieldId:n,majorAppDEFieldId:o}=this.entity,r=s.map((t=>({[n]:t.value,[o]:t.text})));return new p(r,200)}}),qs=t("AcFetchMethod",class extends Xs{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Ys=class{create(t,e,i,a){return a.acMode?new qs(t,e,i,a.localMode):new Xs(t,e,i,a.localMode)}};function Qs(){const t=new Hs;ba("DEACTION",(()=>t));const e=new Ys;ba("FETCH",(()=>e)),ba("FETCHTEMP",(()=>e))}var Js=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"timestamp,desc"};Object.assign(e,t);const i=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),e);return i.headers&&(i.headers["x-page"]&&(i.page=Number(i.headers["x-page"])),i.headers["x-per-page"]&&(i.size=Number(i.headers["x-per-page"])),i.headers["x-total"]&&(i.total=Number(i.headers["x-total"]))),et(i.data)&&(i.data=[]),i}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}async markRead(t){await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/mark_read"),{})}async batchMarkRead(){await ibiz.net.post("".concat(this.baseUrl,"/mark_all_read"),{})}async getUnreadNum(){const t=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),{page:0,size:1,sort:"timestamp,desc",searchconds:[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]});return t.headers["x-total"]?Number(t.headers["x-total"]):0}}),$s=t("MarkOpenDataService",class{constructor(){this.callbackMap=new Map,this.baseUrl="/portal/markopendata",ibiz.mc.command.markOpenData.on((t=>{const e=t.data,{entity:i,key:a}=e,s="".concat(i,"_").concat(a);this.callbackMap.has(s)&&this.callbackMap.get(s).forEach((t=>t(e)))}))}async action(t,e,i){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i))}async send(t,e,i,a){return await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i),a)}subscribe(t,e,i){const a="".concat(t,"_").concat(e),s=this.callbackMap.get(a)||[];s.push(i),this.callbackMap.set(a,s)}unsubscribe(t,e,i){const a="".concat(t,"_").concat(e),s=this.callbackMap.get(a)||[],n=s.indexOf(i);n>-1&&(s.splice(n,1),this.callbackMap.set(a,s))}}),Zs=t("UtilService",class{constructor(t){this.appUtil=t,this.stoageAppDataEntity=null,this.appDEService=null}async getAppDEService(t){if(this.appDEService)return this.appDEService;const{appId:e,name:i,stoageAppDataEntityId:a}=this.appUtil;if(e&&a){const s=ibiz.hub.getApp(e);this.stoageAppDataEntity=await ibiz.hub.getAppDataEntity(a,e);const n=await s.deService.getService(t,a);if(n)return this.appDEService=n,n;throw new Error(ibiz.i18n.t("runtime.service.noFoundStorageEntity",{name:i,stoageAppDataEntityId:a}))}throw new Error(ibiz.i18n.t("runtime.service.noExist",{name:i}))}async load(t,e,i){const a=e.clone(),s=await this.getAppDEService(a);a[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{getAppDEActionId:n}=this.appUtil;try{const t=await s.exec(n||"get",a,i);return this.handleResponse(t)}catch(t){return{}}}async save(t,e,i,a){const s=await this.getAppDEService(e),{context:n,params:o,data:r}=this.handleRequestData(t,e,i,a);return s.exec("save",n,r,o)}handleRequestData(t,e,i,a){const{modelIdAppDEFieldId:s,modelAppDEFieldId:n,appIdAppDEFieldId:o,userIdAppDEFieldId:r,stoageAppDataEntityId:c}=this.appUtil;if(!this.stoageAppDataEntity)throw new Error(ibiz.i18n.t("runtime.service.noFoundEntity",{stoageAppDataEntityId:c}));const d=e.clone(),l={};d[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{keyAppDEFieldId:h}=this.stoageAppDataEntity;return l[h]=t,l[s]=null==i?void 0:i.modelId,l[n]=JSON.stringify(a),l[o]=d.srfappid,l[r]=d.srfpersonid,l.type=null==i?void 0:i.type,l.owner_type=null==i?void 0:i.ownerType,l.owner_id=null==i?void 0:i.ownerId,{context:d,params:i,data:l}}handleResponse(t){const{data:e}=t,{modelAppDEFieldId:i}=this.appUtil;return JSON.parse(e[i])}}),tn=t("TreeNodeData",class{constructor(t,e,i){this._uuid=mt(),this._leaf=!1,this._defaultExpand=!1,this._leaf=!0===i.leaf,this._defaultExpand=!0===i.defaultExpand,this._parent=e,this._nodeType=t.treeNodeType,this._disableSelect=!0===t.disableSelect,this._changedOnly=!0===t.enableRowEditChangedOnly,this._parent&&(this._context={...this._parent._context}),i.navContext&&(this._context=Object.assign(this._context||{},i.navContext)),i.navParams&&(this._params={...i.navParams}),this._nodeId=t.id,Object.defineProperty(this,"srfnodeid",{get(){return this._id},enumerable:!0,configurable:!0})}calcIcon(t){const{sysImage:e}=t,i={};return e&&(e.cssClass&&(i.cssClass=e.cssClass),e.imagePath&&(i.imagePath=e.imagePath),e.rawContent&&(m(e.rawContent)?i.imagePath=e.rawContent:i.htmlStr=e.rawContent)),Object.values(i).length>0?i:void 0}getDiffData(){if(this._deData&&this._oldDeData){const t={};return Object.keys(this._deData).forEach((e=>{this._deData[e]===this._oldDeData[e]&&e!==this._deData.srfkeyfield||(t[e]=this._deData[e])})),t.srfkey=this._deData.srfkey,t}return this._deData}}),en=t("TreeCodeListNodeData",class extends tn{constructor(t,e,i){super(t,e,i);const{data:a}=i;this._text=a.text,this._value=a.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=Te(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),an=["_id","srfnodeid","_value","_text","_deData","clone"],sn=t("TreeDataSetNodeData",class t extends tn{constructor(e,i,a){var s,n;super(e,i,a);const{data:o}=a;this._deData=o,this._oldDeData=o.clone();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=Te(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=qa(o[e.leafFlagAppDEFieldId]):e.childCntAppDEFieldId&&(this._leaf=!qa(o[e.childCntAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),i=t.appDEFieldId.toLowerCase();c.set(e,i),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,i=t.dataItemName;e&&i?l.set(e,i):ibiz.log.error(ibiz.i18n.t("runtime.service.missingDetreeColumnId"),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 i=st(this._deData),a=new t(e,this._parent,{data:i,leaf:this._leaf,navContext:this._context,navParams:this._params,defaultExpand:this._defaultExpand});return Object.keys(this).forEach((t=>{const e=u(t);et(e)&&!an.includes(t)&&(a[t]=this[t])})),a},new Proxy(this,{set(t,e,i){const a=u(e);return et(a)?t[e]=i:t._deData[a]=i,!0},get(t,e,i){const a=u(e);return et(a)?t[e]:et(t._deData[a])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[a];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return g(t,e),e}})}calcIcon(t){let e=super.calcIcon(t)||{};const{iconAppDEFieldId:i,detreeNodeDataItems:a}=t;if(i&&this._deData[i]){const t=this._deData[i];e={},-1!==t.indexOf("fa-")?e.cssClass=t:e.imagePath=t}e&&(this._icon=e);const s=null==a?void 0:a.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 ai.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:i}=t,a=null==i?void 0:i.find((t=>"text"===t.id));return a&&(e=this.calcDataItemScript(a)),e}}),nn=t("TreeStaticNodeData",class extends tn{constructor(t,e,i){var a,s;super(t,e,i);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&&i.parentValueLevel){let t=e;for(let e=1;e<i.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==(a=this._deData)?void 0:a.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),on=t("UIMapField",class{constructor(t,e,i={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,et(i.isOriginField)||(this.isOriginField=i.isOriginField),et(i.dataType)||(this.dataType=i.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=et(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),rn=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 cn=["REGION","REGION2","REGION3","REGION4"],dn=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:i,itemStyle:a,longitudeAppDEFieldId:s,latitudeAppDEFieldId:n,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=i+t.srfkey,this._itemStyle=a,this._mapItemId=i,cn.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,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:l.has(i)?t[l.get(i)]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:l.has(i)?t[l.get(i)]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...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,i),i}})}});var ln=t("PanelData",class{constructor(t,e){const i=new pt,a={},s={};return t.forEach((t=>{var e;a[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(a,n)?a[n]?e[a[n]]=o:t[n]=o:e[n]=o,i.emit("change",n),a[n]&&a[n]!==n&&i.emit("change",a[n]),s[n]&&s[n]!==n&&i.emit("change",s[n]),!0),get:(t,s,n)=>"_evt"===s?i:a[s]?e[a[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const i=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,i),i}})}destroy(){this._evt.reset()}});var hn=t("ChartData",class{constructor(t,e,i,a){return this._seriesModelId=null==e?void 0:e.id,this._catalog=i,this._groupName=a,this._uuid=mt(),new Proxy(this,{set:(e,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...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,i),i}})}}),un=(t,e,i={})=>{let a="";if(!t||!e.detreeNodeDataItems)return a;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(a=i[s.appDEFieldId.toLowerCase()]),a},pn=t("GanttStaticNodeData",class extends nn{constructor(t,e,i,a){super(e,i,a),this._snDataItemValue=un(t.sndataItemName,e),this._beginDataItemValue=un(t.beginDataItemName,e),this._endDataItemValue=un(t.endDataItemName,e),this._prevDataItemValue=un(t.prevDataItemName,e),this._finishDataItemValue=un(t.finishDataItemName,e),this._totalDataItemValue=un(t.totalDataItemName,e)}}),mn=t("GanttDataSetNodeData",class extends sn{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=un(t.sndataItemName,e,s),this._beginDataItemValue=un(t.beginDataItemName,e,s),this._endDataItemValue=un(t.endDataItemName,e,s),this._prevDataItemValue=un(t.prevDataItemName,e,s),this._finishDataItemValue=un(t.finishDataItemName,e,s),this._totalDataItemValue=un(t.totalDataItemName,e,s)}}),gn=t("GanttCodeListNodeData",class extends en{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=un(t.sndataItemName,e,s),this._beginDataItemValue=un(t.beginDataItemName,e,s),this._endDataItemValue=un(t.endDataItemName,e,s),this._prevDataItemValue=un(t.prevDataItemName,e,s),this._finishDataItemValue=un(t.finishDataItemName,e,s),this._totalDataItemValue=un(t.totalDataItemName,e,s)}}),fn=t("MqttService",class{constructor(t,e,i){this.mqttTopic=t,this.token=e,this.appId=i,this.evt=new pt,this.options={connectTimeout:6e3,clientId:mt(),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"),i=t.default?t.default:t,{location:a}=window;this.client=i.connect("ws://".concat(a.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()}}),yn=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,i){const a=e.srfsessionid||"applocation";this.cache.has(a)||this.cache.set(a,new Map);const s=this.cache.get(a);if(!s.has(i)){const e=await ibiz.hub.getAppDataEntity(i,this.appModel.appId);if(!e)throw new o(ibiz.i18n.t("runtime.service.noFound",{id:i}));const n=t.constructorCache.get(i.toUpperCase());let r;r=n?await n(a,e):new os(a,e),s.set(i,r)}return s.get(i)}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,i=[]){if(!0===i.includes(e))return;i.push(e);const a=t.srfsessionid;if(!this.cache.has(a))return;const s=this.cache.get(a).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,i)}))}}async exec(t,e,i,a,n,o){const r=await this.getService(i,t);try{return await r.exec(e,i,a,n,o)}catch(t){throw t instanceof s&&(t.tag=i.srfviewid),t}}};yn.constructorCache=new Map;var wn=t("DEServiceUtil",yn),En=class{constructor(t){this.themeUtil=t,this.state={},this.state.themeTag=ibiz.util.theme.getTheme(),this.state.themeVars={};const{appData:e}=ibiz;if(!e)return;const i=ibiz.hub.getApp();this.config=new Za(i.appId,"customtheme","theme_config_".concat(e.context.srfuserid))}transCustomVars(t){let e="";for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e+=".".concat(i,"{").concat(a,"}")}return e}setCustomThemeParams(t,e){const i=document.getElementById(t);i&&i.remove();const a={};let s=":root.".concat(t,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))if(2===t.split(":").length){const i=t.split(":")[0],s=t.split(":")[1],n=e[t];a[i]||(a[i]=""),a[i]+="".concat(s,": ").concat(n).concat(n.endsWith(";")?"":";")}else{const i=e[t];s+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}s+="}",s+=this.transCustomVars(a);const n=document.createElement("style");n.id=t,n.type="text/css",n.innerHTML=s,document.head.appendChild(n)}clearCustomThemeParams(){this.state.themeVars={};const t=document.getElementById(this.state.themeTag);t&&t.remove()}async loadCustomTheme(){const t=await this.config.load();return t.themeTag&&(this.state.themeTag=t.themeTag,ibiz.util.theme.setTheme(this.state.themeTag)),lt(t.themeVars)&&(this.state.themeVars=t.themeVars,this.setCustomThemeParams(this.state.themeTag,t.themeVars)),t}previewCustomTheme(t,e){return t&&(this.state.themeTag=t,ibiz.util.theme.setTheme(this.state.themeTag)),lt(e)&&(this.state.themeVars=e,this.setCustomThemeParams(this.state.themeTag,e)),this.state}async saveCustomTheme(t,e){const i={themeTag:t,themeVars:e},a=await this.config.save(i);return a&&ibiz.message.success("保存自定义主题成功!"),a}async shareCustomTheme(t,e){const{appData:i}=ibiz;if(!i)return;const a={themeTag:t,themeVars:e},s=ibiz.hub.getApp(),n=Date.now(),o=new Za(s.appId,"customtheme","theme_share_".concat(i.context.srfuserid,"_").concat(n));if(await o.save(a)){const{origin:t,pathname:e}=window.location,a="shareThemeId=".concat(window.btoa(n.toString())),s="shareUserName=".concat(encodeURIComponent(i.context.srfusername)),o="shareUserId=".concat(encodeURIComponent(i.context.srfuserid)),r="/share?".concat(a,"&").concat(s,"&").concat(o);return"".concat(t).concat(e,"#").concat(r)}ibiz.message.error("分享自定义主题失败!")}async getShareTheme(t,e){const i=ibiz.hub.getApp();return new Za(i.appId,"customtheme","theme_share_".concat(t,"_").concat(e)).load()}},vn=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0],this.customUtil={}}async loadTheme(t){const e=st(t.themeParams||{}),i=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:i}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let i=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];i+="".concat(t,": ").concat(a).concat(a.endsWith(";")?"":";")}i+="}";const a=document.createElement("style");a.id=t.themeTag,a.type="text/css",a.innerHTML=i,document.head.appendChild(a)}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")}customTheme(){ibiz.overlay.drawer("IBizCustomTheme",void 0,{width:30,placement:"right"})}async initCustomTheme(t=!0){this.customUtil=new En(this),t&&await this.customUtil.loadCustomTheme()}getCustomTheme(){return this.customUtil.state}setCustomTheme(t){Object.assign(this.customUtil.state,t)}previewCustomTheme(t,e){return this.customUtil.previewCustomTheme(t,e)}resetCustomTheme(){return this.customUtil.clearCustomThemeParams()}async saveCustomTheme(t,e){return this.customUtil.saveCustomTheme(t,e)}async shareCustomTheme(t,e){return this.customUtil.shareCustomTheme(t,e)}async getShareTheme(t,e){return this.customUtil.getShareTheme(t,e)}}),bn=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn(ibiz.i18n.t("runtime.utils.uiDomain.transactionOpen")):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(ibiz.i18n.t("runtime.utils.uiDomain.currentTransaction"));this.state.isOpen=!1}},In=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new bn,this.dataModification=!1,this.id=t||mt()}dataChange(){this.dataModification=!0}dataChangeCompleted(){this.dataModification=!1}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 i=t.majorAppDataEntityId;this.rs2Map.has(i)||this.rs2Map.set(i,[]),this.rs2Map.get(i).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),Dn=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new In(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error(ibiz.i18n.t("runtime.utils.uiDomainManager.invalidInterfaceDomain",{id:t}))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),Cn=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}}),An=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new pt}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}))}getView(t){return this.stackMap.get(t)}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function Pn(t,e=!0){const i=await Promise.allSettled(t),a=[],s=[];if(i.forEach((t=>{"fulfilled"===t.status?a.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 a}var Tn={position:"fixed",zIndex:"10000"};function Nn(t,e=document.body,i=!0){const a=Sn(t);if(null==a)throw new Error(ibiz.i18n.t("runtime.utils.anime.noClone"));const s=a.cloneNode(!0);if(i)for(;s.firstChild;)s.removeChild(s.firstChild);return function(t,{width:e,height:i,boundingLeft:a,boundingTop:s}){t.style.left="".concat(a,"px"),t.style.top="".concat(s,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(i,"px"),Object.assign(t.style,Tn)}(s,xn(a)),e.appendChild(s),s}function xn(t){const e=t.offsetWidth,i=t.offsetHeight,a=window.getComputedStyle(t),s=parseFloat(a.padding),{left:n,top:o}=t.getBoundingClientRect();return{width:e,height:i,padding:s,boundingLeft:n,boundingTop:o}}function Sn(t){return"string"==typeof t?document.querySelector(t):t}var Ln={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Mn={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Rn=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],On={CSS:{},springs:{}};function Fn(t,e,i){return Math.min(Math.max(t,e),i)}function _n(t,e){return t.indexOf(e)>-1}function zn(t,e){return t.apply(null,e)}var Vn={arr:function(t){return Array.isArray(t)},obj:function(t){return _n(Object.prototype.toString.call(t),"Object")},pth:function(t){return Vn.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||Vn.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 Vn.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 Vn.hex(t)||Vn.rgb(t)||Vn.hsl(t)},key:function(t){return!Ln.hasOwnProperty(t)&&!Mn.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function kn(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Un(t,e){var i=kn(t),a=Fn(Vn.und(i[0])?1:i[0],.1,100),s=Fn(Vn.und(i[1])?100:i[1],.1,100),n=Fn(Vn.und(i[2])?10:i[2],.1,100),o=Fn(Vn.und(i[3])?0:i[3],.1,100),r=Math.sqrt(s/a),c=n/(2*Math.sqrt(s*a)),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 i=e?e*t/1e3:t;return i=c<1?Math.exp(-i*c*r)*(l*Math.cos(d*i)+h*Math.sin(d*i)):(l+h*i)*Math.exp(-i*r),0===t||1===t?t:1-i}return e?u:function(){var e=On.springs[t];if(e)return e;for(var i=1/6,a=0,s=0;;)if(1===u(a+=i)){if(++s>=16)break}else s=0;var n=a*i*1e3;return On.springs[t]=n,n}}function Bn(t){return void 0===t&&(t=10),function(e){return Math.ceil(Fn(e,1e-6,1)*t)*(1/t)}}var Wn,Gn,jn=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function i(t,e){return 3*e-6*t}function a(t){return 3*t}function s(t,s,n){return((e(s,n)*t+i(s,n))*t+a(s))*t}function n(t,s,n){return 3*e(s,n)*t*t+2*i(s,n)*t+a(s)}return function(e,i,a,o){if(0<=e&&e<=1&&0<=a&&a<=1){var r=new Float32Array(11);if(e!==i||a!==o)for(var c=0;c<11;++c)r[c]=s(c*t,e,a);return function(t){return e===i&&a===o||0===t||1===t?t:s(d(t),i,o)}}function d(i){for(var o=0,c=1;10!==c&&r[c]<=i;++c)o+=t;--c;var d=o+(i-r[c])/(r[c+1]-r[c])*t,l=n(d,e,a);return l>=.001?function(t,e,i,a){for(var o=0;o<4;++o){var r=n(e,i,a);if(0===r)return e;e-=(s(e,i,a)-t)/r}return e}(i,d,e,a):0===l?d:function(t,e,i,a,n){var o,r,c=0;do{(o=s(r=e+(i-e)/2,a,n)-t)>0?i=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(i,o,o+t,e,a)}}}(),Kn=(Wn={linear:function(){return function(t){return t}}},Gn={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,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-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 i=Fn(t,1,10),a=Fn(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-a/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/a)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Gn[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Gn).forEach((function(t){var e=Gn[t];Wn["easeIn"+t]=e,Wn["easeOut"+t]=function(t,i){return function(a){return 1-e(t,i)(1-a)}},Wn["easeInOut"+t]=function(t,i){return function(a){return a<.5?e(t,i)(2*a)/2:1-e(t,i)(-2*a+2)/2}},Wn["easeOutIn"+t]=function(t,i){return function(a){return a<.5?(1-e(t,i)(1-2*a))/2:(e(t,i)(2*a-1)+1)/2}}})),Wn);function Hn(t,e){if(Vn.fnc(t))return t;var i=t.split("(")[0],a=Kn[i],s=kn(t);switch(i){case"spring":return Un(t,e);case"cubicBezier":return zn(jn,s);case"steps":return zn(Bn,s);default:return zn(a,s)}}function Xn(t){try{return document.querySelectorAll(t)}catch(t){return}}function qn(t,e){for(var i=t.length,a=arguments.length>=2?arguments[1]:void 0,s=[],n=0;n<i;n++)if(n in t){var o=t[n];e.call(a,o,n,t)&&s.push(o)}return s}function Yn(t){return t.reduce((function(t,e){return t.concat(Vn.arr(e)?Yn(e):e)}),[])}function Qn(t){return Vn.arr(t)?t:(Vn.str(t)&&(t=Xn(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Jn(t,e){return t.some((function(t){return t===e}))}function $n(t){var e={};for(var i in t)e[i]=t[i];return e}function Zn(t,e){var i=$n(t);for(var a in t)i[a]=e.hasOwnProperty(a)?e[a]:t[a];return i}function to(t,e){var i=$n(t);for(var a in e)i[a]=Vn.und(t[a])?e[a]:t[a];return i}function eo(t){return Vn.rgb(t)?(i=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+i[1]+",1)":e:Vn.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,a){return e+e+i+i+a+a})),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(i[1],16)+","+parseInt(i[2],16)+","+parseInt(i[3],16)+",1)"}(t):Vn.hsl(t)?function(t){var e,i,a,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,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==o)e=i=a=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,n+1/3),i=d(h,l,n),a=d(h,l,n-1/3)}return"rgba("+255*e+","+255*i+","+255*a+","+c+")"}(t):void 0;var e,i}function io(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 ao(t,e){return Vn.fnc(t)?t(e.target,e.id,e.total):t}function so(t,e){return t.getAttribute(e)}function no(t,e,i){if(Jn([i,"deg","rad","turn"],io(e)))return e;var a=On.CSS[e+i];if(!Vn.und(a))return a;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+i;var o=100/s.offsetWidth;n.removeChild(s);var r=o*parseFloat(e);return On.CSS[e+i]=r,r}function oo(t,e,i){if(e in t.style){var a=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(a)||"0";return i?no(t,s,i):s}}function ro(t,e){return Vn.dom(t)&&!Vn.inp(t)&&(!Vn.nil(so(t,e))||Vn.svg(t)&&t[e])?"attribute":Vn.dom(t)&&Jn(Rn,e)?"transform":Vn.dom(t)&&"transform"!==e&&oo(t,e)?"css":null!=t[e]?"object":void 0}function co(t){if(Vn.dom(t)){for(var e,i=t.style.transform||"",a=/(\w+)\(([^)]*)\)/g,s=new Map;e=a.exec(i);)s.set(e[1],e[2]);return s}}function lo(t,e,i,a){var s=_n(e,"scale")?1:0+function(t){return _n(t,"translate")||"perspective"===t?"px":_n(t,"rotate")||_n(t,"skew")?"deg":void 0}(e),n=co(t).get(e)||s;return i&&(i.transforms.list.set(e,n),i.transforms.last=e),a?no(t,n,a):n}function ho(t,e,i,a){switch(ro(t,e)){case"transform":return lo(t,e,a,i);case"css":return oo(t,e,i);case"attribute":return so(t,e);default:return t[e]||0}}function uo(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var a=io(t)||0,s=parseFloat(e),n=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return s+n+a;case"-":return s-n+a;case"*":return s*n+a}}function po(t,e){if(Vn.col(t))return eo(t);if(/\s/g.test(t))return t;var i=io(t),a=i?t.substr(0,t.length-i.length):t;return e?a+e:a}function mo(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function go(t){for(var e,i=t.points,a=0,s=0;s<i.numberOfItems;s++){var n=i.getItem(s);s>0&&(a+=mo(e,n)),e=n}return a}function fo(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*so(t,"r")}(t);case"rect":return function(t){return 2*so(t,"width")+2*so(t,"height")}(t);case"line":return function(t){return mo({x:so(t,"x1"),y:so(t,"y1")},{x:so(t,"x2"),y:so(t,"y2")})}(t);case"polyline":return go(t);case"polygon":return function(t){var e=t.points;return go(t)+mo(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function yo(t,e){var i=e||{},a=i.el||function(t){for(var e=t.parentNode;Vn.svg(e)&&Vn.svg(e.parentNode);)e=e.parentNode;return e}(t),s=a.getBoundingClientRect(),n=so(a,"viewBox"),o=s.width,r=s.height,c=i.viewBox||(n?n.split(" "):[0,0,o,r]);return{el:a,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function wo(t,e,i){function a(i){void 0===i&&(i=0);var a=e+i>=1?e+i:0;return t.el.getPointAtLength(a)}var s=yo(t.el,t.svg),n=a(),o=a(-1),r=a(1),c=i?1:s.w/s.vW,d=i?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 Eo(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=po(Vn.pth(t)?t.totalLength:t,e)+"";return{original:a,numbers:a.match(i)?a.match(i).map(Number):[0],strings:Vn.str(t)||e?a.split(i):[]}}function vo(t){return qn(t?Yn(Vn.arr(t)?t.map(Qn):Qn(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function bo(t){var e=vo(t);return e.map((function(t,i){return{target:t,id:i,total:e.length,transforms:{list:co(t)}}}))}function Io(t,e){var i=$n(e);if(/^spring/.test(i.easing)&&(i.duration=Un(i.easing)),Vn.arr(t)){var a=t.length;2===a&&!Vn.obj(t[0])?t={value:t}:Vn.fnc(e.duration)||(i.duration=e.duration/a)}var s=Vn.arr(t)?t:[t];return s.map((function(t,i){var a=Vn.obj(t)&&!Vn.pth(t)?t:{value:t};return Vn.und(a.delay)&&(a.delay=i?0:e.delay),Vn.und(a.endDelay)&&(a.endDelay=i===s.length-1?e.endDelay:0),a})).map((function(t){return to(t,i)}))}function Do(t,e){var i=[],a=e.keyframes;for(var s in a&&(e=to(function(t){for(var e=qn(Yn(t.map((function(t){return Object.keys(t)}))),(function(t){return Vn.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),i={},a=function(a){var s=e[a];i[s]=t.map((function(t){var e={};for(var i in t)Vn.key(i)?i==s&&(e.value=t[i]):e[i]=t[i];return e}))},s=0;s<e.length;s++)a(s);return i}(a),e)),e)Vn.key(s)&&i.push({name:s,tweens:Io(e[s],t)});return i}function Co(t,e){var i;return t.tweens.map((function(a){var s=function(t,e){var i={};for(var a in t){var s=ao(t[a],e);Vn.arr(s)&&1===(s=s.map((function(t){return ao(t,e)}))).length&&(s=s[0]),i[a]=s}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}(a,e),n=s.value,o=Vn.arr(n)?n[1]:n,r=io(o),c=ho(e.target,t.name,r,e),d=i?i.to.original:c,l=Vn.arr(n)?n[0]:d,h=io(l)||io(c),u=r||h;return Vn.und(o)&&(o=d),s.from=Eo(l,u),s.to=Eo(uo(o,l),u),s.start=i?i.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=Hn(s.easing,s.duration),s.isPath=Vn.pth(n),s.isPathTargetInsideSVG=s.isPath&&Vn.svg(e.target),s.isColor=Vn.col(s.from.original),s.isColor&&(s.round=1),i=s,s}))}var Ao={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,a,s){if(a.list.set(e,i),e===a.last||s){var n="";a.list.forEach((function(t,e){n+=e+"("+t+") "})),t.style.transform=n}}};function Po(t,e){bo(t).forEach((function(t){for(var i in e){var a=ao(e[i],t),s=t.target,n=io(a),o=ho(s,i,n,t),r=uo(po(a,n||io(o)),o),c=ro(s,i);Ao[c](s,i,r,t.transforms,!0)}}))}function To(t,e){return qn(Yn(t.map((function(t){return e.map((function(e){return function(t,e){var i=ro(t.target,e.name);if(i){var a=Co(e,t),s=a[a.length-1];return{type:i,property:e.name,animatable:t,tweens:a,duration:s.end,delay:a[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!Vn.und(t)}))}function No(t,e){var i=t.length,a=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=i?Math.max.apply(Math,t.map((function(t){return a(t)+t.duration}))):e.duration,s.delay=i?Math.min.apply(Math,t.map((function(t){return a(t)+t.delay}))):e.delay,s.endDelay=i?s.duration-Math.max.apply(Math,t.map((function(t){return a(t)+t.duration-t.endDelay}))):e.endDelay,s}var xo=0;var So=[],Lo=function(){var t;function e(i){for(var a=So.length,s=0;s<a;){var n=So[s];n.paused?(So.splice(s,1),a--):(n.tick(i),s++)}t=s>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ro.suspendWhenDocumentHidden&&(Mo()?t=cancelAnimationFrame(t):(So.forEach((function(t){return t._onDocumentVisibility()})),Lo()))})),function(){t||Mo()&&Ro.suspendWhenDocumentHidden||!(So.length>0)||(t=requestAnimationFrame(e))}}();function Mo(){return!!document&&document.hidden}function Ro(t){void 0===t&&(t={});var e,i=0,a=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=Zn(Ln,t),i=Zn(Mn,t),a=Do(i,t),s=bo(t.targets),n=To(s,a),o=No(n,i),r=xo;return xo++,to(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(){i=0,a=l(c.currentTime)*(1/Ro.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,i=c.animations,a=i.length;e<a;){var s=i[e],n=s.animatable,o=s.tweens,r=o.length-1,d=o[r];r&&(d=qn(o,(function(e){return t<e.end}))[0]||d);for(var l=Fn(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=[],g=d.to.numbers.length,f=void 0,y=0;y<g;y++){var w=void 0,E=d.to.numbers[y],v=d.from.numbers[y]||0;w=d.isPath?wo(d.value,h*E,d.isPathTargetInsideSVG):v+h*(E-v),p&&(d.isColor&&y>2||(w=Math.round(w*p)/p)),m.push(w)}var b=u.length;if(b){f=u[0];for(var I=0;I<b;I++){u[I];var D=u[I+1],C=m[I];isNaN(C)||(f+=D?C+D:C+" ")}}else f=m[0];Ao[s.type](n.target,s.property,f,n.transforms),s.currentValue=f,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function g(t){var h=c.duration,g=c.delay,f=h-c.endDelay,y=l(t);c.progress=Fn(y/h*100,0,100),c.reversePlayback=y<c.currentTime,e&&function(t){if(c.reversePlayback)for(var i=n;i--;)u(t,e[i]);else for(var a=0;a<n;a++)u(t,e[a])}(y),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),y<=g&&0!==c.currentTime&&p(0),(y>=f&&c.currentTime!==h||!h)&&p(h),y>g&&y<f?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(y)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Fn(y,0,h),c.began&&m("update"),t>=h&&(a=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(i=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 i=n=e.length;i--;)c.children[i].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 Po(t,e),c},c.tick=function(t){s=t,i||(i=s),g((s+(a-i))*Ro.speed)},c.seek=function(t){g(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,So.push(c),h(),Lo())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){Fo(vo(t),c)},c.reset(),c.autoplay&&c.play(),c}function Oo(t,e){for(var i=e.length;i--;)Jn(t,e[i].animatable.target)&&e.splice(i,1)}function Fo(t,e){var i=e.animations,a=e.children;Oo(t,i);for(var s=a.length;s--;){var n=a[s],o=n.animations;Oo(t,o),o.length||n.children.length||a.splice(s,1)}i.length||a.length||e.pause()}Ro.version="3.2.1",Ro.speed=1,Ro.suspendWhenDocumentHidden=!0,Ro.running=So,Ro.remove=function(t){for(var e=vo(t),i=So.length;i--;){Fo(e,So[i])}},Ro.get=ho,Ro.set=Po,Ro.convertPx=no,Ro.path=function(t,e){var i=Vn.str(t)?Xn(t)[0]:t,a=e||100;return function(t){return{property:t,el:i,svg:yo(i),totalLength:fo(i)*(a/100)}}},Ro.setDashoffset=function(t){var e=fo(t);return t.setAttribute("stroke-dasharray",e),e},Ro.stagger=function(t,e){void 0===e&&(e={});var i=e.direction||"normal",a=e.easing?Hn(e.easing):null,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Vn.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=io(l?t[1]:t)||0,m=e.start||0+(l?h:0),g=[],f=0;return function(t,e,y){if(r&&(o=0),c&&(o=(y-1)/2),d&&(o=y-1),!g.length){for(var w=0;w<y;w++){if(s){var E=c?(s[0]-1)/2:o%s[0],v=c?(s[1]-1)/2:Math.floor(o/s[0]),b=E-w%s[0],I=v-Math.floor(w/s[0]),D=Math.sqrt(b*b+I*I);"x"===n&&(D=-b),"y"===n&&(D=-I),g.push(D)}else g.push(Math.abs(o-w));f=Math.max.apply(Math,g)}a&&(g=g.map((function(t){return a(t/f)*f}))),"reverse"===i&&(g=g.map((function(t){return n?t<0?-1*t:-t:Math.abs(f-t)})))}return m+(l?(u-h)/f:h)*(Math.round(100*g[e])/100)+p}},Ro.timeline=function(t){void 0===t&&(t={});var e=Ro(t);return e.duration=0,e.add=function(i,a){var s=So.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&So.splice(s,1);for(var r=0;r<n.length;r++)o(n[r]);var c=to(i,Zn(Mn,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Vn.und(a)?d:uo(a,d),o(e),e.seek(c.timelineOffset);var l=Ro(c);o(l),n.push(l);var h=No(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},Ro.easing=Hn,Ro.penner=Kn,Ro.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var _o=Ro,zo={duration:1e3,loop:!1,easing:"easeInOutSine"};function Vo(t,e){const i={};if(e.complete&&t.complete){const a=e.complete,s=t.complete;i.complete=t=>{a(t),s(t)}}return{...t,...e,...i}}function ko(t,e,i={}){const{left:a,top:s}=t.getBoundingClientRect(),{left:n,top:o}=e.getBoundingClientRect(),r=n-a,c=o-s;return new Promise((e=>{const a=Vo({targets:t,translateX:r,translateY:c,...zo,complete:()=>{e(!0)}},i);_o(a)}))}var Uo=t("AnimeUtil",class{async movePoint(t,e,i={}){const a=Sn(e);if(!a)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistEndpointElement")),!1;const s=Nn(t,document.body);if(!s)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistAnimationElement")),!1;const{padding:n,width:o,height:r}=xn(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,i);const d=await ko(s,a,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,i={}){return ko(t,e,i)}resize(t,e={}){return function(t,e={}){return new Promise((i=>{const a=Vo({scale:[1,.8,1],targets:t,...zo,complete:()=>{i(!0)}},e);_o(a)}))}(t,e)}async moveAndResize(t,e,i={}){const a=await this.movePoint(t,e,i);return a&&await this.resize(e,{duration:500}),a}}),Bo=t("FileUtil",class{calcOSSCatUrl(t,e,i){var a;let s="".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId).concat(t);const n=ibiz.hub.getApp(e.srfappid),o=i||n.model.defaultOSSCat||(null==(a=n.model.userParam)?void 0:a.DefaultOSSCat);return s=s.replace("/{cat}",o?"/".concat(o):""),s}calcFileUpDownUrl(t,e,i={},a={}){const{uploadParams:s,exportParams:n,osscat:o}=a;let r=this.calcOSSCatUrl(ibiz.env.uploadFileUrl,t,o),c=this.calcOSSCatUrl("".concat(ibiz.env.downloadFileUrl,"/%fileId%"),t,o),d={},l={};return s&&(d=pe(s,i,e,t)),n&&(l=pe(n,i,e,t)),r+=At.stringify(d,{addQueryPrefix:!0}),c+=At.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(!i.data)throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"));{let t=ibiz.util.file.getFileName(i);e&&(t=e),c(i.data,t)}}async fileUpload(t,e,i){const a=new FormData;a.append("file",e);const s=await ibiz.net.axios({url:t,method:"post",headers:i,data:a});if(200!==s.status)throw new o(ibiz.i18n.t("runtime.utils.fileUtil.fileUploadFailed"));return s.data}getFileName(t){let e="";const i=t.headers["content-disposition"];if(!i)return e;const a=At.parse(i,{delimiter:";"});return a&&a.filename&&(e=a.filename),e.startsWith('"')&&e.endsWith('"')&&(e=e.substring(1,e.length-1)),e}async chooseFileAndUpload(t,e,i,a={}){const{accept:s,multiple:n}=a,o=ibiz.util.file.calcFileUpDownUrl(t,e,i),r=await ibiz.util.file.chooseFile(s,n),c=[],d={Authorization:"Bearer ".concat(ft(u.TOKEN))};for(let t=0;t<r.length;t++){const e=await ibiz.util.file.fileUpload(o.uploadUrl,r[t],d);c.push(e)}return Promise.all(c)}chooseFile(t="",e=!1){return new Promise((i=>{const a=document.createElement("input");a.type="file",a.accept=t,a.multiple=e,a.webkitdirectory=!1,a.addEventListener("change",(t=>{i(t.target.files)})),document.body.appendChild(a),a.click(),document.body.removeChild(a)}))}}),Wo=t("ShortCutUtil",class{constructor(){this.$ShortCut={items:[],mode:"vertical"},this.evt=new pt,this.initShortCut()}get data(){return this.$ShortCut.items}get mode(){return this.$ShortCut.mode}initShortCut(){const t=window.localStorage.getItem("IBizShortCut");t&&(this.$ShortCut=JSON.parse(t))}saveShortCut(){this.evt.emit("change",[...this.$ShortCut.items]),window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}setShortCutMode(t){this.$ShortCut.mode=t,window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}onChange(t){this.evt.on("change",t)}offChange(t){this.evt.off("change",t)}async calcShortCutKey({context:t,appViewId:e}){const i=await ibiz.hub.config.view.get(e);let a="".concat(t.srfappid,"-").concat(t.srfuserid,"-").concat(e);if(i.appDataEntityId){const e=Te(i.appDataEntityId);a+="-".concat(e,"-").concat(t[e])}return a}addShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t.key));e>-1?this.$ShortCut.items.splice(e,1,t):this.$ShortCut.items.push(t),this.saveShortCut()}removeShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t));e>-1&&(this.$ShortCut.items.splice(e,1),this.saveShortCut())}changeIndex(t,e){const{length:i}=this.$ShortCut.items;if(e<0||e>=i||t<0||t>=i)throw new Error(ibiz.i18n.t("runtime.utils.shortCut.invalidIndexNewIndex",{newIndex:t,oldIndex:e,length:i}));const a=this.$ShortCut.items.splice(e,1)[0];this.$ShortCut.items.splice(t,0,a),this.saveShortCut()}isExist(t){return this.$ShortCut.items.findIndex((e=>e.key===t))>=0}}),Go=t("BIReportUtil",class{async openDesignPage(t,e,i){i.mode||(i.mode="DATA");const a=st(t);let s={};if("DATA"===i.mode){const t=ibiz.hub.getApp(ibiz.env.appId);try{Object.assign(a,{pssysbireport:i.reportId});const n=await t.deService.exec("pssysbireport","get",a,e);n.data&&(s=await this.translateDEReportToConfig(n.data))}catch(t){throw new o(t.message)}}else"UI"===i.mode&&(s=i.reportPanel.generator.config);const n=ibiz.overlay.createModal("iBizBIReportDesign",{dismiss:t=>n.dismiss(t),context:a,viewParams:e,config:s},{width:"90%",height:"90%",footerHide:!0});n.present();return await n.onWillDismiss()}async translateDEReportToConfig(t){const e={};let i={};t.bireportuimodel&&(i=JSON.parse(t.bireportuimodel)),e.selectChartType=(null==i?void 0:i.selectChartType)||"NUMBER",e.reportTag="bi_report",e.selectCubeId=t.pssysbicubeid,e.selectedSchemeId=t.pssysbischemeid;const a={},s=(null==i?void 0:i.extendDimension)||[];t.pssysbireportitems&&t.pssysbireportitems.length>0&&t.pssysbireportitems.forEach((t=>{var e,i;if("MEASURE"===t.birepitemtype&&(a.measure||(a.measure=[]),a.measure.push({pssysbischemeid:t.pssysbischemeid,pssysbicubemeasureid:t.pssysbicubemeasureid,pssysbicubeid:t.pssysbicubeid,codename:null==(e=t.pssysbicubemeasureid)?void 0:e.split(".").pop(),pssysbicubemeasurename:t.pssysbicubemeasurename})),"DIMENSION"===t.birepitemtype){a.dimension||(a.dimension=[]),s.length>0&&!a.extendDimension&&(a.extendDimension=[]);const e=null==(i=t.pssysbicubedimensionid)?void 0:i.split(".").pop();s.includes(e)?a.extendDimension.push({pssysbischemeid:t.pssysbischemeid,pssysbicubedimensionid:t.pssysbicubedimensionid,pssysbicubeid:t.pssysbicubeid,codename:e,pssysbicubedimensionname:t.pssysbicubedimensionname}):a.dimension.push({pssysbischemeid:t.pssysbischemeid,pssysbicubedimensionid:t.pssysbicubedimensionid,pssysbicubeid:t.pssysbicubeid,codename:e,pssysbicubedimensionname:t.pssysbicubedimensionname})}}));const n={caption:t.pssysbireportname};return Object.keys(a).length>0&&Object.assign(n,{data:a}),i.style&&Object.assign(n,{style:i.style}),i.filter&&(n.data.filter=i.filter),e.propertyData=n,e}async translateReportPanelToConfig(t){const e={},i={},{appDEReport:a}=t,s={data:i};e.reportTag=a.id;const n=a.appBISchemeId.split(".").pop();e.selectedSchemeId=n;const{name:o,appBICubeId:r,appBIReportDimensions:c,appBIReportMeasures:d,reportUIModel:l}=a.appBIReport;s.caption=o,e.selectCubeId="".concat(n,".").concat(r);let h=[];if(l){const t=JSON.parse(l);e.selectChartType=t.selectChartType,s.style=t.style,s.data.filter=t.filter,t.extendDimension&&(h=t.extendDimension)}else e.selectChartType="NUMBER";return d&&d.length>0&&d.forEach((t=>{i.measure||(i.measure=[]),i.measure.push({pssysbischemeid:n,pssysbicubemeasureid:"".concat(n,".").concat(r,".").concat(t.measureTag),pssysbicubemeasurename:t.measureName,pssysbicubeid:"".concat(n,".").concat(r),codename:t.measureTag})})),c&&c.length>0&&c.forEach((t=>{i.dimension||(i.dimension=[]),h.length>0&&!i.extendDimension&&(i.extendDimension=[]),h.includes(t.dimensionTag)?i.extendDimension.push({pssysbischemeid:n,pssysbicubedimensionid:"".concat(n,".").concat(r,".").concat(t.dimensionTag),pssysbicubedimensionname:t.dimensionName,pssysbicubeid:"".concat(n,".").concat(r),codename:t.dimensionTag,pscodelistid:t.appCodeListId}):i.dimension.push({pssysbischemeid:n,pssysbicubedimensionid:"".concat(n,".").concat(r,".").concat(t.dimensionTag),pssysbicubedimensionname:t.dimensionName,pssysbicubeid:"".concat(n,".").concat(r),codename:t.dimensionTag,pscodelistid:t.appCodeListId})})),e.propertyData=s,e}async translateDataToAppBIReport(t){const{reportTag:e,selectChartType:i,selectCubeId:a,caption:s,data:n,style:o}=t,r=ibiz.hub.getApp(ibiz.env.appId),c={pssysbireportitems:[],pssysbischemeid:a.split(".")[0],pssysbicubeid:a,bireportuimodel:JSON.stringify({selectChartType:i,style:o,filter:null==n?void 0:n.filter}),pssysappid:r.model.codeName,bireporttag:e,pssysbireportname:s,validflag:1};if(n&&n.measure&&n.measure.forEach((t=>{const e={birepitemtype:"MEASURE",pssysbischemeid:t.pssysbischemeid,pssysbicubemeasureid:t.pssysbicubemeasureid,pssysbicubeid:t.pssysbicubeid,pssysbicubename:t.pssysbicubename,pssysbicubemeasurename:t.pssysbicubemeasurename,validflag:1};c.pssysbireportitems.push(e)})),n&&n.dimension&&n.dimension.forEach((t=>{const e={birepitemtype:"DIMENSION",pssysbischemeid:t.pssysbischemeid,pssysbicubedimensionid:t.pssysbicubedimensionid,pssysbicubeid:t.pssysbicubeid,pssysbicubename:t.pssysbicubename,pssysbicubedimensionname:t.pssysbicubedimensionname,validflag:1};c.pssysbireportitems.push(e)})),n&&n.extendDimension){const t=[];n.extendDimension.forEach((e=>{t.push(e.codename);const i={birepitemtype:"DIMENSION",pssysbischemeid:e.pssysbischemeid,pssysbicubedimensionid:e.pssysbicubedimensionid,pssysbicubeid:e.pssysbicubeid,pssysbicubename:e.pssysbicubename,pssysbicubedimensionname:e.pssysbicubedimensionname,validflag:1};c.pssysbireportitems.push(i)}));const e=JSON.parse(c.bireportuimodel);c.bireportuimodel=JSON.stringify({...e,extendDimension:t})}return c}});var jo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},s={}){const n=st(e);n.srfsimple&&delete n.srfsimple;const r=await ibiz.hub.config.view.get(t);if(!r)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t}));if((n.srfkey||0===i.srfuf)&&r.appDataEntityId){const t=Te(r.appDataEntityId);n.srfkey&&(n[t]=n.srfkey,n.srfkey=void 0),0===i.srfuf&&(n[t]=void 0,delete i.srfuf)}if(r.redirectView){return Xe(await ibiz.hub.getAppView(t),n,i,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,i),{ok:!0}):this.openIndexViewTab(r,n,i,s);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,n,i);case"POPUP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopup"));case"POPUPMODAL":return this.openModal(r,n,i);case"POPUPAPP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopupapp"));case"POPOVER":return this.openPopover(r,n,i,s);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,n,i);case"USER":return this.openUserCustom(r,n,i);default:return this.openIndexViewTab(r,n,i)}}openIndexViewTab(t,e,i={},a={}){return ibiz.openView.root(t.id,e,i,a)}openIndexViewTabByModal(t,e,i={}){return ibiz.openView.rootByModal(t.id,e,i)}async openModal(t,e,i={}){return ibiz.openView.modal(t.id,e,i)}async openPopover(t,e,i={},a={}){const{event:s,modalOption:n}=a;if(!s)throw new o(ibiz.i18n.t("runtime.command.app.missingEvent"));return ibiz.openView.popover(t.id,s,e,i,{...n})}async openDrawer(t,e,i={}){return ibiz.openView.drawer(t.id,e,i)}async openUserCustom(t,e,i={}){return ibiz.openView.custom(t.id,e,i)}};jo.TAG="ibiz.app-view.open";var Ko=t("OpenAppViewCommand",jo),Ho=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},s={}){const n=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!n)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationFunction",{appFuncId:t}));const{navigateContexts:r,navigateParams:c,appFuncType:d}=n,l=e.clone();Object.assign(l,pe(r,i,e));const h=pe(c,i,e);switch(Object.assign(h,i),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 a(n,ibiz.i18n.t("runtime.command.app.noFindApplicationFunctionYype",{appFuncType:d}))}}async openAppView(t,e,i,a){if(!t.appViewId)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t.appViewId}));return ibiz.commands.execute(Ko.TAG,t.appViewId,e,i,a)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,i){throw ibiz.log.warn("openPdAppFunc",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}executeJavaScript(t,e,i){throw ibiz.log.warn("executeJavaScript",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}custom(t,e,i){throw ibiz.log.warn("custom",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}};Ho.TAG="ibiz.app-func.exec";var Xo=t("AppFuncCommand",Ho);function qo(){new Xo,new Ko}var Yo=t("Application",class{constructor(t,e){this.model=t,this.subAppRef=e,this.deName2DeCodeName=new Map,this.appBISchemeMap=new Map,this.appBICubeMap=new Map,this.appBIReportMap=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(e&&e.serviceId?e.serviceId:this.appId)}),this.configCache=new Za(this.appId,"PSSysApp",t.codeName),this.deService=new wn(t),this.codeList=new $a(t),this.authority=new us(t)}get appId(){return this.model.appId||ibiz.env.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}getAppUtil(t,e="DEFAULT"){const i=this.model.appUtils||[];let a;return a="CUSTOM"===e?i.find((e=>e.utilTag===t)):i.find((e=>e.id===t)),a}async getUIAction(t){const[,e]=t.split("@");if(e){const i=(await ibiz.hub.getAppDataEntity(e,this.appId)).appDEUIActions.find((e=>e.id===t));if(i)return i}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var i,a;let s=null==(i=this.model.deopprivs)?void 0:i.find((e=>e.name===t));if(!s&&e){s=null==(a=(await ibiz.hub.getAppDataEntity(e,this.appId)).deopprivs)?void 0:a.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.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 fn(ibiz.appData.mqtttopic,y(),this.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}destroy(){this.codeList.destroy()}}),Qo=class{parse(t){return t}},Jo=class{constructor(){this.appMenu=new Qo}},$o=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t=""){let e="";if(t&&-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}getCustomOption(t){var e;const{appViewParams:i,userParam:a}=t;let s=null==(e=null==i?void 0:i.find((t=>"modaloption"===t.id)))?void 0:e.value;!s&&a&&(s=a.modalOption);let n={};if(s)try{n=JSON.parse(s)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.hub.failedParse",{error:t}))}return{modalOption:n}}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const i=this.calcAppViewId(t);this.viewConfigs.set(i,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(ibiz.i18n.t("runtime.hub.noExist",{id: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,...this.getCustomOption(t)})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},Zo=class{constructor(){this.view=new $o}},tr=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(tr||{})),er=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(er||{})),ir=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(ir||{})),ar=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t.DRAFT="DRAFT",t))(ar||{})),sr=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(ibiz.i18n.t("runtime.controller.utils.counter.decrement"));this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),nr=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new sr(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),or=t("CTXState",class{}),rr=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new pt(3e3),this.controllersMap=new Map,this.state=new or}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}}),cr=t("ActivityCounter",class extends sr{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())}}),dr=t("UIActionButtonState",class{constructor(t,e,i){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=i,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await Me(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:i,actionTarget:a,uiactionMode:s,uiactionTag:n}=t;this.dataAccessAction=e,this.actionTarget=a,1===i?this.noPermissionHidden=!1:6===i&&(this.visible=!1),[2,6].includes(i)&&this.dataAccessAction&&(this.visible=!1),(a&&"NONE"!==a||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0,"SINGLEKEY"!==a&&"MULTIKEY"!==a||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e,i){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.actionTarget&&"NONE"===this.actionTarget?this.permitted=await a.authority.calcByNoDataAccessAction(this.dataAccessAction,t,i||this.appDeName):(this.appDeName&&i&&!i.includes(this.appDeName)&&ibiz.log.warn(ibiz.i18n.t("runtime.controller.utils.buttonState.isFinitenconsistency",{uiActionId:this.uiActionId,appDeName:this.appDeName,appDeId:i})),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e,i||this.appDeName))}async update(t,e,i){this.isInit||await this.init(),await this.calcPermission(t,e,i),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!e||this.noKeyDisabled&&!e.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),lr=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,i){await Promise.all(this.children.map((a=>a.update(t,e,i))))}async init(){await Promise.all(this.children.map((t=>t.init())))}}),hr=t("QXEventEx",class extends pt{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((i=>{i(t,...e)}))}async asyncEmit(t,...e){const i=super.asyncEmit(t,...e),a=this.anyEventFns.map((i=>i(t,...e))),s=Promise.all(a),n=await i,o=await s;return n.concat(...o)}reset(){super.reset(),bt(this.anyEventFns)}}),ur=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new hr}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 pr(t){return window.location.hash.split("/").length>2*t+2}function mr(t,e){return(!et(t)&&""!==t||!et(e)&&""!==e)&&t!==e}function gr(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof cs&&(e=e.getOrigin()),e}function fr(t,e,i){const a=[];return t.forEach((t=>{const{valueRuleType:s}=t,n=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&n)"REG"===n.ruleType||"REGEX"===n.ruleType?a.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):"SCRIPT"===n.ruleType&&a.push({validator:(t,e,i,a)=>{if(!e)return!0;try{ai.execScriptFn({rule:t,value:e,callback:i,source:a},n.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=i||e;a.push({validator:(e,i,a,s)=>{if(ht(s[t]))return!0;const{isPast:n,infoMessage:c}=si(t,s,r.groupCond);return n||a(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),a}function yr(t){const e=[],{maxLength:i,minLength:a}=t,{maxValue:s,minValue:n}=t;return i&&e.push({validator:(t,e,a)=>{if(et(e)||!(e.length>i))return!0;a(new Error(ibiz.i18n.t("runtime.controller.utils.valueRule.length",{maxLength:i,length:e.length})))}}),a&&e.push({validator:(t,e,i)=>{if(et(e)||!(e.length<a))return!0;i(new Error("内容长度必须大于等于".concat(a,",当前长度为").concat(e.length)))}}),et(s)||e.push({validator:(t,e,i)=>{if(!(!et(e)&&It(e)&&e>s))return!0;i(new Error("值必须小于等于".concat(s)))}}),et(n)||e.push({validator:(t,e,i)=>{if(!(!et(e)&&It(e)&&e<n))return!0;i(new Error("值必须大于等于".concat(n)))}}),e}var wr=t("ValueExUtil",class{static mergeDefault(t){return rt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(et(e)||""===e)return"";const{valueType:i,objectNameField:a,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(i)){if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.valueEx.objectNameField"));const t=a.toLowerCase();return"OBJECTS"===i?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===i?e.join(s):"".concat(e)}});function Er(t,e){var i;const{name:s,valueType:n,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(et(n)&&et(r))return;if("RESET"===n)return null;const u=d[s];if(!ct(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 Pt().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(i=ibiz.appData)?void 0:i.context))throw new o(ibiz.i18n.t("runtime.controller.utils.valueDefault.noExist"));return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return mt();default:throw new a({},ibiz.i18n.t("runtime.controller.utils.valueDefault.nosupported",{valueType:n}))}}}var vr="asyncimportdata2",br="importdata2";async function Ir(t,e,i,a){ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")});const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(vr);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=Ha(a,e)+n}const o=await ibiz.net.request(n,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});var r;await(r=o.data.asyncacitonid,new Promise((t=>{const e=i=>{const a=i.messageid||i.data.asyncacitonid;if(r!==a)return;const s=i.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","DATAIMPORT")}async function Dr(t,e,i,a){const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(br);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=Ha(a,e)+n}const o={isAsync:!1};try{const t=await ibiz.net.request(n,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED","DATAIMPORT"),Object.assign(o,t.data)}catch(t){t instanceof Error&&(o.errorMessage=t.message)}return o}async function Cr(t){const e={isAsync:ibiz.env.enableMqtt};if(ibiz.env.enableMqtt)Ir(t.selectedFile,t.appDataEntity,t.dataImport,t.context);else{const i=await Dr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);Object.assign(e,i)}return e}async function Ar(t,e,i){if(!ibiz.util.getExcelUtil)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.noExist"));const a=await ibiz.util.getExcelUtil();if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.loadError"));try{return a.exportJsonToExcel({header:t,data:e,filename:i,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function Pr(t){var e;const i=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),a=null==(e=i.appDEDataImports)?void 0:e.find((e=>e.id===t.deDataImportId));if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.importData"));return{deDataImport:a,appDataEntity:i}}async function Tr(t){const{deDataImportId:e,appDataEntityId:i,context:a,params:s}=t,n=t.dataImportViewId||"AppDataUploadView";let o=null;try{o=await ibiz.hub.config.view.get(n)}catch(e){if(t.dataImportViewId)throw e}if(o)return a.srfappdataentityid=i,a.srfdedataimportid=e,ibiz.commands.execute(Ko.TAG,o.id,a,s,{openMode:"POPUPMODAL"});const{deDataImport:r,appDataEntity:c}=await Pr({deDataImportId:e,appDataEntityId:i,appId:a.srfappid}),d=r.enableCustomized?"DataImport2":"DataImport",l=ibiz.overlay.createModal(d,{dismiss:()=>l.dismiss(),dataImport:r,appDataEntity:c,context:a,params:s},{width:"auto",placement:"center"});l.present(),await l.onWillDismiss()}async function Nr(t,e,i){let a="/".concat(t.codeName2.toLowerCase(),"/importtemplate");if((null==e?void 0:e.codeName)&&(a+="?srfimporttag=".concat(e.codeName)),i){a=Ha(i,t)+a}const s=await ibiz.net.request(a,{responseType:"blob"});if(200===s.status){const t=ibiz.util.file.getFileName(s),e=new Blob([s.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}async function xr(t){return new Promise((e=>{E({accept:".xlsx, .xls",multiple:!1,onSelected:async i=>{const a=await Cr({selectedFile:i[0],appDataEntity:t.appDataEntity,dataImport:t.dataImport,context:t.context});e(a)},onCancel:()=>{e({cancel:!0})}})}))}async function Sr(t){var e;let i="/".concat(t.appDataEntity.codeName2.toLowerCase());if(t.context){i=Ha(t.context,t.appDataEntity)+i}const a="".concat(i,"/asyncimportdata2"),s={srfossfileid:t.fileId,srfimportschemaid:t.schemaId},n=(null==(e=t.dataImport)?void 0:e.id)||t.appDataEntity.defaultAppDEDataImportId;n&&Object.assign(s,{srfimporttag:n}),await ibiz.net.request(a,{method:"get",params:s}),ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")})}function Lr(t){var e,i,a,s;let n={system_tag:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,data_entity_tag:null==(i=t.appDataEntity)?void 0:i.codeName,import_tag:(null==(a=t.dataImport)?void 0:a.id)||(null==(s=t.appDataEntity)?void 0:s.defaultAppDEDataImportId),owner_type:"PERSONAL"};return n=it(n,t.data),n}async function Mr(t,e){const i=ibiz.hub.getApp(e.srfappid),a=await ibiz.hub.getAppDataEntity(t,e.srfappid);let s="/jsonschema/".concat(a.name);0===a.dynaSysMode&&ibiz.appData&&(s+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await i.net.get(s)).data}var Rr=t("VIEW_MSG_PREFIX","VIEW_MSG"),Or=t("ViewMsgController",class t{constructor(t,e=""){this.msgGroupId=t,this.viewMsgMap=new Map,this.tag="",this.tag="".concat(Rr,"_").concat(e)}async init(t){var e,i;const a=ibiz.hub.getApp(t.srfappid).model,s=null==(e=a.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new o(ibiz.i18n.t("runtime.controller.utils.viewMsg.message",{msgGroupId:this.msgGroupId}));this.msgGroup=s;const n=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(i=a.appViewMsgs)||i.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(ibiz.i18n.t("runtime.controller.utils.viewMsg.noFound",{message:n.join(",")}))}getDeFieldName(t,e){var i,a;if(e)return null==(a=null==(i=Le(t,e))?void 0:i.name)?void 0:a.toLowerCase()}static async fetchDataSet(t,e,a){const{appDataEntityId:s,appDEDataSetId:n}=t;if(!n)throw new i(t,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfigured"));const o=await ibiz.hub.getApp(e.srfappid).deService.exec(s,n,e,a);return o.data.length?o.data:[]}getMsgRemoveModeStorage(t){return 1!==t.removeMode?null:localStorage.getItem(t.key)}setMsgRemoveModeStorage(t){1===t.removeMode&&localStorage.setItem(t.key,"1")}async calcViewMsgVisible(t,e,i,a){const{enableMode:s,dataAccessAction:n,appDataEntityId:o,appId:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===s&&n){const t=ibiz.hub.getApp(i.srfappid);return!!await t.authority.calcByDataAccessAction(n,i,e,o)}if("DELOGIC"===s&&o&&r&&c){const t=xe(c,await ibiz.hub.getAppDataEntity(o,r));if(t){return!!(await Ws(t,i,e,a)).data}}if("SCRIPT"===s&&d){return!!ai.execScriptFn({data:e,context:i,params:a},d,{isAsync:!1,singleRowReturn:!0})}return!0}async calcViewMessages(t,e){const i=this.msgGroup.appViewMsgGroupDetails,a=[];return(null==i?void 0:i.length)&&await Promise.all(i.map((async i=>{const s=this.viewMsgMap.get(i.appViewMsgId);if(1===s.dynamicMode){const n=await this.calcDynaMsgs(i,t,e);await Promise.all(n.map((async i=>{i.visible=await this.calcViewMsgVisible(s,i.data||{},t,e)}))),a.push(...n)}else{const n=this.calcStaticMsg(i);n.visible=await this.calcViewMsgVisible(s,n.data||{},t,e),a.push(n)}}))),a.filter((t=>t.visible&&!this.getMsgRemoveModeStorage(t)))}calcStaticMsg(t){const{position:e}=t,i=this.viewMsgMap.get(t.appViewMsgId),{codeName:a,title:s,message:n,removeMode:o,position:r,messageType:c,layoutPanel:d,sysCss:l}=i,{userTag:h,userTag2:u,userTag3:p,userTag4:m}=i,g=e||r,f={key:"".concat(this.tag,"_").concat(a),title:s,message:n,position:g,messageType:c,removeMode:o,visible:!0,layoutPanel:d,sysCss:l,extraParams:{userTag:h,userTag2:u,userTag3:p,userTag4:m}};return f.data={env:f},f}async calcDynaMsgs(e,a,s){const n=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u,layoutPanel:p}=n;if(!o)throw new i(n,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));const m=await ibiz.hub.getAppDataEntity(o,a.srfappid),g={...s},f=this.getDeFieldName(m,r);f&&(g.sort="".concat(f,",asc"));const y=await t.fetchDataSet(n,a,g);if(!y.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(m,c),v=this.getDeFieldName(m,u),b=this.getDeFieldName(m,h),I=this.getDeFieldName(m,l),D=this.getDeFieldName(m,d);return y.map((t=>{const e={};v&&!et(t[v])&&(e.position=t[v]),E&&!et(t[E])&&(e.title=t[E]),b&&!et(t[b])&&(e.message=t[b]),I&&!et(t[I])&&(e.messageType=t[I]),D&&!et(t[D])&&(e.removeMode=t[D]),et(t.srfkey)||(e.key="".concat(this.tag,"_").concat(t.srfkey)),p&&(e.layoutPanel=p);const i=it(w,e);return i.data={...t,env:i},i}))}});var Fr="__self",_r=t("BaseController",class{constructor(t,e,i,a){this.model=t,this.params=i,this.ctx=a,this.id=mt(),this.state={},this.name="",this.evt=new ur(this.getEventArgs.bind(this)),this.mountCounter=new cr(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.state.context=e,this.preprocessModel(t),this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}get context(){return this.state.context}preprocessModel(t){}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(Fr),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(Fr)||this.mountCounter.attend(Fr)}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(){}}),zr=t("ViewController",class extends _r{constructor(t,e,i,a){super(ibiz.util.layoutPanel.fill(t),d.create({},e),i||{},new rr(a)),this.session={},this.modal=new Ii({}),this.providers={},this.engines=[],this.error={},this.slotProps={},this.counters={},this.viewLoading=new nr,this.isCloseView=!1,a&&a.registerController(this.model.name,this),this.ctx.init(this),this.initEngines(),this.handleViewError=this.handleViewError.bind(this)}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(ibiz.i18n.t("runtime.controller.common.view.viewActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewPause",{name:this.model.name,id:this.model.id}))}initEngines(){const t=Be(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn(ibiz.i18n.t("runtime.controller.common.view.noFoundViewEngine"),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 ts.getCounterByRef(t,this.context,{...this.params});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={},this.state.isClosing=!1,this.state.hasError=!1,this.state.isShortCut=!1}async onCreated(){this.state.isLoading=!0,await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{ct(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 Bi(t);this.providers[t.name]=e;const i=ke(this.model);i&&await Promise.all(i.map((async t=>{const e=await Bi(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const a=Ue(this.model);a.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(a),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()))),ibiz.mc.error.on(this.handleViewError),this.state.isLoading=!1}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(),await this.initShortCut()}async initShortCut(){const{model:t,context:e}=this,i=await ibiz.util.shortCut.calcShortCutKey({context:e,appViewId:t.id});this.state.isShortCut=ibiz.util.shortCut.isExist(i)}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(ibiz.i18n.t("runtime.controller.common.view.viewDestroy",{name:this.model.name,id:this.model.id})),ibiz.mc.error.off(this.handleViewError)}handleContextParams(){if(this.context.srfappid=this.model.appId||ibiz.env.appId,et(this.context.srfsessionid)||at(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}this.context.srfviewid=this.id;const t=this.model.appViewNavContexts;let e={};lt(t)&&(e=pe(t,this.params,this.context)),Object.assign(this.context,e),Object.prototype.hasOwnProperty.call(this.context,"srfreadonly")||Object.assign(this.context,{srfreadonly:!1});const i=this.model.appViewNavParams;let a={};lt(i)&&(a=pe(i,this.params,this.context)),Object.assign(this.params,a),this.engines.forEach((t=>{t.handleContextParams()})),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let i;for(const a of this.engines)if(i=await a.call(t,e),void 0!==i)break;return i}async callUIAction(t,e){const i=this.call(t,e);if(void 0===i)throw new o(ibiz.i18n.t("runtime.controller.common.view.noSupportBehavior",{key:t}));return i}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,codeName:e}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Or(t,"".concat(e,"_").concat(this.modal.mode)),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){var e,i;const[a,...s]=t,n={title:a.title,desc:a.message,options:{showClose:0!==a.removeMode,showConfirmButton:0!==a.removeMode,customClass:(null==(e=a.sysCss)?void 0:e.cssName)||""}};if(a.layoutPanel&&n.options){const t=new v("view-message").m("alert");n.options.customClass="".concat(n.options.customClass||""," ").concat(t),n.options.message=()=>ibiz.render.renderCtrlShell(a.layoutPanel,this.context,this.params,{data:a.data})}a.extraParams.userTag&&Object.assign(n,{confirmButtonText:a.extraParams.userTag});try{"WARN"===a.messageType?await ibiz.modal.warning(n):"ERROR"===a.messageType?await ibiz.modal.error(n):await ibiz.modal.info(n)}finally{null==(i=this.viewMsgController)||i.setMsgRemoveModeStorage(a)}s.length&&this.alertViewMessage(s)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}handleViewError(t){const{type:e,data:i}=t;"ERROR"===e&&i instanceof s&&i.tag===this.id&&(this.error=i,this.state.hasError=!0)}}),Vr=(t("AppDataUploadViewController",class extends zr{initState(){super.initState()}async onCreated(){await super.onCreated();const{srfappdataentityid:t,srfdedataimportid:e,srfappid:i}=this.context,{appDataEntity:a,deDataImport:s}=await Pr({appDataEntityId:t,deDataImportId:e,appId:i});this.state.appDataEntity=a,this.state.deDataImport=s}downloadTemplate(){const{appDataEntity:t,deDataImport:e}=this.state;Nr(t,e,this.context)}async selectAndImport(){const t=await xr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context});return!0===t.isAsync&&this.closeView(),t}async asyncImportData2(t){return Sr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context,...t})}}),t("MobViewController",class extends zr{}),t("WFStepTraceViewController",class extends zr{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),i=null==(t=this.ctx.parent)?void 0:t.view;if(i&&i.model.appDataEntityId){const t=await e.deService.getService(i.context,i.model.appDataEntityId),a=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(a);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")}if(this.model.cssStyle){const t={};this.model.cssStyle.split(";").filter(Boolean).forEach((e=>{const[i,a]=e.split(":");i&&a&&(t[i.trim()]=a.trim()),Object.assign(this.style,t)}))}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,i){const{navigateContexts:a,navigateParams:s}=this.model;let n={};a&&t&&(n=pe(a,t,i,e));const o=Object.assign(e.clone(),n);let r={};return s&&t&&(r=pe(s,t,i,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 wr.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=Pt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),kr=(t("CodeListEditorController",class extends Vr{get convertToCodeItemText(){return!!this.parent.model.convertToCodeItemText}async loadCodeList(t){const{context:e,params:a}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let i=[];return i=await t.codeList.get(this.model.appCodeListId,e,a),i}throw new i(this.model,ibiz.i18n.t("runtime.controller.common.editor.editorNoConfigured",{editorType:this.model.editorType}))}}),t("ControlController",class extends _r{constructor(t,e,i,a){if(super(t,d.create({},e),new b({},i),a),this.controlParams={},this.providers={},this.triggerKey="",this.awaitActiveCbs=new Map,this.delayCbs=new Map,this.registerToCtx(),this.controlPanel=be(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=st(e))}this.updateContextParams({}),this.handleControlParams()}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 Bi(this.controlPanel);this.providers[this.controlPanel.name]=t}if(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)})),this.model.appDataEntityId){const t=Te(this.model.appDataEntityId);this.triggerKey="".concat(this.view.name,"@").concat(t,"@").concat(this.model.controlType,"@").concat(this.model.codeName)}this.onDEDataChange=this.onDEDataChange.bind(this),ibiz.mc.command.change.on(this.onDEDataChange)}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){ibiz.mc.command.change.off(this.onDEDataChange),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:i}=this.model;let a={};lt(e)&&(a=pe(e,this.params,this.context)),Object.assign(this.context,a);let s={};lt(i)&&(s=pe(i,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,this.awaitActiveCbs.size>0&&this.awaitActiveCbs.forEach((t=>{t()})),this.awaitActiveCbs.clear(),ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentPause",{name:this.model.name,id:this.model.id}))}handlerAbilityParams(t){const e=this.context.clone(),i={...this.params};let a=this.getData()||[];return(null==t?void 0:t.data)&&(a=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(i,t.viewParam),{context:e,params:i,data:a}}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={};lt(t)&&(e=pe(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())}findCtrlMsgByTag(t){let e;const{ctrlMsg:i}=this.model;return i&&i.ctrlMsgItems&&(e=i.ctrlMsgItems.find((e=>e.name===t))),e}actionNotification(t,e){let i,a="";if(this.findCtrlMsgByTag("".concat(t,"_HIDDEN")))return;const o=this.findCtrlMsgByTag(t);if(o&&o.content){i=et(o.timeout)?void 0:o.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),a=ai.execScriptFn(t,"`".concat(o.content,"`"),{isAsync:!1,singleRowReturn:!0})}if(!a&&ibiz.i18n){const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();a=ibiz.i18n.t(e,""),a===e&&(a="")}if(!a&&(null==e?void 0:e.default)&&(a=e.default),!a&&(null==e?void 0:e.error)&&(a=a||e.error.message),a){if(null==e?void 0:e.error){if(e.error instanceof s&&500!==e.error.status)throw e.error;throw ibiz.log.error(e.error),new n(a,i)}ibiz.message.success(a,i,0===i)}}onDEDataChange(t){ibiz.log.debug("onDEDataChange",t)}emitDEDataChange(t,e){const i=e instanceof cs?e.$origin:e,a={triggerKey:this.triggerKey};switch(t){case"create":ibiz.mc.command.create.send(i,a);break;case"update":ibiz.mc.command.update.send(i,a);break;case"remove":ibiz.mc.command.remove.send(i,a);break;default:throw new o(ibiz.i18n.t("runtime.controller.common.control.unsupportedType",{type:t}))}}doNextActive(t,e){if(et(e.delay)&&(e.delay=300),!1===this.state.activated)this.awaitActiveCbs.set(e.key,t);else if(e.delay){const i=this.delayCbs.get(e.key);clearTimeout(i);const a=setTimeout((()=>{t(),clearTimeout(this.delayCbs.get(e.key))}),e.delay);this.delayCbs.set(e.key,a)}else t()}})),Ur=t("MDControlController",class extends kr{constructor(){super(...arguments),this.isSetSort=!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=[],this.state.hideNoDataImage=!1}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)})),this.isSetSort||this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}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 i=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(i.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:i,sortQuery:a,noSort:s}=this.state,n={...this.params};return i&&(n.page=e-1,n.size=i),!s&&a&&(n.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,i=!0===t.isLoadMore;e?this.state.curPage=1:i&&(this.state.curPage+=1);const{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),n=await this.service.fetch(a,s);"number"==typeof n.total&&(this.state.total=n.total),"number"==typeof n.totalPages&&(this.state.totalPages=n.totalPages),i?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(){this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{await Pn(a.map((async t=>{s=await this.handleItemRemove(t,e,i),this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.common.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(e){throw await this._evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0),a.forEach((t=>{this.emitDEDataChange("remove",t)}))}async handleItemRemove(t,e,i){let a=!1;const s=Te(this.model.appDataEntityId);if(0!==t.srfuf){const n=e.clone();n[s]=t.srfkey,await this.service.remove(n,i),a=!0}return a}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,i;const{selectedData:a}=this.state;I(a,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==(i=this.quickToolbarController)||i.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,i=e.filter((e=>e.srfkey!==t.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){const{appDataEntityId:t,dedataImportId:e}=this.model;if(!t||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));await Tr({appDataEntityId:t,deDataImportId:e,context:this.context,params:this.params})}async exportData(t){}onDEDataChange(t){var e;if(!et(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if(!t.data||t.data.srfdecodename!==(null==(e=this.dataEntity)?void 0:e.codeName))return;let i=!1;const{srfkey:a}=t.data;switch(t.subtype){case"OBJECTCREATED":i=!0;break;case"OBJECTUPDATED":case"OBJECTREMOVED":-1!==this.state.items.findIndex((t=>t.srfkey===a))&&(i=!0)}i&&this.doNextActive((()=>this.load({isInitialLoad:!!ibiz.env.isMob})),{key:"refresh"})}}),Br=t("CustomAppMenuController",class{constructor(t,e){this.model=t,this.menu=e,this.type="personal",this.ownerType="",this.ownerId="",this.context=e.context,this.params=e.params,this.init()}init(){var t;this.type="personal",this.ownerId=this.context.srfpersonid;const e=ibiz.hub.getApp(this.context.srfappid).getAppUtil("DYNAMENU","CUSTOM");e?this.util=new Zs(e):this.config=new Za(this.model.appId,"menu","menu_".concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase()))}getResourceTag(){var t;const e="".concat(this.context.srfappid,"_menu_").concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase());switch(this.type){case"personal":return"".concat(e,"_").concat(this.context.srfpersonid);case"data":return"".concat(e,"_").concat(this.ownerType,"_").concat(this.ownerId);default:return e}}async loadCustomModelData(){let t;if(t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t&&t.model){return JSON.parse(t.model)}return[]}async resetCustomModelData(){return this.saveCustomModelData([])}async saveCustomModelData(t,e={}){const i={model:JSON.stringify(t)};return this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},i):await this.config.save(i),t}}),Wr=t("AppMenuController",class extends kr{constructor(t,e,i,a){super(t,e,i,a),this.itemProviders={},this.customController=null,this.saveConfigs=[],this.flattenAllItems(),t.enableCustomized&&(this.customController=new Br(t,this))}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)})),this.customController&&await this.loadCustomMenusModel()}async loadCustomMenusModel(){const t=await this.customController.loadCustomModelData();t&&0!==t.length?this.saveConfigs=t:this.saveConfigs=[]}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await xa(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,a=!0,s={}){const n=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));this.evt.emit("onClick",{eventArg:t,event:e});const r=this.itemProviders[t];if(r&&r.onClick)return r.onClick(n,e,this);if(!n.appFuncId)throw new i(n,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const c=this.context.clone();c.srfappid=n.appId||ibiz.env.appId,this.routeDepth&&a&&Object.assign(c,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(Xo.TAG,n.appFuncId,c,this.params,s)}initMenuItemState(t){var e;const i={permitted:!0,visible:!0};if(t.hidden)i.visible=!1;else{let a=!0;t.accessKey&&(a=this.app.authority.calcByResCode(t.accessKey));let s=a;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}i.permitted=a,i.visible=s}return this.state.menuItemsState[t.id]=i,i}flattenAllItems(){const t=[],e=i=>{i.forEach((i=>{t.push(i),i.appMenuItems&&i.appMenuItems.length>0&&e(i.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 i;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(i=e.appMenuItems)?void 0:i.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),Gr=(t("AppMenuIconViewController",class extends Wr{async onClickMenuItem(t,e){const a=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));if(this.evt.emit("onClick",{eventArg:t,event:e}),!a.appFuncId)throw new i(a,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(Xo.TAG,a.appFuncId,s,this.params)}}),t("CalendarService",class extends ls{async search(t,e={}){const{sysCalendarItems:i}=this.model;if(!i)return[];const a=i.map((async i=>{const a=i.appDEDataSetId||"fetchdefault",s=t.clone(),n=this.handleRequestParams(i,e);return i.maxSize&&(n.size=i.maxSize),this.exec2(a,s,n,void 0,i.appDataEntityId)}));return(await Promise.all(a)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:i}=this.model;if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));const a=i[e];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));return t.map((t=>new rn(a,t)))}async exec2(t,e,i={},a={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,i,a)}handleRequestParams(t,e){const i=st(e),{srfstartdate:a,srfenddate:s}=i;return Object.assign(i,{["n_".concat(t.beginTimeAppDEFieldId,"_gtandeq")]:a,["n_".concat(t.endTimeAppDEFieldId,"_ltandeq")]:s}),delete i.srfstartdate,delete i.srfenddate,i}}));t("CalendarController",class extends Ur{initState(){var t,e;super.initState(),this.state.selectedDate=new Date,this.state.size=1e3,this.state.legends=[],this.state.calendarTitle=this.model.logicName||"",this.state.showDetail=(null==(e=null==(t=this.model.controlParam)?void 0:t.ctrlParams)?void 0:e.SHOWDETAIL)||!1}async onCreated(){await super.onCreated(),this.service=new Gr(this.model),await this.service.init(this.context),this.initViewScheduler(),this.initCalendarLegends()}initCalendarLegends(){const{sysCalendarItems:t}=this.model;if(!t)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));t.forEach((t=>{const{id:e,name:i,bkcolor:a,color:s}=t;this.state.legends.push({id:e,name:i,bkcolor:a,color:s})}))}initViewScheduler(){const t=Ue(this.model);0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async onDestroyed(){await super.onDestroyed(),this.viewScheduler&&this.viewScheduler.destroy()}async setActive(t){this._evt.emit("onActive",{data:t?[t]:[]}),t&&await this.openData(t)}async openData(t){var e,a,s;const n=this.context.clone();n[((null==(a=null==(e=t.deData)?void 0:e.srfdecodename)?void 0:a.toLowerCase())||Te(this.model.appDataEntityId)).toLowerCase()]=t.deData.srfkey;const o=await(null==(s=this.viewScheduler)?void 0:s.triggerCustom("".concat(t.itemType.toLowerCase(),"_opendata"),{context:n,params:this.params,data:[t.deData],event:void 0,view:this.view,ctrl:this}));if(-1===o)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:t.itemType.toLowerCase()}));return{cancel:!o||o.ok}}calcShowMode(t){this.state.hideNoDataImage=!1;const e=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===e&&0===t.length&&(this.state.hideNoDataImage=!0),"MIXIN"===e&&0===t.length&&(this.state.hideNoDataImage=!0)}async load(t={}){const e=!0===t.isInitialLoad,{context:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(i,a)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.calcShowMode(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 i=t.beginTime,a=e.beginTime;let s=0;return Pt(i).isAfter(a)?s=-1:Pt(i).isBefore(a)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{calendarStyle:i}=this.model;let{srfstartdate:a,srfenddate:s}=t;if(!a||!s){switch(i){case"DAY":a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),s=new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1);break;case"WEEK":const t=e.getDay(),n=t>0?1-t:-6;a=new Date(e.getFullYear(),e.getMonth(),e.getDate()+n),s=new Date(new Date(a.getFullYear(),a.getMonth(),a.getDate()+7).getTime()-1);break;case"MONTH":a=new Date(e.getFullYear(),e.getMonth(),1),s=new Date(new Date(e.getFullYear(),e.getMonth()+1,1).getTime()-1);break;default:ibiz.log.warn("日历".concat(i,"样式暂未支持"))}return{srfstartdate:Pt(a).format("YYYY-MM-DD HH:mm:ss"),srfenddate:Pt(s).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:s}}async getFetchParams(t={}){const{curPage:e,size:i,sortQuery:a,noSort:s}=this.state,n={...this.params};if(!s&&a&&(n.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),i&&(n.page=e-1,n.size=i),t&&Object.assign(n,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(n);Object.assign(n,t)}return n}async onRowClick(t){if(!t)return void this.setSelection([]);const{selectedData:e}=this.state,i=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});Pt.extend(Lt),Pt.extend(Rt),Pt.extend(Ft),Pt.extend(zt),Pt.extend(kt);var jr="$default_group",Kr=class{constructor(t,e){var a;this.model=t,this.chartGenerator=e,this.catalogField="",this.catalogFields=[],this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:s,caption:n,id:o,userParam:r}=t;if(!t.catalogField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingClassification"));if(!t.valueField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingValue"));if(e.model.controlParam&&(null==(a=e.model.controlParam.ctrlParams)?void 0:a.CATALOGFIELDS))try{const t=JSON.parse(e.model.controlParam.ctrlParams.CATALOGFIELDS);Array.isArray(t)&&(this.catalogFields=t)}catch(t){throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"))}this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:c,chartYAxisId:d}=s||{};this.xAxisIndex=F(c),this.yAxisIndex=F(d),this.seriesName=n||o,this.staticOptions=this.calcStaticOptions(),r&&(this.seriesUserParam=tc(r))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,i=!1){if(et(e))return;if(et(t))return e;const a=this.chartGenerator.codeListMap.get(t);if(null==a?void 0:a.length){const t=a.find((t=>t.value===e));return t?t.text:"未定义"}return i?void 0:e}getSeriesColor(t){let e="";const i=[...this.chartGenerator.codeListMap.values()].flat().find((e=>e.text===t));return i&&(e=i.color||""),e}prepareChartData(t,e,i,a){var s;this.groupField&&(e["".concat(this.groupField,"_value")]=e[this.groupField],Object.assign(e,{[this.groupField]:a})),this.catalogField&&(e["".concat(this.catalogField,"_value")]=e[this.catalogField],Object.assign(e,{[this.catalogField]:i}));const n=new hn(e,this.model,i,a);t[a].get(i).chartData=n,null==(s=this.chartDataArr)||s.push(n)}handleMultiCatalogGroup(t,e){let i=[];if(0===t.length)i=e.map((t=>({text:t.text,value:t.value})));else for(let a=0;a<t.length;a++)if(e.length>0)for(let s=0;s<e.length;s++)i.push({text:"".concat(t[a].text,"_").concat(e[s].text),value:e[s].value});else i.push({text:t[a].text,value:t[a].value});return i}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:i,catalogCodeListId:a}=this.model;return t.forEach((t=>{let s=jr;if(this.groupField){const e=this.translateVal(i,t[this.groupField]);if(et(e))return;s=e}if(!e[s])if(e[s]=new Map,this.catalogFields.length>0){let t=[];const i=[];this.catalogFields.forEach((t=>{const{codelistId:e}=t;if(e&&this.autoCompleteCategory){const t=this.chartGenerator.codeListMap.get(e);i.push(st(t))}}));for(let e=0;e<i.length;e++)t=this.handleMultiCatalogGroup(t,i[e]);t.forEach((t=>{e[s].set(t.text,{value:0}),this.prepareChartData(e,{[this.valueField]:0,[this.catalogField]:t.value},t.text,s)}))}else if(a&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(a).forEach((t=>{e[s].set(t.text,{value:0}),this.prepareChartData(e,{[this.valueField]:0,[this.catalogField]:t.value},t.text,s)}))}let n="";if(this.catalogFields.length>0){const e=[];if(this.catalogFields.forEach((i=>{const a=this.translateVal(i.codelistId,t[i.codename],!0);a&&e.push(a)})),e.length!==this.catalogFields.length)return;n=e.join("_")}else n=this.translateVal(a,t[this.catalogField],!0);n&&(e[s].get(n)||e[s].set(n,{value:0}),e[s].get(n).value=M(e[s].get(n).value,t[this.valueField]||0),e[s].get(n).chartData?this.prepareChartData(e,Object.assign(t,{[this.valueField]:e[s].get(n).value}),n,s):this.prepareChartData(e,t,n,s))})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const i=t[e],a=this.calcSeriesData(i);let s={...this.staticOptions,data:a};e!==jr&&(s.name=e);const n=this.getSeriesColor(e);return n&&(s.color=n),this.seriesUserParam&&(s=dt(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{var a;this.chartGenerator.model.controlParam&&"ROW"===(null==(a=this.chartGenerator.model.controlParam.ctrlParams)?void 0:a.MODE)?e.push([t.value,i,t.chartData]):e.push([i,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),i=this.calcGroupData(e);return this.addTimeData(i),this.calcGroupSeries(i)}getChartDataByParams(t){var e,i,a;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[jr].get(t.name))?void 0:e.chartData:null==(a=null==(i=this.groupData)?void 0:i[t.seriesName].get(t.name))?void 0:a.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(st(t))}));const{groupMode:i}=this.model;return i&&e.forEach((t=>{let e="";if("DAY"===i||"YEAR"===i||"MONTH"===i){if("DAY"===i?e="YYYY-MM-DD":"YEAR"===i?e="YYYY":"MONTH"===i&&(e="YYYY-MM"),t[this.catalogField]){const i=Pt(t[this.catalogField]).format(e);t[this.catalogField]=i}}else if("QUARTER"===i){if(t[this.catalogField]){const e="".concat(Pt(t[this.catalogField]).format("YYYY"),"-").concat(Pt(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===i&&t[this.catalogField]){const e="".concat(Pt(t[this.catalogField]).format("YYYY"),"-").concat(Pt(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((i=>{const a=t[i];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(a.keys()).sort(((t,e)=>Pt(t).diff(Pt(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(a.keys()).sort(((t,e)=>{const[i,a]=t.split("-"),[s,n]=e.split("-");return i!==s?parseInt(i,10)-parseInt(s,10):parseInt(a,10)-parseInt(n,10)})));const n=new Map;s.forEach((t=>{n.set(t,a.get(t))})),t[i]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const i=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{i.push(Pt(e))}))}));const a=Pt.max(i),s=Pt.min(i);if("DAY"===e){let e=s;const i=a;for(;null==e?void 0:e.isSameOrBefore(i,"day");){const i=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const i=a.year();for(;e<=i;){const i=e.toString();Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const i=a.clone().startOf("month");for(;e.isSameOrBefore(i);){const i=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=i.split("-"),[n]=a.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++)for(let i=1;i<=4;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=i.split("-"),[n]=a.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++){const i=Pt("".concat(e,"-12-31")).isoWeek();for(let a=1;a<=i;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}}this.sortTimeData(t)}},Hr=class extends Kr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:a}=this.model;return a&&(t.step="middle"),t}},Xr=class extends Kr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},qr=class extends Kr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},Yr=class extends Kr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},Qr=class extends Kr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},Jr=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 i=this.indicator[t];(!i||i.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})))}}},$r=class extends Kr{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=t.map((t=>st(t))),i=this.calcGroupData(e);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Jr(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(i).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,i=this.chartGenerator.radarMap.get(this.catalogField),a=Object.keys(e).map((t=>{const a=e[t],s=i.indicatorKeys.map((t=>a.has(t)?a.get(t).value:0));return{name:t===jr?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:a};return this.seriesUserParam&&(s=dt(s,this.seriesUserParam)),s}},Zr=t=>{const e=/function\s*\(\s*|\s*function\s*\(\s*/,i={};return Object.keys(t).forEach((a=>{if(Dt(t[a])&&e.test(t[a])){const e="return ".concat(t[a]);i[a]=new Function(e)()}else Ct(t[a])?i[a]=Zr(t[a]):Array.isArray(t[a])?i[a]=t[a].map((t=>"object"!=typeof t?t:Zr(t))):i[a]=t[a]})),i};function tc(t){const e={};return t&&Object.keys(t).forEach((i=>{const a=i.indexOf(".");if(-1===a)return;const s=i.slice(a+1);if(s)try{e[s]=JSON.parse(t[i])}catch(a){e[s]=t[i]}})),Zr(e)}var ec=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:i,chartXAxises:a,chartYAxises:s,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),i&&(this.staticOptions.legend=this.calcLegendOption(i)),(null==a?void 0:a.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(a)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),n&&(this.chartUserParam=tc(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 Xr(t,this);break;case"scatter":e=new Qr(t,this);break;case"pie":e=new Yr(t,this);break;case"funnel":e=new qr(t,this);break;case"radar":e=new $r(t,this);break;default:ibiz.log.error(ibiz.i18n.t("runtime.controller.control.chart.noSupportSequence",{seriesType:t.seriesType}))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:i,subTitle:a,titlePos:s}=t,n={show:e,text:i,subtext:a,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:i}=t,a={};a.show=e;const s=null==i?void 0:i.toLowerCase();return"left"===s||"right"===s?(a.left=s,a.top="middle",a.orient="vertical"):"bottom"===s&&(a.top=s),a}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:i,dataShowMode:a,userParam:s}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:i,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===a?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===a&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===a?45:0}};s&&(n=dt(n,tc(s))),e.push(n)})),e}handleAxisLayout(t,e,i,a,s=!0){return t.map((t=>s?{value:t.text,textStyle:{padding:[0,e*(i-1-a),0,0]}}:{value:t.text,textStyle:{padding:[e*(i-1-a),0,0,0]}}))}handleAxisLevel(t,e,i){const a=[];if(0===e)return i;let s=1;for(let e=0;e<t.length;e++)s*=t[e].data.length;for(let t=0;t<s;t++)a.push(...i);return a}mergeAxisData(t,e){return t&&Array.isArray(t)?[...t,...e]:[t,...e]}handleSeriesModelCoordinateAxis(t,e){const{xAxisParam:i,yAxisParam:a}=e,s=[],n=[];for(let e=0;e<t.length;e++){const o=st(i),r=st(a);Object.assign(o,{gridIndex:e}),Object.assign(r,{gridIndex:e}),r.axisLabel.formatter=function(t){return 0===t?"{top|".concat(t,"}"):"{bottom|".concat(t,"}")},e!==t.length-1&&(o.name="",o.axisLine.show=!1,o.axisLabel.show=!1,o.axisTick.show=!1),r.showTitle&&Object.assign(r,{name:t[e].serieText}),s.push(o),n.push(r)}this.chartUserParam.xAxis=s,this.chartUserParam.yAxis=n}async initMultiCatalogxAxis(t,e){var i,a,s,n,o,r,c,d,l;const{controlParam:h}=this.model;if(h&&(null==(i=h.ctrlParams)?void 0:i.ZONE)){const t=null==(a=this.model.dechartSerieses)?void 0:a.length;if(t){const e=90/t,i=[];for(let a=0;a<t;a++){const t=a*e+5,s=100-(e+t);i.push({top:"".concat(t,"%"),bottom:"".concat(s,"%"),containLabel:!0})}this.chartUserParam&&(this.chartUserParam.grid=i,this.handleSeriesModelCoordinateAxis(this.model.dechartSerieses,{xAxisParam:(null==(s=this.chartUserParam)?void 0:s.xAxis)||{},yAxisParam:(null==(n=this.chartUserParam)?void 0:n.yAxis)||{}}))}}if(h&&(null==(o=h.ctrlParams)?void 0:o.CATALOGFIELDS))try{const i=JSON.parse(h.ctrlParams.CATALOGFIELDS),a=[];let s=!0,n=!0,o=0;if(Array.isArray(i)){const u=ibiz.hub.getApp(t.srfappid);if(this.chartUserParam){let t={};t="ROW"===(null==(r=h.ctrlParams)?void 0:r.MODE)?Array.isArray(this.chartUserParam.yAxis)?this.chartUserParam.yAxis[this.chartUserParam.yAxis.length-1]:this.chartUserParam.yAxis:Array.isArray(this.chartUserParam.xAxis)?this.chartUserParam.xAxis[this.chartUserParam.xAxis.length-1]:this.chartUserParam.xAxis,t&&(s=void 0===t.name||!!t.name,n=void 0===(null==(c=t.axisLabel)?void 0:c.show)||(null==(d=t.axisLabel)?void 0:d.show))}this.chartUserParam&&this.chartUserParam.grid&&Array.isArray(this.chartUserParam.grid)&&(o=this.chartUserParam.grid.length-1),await Promise.all(i.slice(0,-1).map((async(s,r)=>{var c;if("codelist"===s.mode&&s.codelistId){const d=await u.codeList.get(s.codelistId,t,e);if(d)if("ROW"===(null==(c=h.ctrlParams)?void 0:c.MODE)){const t=this.handleAxisLayout(d,40,i.length,r),e=this.handleAxisLevel(a,r,t);a.push({show:n,gridIndex:o,type:"category",data:e,position:"left"})}else{const t=this.handleAxisLayout(d,24,i.length,r,!1),e=this.handleAxisLevel(a,r,t);a.push({show:n,gridIndex:o,type:"category",data:e,position:"bottom"})}}})));const p=i.map((t=>t.name)).join("/");let m=i.length;n||(m=1),s||(m-=1),this.chartUserParam&&(this.chartUserParam.grid||(this.chartUserParam.grid={}),"ROW"===(null==(l=h.ctrlParams)?void 0:l.MODE)?(0===m?Object.assign(this.chartUserParam.grid,{bottom:45}):Object.assign(this.chartUserParam.grid,{left:40*(m+1)}),a.push({type:"category",gridIndex:o,show:s,data:[{value:p.split("").join("\n"),textStyle:{padding:[0,40*m,0,0]}}],position:"left"}),this.chartUserParam.yAxis&&(this.chartUserParam.yAxis=this.mergeAxisData(this.chartUserParam.yAxis,a))):(0===m?Object.assign(this.chartUserParam.grid,{bottom:30}):Object.assign(this.chartUserParam.grid,{bottom:24*(m+1)}),a.push({type:"category",gridIndex:o,show:s,data:[{value:p,textStyle:{padding:[24*m,0,0,0]}}],position:"bottom"}),this.chartUserParam.xAxis&&(this.chartUserParam.xAxis=this.mergeAxisData(this.chartUserParam.xAxis,a))))}}catch(t){throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"))}}async init(t,e){await this.loadCodeList(t,e),await this.initMultiCatalogxAxis(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 i,a,s;if(this.codeListMap.clear(),!(null==(i=this.model.dechartSerieses)?void 0:i.length))return;const n=ibiz.hub.getApp(t.srfappid),o=async i=>{if(!i||this.codeListMap.has(i))return;const a=await n.codeList.get(i,t,e);this.codeListMap.set(i,a)};if(null==(s=null==(a=this.model.controlParam)?void 0:a.ctrlParams)?void 0:s.CATALOGFIELDS)try{const t=JSON.parse(this.model.controlParam.ctrlParams.CATALOGFIELDS);Array.isArray(t)&&await Promise.all(t.map((async t=>{"codelist"===t.mode&&await o(t.codelistId)})))}catch(t){throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"))}await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:i}=t;await o(i),await o(e)})))}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((i=>{const a=e.length,s=i.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const n=e.length-1;for(let t=a;t<=n;t++)this.seriesGeneratorIndexMap.set(t,i)})),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=dt(this.staticOptions,this.options),this.chartUserParam&&(this.options=dt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noFindSequence",{seriesIndex:t.seriesIndex}));return e.getChartDataByParams(t)}},ic=t("ChartService",class extends ls{}),ac=(t("ChartController",class extends Ur{get _evt(){return this.evt}initState(){super.initState(),this.state.size=1e3,this.state.showGrid=!1,this.state.gridHeaders=[],this.state.gridData=[],this.state.gridPosition="bottom"}async onCreated(){await super.onCreated(),this.service=new ic(this.model),await this.service.init(this.context),this.generator=new ec(this.model),await this.generator.init(this.context,this.params),this.parseGridParam(),this.resizeChart=this.resizeChart.bind(this),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const i=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),i}parseGridParam(){this.model.dechartDataGrid&&(this.model.dechartDataGrid.dataGridPos?this.state.gridPosition=this.model.dechartDataGrid.dataGridPos.toLocaleLowerCase():this.state.gridPosition="bottom",!0===this.model.dechartDataGrid.showDataGrid&&(this.state.showGrid=!0))}computeTotal(t){let e=0;return this.state.items.forEach((i=>{const a=Number(i[t]);Number.isNaN(a)||(e+=Number(a))})),e}handleSingleSerieGridData(){const t=this.generator.seriesGenerators[0],{catalogField:e,valueField:i,groupData:a}=t,s=t.chartGenerator.entity.appDEFields,n=s.find((t=>t.id===e)),o=s.find((t=>t.id===i)),r=[{id:e,name:null==n?void 0:n.logicName},{id:i,name:null==o?void 0:o.logicName},{id:"srfpercent",name:"百分比"}];this.state.gridHeaders=r;const c=[],d=this.computeTotal(i);if(a&&a.$default_group){const t=a.$default_group;for(const[a,s]of t){const t=Number.isNaN(Number(s.value))?0:Number(s.value);let n="";n=0===d||Number.isNaN(Number(s.value))?"0%":"".concat(Math.round(t/d*100),"%");const o={[e]:a,[i]:t,srfpercent:n};c.push(o)}}this.state.gridData=c}handleMultipleSerieGridData(){const t=[],e=[];this.generator.seriesGenerators.forEach((i=>{const{catalogField:a,valueField:s,groupData:n}=i,o=i.chartGenerator.entity.appDEFields;if(t.findIndex((t=>t.id===a))<0){const e=o.find((t=>t.id===a.toLowerCase()));t.push({id:a,name:null==e?void 0:e.logicName})}const r=o.find((t=>t.id===s.toLowerCase()));if(t.push({id:s,name:null==r?void 0:r.logicName}),n&&n.$default_group){const t=n.$default_group;for(const[i,n]of t){const t=Number.isNaN(Number(n.value))?0:Number(n.value),o=e.findIndex((t=>t[a]===i));if(o<0){const n={[a]:i,[s]:t};e.push(n)}else Object.assign(e[o],{[s]:t})}}})),this.state.gridHeaders=t,this.state.gridData=e}computeGridData(){this.generator&&this.generator.seriesGenerators&&(1===this.generator.seriesGenerators.length?this.handleSingleSerieGridData():this.handleMultipleSerieGridData())}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.state.showGrid&&this.computeGridData(),this.updateChart()}async updateChart(){if(!this.chart)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noInitialised"));if(!this.options)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noCalculated"));await this._evt.emit("onBeforeUpdate",void 0),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 kr{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):""),this.setBrowserTabTitle()}))}setBrowserTabTitle(){"ROUTE"!==this.view.modal.mode&&"ROUTE_MODAL"!==this.view.modal.mode||ibiz.util.setBrowserTitle(this.state.caption)}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.session={},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)}}),sc=class{};function nc(t,e){const{srcDEUILogicParamId:i,srcFieldName:s,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(o){case"SRCDLPARAM":c=t.params[i];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=st(ibiz.env);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:o}))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:ai.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:r}),c),t}return c}var oc=class extends sc{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=nc(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.currentConditionValue"));const t=null!=s[this.value]?s[this.value]:e[this.value];r=t,o=Qe(n,this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.sourceDataObjectAttribute"));const e=nc(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});r=e,o=Qe(n,this.op,e);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.currentTime"));default:r=this.value,o=Qe(n,this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditionalTypeName",{name:this.model.name,type:this.type,dstField:this.dstField}),n,ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},rc=class t extends sc{constructor(e){super(),this.model=e;const i=e.deuilogicLinkConds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new oc(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let s="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditional"));for(let i=0;i<this.conds.length;i++){const n=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}const n=this.notMode?!s:s;return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.connectionConditionGroup",{name:this.model.name,id:this.model.id}),n),n}},cc=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:i}=this.model;0===(e||0)&&i&&(this.groupCond=new rc(i))}async exec(t){const{linkMode:e}=this.model,{context:i,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,i,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousTermination"));case 3:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousRejection"));case 9:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.exceptionHandling"));default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.logicalLinkTypes",{linkMode:e}))}}},dc=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new cc(t)))}},lc=class extends dc{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data,t.setLastReturn(t.params[n])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDEUILogicParamId:n}),t.params[n])}},hc=class extends dc{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:a,dstAppDataEntityId:s}=this.model,{data:n,parameters:o}=t;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceBehavior"));let r=[n];if(a){const e=t.params[a];r=e instanceof Array?e:[e]}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityInterfaceAction",{id:this.model.id,dstAppDEUIActionId:e,dstAppDataEntityId:s,dstDEUILogicParamId:a})),await Oc.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:r},this.model.appId)}},uc=class extends dc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeStartupNode",{id:this.model.id}))}},pc=class extends dc{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:i,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(i);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.unsupportedEndNode",{returnType:e}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEndNode",{id:this.model.id,returnType:e}),t.result)}}},mc=class extends dc{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const i of e){let e;switch(i.dstDEUILogicParamId&&"DEBUG"===ibiz.env.logLevel&&(e=st(t.params[i.dstDEUILogicParamId])),i.paramAction){case"SETPARAMVALUE":await this.setParamValue(i,t);break;case"RESETPARAM":await this.resetParam(i,t);break;case"COPYPARAM":await this.copyParam(i,t);break;case"BINDPARAM":await this.bindParam(i,t);break;case"RENEWPARAM":await this.renewParam(i,t);break;case"APPENDPARAM":await this.appendParam(i,t);break;case"SORTPARAM":await this.sortParam(i,t);break;default:throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:i.paramAction}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodePreparationParameter",{id:this.model.id,paramAction:i.paramAction,dstDEUILogicParamId:i.dstDEUILogicParamId}),e,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[i.dstDEUILogicParamId])}}setParamValue(t,e){const{dstFieldName:i,dstDEUILogicParamId:a}=t;if(!a)throw new o(ibiz.i18n.t("runtime.uiLogic.noTargetParameter"));let s=i;e.isEntityParam(a)&&(s=null==s?void 0:s.toLowerCase());const n=nc(e,t);if(s)try{ai.execScriptFn({srcVal:n,dstParam:e.params[a]},"dstParam.".concat(i," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.targetParameter",{dstFieldName:i}),e.params[a]),t}else e.params[a]=n}copyParam(t,e){const{dstDEUILogicParamId:i}=t,a=nc(e,t);e.params[i]=st(a)}bindParam(t,e){const i=nc(e,t);e.params[t.dstDEUILogicParamId]=i}resetParam(t,e){const{dstDEUILogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDEUILogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDEUILogicParamId:i,dstIndex:a,srcIndex:s,srcSize:n}=t,o=nc(e,t),r=a||0,c=s||0,d=n||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:i,dstFieldName:a,dstSortDir:s}=t,n=a;e.params[i].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},gc=class extends dc{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:a,invokeParamId:s}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceObject"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredOperatingParameters"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredCallMethod"));const n=t.params[s];if(!n)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundOperationParameter",{invokeParamId:s}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInterfaceObject",{invokeCtrlId:a}));if(!r[e]||!Z(r[e]))throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInvokeMethod",{invokeMethod:e}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetInvocation",{id:this.model.id,invokeCtrlId:a,invokeMethod:e}),n),await r[e](n)}},fc=class extends dc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const s=nc(t,this.model);t.params[e]=s,t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.bindingParameters",{id:this.model.id,dstDEUILogicParamId:e}),s)}},yc=class extends dc{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 i(this.model,ibiz.i18n.t("runtime.uiLogic.missingMessageTypeConfiguration"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingButtonTypeConfiguration"));let{title:o,message:r}=this.model;if(n){const e=t.params[n];e.title&&(o=e.title),e.message&&(r=e.message)}const c=this.typeMap[e],d={type:c,title:o||ibiz.i18n.t("runtime.uiLogic.message"),desc:r};let l=[];switch(s){case"YESNO":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.yes"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.no"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["yes","no"];break;case"OK":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.showConfirmButton=!0,d.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.cancel"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["ok","cancel"];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.noSupportItem",{name:s}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeMessagePopup",{id:this.model.id,type:c,message:r}));const h=await ibiz.modal.confirm(d);t.setLastReturn(l[h?0:1])}},wc=class extends dc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeFrontendPlugin",{id:this.model.id,sysPFPluginId:this.model.sysPFPluginId}));const e=await ca(this.model);e&&await e.exec(this.model,t)}},Ec=class extends dc{async exec(t){const{dstDEUILogicParamId:e,name:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));const s=t.params[e];ibiz.log.info(ibiz.i18n.t("runtime.uiLogic.logicalNodeOperation",{name:a}),s)}},vc=class extends dc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeResetParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},bc=class extends dc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const s=nc(t,this.model);t.params[e]=st(s),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.copyParameter",{id:this.model.id,dstDEUILogicParamId:e}),s)}},Ic=class extends dc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const r=nc(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.appendedArray",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},Dc=class extends dc{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const n=s,o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[n]-e[n]:e[n]-t[n])),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeSortedArrayParameters",{id:this.model.id,dstFieldName:s,dstSortDir:a,dstDEUILogicParamId:e}),o)}},Cc=class extends dc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeRebuildParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},Ac=class extends dc{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingfilter"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(a,e,t.context,o);c.ok&&(t.params[n]=c.data,t.setLastReturn(t.params[s])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDataSet",{id:this.model.id,dstAppDataEntityId:a,dstAppDEDataSetId:e,retDEUILogicParamId:n}),t.params[n])}},Pc=class extends dc{async exec(t){const{errorInfo:e}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeThrowingExceptions",{id:this.model.id,errorInfo:e})),new o(e)}},Tc=class extends dc{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:a,fireCtrlId:s}=this.model;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredTriggerObject"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEvent"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEventParameters"));const n=t.params[s];if(!n)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundTriggerObject",{fireCtrlId:s}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundEventParameterObject",{eventParamId:a}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetEventTriggerLogic",{id:this.model.id,fireCtrlId:s,eventName:e}),r),await n.evt.emit(e,r)}},Nc=class extends dc{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityConfigured"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityLogicConfigured"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noIncomingLogic"));const r=t.params[s];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.passedParameter",{dstDEUILogicParamId:s}));const c=await Bs(e,a,t.context,r,t.params);n&&(t.params[n]=c,t.setLastReturn(t.params[n])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeExecutingEntityLogic",{id:this.model.id,dstAppDELogicId:e,dstAppDataEntityId:a,retDEUILogicParamId:n}),c)}},xc=class extends dc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDirectCode",{id:this.model.id}),this.model.code),await ai.asyncExecScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"")}},Sc=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model,{parameters:a}=t,{context:s,params:n,data:o}=a,r=ibiz.hub.getApp(i.appId);if("layoutPanel"!==i.codeName){if(i.default)i.entityListParam?t.params[e]=o||[]:t.params[e]=o&&o.length>0?o[0]:{};else if(i.activeContainerParam)t.params[e]=a.ctrl||a.view;else if(i.activeCtrlParam)t.params[e]=a.ctrl;else if(i.ctrlParam){const s=a.view.getController(i.codeName.toLowerCase());s?t.params[e]=s:ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.viewLogicInitializationParameter",{codeName:i.codeName}))}else if(i.activeViewParam)t.params[e]=a.view;else if(i.appGlobalParam){let a=ibiz.util.getGlobalParam();i.paramFieldName&&(a.hasOwnProperty(i.paramFieldName)||(a[i.paramFieldName]={}),a=a[i.paramFieldName]),t.params[e]=a}else if(i.applicationParam)t.params[e]=r;else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]=[];else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.navContextParam)t.params[e]=s;else if(i.navViewParamParam)t.params[e]=ibiz.util.getRouterParams();else if(i.routeViewSessionParam){let s=a.view.getTopView().state;i.paramFieldName&&(s.hasOwnProperty(i.paramFieldName)||(s[i.paramFieldName]={}),s=s[i.paramFieldName]),t.params[e]=s}else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.viewNavDataParam)t.params[e]=n;else if(i.viewSessionParam){let s=a.view.state;i.paramFieldName&&(s.hasOwnProperty(i.paramFieldName)||(s[i.paramFieldName]={}),s=s[i.paramFieldName]),t.params[e]=s}else i.filterParam?t.params[e]={}:i.envParam?t.params[e]=ibiz.env:i.sessionParam&&(t.params[e]=t.session);ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.calculateInterfaceLogicParameters",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}else t.params[e]=a.view.layoutPanel.panelItems}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.restablishInterfaceLogic",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}},Lc=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 i(t,ibiz.i18n.t("runtime.uiLogic.noLogicalNodesConfigured"));t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new uc(t);break;case"END":i=new pc(t);break;case"DEACTION":i=new lc(t);break;case"DEUIACTION":i=new hc(t);break;case"PREPAREJSPARAM":i=new mc(t);break;case"RESETPARAM":i=new vc(t);break;case"COPYPARAM":i=new bc(t);break;case"BINDPARAM":i=new fc(t);break;case"VIEWCTRLINVOKE":i=new gc(t);break;case"MSGBOX":i=new yc(t);break;case"DEBUGPARAM":i=new Ec(t);break;case"APPENDPARAM":i=new Ic(t);break;case"SORTPARAM":i=new Dc(t);break;case"RENEWPARAM":i=new Cc(t);break;case"DEDATASET":i=new Ac(t);break;case"THROWEXCEPTION":i=new Pc(t);break;case"VIEWCTRLFIREEVENT":i=new Tc(t);break;case"DELOGIC":i=new Nc(t);break;case"PFPLUGIN":i=new wc(t);break;case"RAWJSCODE":i=new xc(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Sc(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 ac(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:a}=this.model;if(!a||!this.nodes.has(a))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{const t=this.nodes.get(a);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:i}=t;for(let a=0;a<i.length;a++){const s=i[a];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!0!==t.model.parallelOutput))break}}},Mc=new Map;async function Rc(t,e,i){const a=ibiz.hub.getApp(i.context.srfappid),s=await a.getDEUILogic(t,e);if(!s)throw new o(ibiz.i18n.t("runtime.uiLogic.interfaceLogic",{appDataEntityId:e,deUILogicId:t}));Mc.has(s)||Mc.set(s,new Lc(s)),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.startExecutingInterfaceLogic",{appDataEntityId:e,name:s.name}));const n=Mc.get(s),r=await n.exec(i);return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.endExecutionInterfaceLogic",{appDataEntityId:e,name:s.name})),r}var Oc=t("UIActionUtil",class{static async exec(t,e,i){const a=await Me(t,i);if(!a)throw new o(ibiz.i18n.t("runtime.uiAction.noFoundBehaviorModel",{actionId:t}));if("SINGLEDATA"===a.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await oa(a)).exec(a,e)}static async execAndResolved(t,e,i){var a,s;const n=await this.exec(t,e,i);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==(a=e.view.parentView)||a.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}(await Me(t,i)).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"))}}),Fc=t("UIActionProviderBase",class{async exec(t,e){const a={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{view:s}=e;t.closeEditView&&(s.state.isClosing=!0);const{appDEUILogicId:n,appDataEntityId:o,uilogicAttachMode:r}=t;if("REPLACE"===r){if(!n)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return await Rc(n,o,e),a}if(!await this.isConfirm(t,e))return this.returnError(a,s);const c=await this.execAction(t,e);if(Object.assign(a,c),!0===a.cancel)return this.returnError(a,s);if("AFTER"===t.uilogicAttachMode){if(!n)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));await Rc(n,o,this.mergeArgsByResult(e,a))}const d=this.mergeArgsByResult(e,a);if(t.closeEditView)this.doNextAction(t,d,t.appId);else{const e=await this.doNextAction(t,d,t.appId);if(e&&(Object.assign(a,e),!0===e.cancel))return this.returnError(a,s)}return a}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t,e){return e.state.isClosing=!1,Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const i=this.calcMessage("confirm",t,e);return!t.enableConfirm||!i||ibiz.confirm.warning({title:ibiz.i18n.t("runtime.uiAction.operationConfirmation"),desc:i})}async doNextAction(t,e,i){const a=t.nextId;if(a)return Oc.exec(a,e,i)}async handleParams(t,e,i,a){let s=[];const n=Te(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[i[0]];break;case"MULTIDATA":s=i;break;case"MULTIKEY":s=n&&i.length>0?i.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=i[0]||{};s=n?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:i}=t,a=i||n,s=e||"srfkey";c.unshift({key:a,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&i.length>0,l=pe(c,d?fe(c,i):i[0]||{},a,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:pe(h,d?fe(h,i):i[0]||{},a,r)}}calcMessage(t,e,i){let a,s;const{confirmMsg:n,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":a=n,s=o;break;case"success":a=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||a);t!==s.lanResTag&&(a=t)}if(a){const{data:t}=i,e={...i};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,ai.execScriptFn(e,"`".concat(a,"`"),{isAsync:!1,singleRowReturn:!0})}}handleViewOptionParams(t){if(t.modaloption)try{const e=JSON.parse(t.modaloption);return delete t.modaloption,{modalOption:e}}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.uiAction.viewParameterModalOption",{error:t}))}return{}}}),_c=t("BackendUIActionProvider",class extends Fc{async execAction(t,e){const{context:a,params:s,data:n,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new i(t,ibiz.i18n.t("runtime.uiAction.noEntityOrBehavior"));const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,a,n,s),p={...h},m=t.frontAppViewId;if(m){const t=this.handleViewOptionParams(h),e=await ibiz.commands.execute(Ko.TAG,m,l,h,{event:o,...t});if(!(null==e?void 0:e.ok))return r.cancel=!0,r;if((null==e?void 0:e.ok)&&e.data){0===u.length&&u.push({});const t=e.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((e=>{e.srfactionparam=t}))}}const g=ibiz.hub.getApp(null==a?void 0:a.srfappid),f=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),y=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),w=await g.deService.exec(c,d,l,y?f:f[0],p);if(w.ok){const i=this.calcMessage("success",t,e);i&&ibiz.message.success(i)}return Object.assign(r,{data:gt(w.data)?w.data:[w.data],nextContext:l,nextParams:p}),r}}),zc=t("SysUIActionProvider",class extends Fc{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:i}=e,a=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===a)return{closeView:!0};return await i.callUIAction(a,e)||{}}}),Vc=t("FrontUIActionProvider",class extends Fc{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=C.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 i(t,ibiz.i18n.t("runtime.uiAction.noConfiguredopenView"));const{resultContext:a,resultParams:l}=await this.handleParams(t,s,o,n),h=this.handleViewOptionParams(l),u=await ibiz.commands.execute(Ko.TAG,e,a,l,{event:r,noWaitRoute:c,...h});(null==u?void 0:u.ok)||(d.cancel=!0),(null==u?void 0:u.ok)&&u.data&&(d.data=u.data,d.nextContext=a,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=await this.doOther(t,e);break;case"EDITFORM":d=await this.openEditForm(t,e);break;default:throw new a(t,ibiz.i18n.t("runtime.uiAction.frontProcessingModes",{frontProcessType:t.frontProcessType}))}return d}async doOther(t,e){const{scriptCode:a,uiactionTag:s}=t,{context:n,params:o,data:r,event:c,view:d}=e;if("ShortCut"===s){return await d.callUIAction(s,e)||{}}if(a){return await ai.asyncExecScriptFn({context:n,params:o,data:r,el:null==c?void 0:c.target,view:d},a)||{}}throw new i(t,ibiz.i18n.t("runtime.uiAction.missingConfigurationScriptCode"))}async executePrint(t,e){var i;const{resultContext:a,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(i=n.appDEPrints)?void 0:i.find((e=>e.id===t.appDEPrintId));if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.physicalPrint"));{let t="";if(!a||!a[n.codeName.toLowerCase()])throw new o(ibiz.i18n.t("runtime.uiAction.dataPrimaryKey"));t+="/".concat(n.deapicodeName2,"/printdata/").concat(a[n.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:r.codeName,...s}});if(!e.ok)throw new o(ibiz.i18n.t("runtime.uiAction.printFailure"));if(s&&s.srfcontenttype){const t=ibiz.util.file.getFileName(e),i=URL.createObjectURL(e.data),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){const{resultContext:a,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),{appDataEntityId:n,appDEDataImportId:o,frontAppViewId:r}=t;if(!n||!o)throw new i(t,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));return await Tr({appDataEntityId:n,deDataImportId:o,dataImportViewId:r,context:a,params:s}),{refresh:!0,refreshMode:1}}async executeDataExport(t,e){var i;const{resultParams:a}=await this.handleParams(t,e.context,e.data,e.params),s=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),n=null==(i=s.appDEDataExports)?void 0:i.find((e=>e.id===t.appDEDataExportId));if(!n)throw new o(ibiz.i18n.t("runtime.uiAction.noEntityExportsFound"));{const t="/".concat(s.deapicodeName2,"/exportdata/fetchdefault?srfexporttag=").concat(n.codeName),i={page:0,size:n.maxRowCount?n.maxRowCount:1e3,...e.params,...a},r=await ibiz.net.request(t,{method:"post",data:i});if(200!==r.status)throw new o(ibiz.i18n.t("runtime.uiAction.exportRequestFailed"));{let t="".concat(s.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([r.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}}async openEditForm(t,e){const i={},{context:a,params:s,data:n,event:r}=e;if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.lackNativeEvent"));const{resultContext:c,resultParams:d}=await this.handleParams(t,a,n,s),l=this.handleViewOptionParams(d).modalOption||{},h=it({autoClose:!0},l);let u=!1;const p=ibiz.overlay.createPopover("IBizControlShell",{context:c,params:d,modelData:t.deeditForm,onSaveSuccess:t=>{i.data=[t.args],p&&p.dismiss(),u=!0}},h);return p.present(r.target),await p.onWillDismiss(),u||(i.cancel=!0),i}}),kc=t("WFWithdrawUIActionProvider",class extends Fc{async execAction(t,e){const{view:i}=e;let a=!1;return await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.uiAction.withdrawalConfirmed")})&&i&&(await i.call("WFWithdraw",e),a=!0),{refresh:!1,closeView:a}}}),Uc=class extends Fc{async execAction(t,e){return await ibiz.confirm.info({title:ibiz.i18n.t("runtime.uiAction.logout"),desc:ibiz.i18n.t("runtime.uiAction.wantLogout")})&&await ibiz.hub.controller.logout(),{}}};function Bc(){const t=new Vc;sa("FRONT",(()=>t));const e=new _c;sa("BACKEND",(()=>e));const i=new zc;sa("SYS",(()=>i));const a=new kc;sa("DEUIACTION_WFWithdraw",(()=>a));const s=new Uc;sa("SYS_Logout",(()=>s))}var Wc=t("ToolbarController",class extends kr{constructor(){super(...arguments),this.allToolbarItems=[],this.itemProviders={}}get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new lr,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,i={}){if("DEUIACTION"===t.itemType){const a=t.uiactionId,s=await Me(a,t.appId);if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.toolbar.noFound",{actionId:a}));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(i,n.params),await Oc.execAndResolved(a,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async initToolbarItemProviders(){await Promise.all(this.allToolbarItems.map((async t=>{const e=await Ra(t);e&&(this.itemProviders[t.id]=e)})))}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if(this.allToolbarItems.push(t),t.itemType){const e=t,i=new dr(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,i)}if(t.controlLogics)for(let e=0;e<t.controlLogics.length;e++){const i=t.controlLogics[e],a=this.state.buttonsState[t.id];if(i.itemName===t.id&&"ITEMVISIBLE"===i.triggerType&&a){a.visible=!1;break}}}),{childrenFields:["detoolbarItems"]}),await this.initToolbarItemProviders(),this.state.manualCalcButtonState?await this.state.buttonsState.init():await this.calcButtonState(void 0,this.model.appDataEntityId)}async onItemClick(t,e,i){const a="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:a?"extra":"deuiaction"}),a||await this.doUIAction(t,e,i)}async calcButtonState(t,e){let i=t;if(t&&t instanceof cs&&(i=t.getOrigin()),await this.state.buttonsState.update(this.context,i,e),this.allToolbarItems.forEach((t=>{const e=this.state.buttonsState[t.id];t.hiddenItem&&(e.visible=!1)})),this.scheduler){const t={};i&&(t.data=[i]),r(this.model,(e=>{const i=this.state.buttonsState[e.id];if(i){if(i.visible){const a=this.scheduler.triggerItemVisible(e.id,t);void 0!==a&&(i.visible=a)}if(!i.disabled){const a=this.scheduler.triggerItemEnable(e.id,t);void 0!==a&&(i.disabled=!a)}}}),{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)}}),Gc=t("ContextMenuController",class extends Wc{}),jc=(t("DashboardController",class extends kr{constructor(){super(...arguments),this.providers={},this.portlets={},this.enableDynamic=!1}initState(){super.initState()}async onCreated(){this.model.enableCustomized=!0,await super.onCreated(),await this.initPortlets(this.model.controls),"true"===this.controlParams.enabledynamic&&(this.enableDynamic=!0);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=gr(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const i=["CHART","APPMENU","TOOLBAR","LIST","REPORTPANEL"];await Promise.all(t.map((async t=>{var a;if(t.controlType&&i.includes(t.controlType))return;const s=await ia(t);if(s){this.providers[t.id]=s;const i=await s.createController(t,this,e);this.portlets[t.id]=i,(null==(a=t.controls)?void 0:a.length)&&await this.initPortlets(t.controls,i)}})))}async initPortletsConfig(t={}){Object.keys(t).forEach((e=>{const i=this.portlets[e];i&&(i.config=t[e],i.state.title=i.config.srftitle,Object.assign(i.params,i.config))}))}async resetPortlets(){Object.keys(this.portlets).forEach((t=>{this.portlets[t].resetConfig()})),this.evt.emit("onResetPortlet",void 0)}async loadAllDynaPortlet(){var t;const e=ibiz.hub.getApp(ibiz.env.appId),i=await e.deService.exec("psappportlet","fetchdefault",this.context,{size:1e3,n_pssysappid_eq:e.model.codeName,n_dynamodelflag_noteq:0});return i&&(null==(t=i.data)?void 0:t.length)>0?i.data:[]}async loadDynaPortletById(t){const e=ibiz.hub.getApp(ibiz.env.appId),i=st(this.context);Object.assign(i,{psappportlet:t});const a=await e.deService.exec("psappportlet","get",i,this.params);if(a&&a.data&&a.data.controlmodel){const t=JSON.parse(a.data.controlmodel);return await ibiz.hub.translationModelToDsl(t,"CTRL")}}async dataChangeNotify(t){await Pn(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t,e){this.model=t,this.dashboard=e,this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.portletConfig={},this.type="personal",this.ownerType="",this.ownerId="",this.context=e.context,this.params=e.params,this.init(e.controlParams)}init(t){var e,i;if(this.type="personal",this.ownerId=this.context.srfpersonid,t.type&&(this.type=t.type),t.owner_type&&(this.ownerType=t.owner_type),t.owner_id&&(this.ownerId=this.context[t.owner_id]),"true"===t.multimode&&(this.type="dynamic"),this.model.appDynaDashboardUtilId){const t=ibiz.hub.getApp(this.context.srfappid);this.util=new Zs(t.getAppUtil(this.model.appDynaDashboardUtilId))}else this.config=new Za(this.model.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(i=this.model.codeName)?void 0:i.toLowerCase()))}getResourceTag(){var t,e;const i="".concat(this.context.srfappid,"_dashboard_").concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase());switch(this.type){case"personal":return"".concat(i,"_").concat(this.context.srfpersonid);case"data":return"".concat(i,"_").concat(this.ownerType,"_").concat(this.ownerId);case"dynamic":return"".concat(i,"_").concat(this.context.srfdynadashboardid);default:return i}}async loadCustomModelData(){let t;return t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),t.config&&(this.portletConfig=t.config),{model:this.customModelData,config:this.portletConfig}}async resetCustomModelData(){return this.portletConfig={},this.saveCustomModelData([])}async saveCustomModelData(t,e={}){let i;Object.assign(this.portletConfig,e);const a={model:t,colNum:this.layoutColNum,rowH:this.layoutRowH,config:this.portletConfig};return i=this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},a):await this.config.save(a),i&&(this.customModelData=t),{model:t,config:this.portletConfig}}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),Kc=t("PortletPartController",class{constructor(t,e,i){this.config={},this.model=t,this.dashboard=e,this.parent=i,this.state=this.createState(),this.state.context=d.create({},this.dashboard.context),this.params=new b({},this.dashboard.params)}get context(){return this.state.context}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get contentController(){const{contentControlId:t}=this.model;if(t)return this.dashboard.getController(t)}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e,title:i,titleLanguageRes:a}=this.model;if(t){const{width:t,height:e}=De(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),this.state.title=a?ibiz.i18n.t(a.lanResTag,i):i,this.config={srftitle:this.state.title},Object.assign(this.params,this.config),await this.initActionStates()}createState(){return new jc}refresh(){}async setConfig(t){this.config=t,t.srftitle&&(this.state.title=t.srftitle),B(this.params,t),this.dashboard.evt.emit("onConfigChange",{name:this.model.id,config:this.config})}resetConfig(){const{title:t,titleLanguageRes:e}=this.model;this.params=new b({},this.dashboard.params),this.state.title=e?ibiz.i18n.t(e.lanResTag,t):t,this.config={srftitle:this.state.title},Object.assign(this.params,this.config)}onDataChange(t){let e=t.data[0];e&&e instanceof cs&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(this.context,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 i=new lr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new dr(t.id,this.dashboard.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.dashboard.context),this.state.actionGroupState=i;const{appDataEntityId:a}=this.dashboard.view.model;a&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,i=[]){var a,s;const n=t.uiactionId,o={context:this.context,params:this.params,data:i,view:this.dashboard.view,ctrl:this,event:e},r=await Oc.exec(n,o,t.appId);if(r.closeView)this.dashboard.view.closeView();else if(r.refresh)switch(r.refreshMode){case 1:this.refresh();break;case 2:null==(a=this.dashboard.view)||a.callUIAction("Refresh");break;case 3:null==(s=this.dashboard.view.getTopView())||s.callUIAction("Refresh")}}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(this.context,t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=Ce(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 Kc{}),t("ViewPortletController",class extends Kc{get contentController(){const{portletAppView:t}=this.model;if(t&&t.name)return this.dashboard.getController(t.name)}refresh(){this.contentController&&this.contentController.callUIAction("Refresh")}}),t("MenuPortletController",class extends Kc{}),t("ChartPortletController",class extends Kc{refresh(){this.contentController&&this.contentController.refresh()}}),t("ActionBarPortletController",class extends Kc{}),t("HtmlPortletController",class extends Kc{}),t("ListPortletController",class extends Kc{refresh(){this.contentController&&this.contentController.refresh()}}),t("RawItemPortletController",class extends Kc{}),t("ReportPortletController",class extends Kc{refresh(){this.contentController&&this.contentController.refresh()}}),t("DataViewControlService",class extends ls{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new on(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new on(e,e);this.dataUIMap.set(e,a)}))}})),Xc=t("DataViewControlController",class extends Ur{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=[];const{enablePagingBar:t}=this.model;this.state.enablePagingBar=t}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 i=new lr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new dr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.context,void 0,this.model.appDataEntityId),t.groupActionGroupState=i}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:i}=this.model;if(i)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[i],a=this.state.groups.find((t=>t.key===e));a&&a.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var i,a;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof cs&&(s=s.getOrigin()),s&&(null==(i=e.groupActionGroupState)||i.update(this.context,s,this.model.appDataEntityId))):null==(a=e.groupActionGroupState)||a.update(this.context,void 0,this.model.appDataEntityId)}));else{const i=this.state.groups.find((e=>-1!==e.children.indexOf(t)));i&&(null==(e=i.groupActionGroupState)||e.update(this.context,i.selectedData[0],this.model.appDataEntityId))}}calcShowMode(t){const{enablePagingBar:e}=this.model;this.state.hideNoDataImage=!1,this.state.enablePagingBar=e;const i=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===i&&(this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===i&&0===t.length&&(this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),this.calcShowMode(e),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let i=0;i<e.length;i++)"ACTIONITEM"===e[i].itemType&&(t=e[i]);return t}getOptItemAction(t){var e;const a=new lr,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroup"));if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroupAction")),a;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new dr(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.getOrigin())}return a}async onActionClick(t,e,i){const a=t.uiactionId;await Oc.execAndResolved(a,{context:this.context,params:this.params,data:[e],view:this.view,event:i},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];et(a)||(i.has(a)||i.set(a,[]),i.get(a).push(e))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}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 i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(e)}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,key:i.value,children:t})})),this.state.groups=n}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const i={...this.params,srfgroup:e};Oc.execAndResolved("new",{context:this.context,params:i,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,i){const a=t.uiactionId,s={...this.params,srfgroup:i.key};await Oc.execAndResolved(a,{context:this.context,params:s,data:i.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:a,minorSortDir:s}=this.model,n=a&&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 i(t,ibiz.i18n.t("runtime.controller.control.dataView.sortingItems"));const r={caption:o,key:t.appDEFieldId};n&&a===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),qc=t("ExpBarControlController",class extends kr{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 i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName: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 i=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),a=[];null==i||i.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("、"))}}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&&pr(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:i,params:a}=t,s=this.getNavViewMsg(e[0],i,a);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,i,a){const{navDER:s,navFilter:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?Te(c):void 0,navFilter:n,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:o,navParams:r},l={context:i,params:a,data:e},{resultContext:h,resultParams:u}=ye(d,l),p=Object.assign(i.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(ibiz.i18n.t("runtime.controller.control.expBar.multiNode"))}getNavViewMsg(t,e,i){const a=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,i);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:a,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())}}),Yc=(t("CalendarExpBarController",class extends qc{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 i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName: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 i=new Date(e.beginTime);this.xDataController.setSelectDate(i)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:i,params:a}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return i.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:i,params:a,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends qc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName: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 i;return e&&e.forEach((e=>{e.id===t&&(i=e)})),i}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,i){const a=t._id,s=t._deData||t,n=this.getNodeModel(t._nodeId);if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.expBar.noFindNodeModel",{nodeId:t._nodeId}));const r=this.prepareParams(n,s,e,i);return r.context.currentSrfNav=a,this.state.srfnav=a,{key:a,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,i)=>{0===i?e.push(t):e.push("".concat(e[i-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 qc{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,i,a){var s;const{context:n,params:o}=super.prepareParams(t,e,i,a);if(e._seriesModelId){const i=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(i){const{navigateContexts:t,navigateParams:s}=i,r=pe(t,e,a,n),c=pe(s,e,a,o);return{context:Object.assign(n.clone(),r),params:c}}}return{context:n,params:o}}getNavViewMsg(t,e,i){var a;let s;if(t._seriesModelId){const e=null==(a=this.XDataModel.dechartSerieses)?void 0:a.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const n=this.prepareParams(this.XDataModel,t,e,i);return{key:t._uuid,context:n.context,params:n.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends kr{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[],this.counters={}}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new cs,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await Pn(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(),await this.initCounter(),this.dataChangeNotify=A(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,a=void 0){await Promise.all(t.map((async t=>{const s=await Xi(t,this.model);if(!s)return;if(e.details[t.id])throw new i(t,ibiz.i18n.t("runtime.controller.control.form.initializationException",{id:t.id,detailType:t.detailType}));e.providers[t.id]=s;const n=await s.createController(t,e,a);if(e.details[t.id]=n,"FORMITEM"===t.detailType&&e.formItems.push(n),"MDCTRL"===t.detailType&&e.formMDCtrls.push(n),Ve(t))return;const o=ze(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)||mr(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){if((null==e?void 0:e.error)&&e.error instanceof P){const{details:t}=e.error;t.forEach((t=>{this.setDetailError(t.name,t.errorInfo)}))}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)}async onDestroyed(){await super.onDestroyed(),Object.values(this.counters).forEach((t=>t.destroy()))}async initCounter(){this.counters={};const{appCounterRefs:t}=this.model;if(t&&t.length>0){const e=this.context[Te(this.model.appDataEntityId)];try{await Promise.all(t.map((async t=>{const i=await ts.getCounterByRef(t,this.context,e?{srfcustomtag:e,...this.params}:{...this.params});this.counters[t.id]=i})))}catch(t){console.error(t)}}}setDetailError(t,e){const i=this.details[t],a=null==i?void 0:i.state;a&&(a.error=e)}})),Qc=class extends ds{setDefault(t,e,i,a){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:n,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===a?n:r,h="create"===a?o:c,u=s.id.toLowerCase(),p=Er({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:i});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Jc=t("SearchFormService",class extends Qc{async getDraft(t,e={}){let i={ok:!0,status:200,data:this.getFilteredData({...e})};return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new on(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((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}}),$c=(t("SearchFormController",class extends Yc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Za(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 Jc(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 i=this.state.data[e];null!=i&&""!==i&&(t[e]=i)})),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,i=!1;const a=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===a,i="BOTTOM"!==a,"NONE"===t&&(e=!0,i=!0);const s=t=>{let a,n="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(a=t[e],n=e,!0))),a&&a.length>0){const o=[];a.forEach((t=>{e&&"control_buttons_right"===t.id||i&&"control_buttons_bottom"===t.id||(o.push(t),s(t))})),o.length<a.length&&(t[n]=o)}};(i||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(ibiz.i18n.t("runtime.controller.control.form.searchTerms"));e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o(ibiz.i18n.t("runtime.controller.control.form.saveSearch"));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,this.readonly=!1,this.enableReadonly=!0;let e,i,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)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!(!this.context||!this.enableReadonly)&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),Zc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Zc||{})),td=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(td||{})),ed=t("FormDetailController",class{constructor(t,e,i){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=i,this.state=this.createState(),this.state.context=this.context}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:i,capLanguageRes:a}=this.model;if(t){const{width:e,height:i}=De(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName),a&&a.lanResTag&&(this.model.caption=ibiz.i18n.t(a.lanResTag,this.model.caption))}createState(){var t;return new $c(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 i;this.parent&&!this.parent.state.visible||null==(i=this.model.defdgroupLogics)||i.forEach((i=>{const a=i.relatedDetailNames||[];if(e||T(a,t))try{const t=oi(this.data,i);switch(i.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=Ce(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=Ce(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}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})}}),id=t("FormButtonState",class extends $c{constructor(){super(...arguments),this.loading=!1}}),ad=(t("FormButtonController",class extends ed{constructor(){super(...arguments),this.actionState=null}createState(){var t;return new id(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){const t=this.model.uiactionId;t&&(this.actionState=new dr(this.model.id,this.form.context.srfappid,t))}async formStateNotify(t){if(this.actionState){const t=Te(this.form.model.appDataEntityId);await this.actionState.update(this.context,this.data,t)}await super.formStateNotify(t)}calcDetailDisabled(t){super.calcDetailDisabled(t),this.actionState&&(this.state.disabled=!(!this.state.disabled&&!this.actionState.disabled))}calcDetailVisible(t){super.calcDetailVisible(t),this.actionState&&(this.state.visible=!(!this.state.visible||!this.actionState.visible))}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 Oc.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 $c{constructor(){super(...arguments),this.showMask=!1}})),sd=(t("FormDRUIPartController",class extends ed{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new ad(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),T(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;lt(e)&&(t=Object.assign(t,pe(e,this.data,this.form.params,this.form.context)));const i=pe(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(i))this.navContext=t,this.navParams=i,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=mt(),this.navContext=t,this.navParams=i}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(ibiz.i18n.t("runtime.controller.control.form.relationshipInterface"),t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends $c{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),nd=t("FormGroupPanelController",class extends ed{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 sd(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(this.form.context,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 i=new lr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new dr(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await Oc.execAndResolved(i,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),od=t("FormItemState",class extends $c{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)})}}),rd=(t("FormItemController",class extends ed{constructor(t,e,i){super(t,e,i),this.rules=[],this.state.enableReadonly="SEARCHFORM"!==this.form.getControlType()}createState(){var t;return new od(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(){var t,e;await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:i}=this.model;i||(this.state.enableCondDisabled=!0),!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly&&(null==(t=this.model.editor)?void 0:t.readOnly)&&(this.state.readonly=(null==(e=this.model.editor)?void 0:e.readOnly)||!1),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await ji(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=Di(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...fr(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...yr(this.model.editor)),this.rules.length>0&&(this.validator=new Tt({[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 i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&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&&("string"==typeof this.data[this.name]?ht(this.data[this.name].trimEnd()):ht(this.data[this.name])))return this.state.error=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption: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})}}),class extends $c{constructor(){super(...arguments),this.actionGroupState=null}}),cd=t("FormMDCtrlController",class extends ed{createState(){var t;return new rd(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,2)}get enableDelete(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(this.form.context,t)}}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new lr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new dr(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await Oc.execAndResolved(i,{context:this.context,params:this.params,data:[this.data],view:this.form.view,event:e},t.appId)}refresh(){}async validate(){return!0}}),dd=(t("FormMDCtrlMDController",class extends cd{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 i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));"GRID"===t.controlType&&x(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await Bi(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 a(this.model,ibiz.i18n.t("runtime.controller.control.form.multiDataAddData",{contentType:this.model.contentType}));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.form.mdControllerNoExist"))}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 rd{}),ld=(t("FormMDCtrlFormController",class extends cd{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map,this.items=[]}createState(){var t;return new dd(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await Bi(t);e&&(this.formProvider=e);const{appDataEntityId:a}=this.model.contentControl;this.deName=Te(a)}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.items=e.data,this.state.items=this.items.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const i={...this.params};return{id:t.srfkey,context:e,params:i}})))}async updateData(){var t;const{appDataEntityId:e}=this.model.contentControl,i=await ibiz.hub.getAppDEService(this.model.appId,e,this.context),a=null==(t=this.state.items)?void 0:t.map(((t,e)=>{const i=this.items.find((e=>e.srfkey===t.id));return i.srfordervalue=e+1,i}));i.isLocalMode&&a&&await i.exec("update",this.context,a)}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onLoadSuccess",(e=>{var i,a;const s=null==(i=e.data)?void 0:i[0],n=null==(a=this.state.items)?void 0:a.find((e=>e.id===t));n&&s&&(n.title=s.srfmajortext||"")})),e.evt.on("onSaveSuccess",(e=>{const i=e.data[0],a=this.state.items.find((e=>e.id===t));a&&i&&(a.title=i.srfmajortext||"",a.context[this.deName]!==i.srfkey&&(a.context[this.deName]=i.srfkey)),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async validate(){return-1===(await Promise.all(Array.from(this.formMap.values()).map((t=>t.validate())))).findIndex((t=>!t))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.form.noFoundFormController",{id:t}));await e.remove({silent:!0}),this.formMap.delete(t);const i=this.state.items.findIndex((e=>e.id===t));-1!==i&&this.state.items.splice(i,1)}create(t){const e=this.context.clone(),i={...this.params};this.state.items||(this.state.items=[]);const a={id:mt(),context:e,params:i};void 0!==t?this.state.items.splice(t,0,a):this.state.items.push(a)}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 cd{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1,this.repeaterMap=new Map}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 a(this.model,ibiz.i18n.t("runtime.controller.control.form.repeaterNoSupported",{detailStyle: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=st(e)}setRepeaterController(t,e){this.repeaterMap.set(t,e)}async validate(){return-1===(await Promise.all(Array.from(this.repeaterMap.values()).map((t=>t.validate())))).findIndex((t=>!t))}setValue(t){this.form.setDataValue(this.name,t)}create(t){const e={};if(this.isSingleData)this.setValue(e);else{let i=this.value;i=i?[...i]:[],void 0!==t?i.splice(t,0,e):i.push(e),this.setValue(i)}this.form.evt.emit("onMDCtrlNew",{args:e})}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,i)=>t!==i));this.setValue(e),this.form.evt.emit("onMDCtrlRemove",{args:e})}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends sd{})),hd=(t("FormPageController",class extends nd{createState(){var t;return new ld(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends $c{})),ud=(t("FormRawItemController",class extends ed{createState(){var t;return new hd(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends $c{})),pd=(t("FormTabPageController",class extends ed{createState(){var t;return new ud(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends $c{constructor(){super(...arguments),this.activeTab=""}})),md=(t("FormTabPanelController",class extends ed{createState(){var t;return new pd(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}getCounter(t){const{counters:e}=this.form;return e&&e[t]?e[t]:null}}),t("EditFormService",class extends Qc{async get(t,e={}){var i;let a=await this.exec((null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"update"),a}async getDraft(t,e={}){var i;let a=await this.exec((null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}async remove(t,e={}){var i;return await this.exec((null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var i;const a=e instanceof cs?e.getOrigin():e,s=this.getFilteredData(a);let n=await this.exec((null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create",t,s);return n=this.handleResponse(n),n}async update(t,e){var i;const a=e instanceof cs?e.getOrigin():e,s=this.getFilteredData(a);let n=await this.exec((null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update",t,s);return n=this.handleResponse(n),n}async goBack(t,e){var a;const s=null==(a=this.model.goBackControlAction)?void 0:a.appDEMethodId;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.lackBehavior"));let n=await this.exec(s,t,e instanceof cs?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,i={},a={}){Object.assign(a,{srfupdateitem:!0});let s=await this.exec(t,e,i,a);return s=this.handleResponse(s),s}async wfStart(t,e,i){var a;const s=(null==(a=this.model.wfstartControlAction)?void 0:a.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,i instanceof cs?i.getOrigin():i)}async wfSubmit(t,e,i){var a;const s=this.model;let n="";n=e.type?e.type:(null==(a=s.wfsubmitControlAction)?void 0:a.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,i instanceof cs?i.getOrigin():i)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const i=e,a=i.id.toLowerCase(),s=i.fieldName||e.appDEFieldId;let n;n=s?new on(a,s,{isOriginField:!0,dataType:i.dataType}):new on(a,a,{isOriginField:t.includes(a)}),this.dataUIMap.set(a,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((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}})),gd=(t("EditFormController",class extends Yc{constructor(){super(...arguments),this.oldData=new cs}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new md(this.model),await this.service.init(this.context),this.autoSave=W(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:i}=this.handlerAbilityParams(t);let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:i}),a=await this.service.getDraft(e,i)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=a.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=st(this.context),e=st(this.params),i=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(i&&this.params[i]){t[Te(this.model.appDataEntityId)]=this.params[i],delete e[i],delete this.params[i],delete e.srfcopymode,delete this.params.srfcopymode}let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:e}),a=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return a.data.srfkey=void 0,a.data.tempsrfkey=mt(),this.state.modified=!1,this.state.data=a.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",{args:a.data}),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Ne(this.context,Te(this.model.appDataEntityId)))return this.loadDraft();const{context:e,params:i}=this.handlerAbilityParams(t),a=st(i);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:a}),s=await this.service.get(e,a)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),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",{args:s.data}),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 S(500,this.save.bind(this),[t])}if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));e||await this.startLoading();const{context:i,data:a}=this.handlerAbilityParams(t),s=a[0],n=0===s.srfuf;let r;try{await this.evt.emit("onBeforeSave",{args:s}),r=n?await this.service.create(i,s):await this.service.update(i,s)}catch(t){throw await this.evt.emit("onSaveError",{args:t}),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):x(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",{args:r.data}),this.view.state.isClosing||this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:this.data.srfmajortext||""})}),this.emitDEDataChange(n?"create":"update",r.data),this.data}async remove(t){const{context:e,params:i}=this.handlerAbilityParams(t);let a,s=!1;if(await this.evt.emit("onBeforeRemove",{args:this.data}),1===this.data.srfuf){if(!0!==(null==t?void 0:t.silent)){if(s=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.controller.control.form.deletion")}),!s)return!1}await this.startLoading();try{a=await this.service.remove(e,i)}catch(e){throw await this.evt.emit("onRemoveError",{args:e}),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e}),e}finally{await this.endLoading()}s=a.ok}return this.emitDEDataChange("remove",this.data),this.state.data=new cs,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",{args:this.data}),this.actionNotification("REMOVESUCCESS"),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&&x(this.data,t.data),this.data}async updateFormItem(t){var e;const i=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.form.itemUpdate",{formItemUpdateId:t}));const{appDEMethodId:a,defiupdateDetails:s,customCode:n,scriptCode:r,showBusyIndicator:c}=i,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),n&&r)t=ai.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},i=await this.service.updateFormItem(a,this.context,e);t=i.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(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processStarted")})}async wfSubmit(t){if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processSubmitted")})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=d.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}async immediateAutoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=d.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((i=>{Array.isArray(t[i])?I(t[i],this.oldData[i])||(e[i]=t[i]):t[i]===this.oldData[i]&&i!==t.srfkeyfield||(e[i]=t[i])})),e.srfuf=t.srfuf,new cs(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)}onDEDataChange(t){var e;if("OBJECTUPDATED"===t.subtype&&(et(t.triggerKey)||t.triggerKey!==this.triggerKey)&&this.model.appDataEntityId){const i=Te(this.model.appDataEntityId);if(!t.data||(null==(e=t.data.srfdecodename)?void 0:e.toLowerCase())!==i||t.data.srfkey!==this.data.srfkey)return;this.doNextActive((()=>this.load()),{key:"load"})}}}),t("GridColumnController",class{constructor(t,e){var i;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(i=this.deGridDataItem)?void 0:i.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 ai.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),fd=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,this.oldData=t.clone(),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=>{let i;this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.fieldName],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})}))}getDiffData(){const t={};return Object.keys(this.data).forEach((e=>{this.data[e]===this.oldData[e]&&e!==this.data.srfkeyfield||(t[e]=this.data[e])})),t.srfuf=this.data.srfuf,t.srfkey=this.data.srfkey,new cs(t,this.oldData.$dataUIMap)}}),yd=t("GridService",class extends ls{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const a=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 i(t,ibiz.i18n.t("runtime.controller.control.grid.corresponding",{deField:s}));n=new on(a,o,{isOriginField:!0,dataType:r.dataType})}else n=new on(a,a);this.dataUIMap.set(a,n)}))}}async updateGridEditItem(t,e,i={},a={}){const s=await this.app.deService.getService(e,this.model.appDataEntityId);Object.assign(a,{srfupdateitem:!0});let n=await s.exec(t,e,i,a);return n=this.handleResponse(n),n}async moveOrderItem(t,e,i){const a=this.model.moveControlAction.appDEMethodId,s=Te(this.model.appDataEntityId),n=t.clone();n[s]=e.srfkey;let o=await this.exec(a,n,i);return o=this.handleResponse(o),o}}),wd={string:25,number:6,integer:9,date:5};var Ed=t("GridController",class extends Ur{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.showPercent=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计",this.dataExportParam={},this.allExportColumns=[],this.allExportCodelistMap=new Map,this.formatValue=(t,e="")=>{const i="".concat(e);if(!t)return i;if(Pt(i,t,!0).isValid()){return Pt(i).format(t)}return ibiz.util.text.format(i,t)}}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 enableRowEditOrder(){return!!this.model.enableRowEditOrder}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;const{hideHeader:t,enablePagingBar:e}=this.model;this.state.hideHeader=t,this.state.enablePagingBar=e}async onCreated(){this.addSchemaColumn="true"===this.controlParams.enablejsonschema,this.showPercent="true"===this.controlParams.showpercent,await this.initByEntitySchema(),await super.onCreated(),this.service=new yd(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=A(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup(),await this.initExportData()}calcShowMode(t){const{hideHeader:e,enablePagingBar:i}=this.model;this.state.hideNoDataImage=!1,this.state.hideHeader=e,this.state.enablePagingBar=i;const a=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===a&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===a&&0===t.length&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await Mr(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var i;if(!t.properties)return;const{properties:a}=t;if(!(Object.keys(a).length>0))return;const s={};null==(i=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||i.forEach((t=>{s[t.codeName.toLowerCase()]=t.id}));const n=[];Object.keys(a).forEach((t=>{if(!s[t]){let e;switch(a[t].type){case"string":e="string","date-time"===a[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:a[t].type}))}n.push({key:t,description:a[t].description,type:e})}}));const o=[],r=[];return n.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:t.key,id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,hideDefault:!0,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:t.key,id:t.key,valueType:"SIMPLE",dataType:wd[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:i}=e;this.model=st(this.model),this.model.degridColumns=[...this.model.degridColumns||[],...t],this.model.degridDataItems=[...this.model.degridDataItems||[],...i]}}async initExportData(){var t;if(this.model.dedataExportId&&(this.dataExport=null==(t=this.dataEntity.appDEDataExports)?void 0:t.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport))),this.allExportColumns.length>0)this.allExportColumns.forEach((t=>{t.codeListItems&&this.allExportCodelistMap.set(t.appDEFieldId,t.codeListItems)})),this.dataExportParam.fields=this.allExportColumns.map((t=>t.appDEFieldId)),this.dataExportParam.header=this.allExportColumns.map((t=>t.caption));else{Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&this.allExportCodelistMap.set(t,this.fieldColumns[t].codeListItems)}));const{degridColumns:t=[]}=this.model;this.dataExportParam.fields=t.map((t=>t.id)),this.dataExportParam.header=t.map((t=>t.caption))}}async fillExportCodelistMap(){if(this.model.dedataExportId)return;const t=async(t,e)=>{const i=await e.loadCodeList();this.allExportCodelistMap.set(t,i)},e=[];for(const[i,a]of this.allExportCodelistMap)if(!a){const a=this.fieldColumns[i];a.codeListItems?this.allExportCodelistMap.set(i,a.codeListItems):e.push(t(i,a))}e.length>0&&await Promise.all(e)}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:a}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.attributeColumns"));const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new i(this.groupFieldColumn.model,ibiz.i18n.t("runtime.controller.control.grid.noCodeTable",{groupFieldName:s}));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.configureFirstColumn",{groupFieldName:s}));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===a){if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.requiresCodeTable"));if(this.groupFieldColumn.model.appCodeListId!==e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.noMatchCodeTable",{groupFieldName:s}))}this.calcColumnFixed()}sortItems(t){const e=this.model.orderValueAppDEFieldId;e&&this.enableRowEditOrder&&(t.forEach((t=>{const i=t[e];if(et(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>t[e]-i[e])))}async afterLoad(t,e){this.sortItems(this.state.items),await super.afterLoad(t,e),await Pn(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1);const i=e.map((t=>{const e=new fd(t,this);return this.gridStateNotify(e,"LOAD"),e}));return t.isLoadMore?this.state.rows.push(...i):this.state.rows=i,await this.updateRows(this.state.rows),this.calcGroupData(this.state.items),await this.loadRemoteAgg(),this.calcAggResult(this.state.items),this.calcShowMode(this.state.items),this.calcTotalData(),e}async updateRows(t){for(const e of t)await Promise.all([...Object.values(e.uaColStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId))),...Object.values(e.uiActionGroupStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId)))])}calcGroupData(t){const{enableGroup:e,groupMode:i}=this.model;if(e){const e=new Map,a="CODELIST"===i,s=this.groupFieldColumn.model.id;a&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const i=t[s];a||e.has(i)||e.set(i,[]),e.has(i)&&e.get(i).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==i?void 0:i.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:a}=this.model;if("ALL"!==t)return;if(!a||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.missingConfiguration"));const s=await this.getFetchParams();delete s.sort;const n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,a,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 i=e.calcFieldAgg(t);i&&(this.state.aggResult[e.model.id]=i)}))}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 i=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==i&&e.children.splice(i,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:i}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(i))return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.newRows"));if("row"===i){if(this.state.rows.find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.common.md.firstComplete"))}const a={...this.params},s=this.calcDefaultValue({},!0);let n;Object.assign(a,s);try{n=await this.service.getDraft(this.context,a)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=n.data;L(r,s),this.state.items.unshift(r);const c=new fd(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===i&&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,i=this.findRowState(t);if(!i)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!i.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(i.processing)return void await S(500,this.save.bind(this),[t]);if(!await this.validate(i))throw new o(ibiz.i18n.t("runtime.controller.control.grid.saveCancel"));let a;this.model.enableRowEditChangedOnly&&(t=i.getDiffData());const s=Te(this.model.appDataEntityId),n=this.context.clone();n[s]=t.srfkey;try{a=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:i.data,rowState:i}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,a.data),i.data=a.data,i.oldData=a.data.clone(),i.modified=!1,this.gridStateNotify(i,"SAVE"),await this._evt.emit("onSaveSuccess",void 0),this.emitDEDataChange(e?"create":"update",a.data)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await Pn(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const i=await Qi(t,this.model);if(!i)return;this.providers[t.codeName]=i;const a=await i.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=a,t.enableRowEdit&&(this.editColumns[t.codeName]=a)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=a:"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=[],0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"===t.columnType||t.hiddenDataItem||2===t.hideMode||this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,hideMode:t.hideMode||0,uaColumn:"UAGRIDCOLUMN"===t.columnType,adaptive:"STAR"===t.widthUnit})}),{childrenFields:["degridColumns"]});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=this.mergeGridColumnStates(this.state.columnStates,e.schemaColumnStates):!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=this.mergeGridColumnStates(this.state.columnStates,e.defaultColumnStates))}this.calcColumnFixed()}mergeGridColumnStates(t,e){const i=[];return t.length>0&&t.forEach((t=>{const a=e.find((e=>e.key===t.key));a?i.push(a):i.push(t)})),i}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:i,frozenLastColumn:a}=this.model;this.hasAdaptiveColumn=!1,t.forEach(((t,s)=>{t.adaptive&&(this.hasAdaptiveColumn=!0),t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":i&&s<i?t.fixed="left":a&&s>=e-a&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||mr(t.data[e],i)){t.data[e]=i,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 Pn(Object.values(this.editColumns).map((async i=>i.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((i=>{i.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(ibiz.i18n.t("runtime.controller.control.grid.noSupportRowEditing"));this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)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(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data.srfuf){t.cacheData=st(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let i;t&&(i=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(i,e)}async updateGridEditItem(t,e){var i;const a=null==(i=this.model.degridEditItemUpdates)?void 0:i.find((t=>t.id===e));if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.grid.updateColumns",{updateId:e}));const{appDEMethodId:s,degeiupdateDetails:n,customCode:r,scriptCode:c}=a,d=n.map((t=>t.id));let l;if(r&&c)l=ai.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},i=await this.service.updateGridEditItem(s,this.context,e);l=i.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),i=await this.getFetchParams(null==t?void 0:t.viewParam);let a;await this.startLoading();try{a=await this.service.fetch(e,i)}finally{await this.endLoading()}return a.data}async findAllExportColumns(t){var e;const i=ibiz.hub.getApp(this.context.srfappid),a=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=i.codeList.getCodeList(t.codeListId),e.codeListItems=await i.codeList.get(t.codeListId,this.context)),e}));return a?Promise.all(a):[]}formatExcelData(t){const{fields:e=[]}=this.dataExportParam,i=st(t.map((t=>e.reduce(((e,i)=>(e[i]=t[i],e)),{}))));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;let a=t[e];const s=this.allExportColumns.find((t=>t.appDEFieldId===e)),n=this.fieldColumns[e],o=(null==s?void 0:s.format)||(null==n?void 0:n.valueFormat),r=(null==n?void 0:n.model.unitName)||"";a=this.allExportCodelistMap.get(e)?(null==(i=this.allExportCodelistMap.get(e).find((i=>i.value===t[e])))?void 0:i.text)||a:this.formatValue(o,a)+r,t[e]=a}))})),i}async getExportData(t){var e;const{type:i}=t;let a=[];if(i&&"activatedPage"!==i)if("maxRowCount"===i||"customPage"===i){const{size:s}=this.state,{startPage:n,endPage:o}=t,r="customPage"===i?{page:0,offset:(n-1)*s,size:(o-n+1)*s}:{size:(null==(e=this.dataExport)?void 0:e.maxRowCount)||1e3,page:0};a=await this.loadData({viewParam:r})}else"selectedRows"===i&&(a=this.getData());else a=this.state.rows.map((t=>t.data));if(0===a.length)throw new o(ibiz.i18n.t("runtime.controller.control.grid.exported"));return a}async exportData(t){const{header:e}=this.dataExportParam;if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.grid.tabularColumns"));await this.fillExportCodelistMap();const i=await this.getExportData(t.params),a=this.formatExcelData(i).map((t=>Object.values(t)));await Ar(e,a,this.model.logicName)}calcDefaultValue(t,e){const i={};return Object.values(this.editColumns).forEach((a=>{const{createDV:s,createDVT:n,updateDV:o,updateDVT:r}=a.editItem,c=e?n:r,d=e?s:o,l=Er({name:a.fieldName,valueType:c,defaultValue:d,valueFormat:a.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(i[a.fieldName]=l)})),i}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((i=>i.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){3!==t.hideMode&&(t.hidden=!t.hidden,this.calcColumnFixed(),this.saveColumnStates())}setGroupParams(t){t.sort?(this.state.sortQuery=t.sort,this.isSetSort=!0):this.state.sortQuery="",t.columnstates?(this.state.columnStates=this.mergeGridColumnStates(this.state.columnStates,t.columnstates),this.calcColumnFixed()):this.initColumnStates()}changeColumnStateSort(t,e,i){const a=this.state.columnStates.find((e=>e.key===t));a&&(this.state.columnStates.splice(i,1),this.state.columnStates.splice(e,0,a),this.calcColumnFixed(),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))}actionNotification(t,e){if((null==e?void 0:e.error)&&(null==e?void 0:e.rowState)&&e.error instanceof P){const{details:t}=e.error,{errors:i}=e.rowState;t.forEach((t=>{i[t.name]=t.errorInfo}))}super.actionNotification(t,{...e||{}})}async onDragChange(t,e,a){var s;if(!(null==(s=this.model.moveControlAction)?void 0:s.appDEMethodId))throw new i(this.model,ibiz.i18n.t("runtime.controller.common.md.noMoveDataCconfig"));const n={srftargetkey:e.data.srfkey,srfmovetype:"prev"===a?"MOVEBEFORE":"MOVEAFTER"};(await this.service.moveOrderItem(this.context,t.data,n)).ok&&this.refresh()}async updateChangedItems(t){try{await Promise.all(t.map((async t=>{const e=Te(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.update(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.data)}})))}finally{await this.afterLoad({},this.state.items)}}calcTotalData(){if(!this.showPercent)return;const t={};Object.values(this.fieldColumns).forEach((e=>{const i=e.model.id,a=this.state.items.map((t=>t[i])).reduce(((t,e)=>M(t,e)),0);a&&(t[i]=a)})),this.state.totalResult=t}}),vd=t("GridFieldColumnController",class extends gd{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=W(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const i=new lr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new dr(t.id,this.grid.context.srfappid,e);i.addState(t.id,a)}})),t.uiActionGroupStates[this.model.codeName]=i}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,i){const{userParam:a}=this.model;if(!a)return{context:e,params:i};const{navigateContexts:s,navigateParams:n}=ve(a);let o={};s&&t&&(o=pe(s,t,i,e));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=pe(n,t,i,e));return{context:r,params:{...i,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const i=this.model.linkValueItem||"srfkey",s=t.data[i];if(null==s)throw new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.pickedUpData",{valueItem:i}));const{linkAppViewId:n}=this.model;if(!n)return;const o=di(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...o}),c=st(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Ko.TAG,n,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const i=this.model.deuiactionId;await Oc.execAndResolved(i,{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 i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}calcFieldAgg(t){const{aggField:e,aggMode:i,aggValueFormat:s,unitName:n}=this.model,o=e||this.model.id;let r;if("ALL"===this.grid.model.aggMode){if(!this.grid.state.remoteAggResult)return;r=this.grid.state.remoteAggResult[o]||""}else{if(et(i)||"NONE"===i)return;if(t=t.filter((t=>!et(t[o]))),"PAGE"!==this.grid.model.aggMode)throw new a(this.grid.model,ibiz.i18n.t("runtime.controller.control.grid.aggregateMode",{aggMode:this.grid.model.aggMode}));switch(i){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>M(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>M(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 a(this.model,ibiz.i18n.t("runtime.controller.control.grid.noSupportedMode",{aggMode:i}))}}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.formattingError",{aggValue:r}))}return c&&n&&(c+=n),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return wr.toText(this.model,t);const e="".concat(ht(t)?"":t);if(Number.isNaN(Number(e))&&R(e))return O(e);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=Pt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,i){const a=t.uiactionId;await Oc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),bd=(t("GridUAColumnController",class extends gd{initActionStates(t){var e;const{deuiactionGroup:a}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.behaviorGroup"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const s=new lr;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new dr(t.id,this.grid.context.srfappid,e);s.addState(t.id,i)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,i){const a=t.uiactionId;await Oc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),t("GridFieldEditColumnController",class extends vd{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=_e(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await ji(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=Di(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...fr(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...yr(this.editItem.editor)),this.rules.length>0&&(this.validator=new Tt({[this.fieldName]:this.rules}))}async setRowValue(t,e,i){i=i||this.fieldName,await this.grid.setRowValue(t,i,e)}async dataChangeNotify(t,e){const{resetItemNames:i}=this.editItem;let a=!1;i&&i.length>0&&i.forEach((t=>{e.includes(t)&&(a=!0)})),a&&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(ibiz.i18n.t("runtime.controller.control.grid.checksumErrors",{codeName:this.editItem.codeName,fieldName: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 i=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const i=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const i=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);i&&(t.editColStates[this.fieldName].readonly=i)}calcEnableCond(t){const{enableCond:e}=this.editItem,i=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return i;case 2:return!i;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&!0===t.editColStates[e].required&&("string"==typeof t.data[e]?ht(t.data[e].trimEnd()):ht(t.data[e])))return t.errors[e]=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption:this.model.caption||""}),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(i){const{errors:a}=i;return t.errors[e]=a[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends gd{}),t("ListService",class extends ls{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new on(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new on(e,e);this.dataUIMap.set(e,a)}))}})),Id=(t("ListController",class extends Ur{initState(){super.initState(),this.state.noSort=!0===this.model.noSort;const{enablePagingBar:t}=this.model;this.state.enablePagingBar=t}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new bd(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}calcShowMode(t){const{enablePagingBar:e}=this.model;this.state.hideNoDataImage=!1,this.state.enablePagingBar=e;const i=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===i&&(this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===i&&0===t.length&&(this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async afterLoad(t,e){return await this.handleDataGroup(),this.calcShowMode(e),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,i=new Map;e.forEach((e=>{const a=i.get(e[t])||[];a.push(e),i.set(e[t],a)}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:i}=this.state,a=[],s=ibiz.hub.getApp(this.context.srfappid),n=await s.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const s=i.filter((i=>i[t]===e.value));a.push({caption:e.text,key:e.value,children:[...s]}),o.push(e.value)}));const r=i.filter((e=>-1===o.indexOf(e[t])));r.length>0&&a.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=a}}}),t("PanelController",class extends kr{constructor(t,e,i,a,s){super(t,e,i,a),this.hooks={validate:new ut},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),this.hooks.validate.clear(),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async validate(t){const e=[];return await this.hooks.validate.call({result:e,parentId:t}),e.every((t=>t))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,i=void 0){t&&await Promise.all(t.map((async t=>{var a,s;const n=await Zi(t,e.model,e.view.model);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,i);e.panelItems[t.id]=o,(null==(a=t.panelItems)?void 0:a.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 i=await this.prepareData();if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.panel.panelData"));const a=this.convertData(i);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=a,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=Ke(this.model),i=e.map((t=>t.id)),a=new ln(e,t);return a._evt.on("change",(t=>{i.includes(t)&&this.dataChangeNotify([t])})),a}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)}})),Dd=(t("ViewLayoutPanelController",class extends Id{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 i=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=i(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=i(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,this.readonly=!1;let e,i,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)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!!this.context&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),Cd=(t("PanelItemController",class{constructor(t,e,i){this.model=t,this.panel=e,this.parent=i,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState(),this.state.context=this.panel.context}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(){var t;!!(null==(t=this.model.panelItemGroupLogics)?void 0:t.find((t=>"PANELVISIBLE"===t.logicCat)))&&(this.state.visible=!1),this.panel.hooks.validate.tapPromise((async t=>{t.parentId&&t.parentId!==this.dataParent.model.id||t.result.push(await this.validate())})),await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:i}=this.model;if(t){const{width:e,height:i}=De(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName)}destroy(){}async validate(){return!0}createState(){var t;return new Dd(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 i=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var i;this.parent&&!this.parent.state.visible||null==(i=this.model.panelItemGroupLogics)||i.forEach((i=>{const a=i.relatedItemNames||[];if(e||T(a,t))try{const t=ri(this.data,i);switch(i.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=Ce(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=Ce(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 kr{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,i=this.context.clone(),a={...this.params};t&&Object.assign(i,pe(t,this.params,this.context)),e&&Object.assign(a,pe(e,this.params,this.context)),this.state.context=i,this.state.params=a}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")}}),t("ItemsValueOPs",["EXISTS","NOTEXISTS"])),Ad=/^N_(.\w+)_(.\w+)$/;function Pd(t){var e;return"SIMPLE"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Td(t){var e;return"HIDDEN"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Nd(t){const e=t.split("__")[1].match(Ad);return{field:e[1],op:e[2]}}var xd=["ISNULL","ISNOTNULL","EXISTS","NOTEXISTS"],Sd=/\$\{[^}]*\}/,Ld=t("SearchBarFilterController",class{constructor(t,e,i,a){var s;let n;this.model=t,this.appDataEntity=e,this.context=i,this.params=a,this.noEditor=!1,this.type="FIELD",this.hidden=Td(t),t.appDEFieldId&&(n=Le(this.appDataEntity,t.appDEFieldId)),this.fieldName=n?n.codeName.toLowerCase():t.id,this.key=this.fieldName,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?xd.includes(this.valueOP):!this.model.editor}get valueItem(){return this.editor?this.editor.valueItem:void 0}async init(){if(!this.noEditor){if(!this.model.editor)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.searchBar.missingModel"));this.editorProvider=await ji(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}calcEditorProps(t){const e={};let i=t.value;return t.disabled&&Sd.test(i)&&(i=i.replace("${context.srfpersonid}","当前用户"),i=i.replace("${context.srforgid}","当前组织")),this.valueItem&&(e[this.valueItem]=t.valueItem),{value:i,data:e}}onEditorChange(t,e,i){this.valueItem&&i===this.valueItem?t.valueItem=e:t.value=e}}),Md=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[i]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),i)}async updateBatch(t){const e=this.convertFrontDataToBack(t),i=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(i),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}))}},Rd="",Od={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"]},Fd={};function _d(t,e){if(t.enumSource)return{appId:Rd,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Fd["".concat(t.type,"_").concat(e)]}async function zd(t,e,i){var a;if(!t.properties)return[];const{properties:s}=t;if(!(Object.keys(s).length>0))return[];const n={};null==(a=(await ibiz.hub.getAppDataEntity(e,i)).appDEFields)||a.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[];Object.keys(s).forEach((t=>{if(!n[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(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:s[t].type}))}o.push({key:t,description:s[t].description,type:e,enumSource:s[t].enumSource})}}));const r=[];return o.forEach((t=>{const e=Od[t.type];e?e.forEach((e=>{t&&r.push({appId:Rd,appDEFieldId:n[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Rd,valueOP:e},editor:_d(t,e)})})):ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:""}),t.type)})),r}Object.keys(Od).forEach((t=>{Od[t].forEach((e=>{if(xd.includes(e))return;const i="".concat(t,"_").concat(e);Fd[i]||("date"!==t||["IN","NOTIN"].includes(e)?Fd[i]={appId:Rd,editorType:"TEXTBOX",id:i}:Fd[i]={appId:Rd,editorType:"DATEPICKER",id:i})}))}));var Vd=/^N_(.\w+)_(.\w+)$/,kd=t("SearchBarFilterItemsController",class extends Ld{constructor(t,e,i,a){super(t[0],e,i,a),this.filterModels=t,this.allFields=[],this.subFilterCMap=new Map,this.type="ITEMS"}calcKey(t,e){return"".concat(t.toUpperCase(),"_").concat(e.toUpperCase())}async initMinorAppDE(){var t;const e=this.filterModels[0].appDEFieldId;let i="";if(null==(t=this.appDataEntity.appDEMethodDTOs)||t.find((t=>{var a;const s=null==(a=t.appDEMethodDTOFields)?void 0:a.find((t=>t.appDEFieldId===e));return!!s&&(i=s.refAppDataEntityId,!0)})),!i)throw new o(ibiz.i18n.t("runtime.controller.control.searchBar.noFoundEntity",{targetField:e}));this.minorAppDE=await ibiz.hub.getAppDataEntity(i,this.context.srfappid)}async initAllFields(){var t;const e=new Map;this.filterModels.forEach((t=>{var i;const a=(null==(i=t.defsearchMode.codeName)?void 0:i.split("__")[1]).match(Vd),s=a[1],n=a[2],o=st(t);o.defsearchMode.valueOP=n,o.id=s;const r=new Ld(o,this.appDataEntity,this.context,this.params);this.subFilterCMap.set(this.calcKey(s,n),r),r.hidden||(e.has(s)||e.set(s,{name:s,label:"",valueOPs:[],fieldName:s}),e.get(s).valueOPs.push(n))})),null==(t=this.minorAppDE.appDEFields)||t.forEach((t=>{const i=t.codeName.toUpperCase();e.has(i)&&(e.get(i).label=t.logicName)})),this.allFields=Array.from(e.values()),await Promise.all(Array.from(this.subFilterCMap.values()).map((t=>t.init())))}async init(){await this.initMinorAppDE(),await this.initAllFields(),this.hidden=Array.from(this.subFilterCMap.values()).every((t=>t.hidden))}getSubFilterController(t,e){return this.subFilterCMap.get(this.calcKey(t,e))}});function Ud(){return[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}]}function Bd(t){const e={pass:!1};let i=!1,a=!1;return r(t[0],(t=>{a||("FIELD"===t.nodeType?(i=!0,a=!t.field||!t.valueOP||!xd.includes(t.valueOP)&&et(t.value)):a="ITEMS"===t.nodeType?!t.field||!t.valueOP:!t.logicType)})),i&&!a&&(e.pass=!0),e}function Wd(t,e){let i;if("GROUP"===t.nodeType){const a={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(a.searchconds=t.children.map((t=>Wd(t,e)))),i=a,t.notMode&&(a.notmode=t.notMode)}else if("FIELD"===t.nodeType){const e={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(e.value=t.valueItem),i=e}else{const a={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(a.searchconds=t.children.map((t=>Wd(t,e)))),i=a}return(null==e?void 0:e.after)&&e.after(t,i),i}function Gd(t,e){const{pass:i}=Bd(t);if(!i)return;return t.map((t=>Wd(t,e)))}function jd(t){var e,i;let a;if("GROUP"===t.condtype){const i={logicType:t.condop,nodeType:"GROUP",children:[]};(null==(e=t.searchconds)?void 0:e.length)&&(i.children=t.searchconds.map((t=>jd(t)))),a=i,t.notmode&&(i.notMode=t.notmode)}else if("DEFIELD"===t.condtype){const e={nodeType:"FIELD",field:t.fieldname,value:t.value,valueOP:t.condop};t.valueItem&&(e.valueItem=t.valueItem),a=e}else{const e={nodeType:"ITEMS",field:t.fieldname,valueOP:t.condop,children:[]};(null==(i=t.searchconds)?void 0:i.length)&&(e.children=t.searchconds.map((t=>jd(t)))),t.simple&&(e.simple=t.simple),a=e}return!0===t.hidden&&(a.hidden=!0),a}function Kd(t){let e;if("GROUP"===t.nodeType){const i={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(i.searchconds=t.children.map((t=>Kd(t)))),e=i,t.notMode&&(i.notmode=t.notMode)}else if("FIELD"===t.nodeType){const i={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(i.valueItem=t.valueItem),e=i}else{const i={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(i.searchconds=t.children.map((t=>Kd(t)))),t.simple&&(i.simple=t.simple),e=i}return!0===t.hidden&&(e.hidden=!0),e}function Hd(t){const{pass:e}=Bd(t);if(!e)return;return t.map(Kd)}var Xd=t("SearchBarFilterSimpleItemsController",class extends Ld{constructor(t,e,i,a){super(t,e,i,a),this.noEditor=!1,this.key=this.model.id,this.type="SIMPLE_ITEMS";const s=Nd(t.defsearchMode.codeName);this.subFieldName=s.field,this.subValueOP=s.op}addSimpleFilterNode(t){Object.assign(t,{simple:!0,field:this.fieldName,nodeType:"ITEMS",valueOP:this.valueOP,children:[{nodeType:"FIELD",field:this.subFieldName,valueOP:this.subValueOP,value:null}]})}}),qd=/\$\{[^}]*\}/,Yd=(t("SearchBarController",class extends kr{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!1,this.enableStorage=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")||this.ctx.getController("treegrid")}setStorageKeyFn(t){this.storageKeyFn=t}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.state.advancedQuickSearch=!1,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.state.quickSearchPlaceHolder="",this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){this.addSchemaFilters="true"===this.controlParams.enablejsonschema,this.enableStorage="true"===this.controlParams.storage,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.initAdvancedQuickSearch()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Md(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 Mr(this.model.appDataEntityId,this.context);if(!e)return;const i=await zd(e,this.model.appDataEntityId,this.model.appId),a=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===i.findIndex((e=>{var i;return e.appDEFieldId===t.appDEFieldId&&(!(null==(i=t.defsearchMode)?void 0:i.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&a.push(t)})),i.length>0&&(this.model=st(this.model),this.model.searchBarFilters=i.concat(...a),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("、"),this.state.quickSearchPlaceHolder=this.placeHolder)}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}findFilterController(t,e){return this.filterControllers.find((i=>i.fieldName===t&&(!i.valueOP||i.valueOP===e)))}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query,this.state.advancedQuickSearch&&this.state.quickSearchFieldNames.length&&(e.queryconds=this.state.quickSearchFieldNames.map((t=>"n_".concat(t,"_like"))))),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=pe(ai.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const i=this.calcFilters();return i&&(e.searchconds=i),e}resetFilter(){this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;if(null==(t=this.searchBarFilters)?void 0:t.length){const t=new Map;this.searchBarFilters.forEach((e=>{var i;if((null==(i=e.defsearchMode)?void 0:i.valueOP)&&Cd.includes(e.defsearchMode.valueOP)){if(Pd(e))return void this.filterControllers.push(new Xd(e,this.appDataEntity,this.context,this.params));const i="".concat(e.appDEFieldId,"_").concat(e.defsearchMode.valueOP);return t.has(i)||t.set(i,[]),void t.get(i).push(e)}const a=new Ld(e,this.appDataEntity,this.context,this.params);this.filterControllers.push(a)})),t.size>0&&t.forEach((t=>{const e=new kd(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 Gd(this.state.filterNodes,{after:(t,e)=>{"FIELD"===t.nodeType&&V(t.value)&&qd.test(t.value)&&(e.value=ai.execSingleLine("`".concat(t.value,"`"),{...this.getEventArgs()}))}})}async initSearBarGroups(t=!1){var e;if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const i={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&&(i.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(i.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(i.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(i.show="1"===e.valid_flag)}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.searchBar.JSONFormat",{data:t.data}),e)}return t.defaultGroup&&(i.defaultSelect=!0),i})));const i=await this.service.fetch();if(i.ok&&i.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)x(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,i)=>e.order>this.state.searchBarGroups[t].order?i: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){if(this.enableStorage){const t=null==(e=this.storageKeyFn)?void 0:e.call(this);if(t){const e=localStorage.getItem(t);if(e){if(this.state.searchBarGroups.find((t=>t.name===e)))return void(this.hasDefaultSelect=!0)}}}this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){var t;if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){if(this.enableStorage){const e=null==(t=this.storageKeyFn)?void 0:t.call(this);if(e){const t=localStorage.getItem(e);if(t){const e=this.state.searchBarGroups.find((e=>e.name===t));if(e)return void this.handleGroupClick(e)}}}const e=this.state.searchBarGroups.find((t=>t.defaultSelect));e&&this.handleGroupClick(e)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:Hd(this.state.filterNodes),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(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}));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&&(x(t,e.data),t.saved=!0),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}))}}}}async handleGroupClick(t){var e;if(this.enableStorage){const i=null==(e=this.storageKeyFn)?void 0:e.call(this);i&&t.name&&localStorage.setItem(i,t.name)}if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(x(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>jd(t)));this.state.filterNodes=e}else this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}];r(this.state.filterNodes[0],(t=>{"FIELD"===t.nodeType&&t.field&&t.valueOP&&V(t.value)&&qd.test(t.value)&&(t.disabled=!0)})),this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}initAdvancedQuickSearch(){var t;2===this.model.quickSearchMode&&(null==(t=this.model.searchBarQuickSearchs)?void 0:t.length)&&(this.state.advancedQuickSearch=!0,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.model.searchBarQuickSearchs.forEach((t=>{const e=Le(this.appDataEntity,t.appDEFieldId),i=e.codeName.toLowerCase();this.state.quickSearchItems.push({fieldName:i,label:e.logicName}),this.state.quickSearchFieldNames.push(i)})),this.calcQuickSearchPlaceHolder())}calcQuickSearchPlaceHolder(){if(this.state.advancedQuickSearch)if(this.state.quickSearchFieldNames.length){const t=[];this.state.quickSearchItems.forEach((e=>{this.state.quickSearchFieldNames.includes(e.fieldName)&&t.push(e.label)})),this.state.quickSearchPlaceHolder=t.join("、")}else this.state.quickSearchPlaceHolder=this.placeHolder}}),t("TabExpPanelController",class extends kr{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="",this.state.expViewParams={}}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&&pr(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const i=this.getNavViewMsg(t);!0===e&&(i.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:i}),this.evt.emit("onTabChange",{tab:t})}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:i,navigateContexts:a,navigateParams:s,appDataEntityId:n}=t,o={deName:Te(n),navFilter:i,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:a,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=ye(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d,...this.state.expViewParams}}}getNavViewMsg(t){const{context:e,params:i}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:i,viewId:t.embeddedAppDEViewId,isCache:this.isCache,modalOptions:{replace:!0}}}refresh(){const t=this.getNavViewMsg(this.activeTabViewPanelModel);t.key+=mt(),this.evt.emit("onNavViewChange",{navViewMsg:t})}}),t("TreeService",class extends ls{async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const s=Fe(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:i});if(0===s.length)return;(await Pn(s.map((async i=>{const a=Oe(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Re(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,s){const n=0===Fe(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,i,o)];break;case"DE":r=await this.getDENodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.gantt.noSupport",{treeNodeType:t.treeNodeType}))}const{rootNode:c}=t,d=c&&!this.model.rootVisible;return n||await Promise.all(r.map((async(e,i)=>{var a;if(this.calcExpand(t,i)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(e._id)||d){const t=await this.fetchChildNodes(e,s);e._children=t}}))),r}async getStaticNodeData(t,e,i,a){const s=this.calcStaticExpand(t);return new nn(t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf,defaultExpand:s})}getNodeRSFilterParams(t,e,i){const{parentValueLevel:a,navigateContexts:s,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...i.params},l={...i.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<a;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=Oe(this.model,h._nodeId);t&&t.appDataEntityId&&(p=Te(t.appDataEntityId)),u=h._value}const{resultContext:g,resultParams:f}=ye({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,g),Object.assign(d,f),{context:l,params:d,navContext:g,navParams:f}}async getDENodeDatas(t,e,i,a){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.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,s)=>{const n=this.calcExpand(t,s);return new sn(t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d,defaultExpand:n})}))}return[]}async getCodeListNodeDatas(t,e,i,a){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map(((e,s)=>{const n=this.calcExpand(t,s);return new en(t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r,defaultExpand:n})}))}return[]}async removeItem(t,e,i={}){var a;const s=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.execWithEntityId(t,s,e,void 0,i)}async execWithEntityId(t,e,i,a,s){const n=this.handleCustomRequestHeader();return await this.app.deService.exec(t,e,i,a,s,n)}calcExpand(t,e){const{expandFirstOnly:i,expanded:a}=t;return!!a&&(!i||i&&0===e)}calcStaticExpand(t){const{expandFirstOnly:e,expanded:i}=t;return!!i||!!e}})),Qd=t("TreeController",class extends Ur{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)),i=[];null==t||t.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("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,i;(null==(i=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:i.length)&&(this.contextMenus[t.decontextMenu.id]=new Gc(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 Yd(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 ts.getCounterByRef(e,this.context,{...this.params}))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Fe(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var i;if(null==(i=t.parentDER1N)?void 0:i.pickupDEFName){const i=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==i?void 0:i.treeNodeType)&&i.appDataEntityId&&e.push({minorEntityId:i.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 i=t.decontextMenu;if(null==(e=null==i?void 0:i.detoolbarItems)?void 0:e.length){let e=0;const a=[];r(i,(t=>{if("DEUIACTION"===t.itemType){e+=1;const i=t;200===i.actionLevel&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:a[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let i;e&&await this.startLoading();try{i=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,i),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),i}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(),i=!!e.query;let a;this.state.isLoading=!0;try{a=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:i,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=a:this.state.rootNodes=a,await this.afterLoadNodes(a),a}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 i;const a=null==(i=this.contextMenuInfos[t._nodeId])?void 0:i.clickTBUIActionItem;if(a)return this.doUIAction(a.uiactionId,t,e,a.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect&&!t._disableSelect){const{selectedData:e}=this.state,i=e.filter((e=>e._id!==t._id));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const i=this.state.expandedKeys.includes(t._id);if(e&&!i)this.state.expandedKeys.push(t._id);else if(!e&&i){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)),i=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(i)}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,i,a){const s=this.getEventArgs(),n=this.parseTreeNodeData(e),o=await Oc.exec(t,{...s,...n,event:i},a);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 i;(null==(i=t._children)?void 0:i.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?a._parent:a,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 i=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==i.length&&await Promise.all(i.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,i){var a,s;const n=this.getNodeModel(t._nodeId);if("inner"===i){const t=this.getNodeModel(e._nodeId);return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId)&&!!(null==t?void 0:t.allowDrop)}if((null==(a=t._parent)?void 0:a._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 i=this.dropNodeRss.get(t);return null==i?void 0:i.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,a){var s,n;"inner"!==a||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const o=this.getNodeModel(t._nodeId),r="inner"===a?e:e._parent,c=(null==(s=e._parent)?void 0:s._id)!==(null==(n=t._parent)?void 0:n._id);let d=this.getNodeModel(e._nodeId);if("inner"===a||c){const e=this.findDropNodeRS(r._nodeId,o.appDataEntityId);e&&(t._deData[e.pickupDEFName]=r._value,d=this.getNodeModel(e.childDETreeNodeId)),t._parent=r,t._nodeId=d.id,this.state.expandedKeys=this.calcExpandedKeys([r]),await this.updateDeNodeData([t])}const{moveAppDEActionId:l,appDataEntityId:h,allowOrder:u}=d;if(!l)throw new i(this.model,ibiz.i18n.t("runtime.controller.common.md.noMoveDataCconfig"));if("inner"!==a&&u){const i={srftargetkey:e.srfkey,srfmovetype:"prev"===a?"MOVEBEFORE":"MOVEAFTER"},s=ibiz.hub.getApp(this.context.srfappid),n=Te(h),o=this.context.clone();o[n]=t.srfkey;(await s.deService.exec(h,l,o,i)).ok&&(c?(await this.refreshNodeChildren(t,!0),await this.refreshNodeChildren(r)):await this.refreshNodeChildren(r))}this._evt.emit("onAfterNodeDrop",{isChangedParent:c})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const i=this.getNodeModel(t._nodeId);let a=t._deData;t._changedOnly&&(a=t.getDiffData());const s=Te(i.appDataEntityId),n=this.context.clone();n[s]=a.srfkey;const o=await e.deService.exec(i.appDataEntityId,"update",n,a);o.data&&(t._deData=o.data,t._oldDeData=o.data.clone())})))}async modifyNodeText(t,e){const a=this.getNodeModel(t._nodeId);if(!a.allowEditText)throw new i(a,ibiz.i18n.t("runtime.controller.control.tree.editMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.tree.nodeData"));t._text=e,await this.updateDeNodeData([t]),this.emitDEDataChange("update",t._deData)}async handleItemRemove(t,e,i){let a=!1;const s=this.getNodeModel(t._nodeId);if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeNode"));const n=s.appDataEntityId;if(n){const s=Te(n);if(0!==t.srfuf){const o=e.clone();o[s]=t.srfkey,await this.service.removeItem(n,o,i),a=!0}}return a}onDEDataChange(t){if(!et(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if("OBJECTCREATED"===t.subtype)return;const e=t.data,i=this.state.items.find((t=>"DE"===t._nodeType&&t._deData&&t._deData.srfdecodename===e.srfdecodename&&t._deData.srfkey===e.srfkey));i&&this.doNextActive((()=>this.refreshNodeChildren(i,!0)),{key:"refresh".concat(i._id)})}}),Jd=t("WizardPanelService",class extends ds{async initialize(t,e={},i={}){var a;const s=null==(a=this.model.initControlAction)?void 0:a.appDEMethodId;let n=await this.exec(s,t,e,i);return n=this.handleResponse(n),n}async finish(t,e={},i={}){var a;const s=null==(a=this.model.finishControlAction)?void 0:a.appDEMethodId;let n=await this.exec(s,t,e,i);return n=this.handleResponse(n),n}}),$d=(t("WizardPanelController",class extends kr{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}getData(){return[this.formData]}initState(){super.initState(),this.state.buttonsState=new lr}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,i,a,s;t.firstForm&&(this.firstForm=t);const n="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),o=null==(a=null==(i=this.model.dewizard)?void 0:i.dewizardSteps)?void 0:a.find((e=>e.id===t.dewizardStepId)),r=null==o?void 0:o.stepTag;this.stepTags[n]=r,null==(s=t.stepActions)||s.forEach((e=>{const i="".concat(t.formTag,"@").concat(e),a=new dr(i,this.context.srfappid);a.visible=!this.getStepScriptCode(t,e),this.state.buttonsState.addState(i,a)}))})),this.state.buttonsState.init(),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Jd(this.model),await this.service.init(this.context);const{deeditForms:i}=this.model;i&&i.length>0&&await Promise.all(i.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const i=await Bi(t);i&&(this.providers[e]=i)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardForm",{activeFormTag:t})),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.formController",{activeFormTag:t}));return e}async onFormMounted(t,e){const i=e.ctrl;this.formControllers.set(t,i),i.evt.on("onFormDataChange",(t=>{this.calcButtonState(t.data[0])}));const a=await i.load();this.calcButtonState(i.data),Object.assign(this.formData,a)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const i=Te(this.model.appDataEntityId);!this.context[i]&&e&&e.srfkey&&(this.context[i]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.noConfiguration"));const i=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardFormIdentifier",{tag:t}));return i}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){let t;try{t=await this.service.initialize(this.context,{},this.params)}catch(t){throw this.actionNotification("INITIALIZEERROR",{error:t}),t}const e=Te(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(){try{await this.service.finish(this.context,this.formData,this.params)}catch(t){throw this.actionNotification("FINISHERROR",{error:t}),t}this.evt.emit("onFinishSuccess",void 0),this.actionNotification("FINISHESUCCESS")}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(ibiz.i18n.t("runtime.controller.control.wizardPanel.noPreviousForm"));this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save({silent:!0});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,i=this.model.dewizard.dewizardForms;if(t&&i){const i=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),a=t[i+1];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextStep"));const s=this.getWizardFormByTag(a.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextForm"));this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save({silent:!0}),await this.finish()}getStepScriptCode(t,e){switch(e){case"PREV":return t.goPrevEnableScriptCode;case"NEXT":return t.goNextEnableScriptCode;case"FINISH":return t.goFinishEnableScriptCode}}async calcButtonState(t){var e;const{activeWizardForm:i}=this;if(i){let a=t;a&&a instanceof cs&&(a=a.getOrigin()),null==(e=i.stepActions)||e.forEach((t=>{const e=this.state.buttonsState["".concat(i.formTag,"@").concat(t)],s=this.getStepScriptCode(i,t);e&&s&&(e.visible=!!ai.execScriptFn({view:this.view,context:this.context,params:this.params,data:a,env:ibiz.env},s,{isAsync:!1,singleRowReturn:!0}))}))}}}),t("MDCtrlService",class extends ls{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new on(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new on(e,e);this.dataUIMap.set(e,a)}))}})),Zd=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),tl=(t("MDCtrlController",class extends Ur{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 $d(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(){this.doNextActive((()=>this.load({isInitialLoad:!0})),{key:"refresh"})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new Zd(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 Zd(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,i){const a=t.uiactionId;await Oc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.view,event:i},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:i}=this.model;e&&this.initUIActionGroup(t,e),i&&this.initUIActionGroup(t,i)}initUIActionGroup(t,e){var i;(null==(i=e.uiactionGroupDetails)?void 0:i.length)||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new lr;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const i=new dr(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.data.getOrigin()),t.uaColStates[e.id]=a}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];et(a)||(i.has(a)||i.set(a,[]),i.get(a).push(new Zd(e,this)))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}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 i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(new Zd(e,this))}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,key:i.value,children:t})})),this.state.groups=n}}),t("KanbanService",class extends Hc{async updateGroup(t,e){var i;const a=(null==(i=this.model.updateGroupControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async moveOrderItem(t,e,i){const a=this.model.moveControlAction.appDEMethodId,s=st(e.getOrigin());Object.assign(s,i);let n=await this.exec(a,t,s,{srfupdateitem:!0});return n=this.handleResponse(n),n}})),el=(t("KanbanController",class extends Xc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new tl(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.readonly=!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly),this.state.draggable=this.enableEditOrder||this.enableEditGroup,this.state.uaState={}}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortingProperties"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortDirection"));const s="ASC"===a;t.forEach((t=>{const i=t[e];if(et(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>s?t[e]-i[e]:i[e]-t[e]))}async afterLoad(t,e){var i;this.sortItems(this.state.items),super.afterLoad(t,e);const a=[];return null==(i=this.model.dedataViewItems)||i.forEach((t=>{"ACTIONITEM"===t.itemType&&t.deuiactionGroup&&t.deuiactionGroup.uiactionGroupDetails&&a.push(...t.deuiactionGroup.uiactionGroupDetails)})),a&&a.length>0&&e.forEach((t=>{const e=new lr;a.forEach((t=>{const i=t.uiactionId;if(i){const a=new dr(t.id,this.context.srfappid,i);e.addState(t.id,a)}})),this.state.uaState[t.srfkey]=e})),e.forEach((t=>{this.state.uaState[t.srfkey]&&Object.keys(this.state.uaState[t.srfkey]).length>0&&this.state.uaState[t.srfkey].update(this.context,t.getOrigin(),this.model.appDataEntityId)})),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,i){this.setSelectGroup(i.key),super.onGroupToolbarClick(t,e,i)}async onGroupActionClick(t,e,i,a){this.setSelectGroup(a.key);const s={...this.params,srfgroup:a},n=t.uiactionId;await Oc.execAndResolved(n,{context:this.context,params:s,data:[e],view:this.view,event:i},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o(ibiz.i18n.t("runtime.controller.control.kanban.groupedOn"));return super.handleDataGroup()}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(e)}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,color:i.color,key:i.value,children:t})})),this.state.groups=n}async onDragChange(t){var e;if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.adjustmentsGroup"));const{from:a,to:s,fromIndex:n,toIndex:o}=t,r=this.model.groupAppDEFieldId,c=this.model.minorSortAppDEFieldId,d=this.state.groups.find((t=>t.key===a)),l=this.state.groups.find((t=>t.key===s));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.noAllowReorder"));const e=d.children[n];return e[r]=t.to,this.updateChangedItems([e])}const h=[...l.children];if(!(null==(e=this.model.moveControlAction)?void 0:e.appDEMethodId))throw new i(this.model,ibiz.i18n.t("runtime.controller.common.md.noMoveDataCconfig"));this.state.updating=!0;const u=st(d.children[n]),p=d.children.splice(n,1);if(l.children.splice(o,0,...p),t.from!==t.to){u[r]=t.to;const e=ibiz.hub.getApp(this.model.appId),a=Te(this.model.appDataEntityId),s=this.context.clone();s[a]=u.srfkey;try{await e.deService.exec(this.model.appDataEntityId,"update",s,u);const t=this.state.items.findIndex((t=>t.srfkey===u[this.dataEntity.keyAppDEFieldId]));-1!==t&&this.state.items.splice(t,1,u)}catch(t){throw this.state.updating=!1,new i(this.model,ibiz.i18n.t("runtime.controller.common.md.changeGroupError"))}}const m=((t,e,i,a,s)=>{let n={};const o=a[e];if(o)n={srftargetkey:o.srfkey,srfmovetype:e<a.length-1||s?"MOVEBEFORE":"MOVEAFTER"};else{let t=[];if(a.length>0&&(t=a),t.length>0){const e=t.reduce(((t,e)=>{const a=t[c]>e[c];return a&&t[this.dataEntity.keyAppDEFieldId]!==i.srfkey||a||e[this.dataEntity.keyAppDEFieldId]===i.srfkey?t:e}));e&&e[this.dataEntity.keyAppDEFieldId]!==i.srfkey&&(n={srftargetkey:e.srfkey,srfmovetype:"MOVEAFTER"})}}return n})(0,o,u,h,t.from!==t.to);try{const{ok:t,result:e}=await this.moveOrderItem(u,m);t&&(Array.isArray(e)&&e.length>0?e.forEach((t=>{const e=this.state.items.findIndex((e=>e.srfkey===t[this.dataEntity.keyAppDEFieldId]));-1!==e&&(this.state.items[e][c]=t[c])})):await this.refresh())}catch(t){this.state.updating=!1,this.actionNotification("MOVEERROR",{error:t})}finally{await this.afterLoad({},this.state.items),this.state.updating=!1}}async moveOrderItem(t,e){const i=Te(this.model.appDataEntityId),a=this.context.clone();if(a[i]=t.srfkey,!e.srftargetkey||!e.srfmovetype)return ibiz.log.error(ibiz.i18n.t("runtime.controller.common.md.computeMoveMetaError")),{ok:!1};return{ok:!0,result:(await this.service.moveOrderItem(a,t,e)).data}}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=Te(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.updateGroup(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.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,i){const a=this.state.groups.find((e=>e.key===t));a&&(a[e]=i)}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 i=t.split("quicktoolbar_")[1];this.setGroupController(i,"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 i=t.split("batchtoolbar_")[1];this.setGroupController(i,"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 Yd{})),il=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=>{let i;this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.name],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})})))}}),al=t("TreeGridExController",class extends Qd{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 el(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 Pa(t);if(!e)return;this.providers[t.codeName]=e;const i=await e.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=i:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=i)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{2!==t.hideMode&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,hideMode:t.hideMode||0,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,i)=>{t.uaColumn&&(t.fixed=i+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 il(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(ibiz.i18n.t("runtime.controller.common.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(e.processing)return void await S(500,this.save.bind(this),[t]);const a=this.getNodeModel(t._nodeId),{appDataEntityId:s,updateAppDEActionId:n}=a,r=0===t._deData.srfuf;if(r)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noSupportCreation"));if(!n)throw new i(a,ibiz.i18n.t("runtime.controller.control.treeGridEx.updateBehavior"));const c=Te(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 Pn(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((i=>{i.gridStateNotify(t,e)}))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||mr(t.data[e],i)){t.data[e]=i,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Pn(Object.values(this.columns).map((async i=>i.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const i={};return Object.values(this.fieldColumns).forEach((a=>{const s=a.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=Er({name:a.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(i[a.name]=h)})),i}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)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(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data._deData.srfuf){t.cacheData=st(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}}),sl=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){}}),nl=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:a,detreeNodeDataItems:s,detreeNodeEditItems:n}=e,o=null==a?void 0:a.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 i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.noConfigured",{name: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 i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.editItem",{name: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 ji(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 i=new lr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new dr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.name]=i}}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 i=this.nodeColumn.linkValueItem||"srfkey",a=t.data[i];if(null==a)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noPickedUp",{valueItem:i}));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const n=di(t.data),r=Object.assign(this.context.clone(),{srfkey:a,...n}),c=st(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:i}=ve(d);let a={};e&&t.data&&(a=pe(e,t.data,c,r)),Object.assign(r,a);let s={};i&&t.data&&(s=pe(i,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute(Ko.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const i=this.nodeColumn.deuiactionId;await Oc.execAndResolved(i,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return wr.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=Pt(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 i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(this.context,t.data._deData)}}async setRowValue(t,e,i){i=i||this.name,await this.treeGrid.setRowValue(t,i,e)}}),ol=(t("TreeGridExFieldColumnController",class extends sl{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 nl(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 i=this.nodeColumnControllerMap.get(t.data._nodeId);i&&i.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends sl{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 i=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));i&&this.nodeColumnMap.set(t.id,i)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const i=this.nodeColumnMap.get(t.data._nodeId);i.deuiactionGroup&&(e=i.deuiactionGroup)}return e}initActionStates(t){var e;const i=this.getUIActionGroup(t);if(!i)return void ibiz.log.warn(ibiz.i18n.t("runtime.controller.control.treeGridEx.behaviorGroup",{id:this.model.id}));if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new lr;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new dr(t.id,this.treeGrid.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.model.id]=a}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,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(this.context,t.data._deData)}}}),t("TreeGridController",class extends Ed{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 a=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(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnsSchema"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnMode"));this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=a.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends yd{}),t("MEditViewPanelService",class extends ls{})),rl=(t("MEditViewPanelController",class extends Ur{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new ol(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 i=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(i.appDataEntityId){const a=await ibiz.hub.getAppDataEntity(i.appDataEntityId,i.appId);this.parameters=i&&a?[{parameterName:null==(t=a.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=a.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const i=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,i),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===i.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,i={id:t[e]?t[e]:"mockId:".concat(mt()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:a,pathName:s}=e;t[a]&&!Object.is(t[a],"")&&Object.assign(i.context,{[s]:t[a]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(i,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(i,{srfmajortext:ibiz.i18n.t("runtime.controller.control.meditViewPanel.DraftNew")})})),i}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 i=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(i=!0),await this.handleDelete(t),i&&(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 i=this.state.panelUiItems.findIndex((t=>t.id===e));if(i<0)throw new o(ibiz.i18n.t("runtime.controller.control.meditViewPanel.dataExist"));const a=this.state.panelUiItems[i];a.id.startsWith("mockId:")?this.state.panelUiItems[i]=this.handlePanelItemParams(t):a.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[i].id)}}),t("MapService",class extends ls{async init(t){await super.init(t)}async fetchAll(t,e={}){var i;const a=[];if(null==(i=this.model.sysMapItems)?void 0:i.length){const i=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 i=ai.execSingleLine(r);if(i){const{navigateContexts:a,navigateParams:s}=ve(i);a&&Object.assign(c,pe(a,e,t)),s&&Object.assign(d,pe(a,e,t))}}const l=await i.deService.exec(n,o,c,d);l.data&&a.push(...l.data.map((t=>new dn(t,s))))})))}return new p(a,200)}})),cl=(t("MapController",class extends Ur{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new rl(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:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);i.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(i,a);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 i=await super.afterLoad(t,e),a=[],s=[];return i.forEach((t=>{"REGION"===t._itemStyle?a.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=a,i}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 i=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=i;break;case"strareacode":this.state.strAreaCode="true"===i;break;case"jsonbaseurl":this.state.jsonBaseUrl=i}}))}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 ds{async fetch(t,e={}){this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(this.dataEntity.deapicodeName2,"/report?srfreporttag=").concat(this.model.codeName);let a=await ibiz.net.request(i,{method:"post",data:e});return a=this.handleResponse(a),a}})),dl=class{constructor(t,e){this.config={},this.model=t,this.reportPanel=e}async initConfig(){}init(t){this.protoRef=t}load(t={}){return Promise.resolve(t)}},ll=class extends dl{async initConfig(){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)}},hl=class extends dl{},ul=class extends dl{async initConfig(){const{appDEReport:t}=this.model,{appBIReport:e}=t,i=t.appBISchemeId.split(".").pop();e.appBISchemeId=i,this.config=e}load(t={}){return this.protoRef&&this.protoRef.refresh("ALL"),Promise.resolve(t)}},pl=class{static getInstance(t,e){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.reportType"));switch(t.appDEReport.reportType){case"USER":return new ll(t,e);case"USER2":return new hl(t,e);case"DESYSBIREPORTS":case"SYSBICUBE":case"DESYSBICUBES":case"ALLSYSBICUBES":case"SYSBIREPORT":case"SYSBICUBEREPORTS":case"ALLSYSBIREPORTS":return new ul(t,e);default:throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.noImplemented",{reportType:t.appDEReport.reportType}))}}},ml=(t("ReportPanelController",class extends kr{get _evt(){return this.evt}get isBIReport(){return"DESYSBIREPORTS"===this.state.reportType||"SYSBICUBE"===this.state.reportType||"DESYSBICUBES"===this.state.reportType||"ALLSYSBICUBES"===this.state.reportType||"SYSBIREPORT"===this.state.reportType||"SYSBICUBEREPORTS"===this.state.reportType||"ALLSYSBIREPORTS"===this.state.reportType}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=pl.getInstance(this.model,this),this.generator&&await this.generator.initConfig(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new cl(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={}){if(this.state.reportType&&this.isBIReport)return{};await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam),a=await this.service.fetch(e,i);this.state.data=a.data,await this.afterLoad(t,a.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(){var t;return this.isBIReport?(null==(t=this.generator.protoRef)?void 0:t.state.items)||[]:[this.state.data]}async refresh(){this.isBIReport?this.generator.load():this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}async openReportDesignPage(){if(this.state.reportType&&this.isBIReport){const t=ibiz.overlay.createModal("iBizBIReportDesign",{dismiss:e=>t.dismiss(e),context:this.context,viewParams:this.params,config:await ibiz.util.biReport.translateReportPanelToConfig(this.model)},{width:"90%",height:"90%",footerHide:!0});t.present();return await t.onWillDismiss()}return{ok:!1,data:[]}}}),t("GanttService",class extends Yd{async getNodeDraft(t,e,i,a){var s;const{appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},l=await this.app.deService.exec(n,"getdraft",o,r),{data:h}=l;return(null==(s=null==e?void 0:e.parentDER1N)?void 0:s.pickupDEFName)&&i&&(h[e.parentDER1N.pickupDEFName]=i._value),new mn(this.model,t,i,{data:l.data,leaf:!0,navContext:c,navParams:d,defaultExpand:!1})}async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const s=Fe(this.model,{parentId:t._nodeId,hasQuery:i});if(0===s.length)return;(await Pn(s.map((async i=>{const a=Oe(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Re(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,s){const n=0===Fe(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,i,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.gantt.noSupport",{treeNodeType: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,i,a){const s=this.calcStaticExpand(t);return new pn(this.model,t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf,defaultExpand:s})}async getDEGanttNodeDatas(t,e,i,a){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.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,s)=>{const n=this.calcExpand(t,s);return new mn(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d,defaultExpand:n})}))}return[]}async getCodeListGanttNodeDatas(t,e,i,a){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map(((e,s)=>{const n=this.calcExpand(t,s);return new gn(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r,defaultExpand:n})}))}return[]}})),gl=(t("GanttController",class extends al{initState(){super.initState(),this.state.ganttStyle={},this.state.sliderDraggable=!0}handleControlParams(){super.handleControlParams(),this.controlParams.sliderdraggable&&(this.state.sliderDraggable="true"===this.controlParams.sliderdraggable)}onDataChange(t){}async initService(){this.service=new ml(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}async onCreated(){await super.onCreated(),this.initViewScheduler()}initViewScheduler(){const t=this.model.appViewLogics||[];0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async setActive(t){const e=this.parseTreeNodeData(t);return"DE"===t._nodeType&&await this.onNodeDataActive(e),this.evt.emit("onActive",{...e,nodeData:t})}async onNodeDataActive(t){(await this.openData(t)).cancel||this.refreshNodeChildren(t.data[0],!0)}async refresh(){this.doNextActive((async()=>{const t=await this.load({isInitialLoad:!1}),e=this.model.rootVisible?t:t[0]._children;e&&await this.handleDefaultExpandNodes(e)}),{key:"refresh"})}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.notFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?a._parent:a,n=await this.loadNodes(s);await this.handleDefaultExpandNodes(n),this.evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async handleDefaultExpandNodes(t){for(let e=0;e<t.length;e++){const i=t[e];if(this.state.expandedKeys.includes(i._id)){const t=i.srfkey?"srfkey":"_id",e=this.state.items.find((e=>e[t]===i[t])),a=await this.loadNodes(e);await this.handleDefaultExpandNodes(a)}}}async openData({data:t,context:e,params:a}){var s,n;const o=t[0],r=this.getNodeModel(o._nodeId),{appDataEntityId:c}=r;e[Te(c).toLowerCase()]=null==(s=o._deData)?void 0:s.srfkey;const d=await(null==(n=this.viewScheduler)?void 0:n.triggerCustom("".concat(r.id.toLowerCase(),"_opendata"),{context:e,params:a,data:t,event:void 0,view:this.view,ctrl:this}));if(-1===d)throw new i(r,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:r.id.toLowerCase()}));return{cancel:!d||!d.ok}}async setRowValue(t,e,i){const{beginDataItemName:a,endDataItemName:s}=this.model;if(!Object.prototype.hasOwnProperty.call(t.data,e)||mr(t.data[e],i)){t.data[e]=i,e===a?t.data._beginDataItemValue=i:e===s&&(t.data._endDataItemValue=i),t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async modifyNodeTime(t,{begin:e,end:i}){if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.noNode"));const a=this.getRowState(t._id);if(!a)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));const{beginDataItemName:s,endDataItemName:n}=this.model;this.setRowValue(a,s,e),this.setRowValue(a,n,i),await this.save(a.data)}async save(t){if(this.state.isSimple)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(e.processing)return void await S(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:a}=i,s=0===t._deData.srfuf,n=Te(a),r=this.context.clone();r[n]=t._deData.srfkey;const c=ibiz.hub.getApp(this.context.srfappid);let d;try{d=await c.deService.exec(a,s?"create":"update",r,t._deData)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(s?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=d.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this.evt.emit("onBeforeRemove",void 0),await this.startLoading();let s,n=!1;try{const o=ibiz.hub.getApp(this.context.srfappid);await Pn(a.map((async t=>{if("DE"===t._nodeType){const a=e.clone(),r=this.getNodeModel(t._nodeId);if(r&&0!==t._deData.srfuf){const{appDataEntityId:e}=r;if(a[Te(e)]=t.srfkey,await o.deService.exec(e,"remove",a,i),!s&&t._parent){const e=this.getNodeData(t._parent._id);s=e}n=!0}this.afterRemove(t)}}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.common.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),n&&s&&!(null==t?void 0:t.notRefresh)&&await this.refreshNodeChildren(s)}catch(e){throw await this.evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this.evt.emit("onRemoveSuccess",void 0)}afterRemove(t){var e;const i=this.state.items.findIndex((e=>e._uuid===t._uuid));if(-1!==i&&this.state.items.splice(i,1),this.state.rows[t._uuid]&&delete this.state.rows[t._uuid],t._parent){const i=this.getNodeData(t._parent._id),a=i._children.findIndex((e=>e._uuid===t._uuid));-1!==a&&(null==(e=i._children)||e.splice(a,1))}}async newRow(t={}){var e;const{data:i}=t,{editShowMode:a}=ibiz.config.grid;if("row"===a){if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.common.md.firstComplete"))}let s,n;if(i){const t=Array.isArray(i)?i[0]:i;n=this.getNodeData(t._id),s=this.getNodeModel(n._nodeId)}else n=this.state.rootNodes[0],s=Re(this.model);if(s){let t,i;if(Fe(this.model,{parentId:s.id,hasQuery:!1}).forEach((e=>{const a=this.getNodeModel(e.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&(t=e,i=a)})),i){let s;try{s=await this.service.getNodeDraft(i,t,n,{hasQuery:!1,context:this.context.clone(),params:this.params})}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const o=this.calcDefaultValue(s,!0);Object.assign(s,o);const r=this.getRowState(n._id);(null==(e=n._children)?void 0:e.length)?n._children.push(s):n._children=[s],this.state.items.push(s);const c=new il(s,this);this.state.rows[s._uuid]=c,this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(c,!0),this.evt.emit("onNewRow",{row:r}),this.actionNotification("GETDRAFTSUCCESS",{data:s})}}}onDEDataChange(t){}}),t("HubController",class{constructor(){this.session={}}async login(t,e,i,a,s){return await ibiz.appUtil.login(t,e,i,a,s)}async logout(t){return await ibiz.appUtil.logout(t)}async changePwd(t,e,i){return await ibiz.appUtil.changePwd(t,e,i)}async switchOrg(t,e,i){return await ibiz.appUtil.switchOrg(t,e,i)}async switchTheme(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}async switchLanguage(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}})),fl=class{constructor(){this.evt=new pt,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new ms}async init(){this.listenMessage()}listenMessage(){ibiz.mc.command.asyncAction.on((async t=>{if(!t.data||"ASYNCACTION"!==t.subtype)return;if(t.data.actiontype&&"ASYNCCHATCOMPLETION"===t.data.actiontype)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=>{tt(t[e])&&(t[e]=Pt(t[e]).format("YYYY-MM-DD HH:mm:ss"))})),!z(t.actionresult))try{const e=JSON.parse(t.actionresult);t.actionresult=e}catch(t){}if(!z(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",st(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",st(t)),this.evt.emit("dataChange")}noticeResult(t){ibiz.notice.showAsyncAction(t)}};function yl(t){if(""===t)return!1;const e=(new DOMParser).parseFromString(t,"text/html");return Array.from(e.body.childNodes).some((t=>1===t.nodeType))}var wl=class{constructor(){this.evt=new pt,this.total=0,this.unreadCount=0,this.page=0,this.size=20,this.messages=[],this.unreadOnly=!1,this.service=new Js,this.ns=null,this.provider=null}async init(){this.listenMqtt(),await this.refreshUnreadCount()}async load(){try{await this.fetch(!1)}catch(t){ibiz.log.error(t)}}async loadMore(){await this.fetch(!0)}async refreshUnreadCount(){try{this.unreadCount=await this.service.getUnreadNum(),this.evt.emit("unreadCountChange",this.unreadCount)}catch(t){ibiz.log.error(t)}}toggleUnReadOnly(t){const e=void 0===t?!this.unreadOnly:t;this.unreadOnly!==e&&(this.unreadOnly=e,this.evt.emit("unreadOnlyChange",this.unreadOnly),this.load())}async fetch(t=!1){!1===t?this.page=0:this.page+=1;const e={page:this.page,size:this.size,sort:"timestamp,desc"};this.unreadOnly&&(e.searchconds=[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]);const i=await this.service.fetch(e);this.total=i.total,t?this.messages.push(...i.data):this.messages=i.data,this.evt.emit("dataChange")}listenMqtt(){ibiz.mc.command.internalMessage.on((async t=>{var e;ibiz.log.debug("mqtt internalMessage: ",t),"INTERNALMESSAGE"===t.subtype&&(t.content&&ibiz.notification.default({isHtmlDesc:yl(t.content),desc:t.content,position:"bottom-right",class:null==(e=this.ns)?void 0:e.b("notice"),onClick:()=>{const e=ibiz.env.isMob?t.mobileurl:t.url;this.provider&&this.provider.openViewByUrl(e)}}),this.refreshUnreadCount())}))}async markRead(t){const e=this.messages.find((e=>e.id===t.id));e&&"RECEIVED"===e.status&&(await this.service.markRead(t.id),e.status="READ",this.unreadCount-=1,this.evt.emit("unreadCountChange",this.unreadCount),this.unreadOnly?this.load():this.evt.emit("dataChange"))}async batchMarkRead(){await this.service.batchMarkRead(),await this.fetch(),this.unreadCount=0,this.evt.emit("unreadCountChange",this.unreadCount)}async get(t){return(await this.service.get(t)).data}},El=class{constructor(){this.evt=new pt,this.total=0,this.asyncAction=new fl,this.internalMessage=new wl}async init(){this.internalMessage.evt.on("unreadCountChange",(()=>{this.total=this.internalMessage.unreadCount,this.evt.emit("totalChange",this.total)})),await this.internalMessage.init(),await this.asyncAction.init()}},vl=class{constructor(){this.convert=new Jo,this.controller=new gl,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.drcontrols=new Map,this.dataEntities=new Map,this.config=new Zo,this.notice=new El,this.defaultAppIndexViewName="Index"}calcAppViewId(t=""){let e="";if(t&&-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerSubAppDrControls(t,e){this.drcontrols.has(t)||this.drcontrols.set(t,[]);const i=this.drcontrols.get(t);null==i||i.push(e)}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,i=-1){i<=0&&(i=50);const a=this.calcAppViewId(t);if(this.view2appMap.has(a)){const t=this.view2appPriorityMap.get(a);if(t&&t<i)return}this.view2appMap.set(a,e),-1!==i&&this.view2appPriorityMap.set(a,i)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppBISchemes(t=[],e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppBISchemes(e,t):[]}async getAppAppBICubes(t,e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppAppBICubes(e,t):[]}async getAppBIReports(t,e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppBIReports(e,t):[]}async getAppView(t){const e=this.calcAppViewId(t),i=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(i,e);return this.registerAppView(t),t}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}getSubAppDrControl(t,e){if(!this.drcontrols.has(e))return;return this.drcontrols.get(e).find((e=>e.uniqueTag===t))}async loadAppView(t,e,i){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,i)}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const i=this.dataEntities.get(e);if(-1===t.indexOf(".")){const e=Array.from(i.values()).find((e=>e.codeName===t));if(e)return e}else if(i.has(t))return i.get(t)}if(this.modelLoaderProvider){let i;return i=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(i,e),i}throw new o(ibiz.i18n.t("runtime.service.noFound",{id:t}))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o(ibiz.i18n.t("runtime.utils.firstregister"));const e=await this.modelLoaderProvider.getApp(t),i=await this.modelLoaderProvider.getSubAppRef(t),a=new Yo(e,i);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Za(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,i){return(await this.getAppAsync(t)).deService.getService(i,e)}async translationModelToDsl(t,e){if(this.modelLoaderProvider)return this.modelLoaderProvider.translationModelToDsl(t,e)}reset(){this.appMap.clear(),this.configCache=void 0}destroy(){ibiz.hub.getAllApps().forEach((t=>{t.destroy()}))}},bl=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:i,engineCat:a}=t,s="".concat(a,"_").concat(i),n=this.viewEngines.get(s);if(n)return n(...e);ibiz.log.error(ibiz.i18n.t("runtime.engine.correspondingEngine",{key:s}),t)}}),Il=t("ViewEngineBase",class{constructor(t){this.view=t,this.enabledDataAccAction=!1,this.init(),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 searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get tabSearchForm(){return this.view.getController("tabsearchform")}get viewLayoutPanel(){return this.view.layoutPanel}init(){}handleContextParams(){this.view.params.srfdataaccaction&&(this.enabledDataAccAction=qa(this.view.params.srfdataaccaction),delete this.view.params.srfdataaccaction)}async onCreated(){const{childNames:t,modal:e}=this.view;e.hooks.shouldDismiss.tapPromise((async t=>{this.view.state.isLoading&&(t.allowClose=!1)})),t.push("captionbar","toolbar"),this.calcDynamicLayout()}calcDynamicLayout(){const t=this.calcRemoveLayoutModel();ibiz.log.debug(ibiz.i18n.t("runtime.engine.deleteModel",{codeName:this.view.model.codeName,name:t.join(";")})),this.removeLayoutModel(t)}calcRemoveLayoutModel(){const{model:t}=this.view,e=[];!1===t.showCaptionBar&&e.push("view_captionbar");return["lefttoolbar","righttoolbar","footertoolbar"].forEach((i=>{Ee(t,i)||e.push(i)})),this.calcViewHeaderVisible()||e.push("view_header"),ibiz.env.isMob?(this.calcViewFooterVisible()||e.push("view_footer"),this.isExistAndInLayout("lefttoolbar")||this.isExistAndInLayout("righttoolbar")||!1!==t.showCaptionBar||e.push("view_toolbar")):Ee(t,"toolbar")||e.push("view_toolbar","toolbar"),e}removeLayoutModel(t,e=this.view.model.viewLayoutPanel){if(!e)return;const i=e.rootPanelItems||e.panelItems||[],a=i.findIndex((e=>t.includes(e.id)));-1!==a&&i.splice(a,1),i.forEach((e=>{"CONTAINER"===e.itemType&&this.removeLayoutModel(t,e)}))}async onMounted(){const{model:t,childNames:e}=this.view;ibiz.log.debug(ibiz.i18n.t("runtime.engine.childComponentsMounted",{id:t.id,childName:e.join(";")}))}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData();if("ShortCut"===t)return this.onShortCut(e);if("ToggleFilter"===t)return this.toggleFilter(),null;if("Search"===t){const t=this.searchForm||this.tabSearchForm;return await t.search(),null}if("Reset"===t){const t=this.searchForm||this.tabSearchForm;return await t.reset(),null}}async onShortCut(t){const{data:e}=t,{context:i,model:a,params:s,modal:n}=this.view;if(["EMBED","POPOVER"].includes(n.mode))throw new Error(ibiz.i18n.t("runtime.engine.minimization",{mode:n.mode}));const o=await ibiz.util.shortCut.calcShortCutKey({context:i,appViewId:a.id});if(!ibiz.util.shortCut.isExist(o)){const t=e&&e[0].srfmajortext||a.caption;return ibiz.util.shortCut.addShortCut({key:o,caption:t,icon:a.sysImage,appViewId:a.id,context:d.create(i),params:{...s},openMode:n.mode,fullPath:window.location.hash}),this.view.state.isShortCut=!0,this.view.closeView(),null}return ibiz.util.shortCut.removeShortCut(o),this.view.state.isShortCut=!1,null}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 i=D(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:a}=this.view,s=Ee(a,t);let n=!(!i||!s);if("TOOLBAR"===(null==s?void 0:s.controlType)){const t=s.detoolbarItems;n=!!(n&&t&&t.length>0)}return n}calcViewFooterVisible(){let t=!1;return this.isExistAndInLayout("footertoolbar")&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:i,params:a}=this.view;if(!t)throw new o(ibiz.i18n.t("runtime.engine.loadEntityData"));const s=ibiz.hub.getApp(i.srfappid),n=await s.deService.exec(t,"get",i,a,void 0,{srfdataaccaction:this.enabledDataAccAction}),{data:r}=n;r&&(this.enabledDataAccAction&&await this.handleEntityPrivilege(r,this.view.context),this.view.state.srfactiveviewdata=r,Object.prototype.hasOwnProperty.call(r,"srfreadonly")&&(this.view.context.srfreadonly=r.srfreadonly),e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}async handleEntityPrivilege(t,e){const{appDataEntityId:i}=this.view.model;if(!t.srfdataaccaction)return;const a=ibiz.hub.getApp(e.srfappid);(await a.authority.getService(i)).setDataAccAction({srfkey:t.srfkey,srfsessionid:e.srfsessionid},t.srfdataaccaction)}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),Dl=(t("MDViewEngine",class extends Il{get xdataControlName(){return this.view.model.xdataControlName}get tabToolbar(){return this.view.getController("tabtoolbar")}get tabSearchBar(){return this.view.getController("tabsearchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar","tabtoolbar","tabsearchform","tabsearchbar"),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,i;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId),null==(i=this.tabToolbar)||i.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=>{var e,i;null==(e=this.toolbar)||e.calcButtonState(void 0,this.xdataControl.model.appDataEntityId),null==(i=this.tabToolbar)||i.calcButtonState(void 0,this.xdataControl.model.appDataEntityId),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 i=!!this.searchForm;e.state.keepAlive=i,e.state.visible=i&&!!t.expandSearchForm}if(this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchForm&&this.tabSearchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchBar&&this.tabSearchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault){const t=this.searchBar||this.tabSearchBar;t&&t.hasDefaultSelect&&("grid"===this.xdataControlName||"treegrid"===this.xdataControlName)?t.setDefaultSelect():this.load()}}handleContextParams(){super.handleContextParams(),this.view.context.srfsimple||(this.view.context.srfsimple=!0)}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"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):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):"GetAllData"===t?this.xdataControl.state.items:super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:s,event:n}=t,o=(t.context||this.view.context).clone();o.srfpaginationviewid=this.view.id;const r=t.params||this.view.params;o[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||Te(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("opendata",{context:o,params:r,data:s,event:n,view:this.view}));if(-1===c)throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicOpendata"));return{cancel:!c||!c.ok}}async newData(t){var e,a,s;const{data:n,event:o,copyMode:r}=t;if(!(null==(a=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:a.find((t=>"newdata"===t.id))))throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));const c=st(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 i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));return{cancel:!d||!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()),this.tabSearchForm&&Object.assign(t,this.tabSearchForm.getFilterParams()),this.tabSearchBar&&Object.assign(t,this.tabSearchBar.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 i=Ee(t,"searchbar");return!(!i.enableQuickSearch&&!i.enableGroup&&!0!==i.enableFilter)}calcRemoveLayoutModel(){const{model:t}=this.view,e=super.calcRemoveLayoutModel();return Ee(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),document.title),Cl=class{constructor(){this.layoutPanel=new ci,this.theme=new vn,this.text=new Ci,this.hbs=new he,this.rawValue=new Cn,this.action=Oc,this.error=new Gt,this.viewStack=new An,this.anime=new Uo,this.shortCut=new Wo,this.file=new Bo,this.biReport=new Go,this.error.register(new Wt)}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)}setBrowserTitle(t){const e=ibiz.hub.getApp();let i="";i=ibiz.env.AppTitle?ibiz.env.AppTitle:e.model.title?e.model.title:Dl,document.title=t?"".concat(i," - ").concat(t):i}getGlobalParam(){throw new o(ibiz.i18n.t("runtime.global.noImplemented"))}getRouterParams(){throw new o(ibiz.i18n.t("runtime.global.noImplementedRouting"))}},Al=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}destroy(){}},Pl=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const i=this.constructorMap.get(t.logicType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.logicType",{logicType:t.logicType}));return i(t,e)}},Tl=class extends Al{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,i){this.convertScriptArgs=e;const a=this.logic.scriptCode;this.scriptFn=ai.createScriptFn(t,a,i),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Nl=class extends Al{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return Rc(e,a,t)}},xl=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 i=this.createTrigger(t);this.triggers.set(t.id,i),i.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()),rt(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((i=>{i.match(t)&&e.push(i)})),e}triggerAndExecute(t,e={}){const i=this.getMatchTriggers(t);if(i.length>0){const t=this.getExecuteParams(e);return i.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,i){const a={itemName:t,triggerType:e},s=this.triggerAndExecute(a,i);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 i=this.triggers.get(t);if(!i)return-1;const a=this.getExecuteParams(e);return i.execute(a)}triggerControlEvent(t,e,i){const a={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(a,i)}},Sl=class extends xl{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Ll=class extends xl{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Ml=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const i=this.constructorMap.get(t.triggerType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.trigger.noSupportedType",{triggerType:t.triggerType}));return i(t,e)}},Rl=class{constructor(){this.executorFactory=new Pl,this.triggerFactory=new Ml}createViewScheduler(t){return new Ll(t)}createControlScheduler(t){return new Sl(t)}},Ol=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(ibiz.i18n.t("runtime.logicScheduler.trigger.noExecutorBound",{id:this.logic.id}))}destroy(){this.executor=void 0}},Fl=class extends Ol{},_l=class extends Ol{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.triggerType"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env","view"],(t=>{const{context:e,params:i,data:a,view:s}=t;return{context:e,params:i,data:(null==a?void 0:a[0])||{},env:ibiz.env,view:s}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,i;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(i=this.logic.itemName)?void 0:i.toLowerCase())}execute(t){return!!this.executor.execute(t)}},zl=class extends Ol{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.trigger.timerLacks"));this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.parameterCallback"));const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Vl=class extends Al{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:a,params:s,...n}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noActionableData"));let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.defaultOpendataViewLogic"));const d=c.refAppViewId;if(!d)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noActuallyReference"));const l=c.navigateContexts||[],h=Object.assign(a,pe(l,r[0],s,a));let u={};const p=c.navigateParams;return lt(p)&&(u=pe(p,r[0],s,a)),ibiz.commands.execute(Ko.TAG,d,h,u,{...n,openMode:c.openMode})}async calcOpenViewRef(t,e){const a=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=a.formTypeAppDEFieldId||a.dataTypeAppDEFieldId;if(!s)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.attributeConfiguration",{codeName:a.codeName}));const{data:n}=e,r=n[0][s];if(!r)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.entityAttributeValues"));const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.editViews",{formTypeValue: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=Te(c.parentView.model.appDataEntityId),a=t.batchAddAppViews;if(p=null==a?void 0:a.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.selectionView"))}else{if(h)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.noSupportedBatchAddOnly"));if(p=u,!p||!p.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.newdataViewLogic"))}let m={},g={};const f=(null==r?void 0:r[0])||{},y=p.navigateContexts;lt(y)&&(m=pe(y,f,n,s)),m=Object.assign(s,m);const w=p.navigateParams;if(lt(w)&&(g=pe(w,f,n,s)),n.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&f&&(g[t]=f.srfkey,g.srfcopymode=!0)}g.srfuf=0;const E=await ibiz.commands.execute(Ko.TAG,p.refAppViewId,m,g,{...o,openMode:p.openMode});return l&&E.data&&await this.doBatchAdd(t,E.data,s,p,e.view),E}async getWizardNewViewRef(t,e){var a;const{wizardAppView:s,newDataAppViews:n}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.indexEntity"));const l=await ibiz.commands.execute(Ko.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(a=l.data)?void 0:a[0];if(!h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.checkOne"));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(ibiz.i18n.t("runtime.logicScheduler.executor.entitiesAssociated",{indexType:u}));return p}async doBatchAdd(t,e,a,s,n){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,a.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new i(c,ibiz.i18n.t("runtime.logicScheduler.executor.relationships"));let h="";if(null==d||d.forEach((t=>{const e=Te(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.foreignKey",{pickParentDeName: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,i]=e.split(":");t&&i&&(u[t]=i)}}ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.mappingProperties"),u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((i=>{const a=u[i];e[a]=t[i]})),e}));ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.newCreationData"),m);const g=ibiz.hub.getApp(a.srfappid).deService;await g.exec(c.id,"Create",a,m)}}},kl=class extends Ol{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>pi[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Ul=class extends Ol{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>gi[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},Bl=class extends Al{execute(t){if(!this.logic.appDEUIActionId)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.missingTrigger"));Oc.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.urlReg=/^http[s]?:\/\/[^\s]*/,this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Nt.dirname(this.url.pathname)}dir(t){return this.urlReg.test(t)?t:this.url.origin+Nt.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.urlReg.test(t)?t:this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,i)=>{const a=document.createElement("link");a.setAttribute("type","text/css"),a.setAttribute("rel","stylesheet"),a.setAttribute("href",e),a.onload=t,a.onerror=i,document.head.appendChild(a)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,i){this.tag=t,this.repo=e,this.config=i}}),t("en",{runtime:{common:{unrealized:"unrealized"},command:{app:{noFindApplicationFunction:"An app feature called {appFuncId} cannot be found",noFindApplicationFunctionYype:"Unsupported application function type: {appFuncType}",noFindApplicationView:"The application view [{appViewId}] does not exist",unsupportedPopup:"Unsupported view opening modes: POPUP",unsupportedPopupapp:"Unsupported view opening modes: POPUPAPP",missingEvent:"Bubble opening missing event"}},controller:{common:{control:{componentActivation:"Component [{name}] ({id}) is active",componentPause:"Component [{name}] ({id}) is pause",unsupportedType:"Unsupported entity data change type: {type}",uncheckedData:"Unchecked data",dataDeletion:"data deletion",confirmDataDeletion:"Confirm deletion of data?",noImportModel:"No import model is configured!"},md:{rowData:"Row data does not exist",simpleMode:"Simple mode, no saving",dataDeleted:"Data [{str}] deleted successfully!",noChange:"The value has not changed",firstComplete:"Please complete the current line in the line editor first",noMoveDataCconfig:"No move data behavior config",changeGroupError:"Failed to switch the group",computeMoveMetaError:"Error in calculating target position and movement type"},editor:{editorNoConfigured:"Editor type [{editorType}], code table not configured"},view:{viewActivation:"View [{name}] ({id}) is active",viewPause:"View [{name}] ({id}) is pause",viewDestroy:"View [{name}] ({id}) is destroy",noFoundViewEngine:"The View Engine implementation was not found:",noSupportBehavior:"No engine support for pre-built interface behavior {key}"}},control:{menu:{noFindMenu:"Cannot find menu item named {id}",noConfigured:"No application functionality configured"},calendar:{missingViewLogic:"Missing {itemType}_opendata view logic",noFoundModel:"Calendar item model not found"},chart:{noConfiguredX:"Sequence is not configured with X-axis",noConfiguredY:"Sequence is not configured with Y-axis",missingClassification:"Missing classification attribute configuration",missingValue:"Missing value attribute configuration",noSupportSequence:"Charts do not support sequence types at this time {seriesType}",noFindSequence:"Cannot find generator for {seriesIndex} sequence!",noInitialised:"The chart object is not properly initialised",noCalculated:"Options have not been calculated.",classificationNotArray:"The configured classification attribute value is not an array",classificationNotString:"The configured classification attribute value is not an string",errorJson:"JSON parsing error"},dataView:{noBehaviourGroup:"No interface behaviour group is configured for the action",noBehaviourGroupAction:"No interface behaviour is configured for the action item interface behaviour group",propertiesNoConfigured:"Grouping properties are not configured",tableNoConfigured:"The grouping code table is not configured",sortingItems:"Items with sorting enabled must be associated with an entity attribute"},expBar:{unableMore:"Unable to get multiple data widgets [{xdataControlName}] controller",multiNode:"Multi-node views are implemented by subclasses",noFindNodeModel:"Cannot find node model for {nodeId}"},form:{formCompletion:"Please check the form completion!",savedSuccessfully:"{srfmajortext}Saved successfully!",prompt:"prompt",deletion:"Confirm deletion?",itemUpdate:"No {formItemUpdateId} form item update was found.",processStarted:"Process started successfully",processSubmitted:"Process submitted successfully",lackBehavior:"Lack of return operation entity behavior",initializationException:"Initialization Exception: Form member [{id}]({detailType}) already exists, duplicate form item identifier Please check configuration!",relationshipInterface:"Receive data change events from the relationship interface",fillIn:"Please fill in {caption} ",unconfiguredWidgets:"Multi-data widgets unconfigured content widgets",noFoundFormController:"No form controller corresponding to {id} found",multiDataAddData:"Multi-data widget type {contentType} does not support adding data at the moment",mdControllerNoExist:"mdController does not exist",repeaterNoSupported:"Repeater styles are not supported at this time {detailStyle}",searchTerms:"No search terms found to apply",saveSearch:"No saved search criteria found"},gantt:{noNode:"Not entity gantt node data",nonentity:"Non-entity node data cannot be saved",noSupport:"{treeNodeType} node type not supported"},grid:{unsupported:"Unsupported types {type}",attributeColumns:"Attribute columns with no grouping attributes configured",noCodeTable:"The attribute column {groupFieldName} of the grouping attribute does not have a configuration code table",configureFirstColumn:"Please configure the grouping attribute column {groupFieldName} as the first column",requiresCodeTable:"Code table grouping mode requires code table configuration",noMatchCodeTable:"The grouping code table does not match the code table for the attribute column {groupFieldName}",convertedValue:"The sort attribute of {srfmajortext} cannot be converted to a value",missingConfiguration:"Missing configuration of aggregated entities or aggregated datasets",newRows:"New rows are not supported",saveCancel:"Row data validation failed, save cancel",noSupportRowEditing:"The current form does not support row editing, and you cannot toggle on row editing.",lineEditing:"Only one line can be open for line editing at the same time",updateColumns:"No {updateId} edit columns found for update",exported:"No exported data",tabularColumns:"No tabular columns",corresponding:"Corresponding table data item not found [{deField}].",pickedUpData:"The value of {valueItem} is not picked up in the row data.",noSupportedMode:"Attribute column aggregation mode {aggMode} is not supported yet.",remoteAggregation:"Remote aggregation is not supported yet",aggregateMode:"Aggregate mode is not supported yet {aggMode}",formattingError:"{aggValue} value formatting error",checksumErrors:"{codeName}Checksum errors, {fieldName}",behaviorGroup:"The action column does not have an interface behavior group configured",interfaceBehavior:"No interface behavior is configured for the action column interface behavior group"},kanban:{sortingProperties:"Sorting properties are not configured",sortDirection:"Sort direction is not configured",groupedOn:"Kanban components must be grouped on",adjustmentsGroup:"The current Kanban does not allow adjustments to the grouping!",noAllowReorder:"Current Kanban does not allow reordering!"},meditViewPanel:{DraftNew:"Draft - New",dataExist:"Edit View Panel widget UI data does not exist"},panel:{panelData:"Panel data not captured"},reportPanel:{reportType:"Report panel generator factory parameter error, report panel does not specify report type",noImplemented:"Specify the report {reportType} type report panel generator not implemented yet",noReportUIModel:"The report ui model is not configured"},searchBar:{noFoundEntity:"Cannot find the associated entity corresponding to the attribute {targetField}.",missingModel:"Missing editor model",JSONFormat:"{data} non-standard JSON format:"},toolbar:{noFound:"Interface behavior model {actionId} not found"},tree:{noFoundTreeData:"Cannot find corresponding tree node data",sortAttribute:"Missing Configuration Sort Attribute",editMode:"The tree node is not configured for edit mode: name",nodeData:"Not entity tree node data",noFoundTreeNode:"Tree node not found"},treeGrid:{columnsSchema:"TreeTable Unvalued Columns Schema",columnMode:"Tree table without parent column mode"},treeGridEx:{noConfigured:"The node is not configured with a data item that corresponds to the table column {name}",editItem:"Edit item model corresponding to table column {name} was not found",noPickedUp:"The value of {valueItem} is not picked up in the row data.",behaviorGroup:"The {id} action column does not have an interface behavior group configured.",noSupportCreation:"Does not support the creation of new",updateBehavior:"Tree nodes are not configured to update entity behavior"},wizardPanel:{wizardForm:"Cannot find the wizard form for {activeFormTag}.",formController:"Cannot find a form controller for {activeFormTag}.",noConfiguration:"There is no Configuration Wizard form collection",wizardFormIdentifier:"Cannot find the wizard form with the {tag} identifier.",noPreviousForm:"No previous form",nextStep:"Cannot find next wizard step",nextForm:"Cannot find the next wizard form"}},utils:{buttonState:{isFinitenconsistency:"Inconsistency between entity {appDeName} of {uiActionId} interface behavior and entity {appDeId} of data"},counter:{decrement:"Decrement cannot be called for a count of 0!"},dataFileUtil:{startImport:"Start importing. Please refer to the application notification for detailed progress and results",noExist:"ibiz.util.getExportExcel does not exist",loadError:"Export module loading error",importData:"No corresponding import data model was found"},valueDefault:{noExist:"appdata.context does not exist",nosupported:"Default value type [{valueType}] not supported"},valueEx:{objectNameField:"Missing objectNameField"},valueRule:{length:"The length of the content must be less than or equal to {maxLength}, the current length is {length}."},viewMsg:{message:"Cannot find model for view message group {msgGroupId}",noFound:"No {message} view message model found",unconfigured:"Unconfigured entity dataset",unconfiguredEntities:"Application entities not configured"}}},deLogic:{deLogicLink:{connectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",entityConnectionConditional:"Entity Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",missingConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataMissingConditionValue:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",noSupportedTime:"Conditional value type [current time] is not supported at this time",entityLogicalConnection:"Entity Logical Connection Condition Item: {name} - Condition Value Type: {type} - Source Attribute Name: {dstField} - Source Object Value:",comparisonCondition:"-comparison condition: {op}",comparisonValue:"-comparison value",compareResults:"-Compare and contrast results:"},deLogicNode:{missingTargetParameter:"Missing target parameter object or source parameter object configuration",additionalParameter:"Entity logic node (appended to the array): {id} - additional parameter:",addedValue:"-Added value:",logicNodeParameterName:"Entity Logic Node (Binding Parameters): {id} - Parameter Name: {dstDELogicParamId} - Value:",copyParameter:"Entity logic node (copy parameter): {id} - parameter name: {dstDELogicParamId} - value:",dataSet:"Entity Logic Node (Data Set): {id} - Dataset Entity Id: {dstAppDataEntityId} - Dataset Id: {dstAppDEDataSetId} - Parameter Name: {retDELogicParamId} - Value:",unspecifiedEntity:"Unspecified application entity",unspecifiedBehavior:"Behavior of unspecified entities",entityActions:"Entity Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDELogicParamId} - Value:",unsupportedReturnType:"Unsupported end node return type: {returnType}",endNode:"Entity logic node (end node): {id} - return value type: {returnType} - return value:",noSupportedLogic:"Logic handling of parameter actions {paramAction} is not supported at this time.",preparationParameter:"Entity Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDELogicParamId} - Source Parameter (value):",targetParameter:"-Target parameter (value):",missingConfiguration:"Missing target parameter object configuration",rebuildParameter:"Entity Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDELogicParamId}",resetParameter:"Entity logic node (reset parameter): {id} - reset parameter: {dstDELogicParamId}",missingParameterProperty:"Missing target parameter object or target property configuration",sortedArrayParameters:"Entity Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDELogicParamId} - Sorted Array:",startupNode:"Entity logical node (startup node): {id}",throwsException:"Entity Logic Node (throws exception): {id} - Error Code: {errorCode} - Error Message: {errorInfo}",environmentVariables:"Unsupported logical parameter types: system environment variables",fileObjectListVariable:"Unsupported logical parameter type: file object list variable",fileObjectVariables:"Unsupported logical parameter types: file object variables",filterObjectVariables:"Unsupported logical parameter types: filter object variables",finalDataVariables:"Unsupported logical parameter types: final data variables",rawDataObjects:"Unsupported logical parameter types: Raw Data Objects",operationSessionVariables:"Unsupported Logical Parameter Types: Operation Session Variables",calculateEntity:"Calculated entity logic parameter, identifier: {tag}",value:"-value:",recreatingVariables:"Unsupported logical parameter types recreating variables",reEstablish:"Re-establish the entity logic parameter, identifier: {tag}",expressionEmpty:"Expression is empty",sourceValueType:"The source value type {srcValueType} is not supported yet.",fetchingAttribute:"Fetching the attribute {srcField} from the source parameter reports an error, source parameter:",noScriptCode:"Script code mode has no script code configured",noConfigurationLogicNode:"The entity logic does not have a configuration logic node",unsupportedLogical:"Unsupported logical node types: {logicNodeType}",noSetStartNode:"No start node set",startExecuting:"Start executing entity logic, logic identifier: {id} - logic name: {name}",endExecution:"End execution entity logic, logic identifier: {id} - logic name: {name}",noFoundEntityLogic:"{dataEntityId} entity logic not found {deDELogicId}"}},engine:{correspondingEngine:"There is no {key} corresponding engine",logicOpendata:"Missing view logic for opendata",logicNewdata:"Missing view logic for newdata",deleteModel:"{codeName} Delete model: {name}",childComponentsMounted:"The child components of {id}: {childName} are mounted.",minimization:"The current view is opened in [{mode}], minimization is not supported!",loadEntityData:"The view has no entities and cannot load entity data"},global:{noImplemented:"Getting application global variables is not implemented",noImplementedRouting:"Getting view routing parameter variables is not implemented"},hub:{failedParse:"View parameter modalOption failed to parse: {error}",noExist:"View [{id}] does not exist"},logicScheduler:{executor:{noConfiguredLogic:"No entity interface logic is configured",missingTrigger:"Missing trigger application entity interface behavior id in logic",noActionableData:"There is no actionable data for opendata!",defaultOpendataViewLogic:"opendata view logic is not configured to open the view by default",noActuallyReference:"The default open view for opendata view logic does not actually reference the view",attributeConfiguration:"{codeName}[Multiple Form Entity] or [Index Entity] missing type attribute configuration",entityAttributeValues:"Data Source No Form Type Applied Entity Attribute Values",editViews:"No edit views were found for the entity associated with the form type {formTypeValue}.",selectionView:"Selection view that needs to be opened for batch add was not found",noSupportedBatchAddOnly:"batchAddOnly is not supported yet.",newdataViewLogic:"The newdata view logic is not configured to default to a new data view",indexEntity:"Missing Default Index Entity Selection View",checkOne:"Please check one piece of data",entitiesAssociated:"No edit view found for entities associated with index type {indexType}",relationships:"Entities do not have a collection of relationships from!",foreignKey:"No foreign key attribute found for {pickParentDeName} in the current entity",mappingProperties:"Batch New Conversion Mapping Properties",newCreationData:"Batch new creation data",logicType:"Logic type {logicType} Not supported yet!",noImplementedMethod:"Method not implemented."},trigger:{triggerType:"The trigger type for the predefined logical type {type} can only be a script",noSupportedType:"Trigger type {triggerType} Not supported yet!",noExecutorBound:"{id} No executor bound.",timerLacks:"Timer lacks timing intervals",parameterCallback:"Timer missing default parameter callback"}},model:{utils:{noFoundApplication:"Application not found",unconfiguredPlugins:"Apply unconfigured plug-ins",noFound:"Plugin not found {id}"},view:{engineClassifications:"Unsupported engine classifications: {engineType}"}},platform:{failedDownload:"Failed to download file",fileStreamData:"File stream data does not exist"},register:{helper:{adapter:"Cannot find the adapter corresponding to the system counter plugin {pluginKey}.",customizedSystemAdapter:"Cannot find the adapter corresponding to the customized system counter {codeName}.",noFoundSystemCounter:"Adapter for system counter type {counterType} is not found.",applicationMenu:"Cannot find the adapter corresponding to the application menu item plugin {pluginKey}.",asynchronousAction:"Find the adapter that does not correspond to the asynchronous action type {actiontype}.",matchedPlugin:"Not matched to plugin [{pluginId}] model",customRegistration:"Cannot find an adapter with a custom registration ID of [{registerKey}].",widgetPlugin:"Cannot find the adapter corresponding to the widget plugin {pluginKey}.",widgetStyleType:"Cannot find the adapter corresponding to the widget style: [{controlStyle}] for the widget type: [{controlType}].",widgetType:"Cannot find an adapter for widget type {controlType}.",entityBehaviorPlugin:"Cannot find the adapter corresponding to the entity behavior plugin {pluginKey}.",entityBehaviorMethod:"Find adapters that donnot have an entity behavior method type of {methodType}",editorPlugin:"Cannot find the adapter corresponding to the editor plugin {pluginKey}.",editorStyleType:"Cannot find the adapter corresponding to editor style: [{editorStyle}] for editor type: [{editorType}].",editorTypePredefinedType:"Cannot find an adapter corresponding to editorType: [{editorType}] for predefinedType: [{predefinedType}].",editorType:"Cannot find the adapter corresponding to editor type {editorType}.",formMemberPlugin:"Cannot find the adapter corresponding to the form member plugin {pluginKey}.",formMemberType:"Cannot find an adapter for form member type {detailType}.",tableColumnPlugin:"Cannot find the adapter corresponding to the table column plugin {pluginKey}.",tableColumnType:"Cannot find an adapter for table column type {key}.",messageType:"Cannot find the adapter corresponding to the message type {content_type}.",panelMemberPlugin:"The adapter corresponding to the panel member plugin {pluginKey} could not be found.",panelContainerPredefined:"Cannot find an adapter with panel container predefined type {predefinedType}, registered key {key}",panelMemberDirectContent:"Cannot find adapter with panel member direct content predefined type {predefinedType}, registered key {key}",panelMemberType:"The adapter corresponding to the panel member type {itemType} could not be found.",portalWidgetPlugin:"Cannot find the adapter corresponding to the portal widget plugin {pluginKey}.",portalWidgetMemberType:"Adapter corresponding to portal widget member type {portletType} not found",treeTableColumnPlugin:"Cannot find the adapter corresponding to the tree table column plugin {pluginKey}.",interfaceBehaviorPlugin:"Cannot find the adapter corresponding to the interface behavior plugin {pluginKey}.",interfaceBehaviorMode:"Find the adapter that does not correspond to the interface behavior mode {uiactionMode}.",frontEndPluginNode:"Cannot find interface logic front-end plugin node, plugin {pluginKey} corresponding adapter",viewPlugin:"Cannot find the adapter corresponding to the view plugin {pluginKey}.",correspondViewTypeStyle:"Cannot find an adapter for view type: [{viewType}] corresponding to view style: [{viewStyle}].",toolbarItem:"Cannot find the adapter corresponding to the toolbar item plugin {pluginKey}.",acItem:"Cannot find the adapter corresponding to the ac item plugin {pluginKey}."}},service:{noConfiguredPrimary:"Entity [{codeName}] is not configured with a primary key field",noConfiguredField:"Entity [{codeName}] is not configured with a primary text field",convertedNumber:"{value} cannot be converted to a number.",subRelationships:"Sub-relationships not configured with a nested relational dataset will result in a recursive query death loop, please configure it!",unsupportedMethod:"Unsupported application entity method input attribute type: {type}",noFoundUsernamePassword:"Anonymous login configuration username or password not found",loginFailure:"Login Failure",logoutFailure:"Logout failure",noFound:"Application entity not found [{id}]",mainState:"{codeName} entity does not exist, the main state is not enabled, or the main state collection is empty, return true",operationIdentifier:"Operation identifier {dataAccessAction} main state calculation started",matchMasterState:"Match master state",masterStatePermissions:"Collection of allowed master state permissions",noMatchedState:"Returns false if the main state is not matched.",permissionCalculation:"Operation identifier {dataAccessAction} end of permission calculation: {result}",noFindCodeList:"Cannot find {tag} code list",noConfiguredCounters:"Application counters not configured!",lackEntityLogic:"Lack of entity handling logic",createBehavior:"The create behavior does not pass data",updateBehavior:"The update behavior does not pass data",deletionDeletion:"Currently, only [DER1N] relationship type association deletion deletion is supported.",unableDelete:"Unable to delete [{logicName}-{srfmajortext}], data referenced by [{modelLogicName}-{msg}].",noSupportedDataSource:"Data source type {dataSetType} not supported yet",sourceCodeTable:"No data is specified for the source code table",requestMethods:"Unsupported request methods: {requestMethod}",noConfiguredRequestMethod:"Request method not configured",unsupportedBehaviorTypes:"Unsupported Behavior Types [{actionType}]",noFoundServiceMethod:"Service method not found: {id}",UnsupportedServiceMethod:"Unsupported service method types: {methodType}",noSupportedMethod:"The 「{id}」 method is not supported by {codeName}.",noFoundStorageEntity:"Application function [{name}] storage entity not found [{stoageAppDataEntityId}]",noExist:"Application function [{name}] does not exist",noFoundEntity:"Storage Entity Not Found [{stoageAppDataEntityId}]",noImplemented:"「{methodName}」 is not implemented.",noImplementedCounter:"Counter loading method not implemented",noFoundCounterBehavior:"Get counter behavior not found!",createPrimaryKeyData:"Failed to create new joint primary key data with existing primary key {srfkey}",updatePrimaryKeyData:"Failed to update joint primary key data with existing primary key {srfkey}",noExistNoUpdated:"Data does not exist and cannot be updated!",dataNoExistNoUpdated:"Data [{srfdename}-{srfmajortext}({srfkey})] does not exist and cannot be updated!",noDeleted:"The following data 「{notRemoveKey}」 was not found and could not be deleted!",noAttributeName:"No attribute name is specified",noContextParameterName:"No context parameter name is specified",conditionalObjects:"Unrecognizable Conditional Objects",mustArray:"The value must be an array",unsupportedQueryTypes:"Unsupported query types: {condType}",predefinedType:"Predefined type {predefinedType} is not supported at this time.",dynamicCodeTable:"The return value of a dynamic code table data property is not an object-formatted string and cannot be converted!",unconfiguredDataset:"Unconfigured dataset",processedWithout:"Execution of 「{funcName}」 cannot be processed without 「srfkey」.",noExistProcessed:"Execution of 「{funcName}」 does not exist and 「srfsessionid」 cannot be processed.",missingDetreeColumnId:"Model exception missing detreeColumnId or dataItemName."},uiAction:{noEntityOrBehavior:"No entity or entity behavior configured",noConfiguredopenView:"Not configured to open the view",frontProcessingModes:"Unsupported front processing modes [{frontProcessType}]",missingConfigurationScriptCode:"Custom types are missing configuration script code",dataPrimaryKey:"Data primary key not found",printFailure:"print failure",physicalPrint:"No physical print items found",exportRequestFailed:"Export request failed",noEntityExportsFound:"No entity exports found",lackNativeEvent:"Lack of native JS event objects",wantLogout:"Are you sure you want to log out?",logout:"Logout",operationConfirmation:"Operation Confirmation",viewParameterModalOption:"View parameter modalOption failed to parse: {error}",withdrawalConfirmed:"Is the execution of the withdrawal confirmed?",noFoundBehaviorModel:"No interface behavior model found for {actionId}."},uiLogic:{interfaceConnectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",connectionConditionGroup:"Interface Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",currentConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataObjectAttribute:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",currentTime:"Conditional value type [current time] is not supported at this time",interfaceConnectionConditionalTypeName:"Interface Logic Connection Condition Item: {name} - Condition Value Type: {type} - Source Property Name: {dstField} - Source Object Value:",asynchronousTermination:"Unsupported logical connection type: asynchronous termination",asynchronousRejection:"Unsupported logical connection type: asynchronous rejection",exceptionHandling:"Unsupported Logical Connection Type: Exception Handling",logicalLinkTypes:"Unsupported logical link types:{linkMode}",missingTargetParameter:"Missing target parameter object or source parameter object configuration",appendedArray:"Interface logic node (appended to the array): {id} - additional parameter:",bindingParameters:"Interface Logic Node (Binding Parameters): {id} - Parameter Name: {dstDEUILogicParamId} - Value:",copyParameter:"Interface logic node (copy parameter): {id} - parameter name: {dstDEUILogicParamId} - value:",missingfilter:"Missing configuration filter parameters",interfaceLogicNodeDataSet:"Interface Logic Node (Data Set): {id} - Dataset Entity Identifier: {dstAppDataEntityId} - Dataset Identifier: {dstAppDEDataSetId} - Parameter Name: {retDEUILogicParamId} - Value:",interfaceLogicNodeEntityActions:"Interface Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDEUILogicParamId} - Value:",noConfiguredInterfaceBehavior:"Interface behavior not configured",interfaceLogicNodeEntityInterfaceAction:"Interface Logic Node (Entity Interface Action): {id} - Interface Action Identifier: {dstAppDEUIActionId} - Entity to which the Interface Action belongs: {dstAppDataEntityId} - Target Logic Parameter Object: {dstDEUILogicParamId}",logicalNodeOperation:"Logical node {name} operation parameter value:",unsupportedEndNode:"Unsupported end node return value types: {returnType}",interfaceLogicNodeEndNode:"Interface logic node (end node): {id} - return value type: {returnType} - return value:",noEntityConfigured:"No entity configured",noEntityLogicConfigured:"No entity logic configured",noIncomingLogic:"No incoming logic parameters are configured",passedParameter:"Passed parameter {dstDEUILogicParamId} not found",interfaceLogicNodeExecutingEntityLogic:"Interface logic node (executing entity logic): {id} - entity logic identifier: {dstAppDELogicId} - entity to which the entity logic belongs: {dstAppDataEntityId} - parameter name: {retDEUILogicParamId} - value:",missingMessageTypeConfiguration:"Missing message type configuration",missingButtonTypeConfiguration:"Missing button type configuration",interfaceLogicNodeMessagePopup:"Interface logic node (message popup): {id} - message type: {type} - message: {message}",message:"messages",yes:"yes",no:"no",determine:"Determine",cancel:"Cancel",noSupportItem:"{name} is currently not supported",interfaceLogicNodeFrontendPlugin:"Interface Logic Node (Frontend Plugin): {id} - Plugin Id: {sysPFPluginId}",interfaceLogicNodePreparationParameter:"Interface Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDEUILogicParamId} - Source Parameter (value):",noTargetParameter:"No target parameter object id",targetParameter:"Assigning a value to the target parameter attribute {dstFieldName} reports an error, target parameter:",interfaceLogicNodeDirectCode:"Interface logic node (direct code): {id}-direct code:",interfaceLogicNodeRebuildParameter:"Interface Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"Interface Logic Node (Reset Parameter): {id} - Reset Parameter: {dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"Interface Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDEUILogicParamId} - Sorted Array:",interfaceLogicNodeStartupNode:"Interface logic node (startup node): {id}",interfaceLogicNodeThrowingExceptions:"Interface Logic node (throwing exceptions): {id} - error message: {errorInfo}",noConfiguredTriggerObject:"No trigger object is configured",noConfiguredEvent:"The event name parameter is not configured",noConfiguredEventParameters:"No event parameters are configured",noFoundTriggerObject:"Trigger object not found {fireCtrlId}",noFoundEventParameterObject:"Event parameter object not found {eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"Interface logic node (view widget event trigger logic): {id} - name of the calling view widget: {fireCtrlId} - name of the triggering event: {eventName} - triggering parameters:",noConfiguredInterfaceObject:"No interface object is configured",noConfiguredOperatingParameters:"No operating parameters are configured",noConfiguredCallMethod:"No call method is configured",noFoundOperationParameter:"The operation parameter {invokeParamId} was not found.",noFoundInterfaceObject:"Interface object {invokeCtrlId} was not found.",noFoundInvokeMethod:"The invoke method {invokeMethod} was not found.",interfaceLogicNodeViewWidgetInvocation:"Interface logic node (view widget invocation): {id} - name of the invoking view widget: {invokeCtrlId} - name of the invoking method: {invokeMethod} - trigger parameter:",viewLogicInitializationParameter:"View logic initialization parameter, {codeName} specified widget object not found",calculateInterfaceLogicParameters:"Calculate interface logic parameters, identifier: {tag}",restablishInterfaceLogic:"Re-establish the interface logic parameters, identifying: {tag}",interfaceLogic:"Interface logic {deUILogicId} for entity {appDataEntityId} not found",startExecutingInterfaceLogic:"Start executing the interface logic, entity: {appDataEntityId} - logic name: {name}",endExecutionInterfaceLogic:"End execution interface logic, entity: {appDataEntityId} - logic name: {name}",noLogicalNodesConfigured:"The interface logic has no logical nodes configured"},utils:{anime:{noExistEndpointElement:"The endpoint element does not exist",noExistAnimationElement:"Animation element does not exist",noClone:"Cannot clone a null or undefined element."},errorHandler:{noPermissionless:"No permissionless error handler registered",noProcessor:"No processor was found that can handle this error"},fileUtil:{fileUploadFailed:"File upload failed"},handlebars:{noInitHandlebars:"handlebars not init"},modal:{externalClosureCapability:"External closure capability not registered",shouldDismissResult:"The result of shouldDismiss is false, closing the interrupt."},openRedirectView:{parseSrfnavctxParameter:"Failed to parse srfnavctx parameter in redirection [{urlStr}].",missingEntityName:"Entity name missing from redirection parameter",noFoundSpecifiedEntity:"CodeName not found for the specified entity: {deName}",unsupportedLinkUrl:"Unsupported linkUrl format: {linkUrl}",noConfiguredActualReference:"Actual reference view not configured",redirectingViewReferences:"Redirecting view references there:",redirectionIdentifier:"Redirection identifier [{rdTag}] or [{deRdTag}] or workflow [{wfRdTag}] corresponding to view not found",noMatchActualReferenceView:"Identifies that [{rdTag}] did not match the actual reference view",redirectionView:"Redirection view [{name}] custom category attribute [{typeFieldId}] value is null"},script:{errorReportingScript:"Error Reporting Script"},shortCut:{invalidIndexNewIndex:"Invalid index newIndex: {newIndex}, oldIndex: {oldIndex}, current array length {length}"},uiDomain:{transactionOpen:"Transaction has been opened, only one transaction can be opened for a single interface domain.",currentTransaction:"The current transaction has not been committed and cannot be closed directly."},uiDomainManager:{invalidInterfaceDomain:"Invalid interface domain identifier [{id}]"},verify:{contentConform:"Content must conform to value rules",scopeRules:"Content length must conform to scope rules",valueNull:"The value is null",regularRules:"The value must conform to the regular rules",rangeRules:"Values must conform to the value range rules",scriptRules:"The value must conform to the script rules",emptyLogicGroups:"Empty logic groups were found and the logic could not be executed properly!",unsupportedLogicTypes:"Unsupported logic types {logicType}",emptyLogicGroupsProperly:"Empty logic groups were found and the logic could not be executed properly!",valueOperations:"Value operations: {op}, not yet supported",noCompared:"{value} and {value2} cannot be compared.",conditionalValues:"Conditional values for range comparisons do not exist or are not strings"},firstregister:"Please register the model loading adapter first"},deAction:{responseDataError:"Response data exception [data]: {error}"}}}),t("zhCn",{runtime:{common:{unrealized:"未实现"},command:{app:{noFindApplicationFunction:"找不到叫{appFuncId}的应用功能",noFindApplicationFunctionYype:"未支持的应用功能类型:{appFuncType}",noFindApplicationView:"应用视图[{appViewId}]不存在",unsupportedPopup:"未支持的视图打开模式: POPUP",unsupportedPopupapp:"未支持的视图打开模式: POPUPAPP",missingEvent:"气泡打开缺少event"}},controller:{common:{control:{componentActivation:"部件[{name}]({id})激活",componentPause:"部件[{name}]({id})暂停",unsupportedType:"不支持的实体数据变更类型: {type}",uncheckedData:"未选中数据",dataDeletion:"数据删除",confirmDataDeletion:"确认删除数据?",noImportModel:"没有配置导入模型!"},md:{rowData:"行数据不存在",simpleMode:"简单模式,不保存",dataDeleted:"数据[{str}]删除成功!",noChange:"值没有发生改变",firstComplete:"请先完成当前行编辑中的行的操作",noMoveDataCconfig:"无移动数据行为配置",changeGroupError:"切换分组失败",computeMoveMetaError:"计算目标位置和移动类型发生错误"},editor:{editorNoConfigured:"编辑器类型[{editorType}],未配置代码表"},view:{viewActivation:"视图[{name}]({id})激活",viewPause:"视图[{name}]({id})暂停",viewDestroy:"视图[{name}]({id})销毁",noFoundViewEngine:"未找到视图引擎实现:",noSupportBehavior:"没有引擎支持预置界面行为{key}"}},control:{menu:{noFindMenu:"找不到名为{id}的菜单项",noConfigured:"没有配置应用功能"},calendar:{missingViewLogic:"缺少{itemType}_opendata的视图逻辑",noFoundModel:"未找到日历项模型"},chart:{noConfiguredX:"序列没有配置X坐标轴",noConfiguredY:"序列没有配置Y坐标轴",missingClassification:"缺少分类属性配置",missingValue:"缺少值属性配置",noSupportSequence:"图表暂未支持序列类型{seriesType}",noFindSequence:"找不到{seriesIndex}序列的generator!",noInitialised:"chart对象没有正确初始化",noCalculated:"options还没计算",classificationNotArray:"配置的分类属性值不是一个数组",classificationNotString:"配置的分类属性值不是一个字符串",errorJson:"JSON解析错误"},dataView:{noBehaviourGroup:"操作项没有配置界面行为组",noBehaviourGroupAction:"操作项界面行为组没有配置界面行为",propertiesNoConfigured:"分组属性没有配置",tableNoConfigured:"分组代码表没有配置",sortingItems:"启用排序的项必须关联实体属性"},expBar:{unableMore:"无法获取多数据部件[{xdataControlName}]控制器",multiNode:"多节点视图由子类实现",noFindNodeModel:"找不到{nodeId}的节点模型"},form:{formCompletion:"请检查表单填写!",savedSuccessfully:"{srfmajortext}保存成功",prompt:"提示",deletion:"确认删除吗?",itemUpdate:"没找到{formItemUpdateId}表单项更新",processStarted:"流程启动成功",processSubmitted:"流程提交成功",lackBehavior:"缺少返回操作实体行为",initializationException:"初始化异常: 表单成员[{id}]({detailType})已存在,表单项标识重复请检查配置",relationshipInterface:"接收到关系界面的数据变更事件",fillIn:"请填写{caption}",unconfiguredWidgets:"多数据部件未配置内容部件",noFoundFormController:"没有找到对应{id}的表单控制器",multiDataAddData:"多数据部件类型{contentType}暂不支持添加数据",mdControllerNoExist:"mdController不存在",repeaterNoSupported:"暂不支持重复器样式{detailStyle}",searchTerms:"没有找到可以应用的搜索条件",saveSearch:"没有找到保存的搜索条件"},gantt:{noNode:"不是实体甘特节点数据",nonentity:"非实体节点数据不能保存",noSupport:"{treeNodeType}节点类型未支持"},grid:{unsupported:"未支持的类型{type}",attributeColumns:"没有配置分组属性的属性列",noCodeTable:"分组属性的属性列{groupFieldName}没有配置代码表",configureFirstColumn:"请将分组属性列{groupFieldName}配置为第一列",requiresCodeTable:"代码表分组模式需要配置代码表",noMatchCodeTable:"分组代码表与属性列{groupFieldName}的代码表不一致",convertedValue:"{srfmajortext}的排序属性无法转换成数值",missingConfiguration:"缺少配置聚合实体或聚合数据集",newRows:"不支持新建行",saveCancel:"行数据校验不通过,保存取消",noSupportRowEditing:"当前表格不支持行编辑,无法切换开启行编辑",lineEditing:"同时只能有一行开启行编辑",updateColumns:"没找到{updateId}编辑列更新",exported:"无导出数据",tabularColumns:"无表格列",corresponding:"未找到对应的表格数据项[{deField}]",pickedUpData:"未在行数据中取到 {valueItem} 的值",noSupportedMode:"暂未支持属性列聚合模式{aggMode}",remoteAggregation:"远程聚合暂未支持",aggregateMode:"暂未支持聚合模式{aggMode}",formattingError:"{aggValue} 值格式化错误",checksumErrors:"{codeName}校验报错,{fieldName}",behaviorGroup:"操作列没有配置界面行为组",interfaceBehavior:"操作列界面行为组没有配置界面行为"},kanban:{sortingProperties:"排序属性没配置",sortDirection:"排序方向没配置",groupedOn:"看板部件必须开启分组",adjustmentsGroup:"当前看板不允许调整分组!",noAllowReorder:"当前看板不允许调整次序!"},meditViewPanel:{DraftNew:"草稿--新建",dataExist:"编辑视图面板部件UI数据不存在"},panel:{panelData:"未获取到面板数据"},reportPanel:{reportType:"报表面板生成器工厂参数错误,报表面板未指定报表类型",noImplemented:"指定报表{reportType}类型报表面板生成器暂未实现",noReportUIModel:"未配置指定报表界面模型"},searchBar:{noFoundEntity:"找不到属性{targetField}对应的关联实体",missingModel:"缺少编辑器模型",JSONFormat:"{data}非标准JSON格式:"},toolbar:{noFound:"没有找到界面行为模型{actionId}"},tree:{noFoundTreeData:"找不到对应的树节点数据",sortAttribute:"缺少配置排序属性",editMode:"树节点没有配置编辑模式:名称",nodeData:"不是实体树节点数据",noFoundTreeNode:"未找到树节点"},treeGrid:{columnsSchema:"树表格无值列模式",columnMode:"树表格无父值列模式"},treeGridEx:{noConfigured:"节点没有配置对应表格列{name}的数据项",editItem:"没有找到对应表格列{name}的编辑项模型",noPickedUp:"未在行数据中取到 {valueItem} 的值",behaviorGroup:"{id}操作列没有配置界面行为组",noSupportCreation:"暂不支持新建",updateBehavior:"树节点没有配置更新实体行为"},wizardPanel:{wizardForm:"找不到{activeFormTag}的向导表单",formController:"找不到{activeFormTag}的表单控制器",noConfiguration:"没有配置向导表单集合",wizardFormIdentifier:"找不到标识为{tag}的向导表单",noPreviousForm:"没有上一个表单",nextStep:"找不到下一个向导步骤",nextForm:"找不到下一个向导表单"}},utils:{buttonState:{isFinitenconsistency:"{uiActionId}界面行为的实体{appDeName}和数据的实体{appDeId}不一致"},counter:{decrement:"错误的调用!decrement不能对count为0调用"},dataFileUtil:{startImport:"开始导入,详细进度和结果请看应用通知",noExist:"ibiz.util.getExportExcel不存在",loadError:"导出模块加载错误",importData:"没有找到对应的导入数据模型"},valueDefault:{noExist:"appdata.context不存在",nosupported:"默认值类型[{valueType}]未支持"},valueEx:{objectNameField:"缺少objectNameField"},valueRule:{length:"内容长度必须小于等于{maxLength},当前长度为{length}"},viewMsg:{message:"找不到视图消息组{msgGroupId}的模型",noFound:"没有找到{message}视图消息模型",unconfigured:"未配置实体数据集",unconfiguredEntities:"未配置应用实体"}}},deLogic:{deLogicLink:{connectionConditional:"界面连接条件逻辑组未配置逻辑项",entityConnectionConditional:"实体逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",missingConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataMissingConditionValue:"当前条件值类型为[源数据对象属性],缺少配置条件值",noSupportedTime:"暂未支持条件值类型为[当前时间]",entityLogicalConnection:"实体逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",comparisonCondition:"-对比条件:{op}",comparisonValue:"-对比值:",compareResults:"-对比结果:"},deLogicNode:{missingTargetParameter:"缺少目标参数对象或者源参数对象配置",additionalParameter:"实体逻辑节点(附加到数组):{id}-附加参数:",addedValue:"-附加值:",logicNodeParameterName:"实体逻辑节点(绑定参数):{id}-参数名称:{dstDELogicParamId}-值:",copyParameter:"实体逻辑节点(拷贝参数):{id}-参数名称:{dstDELogicParamId}-值:",dataSet:"实体逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDELogicParamId}-值:",unspecifiedEntity:"未指定应用实体",unspecifiedBehavior:"未指定实体行为",entityActions:"实体逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDELogicParamId}-值:",unsupportedReturnType:"暂未支持的结束节点返回值类型: {returnType}",endNode:"实体逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noSupportedLogic:"暂未支持逻辑处理参数操作{paramAction}",preparationParameter:"实体逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDELogicParamId}-源参数(值):",targetParameter:"-目标参数(值):",missingConfiguration:"缺少目标参数对象配置",rebuildParameter:"实体逻辑节点(重新建立参数):{id}-重建参数:{dstDELogicParamId}",resetParameter:"实体逻辑节点(重置参数):{id}-重置参数:{dstDELogicParamId}",missingParameterProperty:"缺少目标参数对象或目标属性配置",sortedArrayParameters:"实体逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDELogicParamId}-排序后数组:",startupNode:"实体逻辑节点(启动节点):{id}",throwsException:"实体逻辑节点(抛出异常):{id}-错误代码:{errorCode}-错误信息:{errorInfo}",environmentVariables:"未支持的逻辑参数类型: 系统环境变量",fileObjectListVariable:"未支持的逻辑参数类型: 文件对象列表变量",fileObjectVariables:"未支持的逻辑参数类型: 文件对象变量",filterObjectVariables:"未支持的逻辑参数类型: 过滤器对象变量",finalDataVariables:"未支持的逻辑参数类型: 最后数据变量",rawDataObjects:"未支持的逻辑参数类型: 原始数据对象",operationSessionVariables:"未支持的逻辑参数类型: 操作会话变量",calculateEntity:"计算实体逻辑参数,标识:{tag}",value:"-值:",recreatingVariables:"未支持的逻辑参数类型重新建立变量",reEstablish:"重新建立实体逻辑参数,标识:{tag}",expressionEmpty:"表达式为空",sourceValueType:"暂未支持源值类型{srcValueType}",fetchingAttribute:"从源参数取属性{srcField}报错,源参数:",noScriptCode:"脚本代码模式没有配置脚本代码",noConfigurationLogicNode:"实体逻辑没有配置逻辑节点",unsupportedLogical:"未支持的逻辑节点类型: {logicNodeType}",noSetStartNode:"未设置起始节点",startExecuting:"开始执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",endExecution:"结束执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",noFoundEntityLogic:"{dataEntityId}找不到实体逻辑{deDELogicId}"}},engine:{correspondingEngine:"没有{key}对应的引擎",logicOpendata:"缺少opendata的视图逻辑",logicNewdata:"缺少newdata的视图逻辑",deleteModel:"{codeName}删除模型:{name}",childComponentsMounted:"{id}的子组件:{childName}都已mounted",minimization:"当前视图打开方式为 [{mode}], 不支持最小化!",loadEntityData:"该视图没有实体,无法加载实体数据"},global:{noImplemented:"获取应用全局变量没有实现"},hub:{failedParse:"视图参数modalOption 解析失败:{error}",noExist:"视图[{id}]不存在"},logicScheduler:{executor:{noConfiguredLogic:"没有配置实体界面逻辑",missingTrigger:"逻辑中缺少触发应用实体界面行为id",noActionableData:"opendata没有可操作数据!",defaultOpendataViewLogic:"opendata视图逻辑没有配置默认打开视图",noActuallyReference:"opendata视图逻辑的默认打开视图没有实际引用视图",attributeConfiguration:"{codeName}[多表单实体] or [索引实体]缺少类型属性配置",entityAttributeValues:"数据源无表单类型应用实体属性值",editViews:"没有找到与表单类型{formTypeValue}相关的实体的编辑视图",selectionView:"没有找到批添加需要打开的选择视图",noSupportedBatchAddOnly:"batchAddOnly暂未支持",newdataViewLogic:"newdata视图逻辑没有配置默认新建数据视图",indexEntity:"缺少默认索引实体选择视图",checkOne:"请选中一条数据",entitiesAssociated:"没有找到与索引类型{indexType}相关的实体的编辑视图",relationships:"实体没有从关系集合!",foreignKey:"没有找到{pickParentDeName}在当前实体的外键属性",mappingProperties:"批量新建转换映射属性",newCreationData:"批量新建创建数据",logicType:"逻辑类型 {logicType} 暂未支持!",noImplementedMethod:"方法未执行。"},trigger:{triggerType:"预定义逻辑类型{type}的触发器类型只能是脚本",noSupportedType:"触发器类型 {triggerType} 暂未支持!",noExecutorBound:"{id}没有绑定executor",timerLacks:"定时器缺少定时间隔",parameterCallback:"定时器缺少默认参数回调"}},model:{utils:{noFoundApplication:"未找到应用",unconfiguredPlugins:"应用未配置插件",noFound:"未找到插件{id}"},view:{engineClassifications:"未支持的引擎分类:{engineType}"}},platform:{failedDownload:"下载文件失败",fileStreamData:"文件流数据不存在"},register:{helper:{adapter:"找不到系统计数器插件{pluginKey}对应的适配器",customizedSystemAdapter:"找不到自定义系统计数器{codeName}对应的适配器",noFoundSystemCounter:"找不系统计数器类型{counterType}对应的适配器",applicationMenu:"找不到应用菜单项插件{pluginKey}对应的适配器",asynchronousAction:"找不异步操作类型{actiontype}对应的适配器",matchedPlugin:"未匹配到插件[{pluginId}]模型",customRegistration:"找不到自定义注册标识为[{registerKey}]对应的适配器",widgetPlugin:"找不到部件插件{pluginKey}对应的适配器",widgetStyleType:"找不到部件类型:[{controlType}]的部件样式:[{controlStyle}]对应的适配器",widgetType:"找不到部件类型{controlType}对应的适配器",entityBehaviorPlugin:"找不到实体行为插件{pluginKey}对应的适配器",entityBehaviorMethod:"找不实体行为方法类型为{methodType}的适配器",editorPlugin:"找不到编辑器插件{pluginKey}对应的适配器",editorStyleType:"找不到编辑器类型:[{editorType}]的编辑器样式:[{editorStyle}]对应的适配器",editorTypePredefinedType:"找不到编辑器类型:[{editorType}]的预置类型:[{predefinedType}]对应的适配器",editorType:"找不到编辑器类型{editorType}对应的适配器",formMemberType:"找不到表单成员类型{detailType}对应的适配器",tableColumnPlugin:"找不到表格列插件{pluginKey}对应的适配器",tableColumnType:"找不到表格列类型{key}对应的适配器",messageType:"找不站内信类型{content_type}对应的适配器",panelMemberPlugin:"找不到面板成员插件{pluginKey}对应的适配器",panelContainerPredefined:"找不到面板容器预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberDirectContent:"找不到面板成员直接内容预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberType:"找不到面板成员类型{itemType}对应的适配器",portalWidgetPlugin:"找不到门户部件插件{pluginKey}对应的适配器",portalWidgetMemberType:"找不到门户部件成员类型{portletType}对应的适配器",treeTableColumnPlugin:"找不到树表格列插件{pluginKey}对应的适配器",interfaceBehaviorPlugin:"找不到界面行为插件{pluginKey}对应的适配器",interfaceBehaviorMode:"找不界面行为模式{uiactionMode}对应的适配器",frontEndPluginNode:"找不到界面逻辑前端插件节点,插件{pluginKey}对应的适配器",viewPlugin:"找不到视图插件{pluginKey}对应的适配器",correspondViewTypeStyle:"找不到视图类型:[{viewType}]的视图样式:[{viewStyle}]对应的适配器",toolbarItem:"找不到工具栏项插件{pluginKey}对应的适配器",acItem:"找不到自填列表项插件{pluginKey}对应的适配器"}},service:{noConfiguredPrimary:"实体[{codeName}]未配置主键字段",noConfiguredField:"实体[{codeName}]未配置主文本字段",convertedNumber:"{value}不能转换成数字",subRelationships:"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!",unsupportedMethod:"未支持的应用实体方法输入属性类型: {type}",noFoundUsernamePassword:"未找到匿名登录配置用户名或密码",loginFailure:"登录失败",logoutFailure:"登出失败",noFound:"未找到应用实体[{id}]",mainState:"{codeName}实体不存在、未启用主状态或者主状态集合为空,返回true",operationIdentifier:"操作标识{dataAccessAction}主状态计算开始",matchMasterState:"匹配主状态",masterStatePermissions:"允许的主状态权限集合",noMatchedState:"没匹配主状态,返回false",permissionCalculation:"操作标识{dataAccessAction}权限计算结束:{result}",noFindCodeList:"找不到{tag}代码表",noConfiguredCounters:"未配置应用计数器!",lackEntityLogic:"缺少实体处理逻辑",createBehavior:"create行为没有传data",updateBehavior:"update行为没有传data",deletionDeletion:"目前只支持[DER1N]关系类型关联删除删除",unableDelete:"无法删除[{logicName}-{srfmajortext}], 数据被[{modelLogicName}-{msg}]引用",noSupportedDataSource:"数据来源类型{dataSetType}暂未支持",sourceCodeTable:"没有指定数据来源代码表",requestMethods:"未支持的请求方式: {requestMethod}",noConfiguredRequestMethod:"未配置请求方式",unsupportedBehaviorTypes:"未支持的行为类型[{actionType}]",noFoundServiceMethod:"未找到服务方法: {id}",UnsupportedServiceMethod:"未支持的服务方法类型: {methodType}",noSupportedMethod:"{codeName}未支持「{id}」方法",noFoundStorageEntity:"应用功能[{name}]未找到存储实体[{stoageAppDataEntityId}]",noExist:"应用功能[{name}]不存在",noFoundEntity:"未找到存储实体[{stoageAppDataEntityId}]",noImplemented:"「{methodName}」未实现",noImplementedCounter:"未实现计数器加载方法",noFoundCounterBehavior:"未找到获取计数器行为!",createPrimaryKeyData:"新建联合主键数据失败,已有主键为{srfkey}的数据",updatePrimaryKeyData:"更新联合主键数据失败,已有主键为{srfkey}的数据",noExistNoUpdated:"数据不存在,无法更新!",dataNoExistNoUpdated:"数据[{srfdename}-{srfmajortext}({srfkey})]不存在,无法更新!",noDeleted:"未找到以下数据「{notRemoveKey}」,无法删除!",noAttributeName:"没有指定属性名称",noContextParameterName:"没有指定上下文参数名称",conditionalObjects:"无法识别的条件对象",mustArray:"值必须为数组",unsupportedQueryTypes:"暂未支持的查询条件类型: {condType}",predefinedType:"预定义类型{predefinedType}暂不支持",dynamicCodeTable:"动态代码表数据属性返回值不为对象格式的字符串,无法转换!",unconfiguredDataset:"未配置数据集",processedWithout:"执行「{funcName}」不存在「srfkey」无法处理",noExistProcessed:"执行「{funcName}」不存在「srfsessionid」无法处理",missingDetreeColumnId:"模型异常缺少detreeColumnId或者dataItemName"},uiAction:{noEntityOrBehavior:"未配置实体或实体行为",noConfiguredopenView:"未配置打开视图",frontProcessingModes:"未支持的前台处理模式[{frontProcessType}]",missingConfigurationScriptCode:"自定义类型缺少配置脚本代码",dataPrimaryKey:"没有找到数据主键",printFailure:"打印失败",physicalPrint:"没有找到实体打印项",exportRequestFailed:"导出请求失败",noEntityExportsFound:"没有找到实体导出项",lackNativeEvent:"缺少原生JS事件对象",logout:"退出登录",wantLogout:"您确定要退出登录吗?",operationConfirmation:"操作确认",viewParameterModalOption:"视图参数modalOption 解析失败:{error}",withdrawalConfirmed:"是否确认执行撤回操作?",noFoundBehaviorModel:"没找到{actionId}的界面行为模型"},uiLogic:{interfaceConnectionConditional:"界面连接条件逻辑组未配置逻辑项",connectionConditionGroup:"界面逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",currentConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataObjectAttribute:"当前条件值类型为[源数据对象属性],缺少配置条件值",currentTime:"暂未支持条件值类型为[当前时间]",interfaceConnectionConditionalTypeName:"界面逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",asynchronousTermination:"未支持的逻辑连接类型: 异步结束",asynchronousRejection:"未支持的逻辑连接类型: 异步拒绝",exceptionHandling:"未支持的逻辑连接类型: 异常处理",logicalLinkTypes:"未支持的逻辑连接类型:{linkMode}",missingTargetParameter:"缺少目标参数对象或者源参数对象配置",appendedArray:"界面逻辑节点(附加到数组):{id}-附加参数:",bindingParameters:"界面逻辑节点(绑定参数):{id}-参数名称:{dstDEUILogicParamId}-值:",copyParameter:"界面逻辑节点(拷贝参数):{id}-参数名称:{dstDEUILogicParamId}-值:",missingfilter:"缺少配置过滤参数",interfaceLogicNodeDataSet:"界面逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDEUILogicParamId}-值:",interfaceLogicNodeEntityActions:"界面逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDEUILogicParamId}-值:",noConfiguredInterfaceBehavior:"未配置界面行为",interfaceLogicNodeEntityInterfaceAction:"界面逻辑节点(实体界面行为):{id}-界面行为标识:{dstAppDEUIActionId}-界面行为所属实体:{dstAppDataEntityId}-目标逻辑参数对象:{dstDEUILogicParamId}",logicalNodeOperation:"逻辑节点{name}操作参数值:",unsupportedEndNode:"暂未支持的结束节点返回值类型: {returnType}",interfaceLogicNodeEndNode:"界面逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noEntityConfigured:"没有配置实体",noEntityLogicConfigured:"没有配置实体逻辑",noIncomingLogic:"没有配置传入逻辑参数",passedParameter:"没有找到传入参数{dstDEUILogicParamId}",interfaceLogicNodeExecutingEntityLogic:"界面逻辑节点(执行实体逻辑):{id}-实体逻辑标识:{dstAppDELogicId}-实体逻辑所属实体:{dstAppDataEntityId}-参数名称:{retDEUILogicParamId}-值:",missingMessageTypeConfiguration:"缺少消息类型的配置",missingButtonTypeConfiguration:"缺少按钮类型的配置",interfaceLogicNodeMessagePopup:"界面逻辑节点(消息弹窗):{id}-消息类型:{type}-消息:{message}",message:"消息",yes:"是",no:"否",determine:"确定",cancel:"取消",noSupportItem:"{name}暂未支持",interfaceLogicNodeFrontendPlugin:"界面逻辑节点(前端插件):{id}-插件标识:{sysPFPluginId}",interfaceLogicNodePreparationParameter:"界面逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDEUILogicParamId}-源参数(值):",noTargetParameter:"没有目标参数对象id",targetParameter:"给目标参数属性{dstFieldName}赋值报错,目标参数:",interfaceLogicNodeDirectCode:"界面逻辑节点(直接代码):{id}-直接代码:",interfaceLogicNodeRebuildParameter:"界面逻辑节点(重新建立参数):{id}-重建参数:{dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"界面逻辑节点(重置参数):{id}-重置参数:{dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"界面逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDEUILogicParamId}-排序后数组:",interfaceLogicNodeStartupNode:"界面逻辑节点(启动节点):{id}",interfaceLogicNodeThrowingExceptions:"界面逻辑节点(抛出异常):{id}-错误信息:{errorInfo}",noConfiguredTriggerObject:"没有配置触发对象",noConfiguredEvent:"没有配置事件名称参数",noConfiguredEventParameters:"没有配置事件参数",noFoundTriggerObject:"没有找到触发对象{fireCtrlId}",noFoundEventParameterObject:"没有找到事件参数对象{eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"界面逻辑节点(视图部件事件触发逻辑):{id}-调用视图部件名称:{fireCtrlId}-触发事件名称:{eventName}-触发参数:",noConfiguredInterfaceObject:"没有配置界面对象",noConfiguredOperatingParameters:"没有配置操作参数",noConfiguredCallMethod:"没有配置调用方法",noFoundOperationParameter:"没有找到操作参数{invokeParamId}",noFoundInterfaceObject:"没有找到界面对象{invokeCtrlId}",noFoundInvokeMethod:"没有找到调用方法{invokeMethod}",interfaceLogicNodeViewWidgetInvocation:"界面逻辑节点(视图部件调用):{id}-调用视图部件名称:{invokeCtrlId}-调用方法名称:{invokeMethod}-触发参数:",viewLogicInitializationParameter:"视图逻辑初始化参数,未找到{codeName}指定部件对象",calculateInterfaceLogicParameters:"计算界面逻辑参数,标识:{tag}",restablishInterfaceLogic:"重新建立界面逻辑参数,标识:{tag}",interfaceLogic:"找不到实体{appDataEntityId}的界面逻辑{deUILogicId}",startExecutingInterfaceLogic:"开始执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",endExecutionInterfaceLogic:"结束执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",noLogicalNodesConfigured:"界面逻辑没有配置逻辑节点"},utils:{anime:{noExistEndpointElement:"终点元素不存在",noExistAnimationElement:"动画元素不存在",noClone:"不能克隆空或未定义的元素"},errorHandler:{noPermissionless:"没有注册无权限错误处理器",noProcessor:"没有找到能处理该错误的处理器"},fileUtil:{fileUploadFailed:"文件上传失败"},handlebars:{noInitHandlebars:"handlebars未初始化"},modal:{externalClosureCapability:"外部关闭能力未注册",shouldDismissResult:"shouldDismiss结果为false,关闭中断"},openRedirectView:{parseSrfnavctxParameter:"重定向[{urlStr}] 中 srfnavctx 参数解析失败",missingEntityName:"重定向参数缺少实体名称",noFoundSpecifiedEntity:"未找到指定实体的codeName: {deName}",unsupportedLinkUrl:"未支持的linkUrl格式:{linkUrl}",noConfiguredActualReference:"未配置实际引用视图",redirectingViewReferences:"重定向视图引用有:",redirectionIdentifier:"未找到重定向标识[{rdTag}]或[{deRdTag}]或工作流[{wfRdTag}]对应视图",noMatchActualReferenceView:"标识[{rdTag}]未匹配到实际引用视图",redirectionView:"重定向视图[{name}]自定义类别属性[{typeFieldId}]值为空"},script:{errorReportingScript:"报错脚本"},shortCut:{invalidIndexNewIndex:"无效的索引 newIndex: {newIndex}, oldIndex: {oldIndex}, 当前数组长度为 {length}"},uiDomain:{transactionOpen:"事务已经开启, 单个界面域只能开启一个事务",currentTransaction:"当前事务未提交,不可以直接关闭事务"},uiDomainManager:{invalidInterfaceDomain:"无效的界面域标识[{id}]"},verify:{contentConform:"内容必须符合值规则",scopeRules:"内容长度必须符合范围规则",valueNull:"值为空",regularRules:"值必须符合正则规则",rangeRules:"值必须符合值范围规则",scriptRules:"值必须符合脚本规则",emptyLogicGroups:"发现空逻辑组,逻辑无法正常执行!",unsupportedLogicTypes:"未支持的逻辑类型{logicType}",emptyLogicGroupsProperly:"发现空逻辑组,逻辑无法正常执行!",valueOperations:"值操作:{op},暂未支持",noCompared:"{value} 和 {value2} 无法比较大小",conditionalValues:"范围比较的条件值不存或者不是字符串"},firstregister:"请先注册模型加载适配器"},deAction:{responseDataError:"响应数据异常 [data]: {error}"}}})}}}));
|