@ibiz-template/runtime 0.4.11 → 0.4.13

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.
Files changed (192) hide show
  1. package/dist/index.esm.js +1190 -282
  2. package/dist/index.system.min.js +2 -2
  3. package/out/config/global-config.d.ts.map +1 -1
  4. package/out/config/global-config.js +1 -0
  5. package/out/controller/common/base.controller.d.ts +7 -0
  6. package/out/controller/common/base.controller.d.ts.map +1 -1
  7. package/out/controller/common/base.controller.js +10 -0
  8. package/out/controller/common/control/control.controller.d.ts +14 -0
  9. package/out/controller/common/control/control.controller.d.ts.map +1 -1
  10. package/out/controller/common/control/control.controller.js +21 -0
  11. package/out/controller/common/control/md-control.controller.d.ts +9 -0
  12. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  13. package/out/controller/common/control/md-control.controller.js +20 -0
  14. package/out/controller/common/view/view.controller.d.ts +15 -1
  15. package/out/controller/common/view/view.controller.d.ts.map +1 -1
  16. package/out/controller/common/view/view.controller.js +23 -4
  17. package/out/controller/control/app-menu/app-menu.controller.d.ts +7 -0
  18. package/out/controller/control/app-menu/app-menu.controller.d.ts.map +1 -1
  19. package/out/controller/control/app-menu/app-menu.controller.js +22 -0
  20. package/out/controller/control/caption-bar/caption-bar.controller.d.ts.map +1 -1
  21. package/out/controller/control/caption-bar/caption-bar.controller.js +1 -6
  22. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  23. package/out/controller/control/form/edit-form/edit-form.controller.js +9 -22
  24. package/out/controller/control/form/edit-form/edit-form.service.d.ts +3 -2
  25. package/out/controller/control/form/edit-form/edit-form.service.d.ts.map +1 -1
  26. package/out/controller/control/form/edit-form/edit-form.service.js +11 -2
  27. package/out/controller/control/form/form/form.controller.d.ts +0 -7
  28. package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
  29. package/out/controller/control/form/form/form.controller.js +0 -11
  30. package/out/controller/control/form/form/form.service.d.ts +24 -0
  31. package/out/controller/control/form/form/form.service.d.ts.map +1 -0
  32. package/out/controller/control/form/form/form.service.js +45 -0
  33. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts.map +1 -1
  34. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.js +5 -1
  35. package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
  36. package/out/controller/control/form/form-detail/form-item/form-item.controller.js +0 -5
  37. package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
  38. package/out/controller/control/form/search-form/search-form.controller.js +1 -5
  39. package/out/controller/control/form/search-form/search-form.service.d.ts +4 -3
  40. package/out/controller/control/form/search-form/search-form.service.d.ts.map +1 -1
  41. package/out/controller/control/form/search-form/search-form.service.js +8 -3
  42. package/out/controller/control/gantt/gantt.controller.d.ts +146 -2
  43. package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
  44. package/out/controller/control/gantt/gantt.controller.js +270 -0
  45. package/out/controller/control/grid/grid/grid-row.state.d.ts +11 -0
  46. package/out/controller/control/grid/grid/grid-row.state.d.ts.map +1 -1
  47. package/out/controller/control/grid/grid/grid-row.state.js +13 -0
  48. package/out/controller/control/grid/grid/grid.controller.d.ts +7 -0
  49. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  50. package/out/controller/control/grid/grid/grid.controller.js +27 -0
  51. package/out/controller/control/grid/grid/grid.service.d.ts.map +1 -1
  52. package/out/controller/control/grid/grid/grid.service.js +30 -20
  53. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +21 -1
  54. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
  55. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +44 -1
  56. package/out/controller/control/kanban/kanban.controller.d.ts +13 -0
  57. package/out/controller/control/kanban/kanban.controller.d.ts.map +1 -1
  58. package/out/controller/control/kanban/kanban.controller.js +72 -0
  59. package/out/controller/control/report-panel/generator/user-generator.js +1 -1
  60. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  61. package/out/controller/control/search-bar/search-bar.controller.js +11 -6
  62. package/out/controller/control/toolbar/toolbar.controllerr.d.ts +7 -0
  63. package/out/controller/control/toolbar/toolbar.controllerr.d.ts.map +1 -1
  64. package/out/controller/control/toolbar/toolbar.controllerr.js +22 -0
  65. package/out/controller/control/tree/tree.controller.d.ts +75 -0
  66. package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
  67. package/out/controller/control/tree/tree.controller.js +264 -1
  68. package/out/interface/common/i-global-config/i-global-view-config.d.ts +7 -0
  69. package/out/interface/common/i-global-config/i-global-view-config.d.ts.map +1 -1
  70. package/out/interface/controller/controller/control/i-control.controller.d.ts +14 -0
  71. package/out/interface/controller/controller/control/i-control.controller.d.ts.map +1 -1
  72. package/out/interface/controller/controller/view/i-view.controller.d.ts +14 -0
  73. package/out/interface/controller/controller/view/i-view.controller.d.ts.map +1 -1
  74. package/out/interface/controller/event/control/i-gantt.event.d.ts +42 -0
  75. package/out/interface/controller/event/control/i-gantt.event.d.ts.map +1 -1
  76. package/out/interface/controller/event/control/i-tree.event.d.ts +17 -0
  77. package/out/interface/controller/event/control/i-tree.event.d.ts.map +1 -1
  78. package/out/interface/controller/state/control/i-control.state.d.ts +8 -0
  79. package/out/interface/controller/state/control/i-control.state.d.ts.map +1 -1
  80. package/out/interface/controller/state/control/i-gantt.state.d.ts +22 -0
  81. package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
  82. package/out/interface/controller/state/control/i-grid.state.d.ts +11 -0
  83. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  84. package/out/interface/controller/state/control/i-kanban.state.d.ts +24 -0
  85. package/out/interface/controller/state/control/i-kanban.state.d.ts.map +1 -1
  86. package/out/interface/controller/state/control/i-tree.state.d.ts +7 -0
  87. package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
  88. package/out/interface/controller/state/view/i-view.state.d.ts +8 -0
  89. package/out/interface/controller/state/view/i-view.state.d.ts.map +1 -1
  90. package/out/interface/provider/i-grid-column.provider.d.ts +2 -2
  91. package/out/interface/provider/i-grid-column.provider.d.ts.map +1 -1
  92. package/out/interface/service/i-data-entity/i-data-entity.d.ts +8 -0
  93. package/out/interface/service/i-data-entity/i-data-entity.d.ts.map +1 -1
  94. package/out/interface/service/service/i-app-de.service.d.ts +11 -0
  95. package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
  96. package/out/interface/service/service/i-auth.service.d.ts +3 -2
  97. package/out/interface/service/service/i-auth.service.d.ts.map +1 -1
  98. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts.map +1 -1
  99. package/out/logic-scheduler/executor/app-ui-logic-executor.js +4 -2
  100. package/out/register/helper/grid-column-register.d.ts +2 -2
  101. package/out/register/helper/grid-column-register.d.ts.map +1 -1
  102. package/out/register/helper/grid-column-register.js +14 -0
  103. package/out/service/dto/method.dto.d.ts.map +1 -1
  104. package/out/service/dto/method.dto.js +8 -1
  105. package/out/service/service/auth/v7-auth.service.d.ts +1 -1
  106. package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
  107. package/out/service/service/auth/v7-auth.service.js +12 -7
  108. package/out/service/service/entity/de.service.d.ts +9 -1
  109. package/out/service/service/entity/de.service.d.ts.map +1 -1
  110. package/out/service/service/entity/de.service.js +69 -0
  111. package/out/service/service/entity/method/fetch.d.ts +5 -12
  112. package/out/service/service/entity/method/fetch.d.ts.map +1 -1
  113. package/out/service/service/entity/method/fetch.js +7 -74
  114. package/out/service/utils/de-cache/de-cache.js +2 -2
  115. package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +1 -0
  116. package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
  117. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +2 -0
  118. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
  119. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.js +2 -1
  120. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts +7 -0
  121. package/out/service/vo/gantt-node-data/gantt-node-data-util.d.ts.map +1 -1
  122. package/out/service/vo/gantt-node-data/gantt-node-data-util.js +18 -0
  123. package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +1 -0
  124. package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
  125. package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
  126. package/out/service/vo/tree-node-data/tree-code-list-node-data.js +8 -4
  127. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  128. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +8 -4
  129. package/out/service/vo/tree-node-data/tree-node-data.d.ts +1 -0
  130. package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
  131. package/out/service/vo/tree-node-data/tree-node-data.js +2 -0
  132. package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
  133. package/out/service/vo/tree-node-data/tree-static-node-data.js +8 -2
  134. package/out/utils/layout-panel-util/layout-panel-util.d.ts.map +1 -1
  135. package/out/utils/layout-panel-util/layout-panel-util.js +16 -2
  136. package/package.json +3 -3
  137. package/src/config/global-config.ts +1 -0
  138. package/src/controller/common/base.controller.ts +11 -0
  139. package/src/controller/common/control/control.controller.ts +23 -0
  140. package/src/controller/common/control/md-control.controller.ts +21 -0
  141. package/src/controller/common/view/view.controller.ts +27 -5
  142. package/src/controller/control/app-menu/app-menu.controller.ts +25 -0
  143. package/src/controller/control/caption-bar/caption-bar.controller.ts +1 -8
  144. package/src/controller/control/form/edit-form/edit-form.controller.ts +11 -26
  145. package/src/controller/control/form/edit-form/edit-form.service.ts +11 -2
  146. package/src/controller/control/form/form/form.controller.ts +0 -14
  147. package/src/controller/control/form/form/form.service.ts +63 -0
  148. package/src/controller/control/form/form-detail/form-detail/form-detail.controller.ts +9 -1
  149. package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +0 -5
  150. package/src/controller/control/form/search-form/search-form.controller.ts +1 -5
  151. package/src/controller/control/form/search-form/search-form.service.ts +8 -3
  152. package/src/controller/control/gantt/gantt.controller.ts +331 -1
  153. package/src/controller/control/grid/grid/grid-row.state.ts +15 -0
  154. package/src/controller/control/grid/grid/grid.controller.ts +34 -0
  155. package/src/controller/control/grid/grid/grid.service.ts +34 -21
  156. package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +67 -2
  157. package/src/controller/control/kanban/kanban.controller.ts +81 -0
  158. package/src/controller/control/report-panel/generator/user-generator.ts +1 -1
  159. package/src/controller/control/search-bar/search-bar.controller.ts +12 -8
  160. package/src/controller/control/toolbar/toolbar.controllerr.ts +29 -0
  161. package/src/controller/control/tree/tree.controller.ts +327 -2
  162. package/src/interface/common/i-global-config/i-global-view-config.ts +8 -0
  163. package/src/interface/controller/controller/control/i-control.controller.ts +16 -0
  164. package/src/interface/controller/controller/view/i-view.controller.ts +16 -0
  165. package/src/interface/controller/event/control/i-gantt.event.ts +37 -1
  166. package/src/interface/controller/event/control/i-tree.event.ts +14 -0
  167. package/src/interface/controller/state/control/i-control.state.ts +9 -0
  168. package/src/interface/controller/state/control/i-gantt.state.ts +25 -0
  169. package/src/interface/controller/state/control/i-grid.state.ts +10 -0
  170. package/src/interface/controller/state/control/i-kanban.state.ts +26 -0
  171. package/src/interface/controller/state/control/i-tree.state.ts +8 -0
  172. package/src/interface/controller/state/view/i-view.state.ts +9 -0
  173. package/src/interface/provider/i-grid-column.provider.ts +2 -2
  174. package/src/interface/service/i-data-entity/i-data-entity.ts +9 -0
  175. package/src/interface/service/service/i-app-de.service.ts +12 -0
  176. package/src/interface/service/service/i-auth.service.ts +3 -2
  177. package/src/logic-scheduler/executor/app-ui-logic-executor.ts +8 -2
  178. package/src/register/helper/grid-column-register.ts +17 -2
  179. package/src/service/dto/method.dto.ts +8 -1
  180. package/src/service/service/auth/v7-auth.service.ts +18 -8
  181. package/src/service/service/entity/de.service.ts +74 -1
  182. package/src/service/service/entity/method/fetch.ts +8 -79
  183. package/src/service/utils/de-cache/de-cache.ts +2 -2
  184. package/src/service/vo/gantt-node-data/gantt-code-list-node-data.ts +2 -0
  185. package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +6 -1
  186. package/src/service/vo/gantt-node-data/gantt-node-data-util.ts +21 -0
  187. package/src/service/vo/gantt-node-data/gantt-static-node-data.ts +2 -0
  188. package/src/service/vo/tree-node-data/tree-code-list-node-data.ts +10 -5
  189. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +10 -5
  190. package/src/service/vo/tree-node-data/tree-node-data.ts +3 -0
  191. package/src/service/vo/tree-node-data/tree-static-node-data.ts +10 -3
  192. package/src/utils/layout-panel-util/layout-panel-util.ts +17 -2
@@ -1,4 +1,4 @@
1
- System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],function(d,da){"use strict";var m,f,D,ha,Vt,pa,st,kt,V,ut,fa,ma,Ea,ga,Ee,wa,ge,Da,W,we,Wt,Ut,zt,Gt,jt,Kt,De,Ca,va,q,Ia,Aa,Ht,ya,wt,Fa,Pa,ba,Na,Sa,La,Ra,Ta,Ba,x,k,Ce,Dt,j,Xt,Pt,ve,Ie,Ae,Oa,_a,ye,xa,C,Fe,T,I,ct,Ct,Pe,be,vt,S,Ne,Se;return{setters:[function(g){m=g.RuntimeModelError,f=g.RuntimeError,D=g.ModelError,ha=g.downloadFileFromBlob,Vt=g.IBizContext,pa=g.clone,st=g.CoreConst,kt=g.DataTypes,V=g.HttpResponse,ut=g.HttpError,fa=g.Net,ma=g.getToken,Ea=g.NOOP,ga=g.IBizParams,Ee=g.NoticeError,wa=g.isElementSame,ge=g.findRecursiveChild,Da=g.StringUtil,W=g.recursiveIterate,we=g.debounceAndAsyncMerge,Wt=g.mergeDefaultInLeft,Ut=g.isOverlap,zt=g.BitMask,Gt=g.mergeInLeft,jt=g.awaitTimeout,Kt=g.plus,De=g.toNumberOrNil},function(g){Ca=g.isEmpty,va=g.isString,q=g.isArray,Ia=g.isObject,Aa=g.isNil,Ht=g.debounce,ya=g.camelCase,wt=g.eq,Fa=g.gt,Pa=g.gte,ba=g.findIndex,Na=g.lt,Sa=g.lte,La=g.upperFirst,Ra=g.snakeCase,Ta=g.kebabCase,Ba=g.isFunction},function(g){x=g.notNilEmpty,k=g.isNilOrEmpty,Ce=g.AsyncSeriesHook,Dt=g.QXEvent,j=g.createUUID,Xt=g.isArray,Pt=g.setCookie,ve=g.clearCookie,Ie=g.getCookie,Ae=g.ascSort,Oa=g.descSort,_a=g.clearAll,ye=g.isNumber},function(g){xa=g.default},function(g){C=g.isNil,Fe=g.mergeRight,T=g.isEmpty,I=g.clone,ct=g.equals,Ct=g.where,Pe=g.mergeLeft,be=g.isNotNil,vt=g.mergeDeepRight},function(g){S=g.default},function(g){Ne=g.default},function(g){Se=g.default}],execute:function(){d({asyncImportData:xo,calcContentAlignStyle:or,calcDeCodeNameById:B,calcDynaClass:It,calcGridLayoutPos:ur,calcLayoutHeightWidth:qt,calcMainStateOPPrivsStrs:Ha,calcNavParams:Yt,calcResPath:oe,compare:St,compareNumber:Oe,contains:Lt,convertNavData:F,convertNavDataByArray:Ga,convertObjectToNavParams:Le,execDELogic:le,execDELogicAction:Hs,execDELogicById:Ks,execFieldLogics:_t,execUILogic:he,exportData:si,fieldValueToBoolean:Ke,filterFieldLogics:Ya,filterValueRules:Ve,findChildFormDetails:Qa,findDELogic:Be,findEditItem:qa,findFieldById:At,findModelChild:lt,formatMultiData:Re,generateEditorRules:Ze,generateRules:Je,getAllPanelField:ss,getAppCounterProvider:ds,getAppViewRef:rr,getAsyncActionProvider:nn,getChildNodeRSs:Nt,getControl:ir,getControlPanel:ja,getControlProvider:ft,getControlsByView:Ja,getDEMethodProvider:Ms,getDeACMode:cr,getDefaultValue:ta,getEditorProvider:ie,getFormDetailProvider:Es,getGridColumnProvider:Ge,getMatchResPath:Ws,getOriginData:ai,getPFPlugin:nr,getPanelItemProvider:Cs,getPlatformProvider:Os,getPlatformType:Ls,getPortletProvider:As,getRootNode:$t,getTreeNode:Jt,getUIActionById:Qt,getUIActionProvider:Fs,getUILogicNodeProvider:bs,getViewEngines:ts,getViewLogics:Za,getViewProvider:an,getWFContext:ns,getWFSubmitViewId:Tr,handleAllSettled:it,hasDeCodeName:Xa,hasSubRoute:Qe,importData:Mo,install:bc,installCommand:ti,isDataContainer:es,isFormDataContainer:$a,isValueChange:$e,matchMainState:Ka,openRedirectView:is,parseUserParams:Te,presetAppCounterProvider:Vs,presetDEMethodProvider:qs,presetUIActionProvider:oi,registerAppCounterProvider:ls,registerAsyncActionProvider:sn,registerControlProvider:Yr,registerDEMethodProvider:ne,registerEditorProvider:qr,registerFormDetailProvider:Qr,registerGridColumnProvider:$r,registerPanelItemProvider:Jr,registerPlatformProvider:Ts,registerPortletProvider:Zr,registerUIActionProvider:yt,registerUILogicNodeProvider:tn,registerViewProvider:en,strContain:Zt,testCond:tt,toLocalOpenWFRedirectView:rs,verifyDeRules:_e,verifyFormGroupLogic:te,verifyPanelGroupLogic:ee});var g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ma={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){return function(a,s,i){var r=function(n,o){if(!o||!o.length||o.length===1&&!o[0]||o.length===1&&Array.isArray(o[0])&&!o[0].length)return null;var u;o.length===1&&o[0].length>0&&(o=o[0]),u=(o=o.filter(function(l){return l}))[0];for(var c=1;c<o.length;c+=1)o[c].isValid()&&!o[c][n](u)||(u=o[c]);return u};i.max=function(){var n=[].slice.call(arguments,0);return r("isAfter",n)},i.min=function(){var n=[].slice.call(arguments,0);return r("isBefore",n)}}})})(Ma);var Fi=Ma.exports,Pi=bt(Fi),Va={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){return function(a,s){s.prototype.isSameOrBefore=function(i,r){return this.isSame(i,r)||this.isBefore(i,r)}}})})(Va);var bi=Va.exports,Ni=bt(bi),ka={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){var a="month",s="quarter";return function(i,r){var n=r.prototype;n.quarter=function(c){return this.$utils().u(c)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(c-1))};var o=n.add;n.add=function(c,l){return c=Number(c),this.$utils().p(l)===s?this.add(3*c,a):o.bind(this)(c,l)};var u=n.startOf;n.startOf=function(c,l){var h=this.$utils(),p=!!h.u(l)||l;if(h.p(c)===s){var E=this.quarter()-1;return p?this.month(3*E).startOf(a).startOf("day"):this.month(3*E+2).endOf(a).endOf("day")}return u.bind(this)(c,l)}}})})(ka);var Si=ka.exports,Li=bt(Si),Wa={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){var a="week",s="year";return function(i,r,n){var o=r.prototype;o.week=function(u){if(u===void 0&&(u=null),u!==null)return this.add(7*(u-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var l=n(this).startOf(s).add(1,s).date(c),h=n(this).endOf(a);if(l.isBefore(h))return 1}var p=n(this).startOf(s).date(c).startOf(a).subtract(1,"millisecond"),E=this.diff(p,a,!0);return E<0?n(this).startOf("week").week():Math.ceil(E)},o.weeks=function(u){return u===void 0&&(u=null),this.week(u)}}})})(Wa);var Ri=Wa.exports,Ti=bt(Ri),Ua={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){var a="day";return function(s,i,r){var n=function(c){return c.add(4-c.isoWeekday(),a)},o=i.prototype;o.isoWeekYear=function(){return n(this).year()},o.isoWeek=function(c){if(!this.$utils().u(c))return this.add(7*(c-this.isoWeek()),a);var l,h,p,E,w=n(this),y=(l=this.isoWeekYear(),h=this.$u,p=(h?r.utc:r)().year(l).startOf("year"),E=4-p.isoWeekday(),p.isoWeekday()>4&&(E+=7),p.add(E,a));return w.diff(y,"week")+1},o.isoWeekday=function(c){return this.$utils().u(c)?this.day()||7:this.day(this.day()%7?c:c-7)};var u=o.startOf;o.startOf=function(c,l){var h=this.$utils(),p=!!h.u(l)||l;return h.p(c)==="isoweek"?p?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):u.bind(this)(c,l)}}})})(Ua);var Bi=Ua.exports,Oi=bt(Bi),_i=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:"},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:60*60*1e3},this.form={mdCtrlConfirmBeforeRemove:!0}}},xi=d("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Z=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};Z.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var _=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Mi=class extends _{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const s=t.filter(i=>!!i).length===t.length;return Z.handleJudgmentExecute(this,s,e)}},Vi=class extends _{constructor(t){super(t,"camelCase")}onExecute(t){return t?ya(t):""}},ki=class extends _{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Wi=class extends _{constructor(t){super(t,"eq")}onExecute(t,e,a){const s=wt(t,e);return Z.handleJudgmentExecute(this,s,a)}},Ui=class extends _{constructor(t){super(t,"gt")}onExecute(t,e,a){const s=Fa(t,e);return Z.handleJudgmentExecute(this,s,a)}},zi=class extends _{constructor(t){super(t,"gte")}onExecute(t,e,a){const s=Pa(t,e);return Z.handleJudgmentExecute(this,s,a)}},Gi=class extends _{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,s){let i=!1;return q(t)?i=!wt(ba(t,r=>wt(r[e],a)),-1):i=t.hasOwnProperty(e)&&(i=wt(t[e],a)),Z.handleJudgmentExecute(this,i,s)}},ji=class extends _{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},Ki=class extends _{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,typeof e=="number"?e:void 0)}},Hi=class extends _{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Xi=class extends _{constructor(t){super(t,"lt")}onExecute(t,e,a){const s=Na(t,e);return Z.handleJudgmentExecute(this,s,a)}},Yi=class extends _{constructor(t){super(t,"lte")}onExecute(t,e,a){const s=Sa(t,e);return Z.handleJudgmentExecute(this,s,a)}},qi=class extends _{constructor(t){super(t,"neq")}onExecute(t,e,a){const s=!wt(t,e);return Z.handleJudgmentExecute(this,s,a)}},Qi=class extends _{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return Z.handleJudgmentExecute(this,a,e)}},$i=class extends _{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const s=t.find(i=>!!i);if(a.fn){const i=((e=a.data)==null?void 0:e.root)||{};return s?a.fn(i):a.inverse(i)}return s||""}},Ji=class extends _{constructor(t){super(t,"pascalCase")}onExecute(t){return t?La(t):""}},Zi=class extends _{constructor(t){super(t,"snakeCase")}onExecute(t){return t?Ra(t):""}},tr=class extends _{constructor(t){super(t,"spinalCase")}onExecute(t){return t?Ta(t):""}},er=class extends _{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};function ar(t){new Mi(t),new Vi(t),new ki(t),new Wi(t),new Ui(t),new zi(t),new ji(t),new Ki(t),new Hi(t),new Xi(t),new Yi(t),new qi(t),new Qi(t),new $i(t),new Ji(t),new Zi(t),new tr(t),new er(t),new Gi(t)}var sr=d("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=da.import("handlebars");const t=await this.p;return this.hsb=t.default||t,this.p=null,ar(this.hsb),this.hsb}async render(t,e){return this.hsb||await this.init(),this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function Le(t){const e=[],a=/^%(.+)%$/;for(const s in t){let i=!0,r=t[s];x(t[s])&&a.test(t[s])&&(i=!1,r=t[s].substring(1,t[s].length-1)),e.push({key:s.toLowerCase(),rawValue:i,value:r})}return e}function F(t,...e){if(!t||Ca(t))return{};const a=Array.isArray(t)?t:Le(t);return Ga(a,...e)}function za(t,e){const a=t.find(s=>k(s)?!1:s[e]||Object.prototype.hasOwnProperty.call(s,e));return{find:!!a,value:a?.[e]}}function Ga(t,...e){const a=/\$\{[^}]*\}/g,s={};for(const i of t)if(i.rawValue)s[i.key.toLowerCase()]=i.value||null;else{const r=i.value.match(a);if(r!==null){let n=i.value;r.forEach(o=>{const{find:u,value:c}=za(e,o.slice(2,-1).toLowerCase());u&&(n=n.replace(o,"".concat(c)))}),s[i.key.toLowerCase()]=n}else{const{find:n,value:o}=za(e,i.value.toLowerCase());n&&(s[i.key.toLowerCase()]=o)}}return s}function Re(t,e){const a={};if(!t)return a;const s=Array.isArray(t)?t:Le(t),i=e[0];return s.forEach(r=>{const{rawValue:n,value:o}=r;!n&&o&&Object.prototype.hasOwnProperty.call(i,o)&&(a[o]=e.map(u=>u[o]).join(";"))}),a}function Yt(t,e){const{deName:a,navFilter:s,pickupDEFName:i,navContexts:r,navParams:n}=t,{context:o,params:u,data:c,derValue:l}=e,h={},p={},E=l||c.srfkey;E&&(a&&(h[a]=E),s&&(p[s]=E),i&&(p["n_".concat(i.toLowerCase(),"_eq")]=E));const w=F(r,c,u,o),y=F(n,c,u,o);return Object.assign(h,w),Object.assign(p,y),{resultContext:h,resultParams:p}}function lt(t,e){if(t&&e){const a=t.find(s=>s.id?s.id.toLowerCase()===e.toLowerCase():!1);if(a)return a}return null}function ir(t,e){var a,s;let i=t.controls||[];return(s=(a=t.viewLayoutPanel)==null?void 0:a.controls)!=null&&s.length&&(i=i.concat(t.viewLayoutPanel.controls)),i.find(r=>r.name===e||r.codeName===e||r.id===e)}function rr(t,e){var a,s;let i=t.appViewRefs||[];return(s=(a=t.viewLayoutPanel)==null?void 0:a.appViewRefs)!=null&&s.length&&(i=i.concat(t.viewLayoutPanel.appViewRefs)),i.find(r=>r.name===e||r.id===e)}function Te(t){const e={},a={},s={};for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i];if(i.indexOf(".")!==-1){const n=i.split(".");switch(n[0]){case"SRFNAVPARAM":Object.assign(a,{[n[1]]:r});break;case"SRFNAVCTX":Object.assign(e,{[n[1]]:r});break;default:Object.assign(s,{key:r});break}}}return{navigateContexts:e,navigateParams:a,other:s}}function nr(t,e){const a=ibiz.hub.getApp(e);if(!a)throw new m(a,"\u672A\u627E\u5230\u5E94\u7528");const{model:s}=a;if(!s.appPFPluginRefs)throw new m(s,"\u5E94\u7528\u672A\u914D\u7F6E\u63D2\u4EF6");const i=s.appPFPluginRefs.find(r=>r.pluginCode.toLowerCase()===t.toLowerCase());if(!i)throw new Error("\u672A\u627E\u5230\u63D2\u4EF6".concat(t));return i}function ja(t){let e;if(t.controlRenders){const a=t.controlRenders.find(s=>s.renderType==="LAYOUTPANEL"&&!!s.layoutPanel);e=a?.layoutPanel}return e}function qt(t){const{width:e,height:a,widthMode:s,heightMode:i}=t,r={width:"",height:""};return s==="FULL"?r.width="100%":e&&e>0&&(e>0&&e<=1?r.width="".concat(e*100,"%"):s==="PERCENTAGE"?r.width="".concat(e,"%"):r.width="".concat(e,"px")),i==="FULL"?r.height="100%":a&&a>0&&(a>0&&a<=1?r.height="".concat(a*100,"%"):i==="PERCENTAGE"?r.height="".concat(a,"%"):r.height="".concat(a,"px")),r}function or(t){const{valignSelf:e,halignSelf:a}=t;let s;if(e||a){switch(s={display:"flex"},e){case"TOP":Object.assign(s,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(s,{"align-items":"center"});break;case"BOTTOM":Object.assign(s,{"align-items":"flex-end"});break}switch(a){case"LEFT":Object.assign(s,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(s,{"justify-content":"center"});break;case"RIGHT":Object.assign(s,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(s,{"justify-content":"space-between"});break}}return s}function ur(t){const{layout:e,colXS:a,colXSOffset:s,colSM:i,colSMOffset:r,colMD:n,colMDOffset:o,colLG:u,colLGOffset:c}=t,l=(h,p)=>({span:(!h||h===-1?e==="TABLE_24COL"?24:12:h)*(e==="TABLE_24COL"?1:2),offset:!p||p===-1?void 0:p});return{xs:l(a,s),sm:l(i,r),md:l(n,o),lg:l(u,c)}}function It(t,e){const a=[],s=R.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return va(s)?a.push(s):q(s)?a.push(...s):Ia(s)&&Object.keys(s).forEach(i=>{s[i]&&a.push(i)}),a}function Ka(t,e){const{mainStateAppDEFieldIds:a,demainStates:s}=t;if(a&&s){const i=[];return a.forEach(r=>{i.push(e[r])}),s.find(r=>{const{stateValue:n,state2Value:o,state3Value:u}=r;let c=!0;const l=[n,o,u];for(let h=0;h<i.length;h++)if("".concat(i[h])!=="".concat(l[h])){c=!1;break}return c})}}function Ha(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:s,opprivAllowMode:i}=t,r=s?.map(o=>o.name)||[];let n=[];return i?n=r:n=[...a.deopprivs,...e.deopprivs].filter(u=>!r.includes(u.name)).map(u=>u.name),n}function B(t){return t.split(".").pop()}function Xa(t,e){const a=B(e);return x(t[a])}async function cr(t,e,a){var s;return(s=(await ibiz.hub.getAppDataEntity(e,a)).appDEACModes)==null?void 0:s.find(n=>n.id===t)}function Be(t,e){var a;return(a=e.appDELogics)==null?void 0:a.find(s=>s.id===t)}function Ya(t,e){var a,s;const i=[];return(a=t.appDEFields)==null||a.forEach(r=>{e==="compute"&&r.computeAppDEFLogicId?i.push(r.computeAppDEFLogicId):e==="change"&&r.onChangeAppDEFLogicId?i.push(r.onChangeAppDEFLogicId):e==="default"&&r.defaultValueAppDEFLogicId&&i.push(r.defaultValueAppDEFLogicId)}),((s=t.appDELogics)==null?void 0:s.filter(r=>i.includes(r.id)))||[]}function At(t,e){var a;return(a=t.appDEFields)==null?void 0:a.find(s=>s.id===e)}async function Qt(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function $t(t){return t.detreeNodes.find(e=>e.rootNode)}function Jt(t,e){return t.detreeNodes.find(a=>a.id===e)}function lr(t,e){return t===3||(e?t===1:t===2)}function Nt(t,e){const a=e.parentId||$t(t).id;return t.detreeNodeRSs.filter(s=>s.parentDETreeNodeId===a&&lr(s.searchMode,e.hasQuery))}function qa(t,e){var a;return(a=t.degridEditItems)==null?void 0:a.find(s=>s.codeName===e)}function Qa(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails;break}return e||[]}function $a(t){return t.detailType==="MDCTRL"}function Ja(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function Za(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function ts(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter(s=>{switch(s.engineCat){case"CTRL":return ibiz.log.warn("\u672A\u652F\u6301\u7684\u5F15\u64CE\u5206\u7C7B\uFF1A".concat(s.engineType)),!1;default:return!0}})}function es(t){return t.itemType==="CONTAINER"&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var dr=["panelItems","panelTabPages","rootPanelItems"];function as(t){let e=[];for(const s of dr)if(t[s]){e=t[s];break}const a=[];return e.length&&(a.push(...e.filter(s=>s.itemType==="FIELD")),e.forEach(s=>{es(s)||a.push(...as(s))})),a}function ss(t){return as(t)}async function is(t,e,a={},s={}){return hr(t,e,a,s)}async function rs(t,e,a={}){const s=e.lastIndexOf("?"),i=decodeURIComponent(e.substring(s+1,e.length)),r=xa.parse(i,{delimiter:";"}),n=r.srfdename||"";if(!n)throw new f("\u91CD\u5B9A\u5411\u53C2\u6570\u7F3A\u5C11\u5B9E\u4F53\u540D\u79F0");const u=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(n.toUpperCase());if(!u)throw new f("\u672A\u627E\u5230\u6307\u5B9A\u5B9E\u4F53\u7684codeName: ".concat(n));r[u.toLowerCase()]=r[n.toLowerCase()];const c="".concat(u).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(c);if(delete r.srfdename,r.srfwf!=="undo"){const p=r.processDefinitionKey.split("-")[3],E=p.substring(0,p.lastIndexOf("v")),w=p.substring(p.lastIndexOf("v"));r.wf=E,r.wfVersion=w}r.srfprocessinstanceid&&(t.srfprocessinstanceid=r.srfprocessinstanceid,delete r.srfprocessinstanceid),await ibiz.commands.execute(et.TAG,l.id,t,r,a)}async function hr(t,e,a={},s={}){var i;const r=t.appViewNavContexts||[],n=F(r,a,e);e=Object.assign(e.clone(),n);const o=t.appViewNavParams||[],u=F(o,a,e);Object.assign(a,u);const c=t.appDataEntityId,l=B(c);let h=((i=s.data)==null?void 0:i[0])||{};e[l]=h[l]||e[l]||a[l];const p=t.getDataAppDEActionId,w=await ibiz.hub.getApp(t.appId).deService.getService(c);ibiz.loading.showRedirect();try{const J=await w.exec(p||"get",e,a);if(J.ok){h=J.data;let N=h.linkurl;if(N)return e.srfprocessinstanceid&&(N+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&N.indexOf("appredirectview?")!==-1&&(N=N.slice(N.indexOf("appredirectview?"))),N.startsWith("http://")||N.startsWith("https://")?new Promise(at=>{const gi=window.open(N,"_blank");gi&&(gi.callback=()=>{at({ok:!0,data:[]})})}):N.startsWith("appredirectview?")?(await rs(e,N,s),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const y=await ibiz.hub.getAppDataEntity(c,t.appId),v=await pr(y,t,a,h),P=v.split(":"),b=P.length===2?v:P.slice(0,2).join(":"),A="".concat(y.name.toUpperCase(),":").concat(v),L=t.redirectAppViewRefs,G=L?.find(J=>{const N=J.name||J.id;return N===A||N===v||N===b});if(G){const J=G.refAppViewId;if(J){const N=await ibiz.commands.execute(et.TAG,J,e,a,{...s,data:[h]});if(N)return N}else throw new m(G,"\u672A\u914D\u7F6E\u5B9E\u9645\u5F15\u7528\u89C6\u56FE")}else throw ibiz.log.error("\u91CD\u5B9A\u5411\u89C6\u56FE\u5F15\u7528\u6709\uFF1A",L?.map(({refAppViewId:J,name:N,realTitle:at})=>({viewId:J,tag:N,title:at}))),new m(t,"\u672A\u627E\u5230\u91CD\u5B9A\u5411\u6807\u8BC6[".concat(v,"]\u6216[").concat(A,"]\u6216\u5DE5\u4F5C\u6D41[").concat(b,"]\u5BF9\u5E94\u89C6\u56FE"));return{ok:!0,data:[]}}async function pr(t,e,a,s){let i="";const r=e.typeAppDEFieldId;if(r){const{codeName:c}=At(t,r),l=s[c.toLowerCase()];if(x(l))return"".concat(l);ibiz.log.warn("\u91CD\u5B9A\u5411\u89C6\u56FE[".concat(e.name,"]\u81EA\u5B9A\u4E49\u7C7B\u522B\u5C5E\u6027[").concat(r,"]\u503C\u4E3A\u7A7A"),s)}const n="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),o=a.srfwf;if(x(o))return x(a.wf)?"".concat(n,":").concat(o.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(n,":").concat(o.toUpperCase());let u="";if(t.indexTypeAppDEFieldId){const{codeName:c}=At(t,t.indexTypeAppDEFieldId);u=s[c.toLowerCase()]}if(k(u)&&t.formTypeAppDEFieldId){const{codeName:c}=At(t,t.formTypeAppDEFieldId);u=s[c.toLowerCase()]}return x(u)?i="".concat(n,":").concat(u.toString().toUpperCase()):i="".concat(n),i}function tt(t,e,a){if(Object.is(e,"IN"))return Lt(t,a);if(Object.is(e,"NOTIN"))return!Lt(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return St(t,a)<0;case"LTANDEQ":return St(t,a)<=0;case"GT":return St(t,a)>0;case"GTANDEQ":return St(t,a)>=0;case"ISNULL":return k(t);case"ISNOTNULL":return x(t);case"TESTNULL":return C(t);case"IN":return Lt(t,a);case"NOTIN":return!Lt(t,a);case"LIKE":return Zt(t,a);case"LEFTLIKE":return Zt(t,a,"start");case"RIGHTLIKE":return Zt(t,a,"end");default:throw new f("\u503C\u64CD\u4F5C\uFF1A".concat(e,"\uFF0C\u6682\u672A\u652F\u6301"))}}function St(t,e){const a=Number(t),s=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(s))return Oe(a,s);const i=new Date(t).getTime(),r=new Date(e).getTime();if(!Number.isNaN(i)&&!Number.isNaN(r))return Oe(i,r);throw new f("".concat(t," \u548C ").concat(e," \u65E0\u6CD5\u6BD4\u8F83\u5927\u5C0F"))}function Oe(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Lt(t,e){if(!e||typeof e!="string")throw new f("\u8303\u56F4\u6BD4\u8F83\u7684\u6761\u4EF6\u503C\u4E0D\u5B58\u6216\u8005\u4E0D\u662F\u5B57\u7B26\u4E32");return t?e.split(",").includes("".concat(t)):!1}function Zt(t,e,a){if(!t||!e)return!1;const s="".concat(t).toUpperCase(),i="".concat(e).toUpperCase(),r=s.indexOf(i);switch(a){case"start":return r===0;case"end":return r+i.length===s.length;default:return r!==-1}}var fr={singleRowReturn:!1,isAsync:!0},mr=d("ScriptFunction",class{constructor(t,e,a=fr){this.argKeys=[],this.options=a;const s=this.formatCode(e,a);this.calcArgKeys(t,a);const i=new Function(...this.argKeys,s);this.scriptFn=function(...n){try{return i.apply({},n)}catch(o){throw console.log("\u62A5\u9519\u811A\u672C",s),o}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);const s=["document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"];a.push(...s),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?Fe(e,t):t;a.document=document,a.selector=i=>document.getElementsByClassName(i);const s=[];return this.argKeys.forEach(i=>{a[i]===void 0&&this.fillDefaultParams(i,a),s.push(a[i])}),s}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;break}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session;break}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),R=d("ScriptFactory",class{static createScriptFn(t,e,a){return new mr(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function Er(t){return t.condType==="GROUP"}function gr(t){return t.condType==="SIMPLE"}function wr(t){return t.condType==="VALUERANGE2"}function Dr(t){return t.condType==="REGEX"}function Cr(t){return t.condType==="STRINGLENGTH"}function vr(t){return t.condType==="SYSVALUERULE"}function _e(t,e,a){const s={isPast:!0,infoMessage:a.ruleInfo};if(Er(a)){const i=a.conds;i&&i.length>0&&(s.isPast=Ir(i,r=>{const{isPast:n,infoMessage:o}=_e(t,e,r);return s.infoMessage=o,n},a.condOp,!!a.notMode),!s.isPast&&(a.condOp==="AND"&&a.notMode||a.condOp==="OR"&&!a.notMode)&&(s.infoMessage=a.ruleInfo))}else{t=a?.defname.toLowerCase()||t;try{if(gr(a))s.isPast=!Ar(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(wr(a))s.isPast=!Fr(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(Dr(a))s.isPast=!xe(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(Cr(a))s.isPast=!yr(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(vr(a)&&a?.sysValueRule){const{ruleType:i,regExCode:r,scriptCode:n,ruleInfo:o}=a.sysValueRule;if(s.infoMessage=a.ruleInfo||o,i==="REG")s.isPast=!xe(e[t],r,s.infoMessage,a.keyCond);else if(i==="SCRIPT"){const{isPast:u,infoMessage:c}=Pr(e[t],e,n,s.infoMessage,a.keyCond);s.isPast=u,s.infoMessage=c||s.infoMessage}}}catch{s.isPast=!1}s.isPast=a.notMode?!s.isPast:s.isPast}return s}function Ir(t,e,a="AND",s=!1){if(!(t?.length>0))return!1;let i=a==="AND";for(let r=0,n=t.length;r<n;r++){const o=e(t[r],r);if(a==="AND"){if(!o){i=!1;break}}else if(a==="OR"&&o){i=!0;break}}return s?!i:i}function Ar(t,e,a,s,i,r,n){Object.is(i,"CURTIME")&&(a="".concat(new Date)),Object.is(i,"ENTITYFIELD")&&(a=a?a.toLowerCase():"",a=r[a]?r[a]:a),(C(s)||T(s))&&(s="\u5185\u5BB9\u5FC5\u987B\u7B26\u5408\u503C\u89C4\u5219");const o=tt(t,e,a);if(!o&&n)throw new f(s);return!o}function yr(t,e,a,s,i,r,n){if(k(r)&&(r="\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u7B26\u5408\u8303\u56F4\u89C4\u5219"),k(t)){if(n)throw new f("\u503C\u4E3A\u7A7A");return r="\u503C\u4E3A\u7A7A",!0}const u=t.length;if(e!==null){if(a){if(u<e){if(n)throw new f(r);return!0}}else if(u<=e){if(n)throw new f(r);return!0}}if(s!==null){if(i){if(u>s){if(n)throw new f(r);return!0}}else if(u>=s){if(n)throw new f(r);return!0}}return r="",!1}function xe(t,e,a,s){if(k(a)&&(a="\u503C\u5FC5\u987B\u7B26\u5408\u6B63\u5219\u89C4\u5219"),k(t)){if(s)throw new f("\u503C\u4E3A\u7A7A");return a="\u503C\u4E3A\u7A7A",!0}if(!new RegExp(e).test(t)){if(s)throw new f(a);return!0}return a="",!1}function Fr(t,e,a,s,i,r,n){if(k(r)&&(r="\u503C\u5FC5\u987B\u7B26\u5408\u503C\u8303\u56F4\u89C4\u5219"),k(t)){if(n)throw new f("\u503C\u4E3A\u7A7A");return r="\u503C\u4E3A\u7A7A",!0}if(xe(t,/^-?\d*\.?\d+$/,"",n))return!0;const c=Number.parseFloat(t);if(e!==null){if(a){if(c<e){if(n)throw new f(r);return!0}}else if(c<=e){if(n)throw new f(r);return!0}}if(s!=null){if(i){if(c>s){if(n)throw new f(r);return!0}}else if(c>=s){if(n)throw new f(r);return!0}}return r="",!1}function Pr(t,e,a,s,i){k(s)&&(s="\u503C\u5FC5\u987B\u7B26\u5408\u811A\u672C\u89C4\u5219");const r=e;let n="",o=!0;const u=c=>{o=!1,c?.length>0?c.forEach(l=>{l?.message&&(n+=l.message)}):c?.message&&(n=c.message)};try{const c=R.execScriptFn({value:t,data:r},a,{isAsync:!1});typeof c=="boolean"&&(o=c)}catch(c){ibiz.log.error(c),u(c)}if(s="",!o&&i)throw new f(s);return{isPast:o,infoMessage:n||s}}function br(t){return t.logicType==="GROUP"}function Nr(t){return t.logicType==="SINGLE"}function te(t,e){if(br(e)){const a=e.defdlogics;if(!a||a.length===0)throw new m(e,"\u53D1\u73B0\u7A7A\u903B\u8F91\u7EC4\uFF0C\u903B\u8F91\u65E0\u6CD5\u6B63\u5E38\u6267\u884C\uFF01");let s=!0;return e.groupOP==="AND"?s=a.find(r=>!te(t,r))===void 0:e.groupOP==="OR"&&(s=e.defdlogics.find(r=>te(t,r))!==void 0),e.notMode?!s:s}if(Nr(e))return tt(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new D(e,"\u672A\u652F\u6301\u7684\u903B\u8F91\u7C7B\u578B".concat(e.logicType))}function Sr(t){return t.logicType==="GROUP"}function Lr(t){return t.logicType==="SINGLE"}function ee(t,e){if(Sr(e)){const a=e.panelItemLogics;if(!a||a.length===0)throw new m(e,"\u53D1\u73B0\u7A7A\u903B\u8F91\u7EC4\uFF0C\u903B\u8F91\u65E0\u6CD5\u6B63\u5E38\u6267\u884C\uFF01");let s=!0;return e.groupOP==="AND"?s=a.find(r=>!ee(t,r))===void 0:e.groupOP==="OR"&&(s=e.panelItemLogics.find(r=>ee(t,r))!==void 0),e.notMode?!s:s}if(Lr(e))return tt(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new D(e,"\u672A\u652F\u6301\u7684\u903B\u8F91\u7C7B\u578B".concat(e.logicType))}var Rr=d("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||e.useDefaultLayout===!0){const a=this.calcLayoutTag(t);if(this.cache.has(a)){const s=I(this.cache.get(a));t.viewLayoutPanel=s,t.appCounterRefs&&(s.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(s.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(s.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(s.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(s.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;switch(e){case"APPINDEXVIEW":return this.calcIndexViewLayoutTag(t);default:return"".concat(e,"_").concat(a)}}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:s,mainMenuAlign:i}=t;let r="";return s?r="BLANK_MODE":i&&(r=i.toUpperCase()),r!==""?"".concat(e,"_").concat(a,"_").concat(r):"".concat(e,"_").concat(a)}});function ns(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}function Tr(t,e){var a;const{type:s,sequenceflowview:i,sequenceflowmobview:r}=e,n=((a=t.viewLayoutPanel)==null?void 0:a.appViewRefs)||t.appViewRefs,o=s?"WFUTILACTION@".concat(s.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?r:i),u=n?.find(c=>c.name.indexOf(o)!==-1);return u?.refAppViewId}var Br=d("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))(Br||{})),Or=d("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))(Or||{})),_r=d("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(_r||{})),xr=d("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(xr||{})),Mr=d("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))(Mr||{})),Vr=d("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))(Vr||{})),kr=d("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))(kr||{})),Me=d("StudioViewEvents",class{});Me.onViewMounted="onMounted",Me.onViewDestroyed="onDestroyed";var ae=d("StudioPanelEvents",class{});ae.onClick="onClick",ae.onChange="onChange",ae.onEnter="onEnter",ae.onLeave="onLeave";var z=d("StudioControlEvents",class{});z.onBeforeLoad="onBeforeLoad",z.onLoadSuccess="onLoadSuccess",z.onLoadError="onLoadError",z.onBeforeLoadDraft="onBeforeLoadDraft",z.onLoadDraftSuccess="onLoadDraftSuccess",z.onLoadDraftError="onLoadDraftError",z.onBeforeSave="onBeforeSave",z.onSaveSuccess="onSaveSuccess",z.onSaveError="onSaveError",z.onBeforeRemove="onBeforeRemove",z.onRemoveSuccess="onRemoveSuccess",z.onRemoveError="onRemoveError",z.CLICK="onClick";var Wr=d("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new Ce,beforeDismiss:new Ce},this._dismiss=e=>{ibiz.log.error("\u5916\u90E8\u5173\u95ED\u80FD\u529B\u672A\u6CE8\u518C",e)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return this.ignoreDismissCheck!==!0&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss\u7ED3\u679C\u4E3Afalse,\u5173\u95ED\u4E2D\u65AD\u3002"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function Ve(t,e){return t.filter(a=>{const{checkMode:s}=a,i=a.deformItemName||a.degridEditItemName;return s!==2&&i===e})}var Ur=d("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")}}),zr=d("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=I(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let s=":root.".concat(t.themeTag,"{");for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];s+="".concat(r,": ").concat(n).concat(n.endsWith(";")?"":";")}s+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=s,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),Gr=d("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return t!==void 0&&(t==="true"||t==="false"?e=t==="true":this.isNumber(t)&&(e=parseFloat(t))),e}});async function it(t,e=!0){const a=await Promise.allSettled(t),s=[],i=[];if(a.forEach(r=>{r.status==="fulfilled"?s.push(r.value):i.push(r.reason)}),i.length>0){const r=i.length===1?i[0]:i;if(e)throw r;ibiz.util.error.handle(r)}return s}var jr=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if(t==="ISNULL")return e==null;if(t==="ISNOTNULL")return e!=null;if(t==="EQ"||t==="ABSEQ"||t==="GT"||t==="GTANDEQ"||t==="LT"||t==="LTANDEQ"||t==="NOTEQ"){let s=-1;if(e==a?s=0:e>a&&(s=1),t==="EQ"||t==="ABSEQ")return s===0;if(t==="GT")return s>0;if(t==="GTANDEQ")return s>=0;if(t==="LT")return s<0;if(t==="LTANDEQ")return s<=0;if(t==="NOTEQ")return s!==0}if(t==="LIKE")return e!=null&&a!=null?e.toString().toUpperCase().indexOf(a.toString().toUpperCase())!==-1:!1;if(t==="LEFTLIKE")return e!=null&&a!=null?e.toString().toUpperCase().indexOf(a.toString().toUpperCase())===0:!1}catch(s){ibiz.log.error(s)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},os=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},ke=class extends os{parse(t){const e=t.length;let a=!0,s=!1,i=!1;for(let r=0;r<e;r++){if(a){const n=t[r];this.setCondOp(n),a=!1,s=!0;continue}if(s){const n=t[r];this.setParam(n),s=!1,i=!0;continue}if(i){const n=t[r];if(n instanceof Object&&!(n instanceof Array)){const o=n;o.type!=null&&this.setValueType(o.type.toString()),o.value!=null&&this.setValue(o.value.toString())}else this.setValue(n);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}},us=class wi extends os{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let s=!0,i=!0,r=!1;for(let n=0;n<a;n++){if(s&&i&&e[n]==="!"){this.setNotMode(!0),s=!1;continue}if(i){const o=e[n];this.setCondOp(o),i=!1,s=!1,r=!0;continue}if(r){const o=e[n];if(o instanceof Array)o.forEach(u=>{if(u.length>0){const c=u[0].toString();if(c==="!"||c==="OR"||c==="AND"){const l=new wi;l.parse(u),this.childCondList.push(l)}else{const l=new ke;l.parse(u),this.childCondList.push(l)}}});else throw new f("\u503C\u5FC5\u987B\u4E3A\u6570\u7EC4")}}}setNotMode(e){this.bNotMode=e}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Kr=class extends us{},Hr=class extends ke{},We=class ca extends jr{test(e,a){return this.testCond(this.getPSModelGroupCondBase(),e,a)}testCond(e,a,s){if(e instanceof us){const i=e.getChildPSModelCondBases();if(i==null||T(i))return!e.isNotMode();const r=e.getCondOp()==="AND";let n=r;for(let o=0;o<i.length;o++){const u=i[o];if(this.testCond(u,a,s)){if(!r){n=!0;break}}else if(r){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof ke){T(e.getParam())&&ibiz.log.warn("\u6CA1\u6709\u6307\u5B9A\u5C5E\u6027\u540D\u79F0",e);const i=a[e.getParam().toLowerCase()];let r=null;const n=e.getValueType(),o=e.getValue();return n!=null&&!T(n)?(T(o)&&ibiz.log.warn("\u6CA1\u6709\u6307\u5B9A\u4E0A\u4E0B\u6587\u53C2\u6570\u540D\u79F0"),ca.PARAMTYPE_WEBCONTEXT===n?r=s.data[o.toLowerCase()]:ca.PARAMTYPE_DATACONTEXT===n&&(r=s.getValue(o.toLowerCase()))):r=e.getValue(),this.testSingleCond(e.getCondOp(),i,r)}return ibiz.log.warn("\u65E0\u6CD5\u8BC6\u522B\u7684\u6761\u4EF6\u5BF9\u8C61",e),!1}createPSModelSingleCond(){return new Hr}createPSModelGroupCond(){return new Kr}};We.PARAMTYPE_DATACONTEXT="DATACONTEXT",We.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Xr=d("PSDEDQCondEngine",We);async function Q(t,e){var a;const i=(a=ibiz.hub.getApp(e).model.appPFPluginRefs)==null?void 0:a.find(r=>r.pluginCode.toLowerCase()===t);if(!i){ibiz.log.error("\u672A\u5339\u914D\u5230\u63D2\u4EF6[".concat(t,"]\u6A21\u578B"));return}return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode)}var cs=d("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function ls(t,e){ibiz.register.register("".concat(cs,"_").concat(t),e)}function Ue(t){return ibiz.register.get("".concat(cs,"_").concat(t))}async function ds(t){let e;const{codeName:a,counterType:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(e=Ue(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7CFB\u7EDF\u8BA1\u6570\u5668\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s==="CUSTOM"){if(e=Ue(a),e)return e;throw new f("\u627E\u4E0D\u5230\u81EA\u5B9A\u4E49\u7CFB\u7EDF\u8BA1\u6570\u5668".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}if(e=Ue(s),e)return e;throw new f("\u627E\u4E0D\u7CFB\u7EDF\u8BA1\u6570\u5668\u7C7B\u578B".concat(s,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}var hs=d("CONTROL_PROVIDER_PREFIX","CONTROL");function Yr(t,e){ibiz.register.register("".concat(hs,"_").concat(t),e)}function ze(t){return ibiz.register.get("".concat(hs,"_").concat(t))}async function ft(t){let e;const{controlType:a,controlStyle:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(e=ze(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u90E8\u4EF6\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s&&s!=="DEFAULT"){const n="".concat(a,"_").concat(s);if(e=ze(n),!e)ibiz.log.error("\u627E\u4E0D\u5230\u90E8\u4EF6\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u90E8\u4EF6\u6837\u5F0F\uFF1A[").concat(s,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}if(e=ze(a),e)return e;switch(a){case"DATAINFOBAR":return;default:ibiz.log.error("\u627E\u4E0D\u5230\u90E8\u4EF6\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}}var ps=d("EDITOR_PROVIDER_PREFIX","EDITOR");function qr(t,e){ibiz.register.register("".concat(ps,"_").concat(t),e)}function se(t){return ibiz.register.get("".concat(ps,"_").concat(t))}async function ie(t){let e;const{editorType:a,editorStyle:s,predefinedType:i,sysPFPluginId:r,appId:n}=t;if(r){const o=await Q(r,n);if(o&&(e=se(o)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u63D2\u4EF6".concat(o,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s&&s!=="DEFAULT"){const o="".concat(a,"_").concat(s);if(e=se(o),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u7F16\u8F91\u5668\u6837\u5F0F\uFF1A[").concat(s,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}if(i){let o="".concat(i,"_").concat(a);if(s&&s!=="DEFAULT"&&(o+="_".concat(s)),e=se(o),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u9884\u7F6E\u7C7B\u578B\uFF1A[").concat(i,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}if(e=se(a),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var fs=d("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function Qr(t,e){ibiz.register.register("".concat(fs,"_").concat(t),e)}function ms(t){return ibiz.register.get("".concat(fs,"_").concat(t))}async function Es(t){let e;const{detailType:a,sysPFPluginId:s,appId:i}=t;if(s){const r=await Q(s,i);if(r&&(e=ms(r)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u5355\u6210\u5458\u63D2\u4EF6".concat(r,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=ms(a),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u5355\u6210\u5458\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var gs=d("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function $r(t,e){ibiz.register.register("".concat(gs,"_").concat(t),e)}function ws(t){return ibiz.register.get("".concat(gs,"_").concat(t))}async function Ge(t){let e;const{columnType:a,enableRowEdit:s,sysPFPluginId:i,appId:r}=t;if(i){const o=await Q(i,r);if(o&&(e=ws(o)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u683C\u5217\u63D2\u4EF6".concat(o,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}const n=s?"".concat(a,"_EDIT"):a;if(e=ws(n),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u683C\u5217\u7C7B\u578B".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var Ds=d("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Jr(t,e){ibiz.register.register("".concat(Ds,"_").concat(t.toUpperCase()),e)}function Rt(t){return ibiz.register.get("".concat(Ds,"_").concat(t.toUpperCase()))}async function Cs(t){var e;let a;const{itemType:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(a=Rt(n)),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u6210\u5458\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return a}if(s==="CONTAINER"){const n=t.predefinedType||"DEFAULT",o="CONTAINER_".concat(n);if(a=Rt(o),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u5BB9\u5668\u9884\u7F6E\u7C7B\u578B\u4E3A".concat(n,"\u7684\u9002\u914D\u5668\uFF0C\u6CE8\u518Ckey\u4E3A").concat(o));else return a}if(s==="RAWITEM"){const n=((e=t.rawItem)==null?void 0:e.predefinedType)||"DEFAULT",o="RAWITEM_".concat(n);if(a=Rt(o),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u6210\u5458\u76F4\u63A5\u5185\u5BB9\u9884\u7F6E\u7C7B\u578B\u4E3A".concat(n,"\u7684\u9002\u914D\u5668\uFF0C\u6CE8\u518Ckey\u4E3A").concat(o));else return a}if(s==="FIELD"){const{editor:n}=t;if(n&&n.predefinedType){const o="FIELD_".concat(n.predefinedType.toUpperCase());if(a=Rt(o),a)return a}}if(a=Rt(s),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u6210\u5458\u7C7B\u578B".concat(s,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return a}var vs=d("PORTLET_PROVIDER_PREFIX","PORTLET");function Zr(t,e){ibiz.register.register("".concat(vs,"_").concat(t),e)}function Is(t){return ibiz.register.get("".concat(vs,"_").concat(t))}async function As(t){let e;const{portletType:a,sysPFPluginId:s,appId:i}=t;if(s){const r=await Q(s,i);if(r&&(e=Is(r)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u95E8\u6237\u90E8\u4EF6\u63D2\u4EF6".concat(r,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=Is(a),!e)ibiz.log.error("\u627E\u4E0D\u5230\u95E8\u6237\u90E8\u4EF6\u6210\u5458\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var ys=d("UIACTION_PROVIDER_PREFIX","UIACTION");function yt(t,e){ibiz.register.register("".concat(ys,"_").concat(t),e)}function je(t){return ibiz.register.get("".concat(ys,"_").concat(t))}async function Fs(t){let e;const{uiactionMode:a,sysPFPluginId:s,appId:i,uiactionTag:r}=t;if(s){const n=await Q(s,i);if(n&&(e=je(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u754C\u9762\u884C\u4E3A\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=je("".concat(a,"_").concat(r)),e||(e=je(a),e))return e;throw new f("\u627E\u4E0D\u754C\u9762\u884C\u4E3A\u6A21\u5F0F".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}var Ps=d("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");function tn(t,e){ibiz.register.register("".concat(Ps,"_").concat(t),e)}async function bs(t){let e;const{sysPFPluginId:a,appId:s}=t,i=await Q(a,s);if(i){if(e=ibiz.register.get("".concat(Ps,"_").concat(i)),e)return e;throw new f("\u627E\u4E0D\u5230\u754C\u9762\u903B\u8F91\u524D\u7AEF\u63D2\u4EF6\u8282\u70B9\uFF0C\u63D2\u4EF6".concat(i,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}}var Ns=d("VIEW_PROVIDER_PREFIX","VIEW");function en(t,e){ibiz.register.register("".concat(Ns,"_").concat(t),e)}function re(t){return ibiz.register.get("".concat(Ns,"_").concat(t))}async function an(t){let e;const{viewType:a,viewStyle:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(e=re(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u89C6\u56FE\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s&&s!=="DEFAULT"){const n="".concat(a,"_").concat(s);if(e=re(n),!e)ibiz.log.error("\u627E\u4E0D\u5230\u89C6\u56FE\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u89C6\u56FE\u6837\u5F0F\uFF1A[").concat(s,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}return e||(e=re(a)),e||(e=re("DEFAULT")),e}var Ss=d("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");function sn(t,e){ibiz.register.register("".concat(Ss,"_").concat(t),e)}function rn(t){return ibiz.register.get("".concat(Ss,"_").concat(t))}function nn(t){const e=rn(t);if(e)return e;throw new f("\u627E\u4E0D\u5F02\u6B65\u64CD\u4F5C\u7C7B\u578B".concat(t,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}var on=d("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(a.status!==200)throw new f("\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25");if(a.data){const s=e;return ha(a.data,s),Promise.resolve(!0)}else throw new f("\u6587\u4EF6\u6D41\u6570\u636E\u4E0D\u5B58\u5728")}}),un=d("BrowserPlatformProvider",class extends on{});function cn(){const t=new un;Ts("Browser",()=>t)}var Tt=window.navigator.userAgent.toLowerCase();function ln(){return/Android|Adr/i.test(Tt)}function dn(){return/iPhone|iPod|iPad/i.test(Tt)}function hn(){return/MicroMessenger/i.test(Tt)}function pn(){return/DingTalk/i.test(Tt)}function fn(){return/miniProgram/i.test(Tt)||window.__wxjs_environment==="miniprogram"}function Ls(){return ln()?"Android":dn()?"IOS":hn()?"WeChat":pn()?"DingTalk":fn()?"WeChatMiniProgram":"Browser"}var Rs=d("PLATFORM_PROVIDER_PREFIX","PLATFORM");function Ts(t,e){ibiz.register.register("".concat(Rs,"_").concat(t),e)}function Bs(t){return ibiz.register.get("".concat(Rs,"_").concat(t))}function Os(){const t=Ls(),e=Bs(t);return e||Bs("Browser")}var _s=d("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function ne(t,e){ibiz.register.register("".concat(_s,"_").concat(t),e)}function xs(t){return ibiz.register.get("".concat(_s,"_").concat(t))}async function Ms(t){let e;const{methodType:a,sysPFPluginId:s,appId:i}=t;if(s){const r=await Q(s,i);if(r&&(e=xs(r)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u5B9E\u4F53\u884C\u4E3A\u63D2\u4EF6".concat(r,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=xs(a),e)return e;throw new f("\u627E\u4E0D\u5B9E\u4F53\u884C\u4E3A\u65B9\u6CD5\u7C7B\u578B\u4E3A".concat(a,"\u7684\u9002\u914D\u5668"))}var mn=d("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=Vt.create(),this.params={},this.evt=new Dt,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=I(t)),e&&(this.params=I(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval(()=>{this.evt.getSize("change")>0&&this.load()},this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new f("\u672A\u5B9E\u73B0\u8BA1\u6570\u5668\u52A0\u8F7D\u65B9\u6CD5")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&x(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()}}),En=d("AppDECounter",class extends mn{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const a=this.model.getAppDEActionId;if(!a)throw new m(this.model,"\u672A\u627E\u5230\u83B7\u53D6\u8BA1\u6570\u5668\u884C\u4E3A!");this.action=a,await super.init(t,e)}async load(){const e=await ibiz.hub.getApp(this.context.srfappid).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}}),gn=d("AppDECounterProvider",class{createCounter(t){return new En(t)}});function Vs(){ls("DEDR",()=>new gn)}var wn=d("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Xr;return a.parse(["OR",this.calcCond(e)]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach(a=>{const s=[];if(a.condType==="GROUP"){const i=a;i.notMode&&s.push("!"),s.push(a.condOp);const r=i.dedqconditions;if(r){const n=this.calcCond(r);s.push(n)}}else if(a.condType==="SINGLE"){const i=a;s.push(i.fieldName),i.condValue||s.push("")}else throw new D(a,"\u6682\u672A\u652F\u6301\u7684\u67E5\u8BE2\u6761\u4EF6\u7C7B\u578B: ".concat(a.condType));e.push(s)}),e}});wn.map=new WeakMap;var Dn=d("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){const t=async()=>{const{predefinedType:e}=this.codeList;if(e){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(e))throw new D(this.codeList,"\u9884\u5B9A\u4E49\u7C7B\u578B".concat(e,"\u6682\u4E0D\u652F\u6301"));return}this.initPromise=void 0};return this.initPromise=t(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:s,iconClsAppDEFieldId:i,iconClsXAppDEFieldId:r,iconPathAppDEFieldId:n,iconPathXAppDEFieldId:o,disableAppDEFieldId:u,dataAppDEFieldId:c}=this.codeList,l=a?t[a]:t.srfkey;if(e.id=l,e.value=l,e.text=s?t[s]:t.srfmajortext,(i||r||n||o)&&(e.sysImage={appId:this.codeList.appId},i&&(e.sysImage.cssClass=t[i]),r&&(e.sysImage.cssClassX=t[r]),n&&(e.sysImage.imagePath=t[n]),o&&(e.sysImage.imagePathX=t[o])),u&&(e.disableSelect=Ke(t[u])),c&&t[c])try{e.data=R.execSingleLine(t[c])}catch{ibiz.log.error("\u52A8\u6001\u4EE3\u7801\u8868\u6570\u636E\u5C5E\u6027\u8FD4\u56DE\u503C\u4E0D\u4E3A\u5BF9\u8C61\u683C\u5F0F\u7684\u5B57\u7B26\u4E32\uFF0C\u65E0\u6CD5\u8F6C\u6362\uFF01")}return e}async load(t={},e={}){const a=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:i,minorSortAppDEFieldId:r,minorSortDir:n,pvalueAppDEFieldId:o,customCond:u}=this.codeList,c={...e};if(r&&n&&Object.assign(c,{sort:"".concat(r.toLowerCase(),",").concat(n.toLowerCase())}),u){const p=R.execSingleLine(u),E=F(p,c,t);Object.assign(c,E)}if(c.size||(c.size=1e4),this.isPredefined){const p=await a.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),c);return Object.freeze(p.data.items)}if(!s)throw new m(this.codeList,"\u672A\u914D\u7F6E\u5E94\u7528\u5B9E\u4F53");if(!i)throw new m(this.codeList,"\u672A\u914D\u7F6E\u6570\u636E\u96C6");const l=await a.deService.exec(s,i,t,void 0,c);let h=[];return l.data.length&&l.data.forEach(p=>{if(o){const E=this.prepareTreeData(l.data);E&&(h=E)}else h.push(this.convertData(p))}),Object.freeze(h)}prepareTreeData(t,e){const{pvalueAppDEFieldId:a}=this.codeList;let s=[];if(s=t.filter(i=>e?i[a]===e:!i[a]),s.length!==0)return s.map(i=>{const r=this.convertData(i);return r.children=this.prepareTreeData(t,r.value),r})}async get(t={},e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const u=this.cache.get(a);if(u.expirationTime>new Date().getTime())return u.promise?u.promise:u.items;this.cache.delete(a)}const s=this.load(t,e),{cacheTimeout:i}=this.codeList,r=i===-1||C(i)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,n={expirationTime:new Date().getTime()+r,promise:s};this.cache.set(a,n);const o=await s;return n.items=o,delete n.promise,o}});function ks(t,e){if(e!=null){const{srfkey:a}=e;if(!C(a)&&!T(a))return!0}throw new f("\u6267\u884C\u300C".concat(t,"\u300D\u4E0D\u5B58\u5728\u300Csrfkey\u300D\u65E0\u6CD5\u5904\u7406"))}function dt(t,e){const{srfsessionid:a}=e;if(!C(a)&&!T(a))return!0;throw new f("\u6267\u884C\u300C".concat(t,"\u300D\u4E0D\u5B58\u5728\u300Csrfsessionid\u300D\u65E0\u6CD5\u5904\u7406"))}var Cn=d("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!((t=this.entity.unionKeyValueAppDEFieldIds)!=null&&t.length)}forceAdd(t,e){const s=this.getCacheByTag(t).get(e.srfkey);s&&(s.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.getCacheByTag(t).set(e.srfkey,I(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.getCacheByTag(t).delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new f("\u65B0\u5EFA\u8054\u5408\u4E3B\u952E\u6570\u636E\u5931\u8D25\uFF0C\u5DF2\u6709\u4E3B\u952E\u4E3A".concat(e.srfkey,"\u7684\u6570\u636E"));try{return dt("add",t),(C(e.srfkey)||T(e.srfkey))&&(e.srfkey=j()),e.srftempdate=new Date().getTime(),this.getCacheByTag(t).set(e.srfkey,I(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(a){return ibiz.log.error(a),null}}get(t,e){try{dt("get",t);const s=this.getCacheByTag(t).get(e);return ibiz.log.warn("get",e,s),I(s)}catch(a){return ibiz.log.error(a),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new f("\u66F4\u65B0\u8054\u5408\u4E3B\u952E\u6570\u636E\u5931\u8D25\uFF0C\u5DF2\u6709\u4E3B\u952E\u4E3A".concat(e.srfkey,"\u7684\u6570\u636E"));try{dt("update",t),ks("update",e),e.srftempdate=new Date().getTime();const s=this.getCacheByTag(t),i=s.get(a);if(i)return i.assign(e),s.set(a,i),ibiz.log.warn("update",a,e),I(i);throw new Error("\u6570\u636E\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u66F4\u65B0!")}catch(s){return ibiz.log.error(s),null}}delete(t,e){try{dt("delete",t);const a=this.getCacheByTag(t),s=e;if(a.has(s)){const i=a.get(s);return i.srftempdate=new Date().getTime(),a.delete(s),ibiz.log.warn("delete",s),i}return null}catch(a){return ibiz.log.error(a),null}}createBatch(t,e){try{dt("add",t);const a=this.getCacheByTag(t);for(let s=0;s<e.length;s++){const i=e[s];(C(i.srfkey)||T(i.srfkey))&&(i.srfkey=j()),i.srftempdate=new Date().getTime();const r=I(i);a.set(i.srfkey,r),e[s]=r,ibiz.log.warn("add",i.srfkey,i)}return e}catch(a){ibiz.log.error(a)}return[]}updateBatch(t,e){try{dt("update",t);const a=this.getCacheByTag(t);for(let s=0;s<e.length;s++){const i=e[s];ks("update",i),i.srftempdate=new Date().getTime();const r=a.get(i.srfkey);if(r)r.assign(i),a.set(i.srfkey,r),ibiz.log.warn("update",i.srfkey,i),e[s]=I(r);else throw new Error("\u6570\u636E[".concat(i.srfdename,"-").concat(i.srfmajortext,"(").concat(i.srfkey,")]\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u66F4\u65B0!"))}return e}catch(a){return ibiz.log.error(a),null}}deleteBatch(t,e){try{dt("delete",t)}catch(i){return ibiz.log.error(i),e}const a=this.getCacheByTag(t),s=[];for(let i=0;i<e.length;i++){const r=e[i];a.has(r)||s.push(r)}if(s.length>0)throw new Error("\u672A\u627E\u5230\u4EE5\u4E0B\u6570\u636E\u300C".concat(s.join("\u3001"),"\u300D\uFF0C\u65E0\u6CD5\u5220\u9664!"));for(let i=0;i<e.length;i++){const r=e[i];a.delete(r),ibiz.log.warn("delete",r)}return[]}checkData(t,e){return this.getList(t).findIndex(i=>i.srfkey===e)!==-1}getList(t){try{dt("getList",t);const e=this.getCacheByTag(t);if(!e)return[];const a=e.values();return Array.from(a)}catch(e){return ibiz.log.error(e),[]}}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ct(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const s=t[a];e[a]=ct(s)}return Ct(e)}clear(t){const e=t.srfsessionid;this.cacheMap.size>0&&this.cacheMap.delete(e)}getCacheByTag(t){const e=t.srfsessionid;return this.cacheMap.has(e)||this.cacheMap.set(e,new Map),this.cacheMap.get(e)}calcUnionKey(t){const a=this.entity.unionKeyValueAppDEFieldIds.map(s=>lt(this.entity.appDEFields||[],s).codeName.toLowerCase()).map(s=>{if(C(t[s]))throw new f("\u8054\u5408\u952E\u503C\u8BA1\u7B97\u5F02\u5E38\uFF0C".concat(s,"\u5C5E\u6027\u4E3A\u7A7A\u503C\uFF01"));return t[s]});t.srfkey=a.join("")}}),vn=/\$\{(.*?)\}/g;function Ws(t,e){const i=(e.requestPaths||[]).map(r=>{const n=r.match(vn),o=n?.map(u=>u.substring(2,u.length-1))||[];return{path:r,keys:o}}).filter(r=>{const{keys:n}=r;return n.length===0?!0:n.every((o,u)=>u===n.length-1?!0:t[o]!=null)}).sort((r,n)=>n.keys.length-r.keys.length);if(i.length>0)return i[0]}function oe(t,e){const a=Ws(t,e);if(a){if(a.keys.length>0){let{path:s}=a;return a.keys.forEach((i,r)=>{r===a.keys.length-1?s=s.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):s=s.replace("${".concat(i,"}"),t[i])}),s}return a.path}return""}var In=d("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(!C(e.page)&&!T(e.page)&&(this.page=e.page),!C(e.size)&&!T(e.size)&&(this.size=e.size),!C(e.query)&&!T(e.query)&&(this.query=e.query),!C(e.sort)&&!T(e.sort)){const a=e.sort.split(",");a.length>=1&&([this.sortField]=a),a.length>=2&&(this.sortMode=a[1].toUpperCase())}!C(e.srfparentkey)&&!T(e.srfparentkey)&&(this.srfparentkey=e.srfparentkey),!C(e.srfparentdename)&&!T(e.srfparentdename)&&(this.srfparentdename=e.srfparentdename),this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort,delete this.data.srfparentkey,delete this.data.srfparentdename}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Ke(t){return[1,"1",!0,"true"].includes(t)}var An=d("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let s=[];return a?.length&&(s=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(s)),s}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map(a=>{var s;let i=a.text;a.textLanguageRes&&(i=ibiz.i18n.t(a.textLanguageRes.lanResTag,a.text));let{tooltip:r}=a;a.tooltipLanguageRes&&(r=ibiz.i18n.t(a.tooltipLanguageRes.lanResTag,a.tooltip));const n={text:i,value:e?Number(a.value):a.value,color:a.color,id:a.codeName,textCls:a.textCls,disableSelect:a.disableSelect,tooltip:r,data:a.data?R.execSingleLine(a.data):void 0,sysImage:a.sysImage};return(s=a.codeItems)!=null&&s.length&&(n.children=this.formatStaticItems(a.codeItems,e)),Object.freeze(n)})}async getDynamicCodeList(t,e={},a={}){let s;const i=t.codeName;return this.cache.has(i)?s=this.cache.get(i):(s=new Dn(t),this.cache.set(i,s),await s.init()),s.get(e,a)}async get(t,e,a){const s=this.allCodeLists.get(t);if(!s)throw new f("\u627E\u4E0D\u5230".concat(t,"\u4EE3\u7801\u8868"));return s.codeListType==="STATIC"?this.getStatic(s):s.codeListType==="DYNAMIC"?this.getDynamicCodeList(s,e,a):[]}}),Bt=d("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return e.ok?e.data:!1}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok?t.data||{}:{}}}),Us=d("CounterService",class{static async getCounter(t,e,a){const s=t.id;if(this.counterMap.has(s)){const n=this.counterMap.get(s);if(n.isDestroyed===!1)return n;this.counterMap.delete(s)}const r=(await ds(t)).createCounter(t);return await r.init(e,a),this.counterMap.set(s,r),r}static async getCounterByRef(t,e,a){const{appCounter:s}=t;if(!s)throw new m(t,"\u672A\u914D\u7F6E\u5E94\u7528\u8BA1\u6570\u5668!");return this.getCounter(s,e,a)}});Us.counterMap=new Map;var yn=d("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:s}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(s,"/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(){return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},s={}){switch(t){case"wfstart":return this.wfStart(e,a,s);case"wfsubmit":return this.wfSubmit(e,a,s);case"reassign":return this.wfReassign(e,a,s);case"addstepbefore":return this.wfAddStepBefore(e,a,s);case"addstepafter":return this.wfAddStepAfter(e,a,s);case"sendback":return this.wfSendBack(e,a,s);case"sendcopy":return this.wfSendCopy(e,a,s);default:throw new f("\u300C".concat(t,"\u300D\u672A\u5B9E\u73B0"))}}}),Fn=class{constructor(t){this.model=t}exportData(t,e,a,s){const i=oe(a,this.model),r="".concat(i,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(r,{method:"post",data:s,responseType:"blob"})}},Pn=d("DEService",class{constructor(t){this.model=t,this.methodMap=new Map,this.local=new Cn(t),this.configCache=new Bt(t.appId,"PSAppDataEntity",t.codeName),this.wf=new yn(t),this.file=new Fn(t)}async getMethod(t,e=!1){const a=e?"ac-".concat(t):t;if(this.methodMap.has(a))return this.methodMap.get(a);const s=lt(this.model.appDEMethods,t),i=await Ms(s);if(!i)throw new D(s,"\u672A\u652F\u6301\u7684\u670D\u52A1\u65B9\u6CD5\u7C7B\u578B: ".concat(s.methodType));const r=i.create(this.model,s,{acMode:e});return this.methodMap.set(a,r),r}async exec(t,e,a,s){const i=await this.getMethod(t);if(i)return i.exec(e,a,s);throw new f("".concat(this.model.codeName,"\u672A\u652F\u6301\u300C").concat(t,"\u300D\u65B9\u6CD5"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async execAc(t,e,a,s={}){const i=await this.getMethod(t,!0);if(i)return i.exec(e,a,s);throw new f("".concat(this.model.codeName,"\u672A\u652F\u6301\u300C").concat(t,"\u300D\u65B9\u6CD5"))}aiChatSse(t,e,a={},s={}){const i=ibiz.hub.getApp(this.model.appId),r=this.calcSsePath(e);return new Promise((n,o)=>{i.net.sse("/".concat(r),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(s),onmessage:u=>{if(u.data){const c=JSON.parse(u.data);t(c)}},onclose:()=>{n()},onerror:u=>{o(u)}})})}aiChatHistory(t,e={},a={}){const s=ibiz.hub.getApp(this.model.appId),i=this.calcSsePath(t,!0);return s.net.post(i,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],s="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return oe(t,this.model)+s}}),bn=d("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(bn||{})),Nn=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],K=d("ControlVO",class la{constructor(e={},a=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:e||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:a||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(s){this.$origin.srfactionparam=s},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.$origin,s))Object.defineProperty(this,s,{get(){return this.$origin[s]},set(i){this.$origin[s]=i},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(s)){const{dataKey:i}=this.$dataUIMap.get(s);Object.defineProperty(this,s,{get(){return this.$origin[i]},set(r){this.$origin[i]=r},enumerable:!1,configurable:!0})}else Object.defineProperty(this,s,{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(s){this.$origin.tempsrfkey=s},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:C(this.srfkey)?j():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach(s=>{Object.defineProperty(this,s,{get(){return this.$origin[s]},enumerable:!1,configurable:!0})}),this.$dataUIMap.forEach((s,i)=>{const r=s.dataKey;this.linkProperty(i,r,s)}),Object.keys(e).forEach(s=>{Object.prototype.hasOwnProperty.call(this,s)||this.linkProperty(s,s)})}linkProperty(e,a,s){const i=s?s.isOriginField:!0;Nn.includes(e)||(i||Object.prototype.hasOwnProperty.call(this.$origin,e)?Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get(){return this.$origin[a]},set(r){this.$origin[a]=r}}):Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof la?e.getOrigin():e}clone(){const e=I(this.$origin),a=new la(e,this.$dataUIMap);return Object.keys(this).forEach(s=>{a[s]=this[s]}),a}}),Ot=d("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,s){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,s)}handleResponse(t){return pa(t)}toUIData(t){return new K(t,this.dataUIMap)}}),rt=d("MDControlService",class extends Ot{async fetch(t,e={}){var a;const s=((a=this.model.fetchControlAction)==null?void 0:a.appDEMethodId)||"fetchdefault";let i=await this.exec(s,t,e);return i=this.handleResponse(i),i}async get(t,e={}){var a;const s=((a=this.model.getControlAction)==null?void 0:a.appDEMethodId)||"get";let i=await this.exec(s,t,void 0,e);return i=this.handleResponse(i),i}async getDraft(t,e={}){var a;const s=((a=this.model.getDraftControlAction)==null?void 0:a.appDEMethodId)||"getdraft";let i=await this.exec(s,t,void 0,e);return i=this.handleResponse(i),i}async remove(t,e={}){var a;const s=((a=this.model.removeControlAction)==null?void 0:a.appDEMethodId)||"remove";return await this.exec(s,t,void 0,e)}async create(t,e){var a;const s=((a=this.model.createControlAction)==null?void 0:a.appDEMethodId)||"create";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}async update(t,e){var a;const s=((a=this.model.updateControlAction)==null?void 0:a.appDEMethodId)||"update";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}async exportData(t,e,a={}){throw new f("\u672A\u5B9E\u73B0")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&(Xt(e.data)?e.data=e.data.map(a=>this.toUIData(a)):e.data=this.toUIData(e.data)),e}}),Sn=d("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){return!(e.srfopprivs&&!e.srfopprivs.includes(t)||!await this.calcByDeMainState(t,e))}async calcByDeMainState(t,e){let a=!0;const s=this.entityModel;if(!s.enableDEMainState)return ibiz.log.debug("".concat(s.codeName,"\u5B9E\u4F53\u4E0D\u5B58\u5728\u6216\u8005\u4E3A\u542F\u7528\u4E3B\u72B6\u6001\uFF0C\u8FD4\u56DEtrue")),a;ibiz.log.debug("\u64CD\u4F5C\u6807\u8BC6".concat(t,"\u4E3B\u72B6\u6001\u8BA1\u7B97\u5F00\u59CB"),e,s);const i=Ka(s,e);if(i){ibiz.log.debug("\u5339\u914D\u4E3B\u72B6\u6001",i);const r=Ha(i,s);ibiz.log.debug("\u5141\u8BB8\u7684\u4E3B\u72B6\u6001\u6743\u9650\u96C6\u5408",r),a=r.includes(t)}else ibiz.log.debug("\u6CA1\u5339\u914D\u4E3B\u72B6\u6001\uFF0C\u8FD4\u56DEfalse"),a=!1;return ibiz.log.debug("\u64CD\u4F5C\u6807\u8BC6".concat(t,"\u6743\u9650\u8BA1\u7B97\u7ED3\u675F\uFF1A").concat(a)),a}}),Ln=d("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 f("\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[".concat(t,"]"));const a=this.constructorCache.get(t);let s;a?s=await a(e):s=new Sn(e),this.cache.set(t,s)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),t.enablepermissionvalid===!0&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const r=await(await ibiz.hub.getApp(this.appModel.appId)).getOPPriv(t,a);if(this.enablePermission&&r?.mapSysUniResCode&&!this.calcByResCode(r.mapSysUniResCode))return!1}return e&&a?(await this.getService(a)).calcByDataAccessAction(t,e):!0}}),Rn=d("V7AuthService",class{async login(t,e,a){try{const s=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:i}=s;if(i&&i.token){Pt(st.TOKEN,i.token,a?7:0,!0);const r=new Date().getTime()+(i.expirein||7199)*1e3;Pt(st.TOKEN_EXPIRES,"".concat(r),a?7:0,!0)}return!0}catch(s){ibiz.notification.error({title:"\u767B\u5F55\u5931\u8D25",desc:s.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),ve(st.TOKEN),ve(st.TOKEN_EXPIRES),!0}catch(t){ibiz.notification.error({title:"\u767B\u51FA\u5931\u8D25",desc:t.message||""})}return!1}async extendLogin(){const t=Ie(st.TOKEN),e=Ie(st.TOKEN_EXPIRES);if(t&&e){let a=Number(e)-new Date().getTime();const s=5*60*1e3;a=a>s?a-s:0,setTimeout(async()=>{const i=await ibiz.net.get("/uaa/refreshtoken2");if(i.ok){Pt(st.TOKEN,i.data.token,0,!0);const r=new Date().getTime()+(i.data.expirein||7199)*1e3;Pt(st.TOKEN_EXPIRES,"".concat(r),0,!0)}this.extendLogin()},a)}}}),Tn=d("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return C(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),ue=d("AppDataEntity",class me{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:a instanceof me?I(a._data):I(a)}),Object.defineProperty(this,"srfdeid",{get(){return e.id}}),Object.defineProperty(this,"srfdecodename",{get(){return e.codeName}});const s=lt(e.appDEFields||[],e.keyAppDEFieldId);if(s){const r=s.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get(){return r}}),Object.defineProperty(this,"srfkey",{set(n){this._data[r]=n},get(){return this._data[r]}})}else ibiz.log.warn("\u5B9E\u4F53[".concat(e.codeName,"]\u672A\u914D\u7F6E\u4E3B\u952E\u5B57\u6BB5"));const i=lt(e.appDEFields||[],e.majorAppDEFieldId);if(i){const r=i.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get(){return r}}),Object.defineProperty(this,"srfmajortext",{set(n){this._data[r]=n},get(){return this._data[r]}})}else ibiz.log.warn("\u5B9E\u4F53[".concat(e.codeName,"]\u672A\u914D\u7F6E\u4E3B\u6587\u672C\u5B57\u6BB5"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:C(this.srfkey)?j():this.srfkey}),this.defineProperties()}defineProperties(){var e;const{_data:a,convertVal:s}=this,i={};Object.keys(a).forEach(n=>{i[n]={enumerable:!0,set(o){a[n]=o},get(){return a[n]}}}),(e=this._entity.appDEFields)==null||e.forEach(n=>{const o=n.codeName.toLowerCase();i[o]={enumerable:!0,set(u){a[o]=s(u,n.stdDataType)},get(){return a[o]}},a[o]=s(a[o],n.stdDataType)}),Object.defineProperties(this,i)}clone(){const e=new me(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return e instanceof me?a=e._data:a=e,Object.keys(a).forEach(s=>{a[s]===void 0&&delete a[s]}),Object.assign(this._data,a),this}convertVal(e,a){if(e==null||C(a))return e;if(kt.isNumber(a)){const s=!C(e)&&e!==""?Number(e):e;return Number.isNaN(s)?(ibiz.log.debug("".concat(e,"\u4E0D\u80FD\u8F6C\u6362\u6210\u6570\u5B57")),e):s}return e}}),zs=d("MethodDto",class Di{constructor(e,a,s){this.entity=e,this.isLocalMode=a,this.dto=s,this.dtoMap=new Map,s?(this.app=ibiz.hub.getApp(e.appId),this.fields=s.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(e){const a={};return e.forEach((s,i)=>{a[i+1]=s}),a}convertListMapToArray(e){const a=[];return Object.keys(e).forEach(s=>{const i=parseInt(s,10);a[i-1]=e[i]}),a}async get(e,a){const s={};for(let i=0;i<this.fields.length;i++){const r=this.fields[i],n=r.codeName.toLowerCase();switch(r.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":{if(r.listMap)a[n]&&(s[n]=a[n].length===0?null:this.convertArrayToListMap(a[n]));else{if(a[n]!==void 0||!r.refAppDataEntityId)break;const o=await this.getFieldDto(r),c=(await this.app.deService.getService(r.refAppDataEntityId)).local.getList(e);if(c){const l=[];for(let h=0;h<c.length;h++)l.push(await o.get(e,c[h]));s[n]=l}}break}default:throw new D(r,"\u672A\u652F\u6301\u7684\u5E94\u7528\u5B9E\u4F53\u65B9\u6CD5\u8F93\u5165\u5C5E\u6027\u7C7B\u578B: ".concat(r.type))}}return{...a,...s}}async sets(e,a){const s=await this.app.deService.getService(this.entity.id);return this.isLocalMode&&s.local.clear(e),Promise.all(a.map(async i=>{const r=this.fields.filter(o=>o.type==="DTOS").map(async o=>{const u=o.codeName.toLowerCase();if(o.listMap&&typeof i[u]=="object")i[u]=this.convertListMapToArray(i[u]);else{if(!o.refAppDataEntityId)return;const c=await this.getFieldDto(o),l=i[u];l?await c.sets(e,l):await c.sets(e,[])}});for(let o=0;o<r.length;o++)await r[o];const n=new ue(this.entity,i);return this.isLocalMode&&await s.local.add(e,n),n}))}async getFieldDto(e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),s=lt(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),i=new Di(a,!0,s);return this.dtoMap.set(e.codeName,i),i}});function ce(t){return t.actionType==="BUILTIN"||t.dataSetType==="DATAQUERY"}var Bn=d("MethodInput",class{constructor(t,e){this.entity=t,this.method=e;const a=e.appDEMethodInput;if(a){const s=lt(t.appDEMethodDTOs||[],a.appDEMethodDTOId);s&&(this.dto=new zs(t,this.isLocalMode,s))}}get isLocalMode(){return ce(this.method)}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),On=d("MethodReturn",class{constructor(t,e){this.entity=t,this.method=e;const a=e.appDEMethodReturn;if(a){const s=lt(t.appDEMethodDTOs||[],a.appDEMethodDTOId);s&&(this.dto=new zs(t,this.isLocalMode,s))}}get isLocalMode(){return ce(this.method)}async handle(t,e){return this.dto?(await this.dto.sets(t,[e]))[0]:(k(e)&&(e={}),new ue(this.entity,e))}}),Gs=d("Method",class{constructor(t,e){this.entity=t,this.method=e,this.app=ibiz.hub.getApp(t.appId),this.input=new Bn(t,e),this.result=new On(t,e)}async request(t,e,a,s){const{actionType:i,requestMethod:r}=this.method;if(i==="REMOTE"){const n=this.method.codeName.toLowerCase();let o=null;switch(r){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,n),a||s||{});break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,n),a||s);break;case"PUT":{o=await this.app.net.put(this.mergeRequestPath(t,n),a||s||{});break}case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,n),a||s);break;default:throw r?new m(this.method,"\u672A\u652F\u6301\u7684\u8BF7\u6C42\u65B9\u5F0F: ".concat(r)):new m(this.method,"\u672A\u914D\u7F6E\u8BF7\u6C42\u65B9\u5F0F")}return o}throw new m(this.method,"\u672A\u652F\u6301\u7684\u884C\u4E3A\u7C7B\u578B[".concat(i,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return oe(t,this.entity)+e}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(t){const e=a=>a instanceof ue?a.clone():new ue(this.entity,a);return q(t)?t.map(a=>e(a)):e(t)}}),_n=class{constructor(t,e,a,s){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:q(a)?a:[a],params:s}}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;(e=this.deLogicParams.get(t))==null||e.calc(this)}renewParam(t){var e;(e=this.deLogicParams.get(t))==null||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)}},js=class{},xn=class extends js{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,a){const s=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=a[this.value]!=null?a[this.value]:e[this.value];return tt(s[this.dstField],this.op,i)}case"SRCENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6E90\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=t.params[this.srcParam];return tt(s[this.dstField],this.op,i[this.value])}case"CURTIME":throw new D(this.model,"\u6682\u672A\u652F\u6301\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u5F53\u524D\u65F6\u95F4]");default:return tt(s[this.dstField],this.op,this.value)}}},Mn=class Ci extends js{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map(s=>s.logicType==="SINGLE"?new xn(s):new Ci(s))}get op(){return this.model.groupOP}get notMode(){return this.model.notMode===!0}test(e,a,s){let i=!0;if(this.conds.length===0)throw new m(this.model,"\u754C\u9762\u8FDE\u63A5\u6761\u4EF6\u903B\u8F91\u7EC4\u672A\u914D\u7F6E\u903B\u8F91\u9879");for(let r=0;r<this.conds.length;r++){const o=this.conds[r].test(e,a,s);if(this.op==="AND"&&o===!1){i=!1;break}if(this.op==="OR"&&o===!0){i=!0;break}}return this.notMode?!i:i}},Vn=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new Mn(e))}async exec(t){const{defaultLink:e}=this.model;return e||!this.groupCond?!0:this.groupCond.test(t,t.context,t.data[0]||{})}},X=class{constructor(t){this.model=t;var e;this.links=(e=t.links||[])==null?void 0:e.map(a=>new Vn(a))}},kn=class extends X{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDELogicParamId:s,retDELogicParamId:i}=this.model;if(!e)throw new m(this.model,"\u672A\u6307\u5B9A\u5E94\u7528\u5B9E\u4F53");if(!a)throw new m(this.model,"\u672A\u6307\u5B9A\u5B9E\u4F53\u884C\u4E3A");const r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(e,a,t.context,r,t.viewParam);o.ok&&(t.params[i]=o.data)}},Wn=class extends X{async exec(t){}},Un=class extends X{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;case"LOGICPARAMFIELD":case"BREAK":default:throw new D(this.model,"\u6682\u672A\u652F\u6301\u7684\u7ED3\u675F\u8282\u70B9\u8FD4\u56DE\u503C\u7C7B\u578B: ".concat(a))}}};function mt(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:i}=e,r=e.srcValueType||"SRCDLPARAM";let n=s,o;switch(r){case"SRCDLPARAM":o=t.params[a],t.isEntityParam(a)&&(n=n?.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(i);case"WEBCONTEXT":case"VIEWPARAM":o=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":o=t.parameters.context;break;case"ENVPARAM":o=I(ibiz.env);break;default:throw new D(e,"\u6682\u672A\u652F\u6301\u6E90\u503C\u7C7B\u578B".concat(r))}if(o&&n)try{Array.isArray(o)?o=o[Number(n)]:o=R.execScriptFn({srcValue:o},"srcValue.".concat(n),{singleRowReturn:!0,isAsync:!1})}catch(u){throw ibiz.log.error("\u4ECE\u6E90\u53C2\u6570\u53D6\u5C5E\u6027".concat(n,"\u62A5\u9519\uFF0C\u6E90\u53C2\u6570\uFF1A"),o),u}return o}var zn=class extends X{async exec(t){const e=this.model.delogicNodeParams;e?.length&&await Promise.all(e.map(a=>{switch(a.paramAction){case"SETPARAMVALUE":return this.setParamValue(a,t);case"RESETPARAM":return this.resetParam(a,t);case"COPYPARAM":return this.copyParam(a,t);case"BINDPARAM":return this.bindParam(a,t);case"RENEWPARAM":return this.renewParam(a,t);case"APPENDPARAM":return this.appendParam(a,t);case"SORTPARAM":return this.sortParam(a,t);default:throw new D(a,"\u6682\u672A\u652F\u6301\u903B\u8F91\u5904\u7406\u53C2\u6570\u64CD\u4F5C".concat(a.paramAction))}}))}copyParam(t,e){const{dstDELogicParamId:a}=t,s=mt(e,t);e.params[a]=I(s)}bindParam(t,e){const a=mt(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:s}=t;let i=a;e.isEntityParam(s)&&(i=i?.toLowerCase());const r=mt(e,t);i?e.params[s][i]=r:e.params[s]=r}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=t,n=mt(e,t),o=s||0,u=i||0,c=r||n.length;e.params[a].splice(o,0,...n.slice(u,c))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:s,dstSortDir:i}=t,r=s.toLowerCase();e.params[a].sort((o,u)=>i==="ASC"?o[r]-u[r]:u[r]-o[r])}},Gn=class extends X{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:s,retDELogicParamId:i}=this.model,r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(a,e,t.context,r);o.ok&&(t.params[i]=o.data)}},jn=class extends X{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=mt(t,this.model);t.params[e]=s}},Kn=class extends X{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.resetParam(e)}},Hn=class extends X{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.renewParam(e)}},Xn=class extends X{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=mt(t,this.model);t.params[e]=I(s)}},Yn=class extends X{async exec(t){const{dstDELogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u76EE\u6807\u5C5E\u6027\u914D\u7F6E");const i=s.toLowerCase();t.params[e].sort((n,o)=>a==="ASC"?n[i]-o[i]:o[i]-n[i])}},qn=class extends X{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const n=mt(t,this.model),o=s||0,u=i||0,c=r||n.length;t.params[e].splice(o,0,...n.slice(u,c))}},Qn=class extends X{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new ut({response:{status:e,statusText:a}})}},$n=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=I(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u5206\u9875\u67E5\u8BE2\u7ED3\u679C");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=I(t.data||{});else{if(a.envParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF");if(a.fileListParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u6587\u4EF6\u5BF9\u8C61\u5217\u8868\u53D8\u91CF");if(a.fileParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u6587\u4EF6\u5BF9\u8C61\u53D8\u91CF");if(a.filterParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u8FC7\u6EE4\u5668\u5BF9\u8C61\u53D8\u91CF");if(a.lastParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u6700\u540E\u6570\u636E\u53D8\u91CF");if(a.originEntity)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u539F\u59CB\u6570\u636E\u5BF9\u8C61");if(a.sessionParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u64CD\u4F5C\u4F1A\u8BDD\u53D8\u91CF")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else if(a.simpleParam||a.entityParam)t.params[e]={};else throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B\u91CD\u65B0\u5EFA\u7ACB\u53D8\u91CF")}},Jn=class{constructor(t){this.model=t,this.nodes=new Map,this.params=new Map;var e,a;if(t.customCode){if(!t.scriptCode)throw new m(t,"\u811A\u672C\u4EE3\u7801\u6A21\u5F0F\u6CA1\u6709\u914D\u7F6E\u811A\u672C\u4EE3\u7801");this.scriptFn=R.createScriptFn([],t.scriptCode,{isAsync:!0});return}if(!((e=t.delogicNodes)!=null&&e.length))throw new m(t,"\u5B9E\u4F53\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u903B\u8F91\u8282\u70B9");t.delogicNodes.forEach(s=>{const{logicNodeType:i}=s;let r;switch(i){case"BEGIN":r=new Wn(s);break;case"END":r=new Un(s);break;case"DEACTION":r=new kn(s);break;case"PREPAREPARAM":r=new zn(s);break;case"DEDATASET":r=new Gn(s);break;case"THROWEXCEPTION":r=new Qn(s);break;case"BINDPARAM":r=new jn(s);break;case"RESETPARAM":r=new Kn(s);break;case"COPYPARAM":r=new Xn(s);break;case"RENEWPARAM":r=new Hn(s);break;case"APPENDPARAM":r=new qn(s);break;case"SORTPARAM":r=new Yn(s);break;default:throw new D(s,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8282\u70B9\u7C7B\u578B: ".concat(i))}this.nodes.set(s.id,r)}),(a=t.delogicParams)==null||a.forEach(s=>{this.params.set(s.id,new $n(s))}),this.nodes.forEach(s=>{s.links.forEach(i=>{i.srcNode=s,this.nodes.has(i.model.thenId)&&(i.dstNode=this.nodes.get(i.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 _n(this.params,t,e,a);this.initLogicParams(s);const{startDELogicNodeId:i}=this.model;if(i&&this.nodes.has(i)){const r=this.nodes.get(i);await this.deepExec(r,s)}else throw new m(this.model,"\u672A\u8BBE\u7F6E\u8D77\u59CB\u8282\u70B9");return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let s=0;s<a.length;s++){const i=a[s];if(await i.exec(e)&&i.dstNode&&(await this.deepExec(i.dstNode,e),t.model.parallelOutput===!1))break}}},He=new Map;async function Zn(t,e,a){const s=await ibiz.hub.getAppDataEntity(e,a);return Be(t,s)}async function le(t,e,a={},s={}){return He.has(t)||He.set(t,new Jn(t)),He.get(t).exec(e,a,s)}async function Ks(t,e,a,s,i){const r=await Zn(t,e,a.srfappid);if(!r)throw new f("".concat(e,"\u627E\u4E0D\u5230\u5B9E\u4F53\u903B\u8F91").concat(t));return le(r,a,s,i)}async function Hs(t,e,a,s){const i=I(e),r=a&&I(a),n=s&&I(s);try{const o=await le(t,i,r,n);return new V(o)}catch(o){if(o instanceof ut)return new V(o,500);throw o}}async function Xs(t,e,a,s,i){const r=Ya(t,e);r.length&&(await Promise.all(r.map(o=>le(o,a,s,i)))).forEach(o=>{Object.assign(s,o)})}async function _t(t,e,a,s,i={}){if(s){if(q(s)){await Promise.all(s.map(r=>Xs(t,e,a,r,i)));return}return Xs(t,e,a,s,i)}}var to=d("DEActionMethod",class extends Gs{get isLocalMode(){return ce(this.method)}async inputHandle(t,e){return q(e)?e:this.input.handle(t,e)}async exec(t,e,a){if(e&&await _t(this.entity,"change",t,e,a),this.method.actionType==="DELOGIC"){const i=Be(this.method.appDELogicId,this.entity);if(!i)throw new m(this.method,"\u7F3A\u5C11\u5B9E\u4F53\u5904\u7406\u903B\u8F91");return Hs(i,t,e,a)}e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await _t(this.entity,"change",t,e,a);let s;switch(this.method.codeName){case"Create":s=await this.create(t,e,a||{});break;case"Get":s=await this.get(t,a);break;case"GetDraft":s=await this.getDraft(t,a);break;case"Remove":s=await this.remove(t,a);break;case"Update":s=await this.update(t,e,a);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,a);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let i=this.calcPath(t);if(this.method.needResourceKey){let n=t[this.entity.codeName.toLowerCase()];Aa(n)&&(n=q(e)?null:e?.[this.entity.keyAppDEFieldId]),i="".concat(i,"/").concat(n)}const r=await this.request(i,t,e,a);r.data=await this.result.handle(t,r.data),s=r}}return s.data&&await _t(this.entity,"compute",t,s.data,a),s}async create(t,e,a){if(!e)throw new f("create\u884C\u4E3A\u6CA1\u6709\u4F20data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const s=this.calcPath(t),i=await this.app.net.post(s,e,a);return i.data=await this.result.handle(t,i.data),i}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new f("update\u884C\u4E3A\u6CA1\u6709\u4F20data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const s=this.calcPath(t),i=await this.app.net.put("".concat(s,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return i.data=await this.result.handle(t,i.data),i}async get(t,e={}){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);return s.data=await this.result.handle(t,s.data),s}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get("".concat(a,"/getdraft"),e);return s.data=await this.result.handle(t,s.data),s}async createTemp(t,e){try{const a=await this.getService(),s=this.createEntity(e);let i;return q(s)?i=await Promise.all(s.map(r=>a.local.add(t,r))):i=await a.local.add(t,s),new V(i)}catch(a){throw new ut(a)}}async getDraftTemp(t,e){try{const a=this.createEntity({});return a?new V(a):new V(a,500)}catch(a){return new V(a,500)}}async removeTemp(t,e){try{let a=null;!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=(await this.getService()).local.delete(t,a);return i?new V(i):new V(i,500)}catch(a){throw new ut(a)}}async updateTemp(t,e){try{const a=await this.getService(),s=this.createEntity(e);let i;return q(s)?i=await Promise.all(s.map(r=>a.local.update(t,r))):i=await a.local.update(t,s),i?new V(i):new V(i,500)}catch(a){throw new ut(a)}}async getTemp(t,e){try{let a=null;!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=(await this.getService()).local.get(t,a);return i?new V(i):new V(i,500)}catch(a){throw new ut(a)}}async removeBatchTemp(t,e){return new V(!0)}}),eo=class{create(t,e,a){return new to(t,e)}},Ys=d("FetchMethod",class extends Gs{get isLocalMode(){return ce(this.method)}async exec(t,e,a){const s=e&&!q(e)?e:a||{};if(this.isLocalMode){const n=await this.searchLocal(null,new In(t,s));return new V(n,200)}let i;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":i=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const n=this.calcPath(t);i=await this.request(n,t,e,a)}break;default:throw new D(this.method,"\u6570\u636E\u6765\u6E90\u7C7B\u578B".concat(this.method.dataSetType,"\u6682\u672A\u652F\u6301"))}const r=i.data||[];return i.data=r.map(n=>this.createEntity(n)),i.data&&await _t(this.entity,"compute",t,i.data,s),i}async selectLocal(t,e={}){let s=(await this.getService()).local.getList(t);s=Ae(s,"srfordervalue");const i={},r={},n={},o={};e.srfkey&&(i.srfkey=ct(e.srfkey),delete e.srfkey);for(const c in e)if(Object.prototype.hasOwnProperty.call(e,c)){const l=e[c];l==null?(r[c]=ct(null),n[c]=ct(void 0),o[c]=ct("")):i[c]=ct(l)}if(!T(i)){const c=Ct(i),l=Ct(r),h=Ct(n),p=Ct(o);s=s.filter(E=>{if(T(r)){if(c(E))return!0}else if(c(E)&&(l(E)||h(E)||p(E)))return!0;return!1})}return s.map(c=>c.clone())}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){const s=await this.getService();let i=[];t?(i=s.local.getList(e.context),i.length>0&&(i=i.filter(l=>t.test(l,e)))):(i=await this.selectLocal(e.context,e.data),i.length>0&&e.query&&e.query!==""&&a&&(i=i.filter(l=>{const h=new RegExp(e.query);for(let p=0;p<a.length;p+=1){const E=a[p],w=l[E];if(h.test(w))return!0}return!1}))),!C(e.sortField)&&!T(e.sortField)&&(e.sortMode==="DESC"?i=Oa(i,e.sortField):i=Ae(i,e.sortField));const{page:r,size:n}=e,o=r*n,u=(r+1)*n-1;return i.slice(o,u).map(l=>I(l))}async fetchCodeListSet(t,e){const{appCodeListId:a}=this.method;if(!a)throw new m(this.method,"\u6CA1\u6709\u6307\u5B9A\u6570\u636E\u6765\u6E90\u4EE3\u7801\u8868");const s=await this.app.codeList.get(a,t,e),{keyAppDEFieldId:i,majorAppDEFieldId:r}=this.entity,n=s.map(o=>({[i]:o.value,[r]:o.text}));return new V(n,200)}}),ao=d("AcFetchMethod",class extends Ys{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),so=class{create(t,e,a){return a.acMode?new ao(t,e):new Ys(t,e)}};function qs(){const t=new eo;ne("DEACTION",()=>t);const e=new so;ne("FETCH",()=>e),ne("FETCHTEMP",()=>e)}var Xe=d("TreeNodeData",class{constructor(t,e,a){this.leaf=!1,this.leaf=a.leaf===!0,this.parent=e,this.parent&&(this.context={...this.parent.context}),a.navContext&&(this.context=Object.assign(this.context||{},a.navContext)),a.navParams&&(this.params={...a.navParams}),this.nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath)),Object.values(a).length>0?a:void 0}}),Qs=d("TreeCodeListNodeData",class extends Xe{constructor(t,e,a){super(t,e,a);const{data:s}=a;if(this.text=s.text,this.value=s.value,this.id=e?"".concat(e.id,":").concat(t.id,"@").concat(this.value):t.id+this.value,this.id=this.id.toLowerCase(),t.appDataEntityId){const i=B(t.appDataEntityId);this.context=Object.assign(this.context||{},{[i]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text,this.icon=this.calcIcon(t)}}),Ye=d("TreeDataSetNodeData",class extends Xe{constructor(t,e,a){super(t,e,a);const{data:s}=a;if(this.deData=s,this.text=t.textAppDEFieldId?s[t.textAppDEFieldId]:s.srfmajortext,this.value=t.idAppDEFieldId?s[t.idAppDEFieldId]:s.srfkey,this.id=e?"".concat(e.id,":").concat(t.id,"@").concat(s.srfkey):t.id+s.srfkey,this.id=this.id.toLowerCase(),t.appDataEntityId){const i=B(t.appDataEntityId);this.context=Object.assign(this.context||{},{[i]:s.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext,this.icon=this.calcIcon(t),this.textHtml=this.calcTextHtml(t),t.leafFlagAppDEFieldId&&(this.leaf=Ke(s[t.leafFlagAppDEFieldId]))}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:s}=t;a&&this.deData[a]&&(e.imagePath=this.deData[a]),e&&(this.icon=e);const i=s?.find(r=>r.id==="icon");return i&&(e.htmlStr=this.calcDataItemScript(i)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return R.execScriptFn({data:this.deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,s=a?.find(i=>i.id==="text");return s&&(e=this.calcDataItemScript(s)),e}}),$s=d("TreeStaticNodeData",class extends Xe{constructor(t,e,a){var s,i;super(t,e,a);const r=t.nodeValue==="root"?void 0:t.nodeValue;if(this.id=e?"".concat(e.id,":").concat(t.id):t.id,this.id=this.id.toLowerCase(),this.text=t.text,this.value=r,e&&a.parentValueLevel){let n=e;for(let o=1;o<a.parentValueLevel;o++)n=n?.parent;n?.deData&&(this.deData=n.deData),this.value=r||n?.value}this.srfkey=((s=this.deData)==null?void 0:s.srfkey)||this.value,this.srfmajortext=((i=this.deData)==null?void 0:i.srfmajortext)||this.text,this.icon=this.calcIcon(t)}}),Y=d("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,C(a.isOriginField)||(this.isOriginField=a.isOriginField),C(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(kt.isNumber(this.dataType)){const e=!C(t)&&t!==""?Number(t):t;return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"\u4E0D\u80FD\u8F6C\u6362\u6210\u6570\u5B57")),t):e}return t}}),io=d("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}});function ro(t,e){e.forEach(a=>{Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{enumerable:!0,configurable:!0,writable:!0,value:void 0})})}var no=["REGION","REGION2","REGION3","REGION4"],oo=d("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:s,longitudeAppDEFieldId:i,latitudeAppDEFieldId:r,textAppDEFieldId:n,dataAppDEFieldId:o,tipsAppDEFieldId:u,sysImage:c}=e,l=new Map;return this._id=a+t.srfkey,this._itemStyle=s,this._mapItemId=a,no.includes(this._itemStyle)?i&&l.set("_areaCode",i):(i&&l.set("_longitude",i),r&&l.set("_latitude",r)),u&&l.set("_tooltip",u),n&&l.set("_text",n),o&&l.set("_value",o),c&&(this._symbol=c.rawContent||c.imagePath),new Proxy(this,{set(h,p,E){return Object.prototype.hasOwnProperty.call(t,p)?t[p]=E:l.has(p)?t[l.get(p)]=E:h[p]=E,!0},get(h,p,E){if(h[p]!==void 0)return h[p];if(l.has(p))return t[l.get(p)];if(t[p]!==void 0)return t[p]},ownKeys(h){const p=[...new Set([...Object.keys(h),...Object.keys(t)])];return ro(h,p),p}})}});function uo(t,e){e.forEach(a=>{Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{enumerable:!0,configurable:!0,writable:!0,value:void 0})})}var co=d("PanelData",class{constructor(t,e){const a=new Dt,s={},i={};return t.forEach(r=>{var n;s[r.id]=(n=r.viewFieldName)==null?void 0:n.toLowerCase(),r.viewFieldName&&(i[r.viewFieldName.toLowerCase()]=r.id)}),new Proxy(this,{set(r,n,o){return Object.prototype.hasOwnProperty.call(s,n)?s[n]?e[s[n]]=o:r[n]=o:e[n]=o,a.emit("change",n),s[n]&&s[n]!==n&&a.emit("change",s[n]),i[n]&&i[n]!==n&&a.emit("change",i[n]),!0},get(r,n,o){return n==="_evt"?a:s[n]?e[s[n]]:Object.prototype.hasOwnProperty.call(e,n)?e[n]:r[n]},ownKeys(r){const n=Object.keys(e);return uo(r,n),n}})}destroy(){this._evt.reset()}});function lo(t,e){e.forEach(a=>{Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{enumerable:!0,configurable:!0,writable:!0,value:void 0})})}var ho=d("ChartData",class{constructor(t,e,a,s){return this._seriesModelId=e?.id,this._catalog=a,this._groupName=s,this._uuid=j(),new Proxy(this,{set(i,r,n){return Object.prototype.hasOwnProperty.call(t,r)?t[r]=n:i[r]=n,!0},get(i,r,n){if(i[r]!==void 0)return i[r];if(t[r]!==void 0)return t[r]},ownKeys(i){const r=[...new Set([...Object.keys(i),...Object.keys(t)])];return lo(i,r),r}})}}),M=(t,e,a={})=>{let s="";if(!t||!e.detreeNodeDataItems)return s;const i=e.detreeNodeDataItems.find(r=>r.id===t);return i&&i.appDEFieldId&&(s=a[i.appDEFieldId]),s},po=d("GanttStaticNodeData",class extends $s{constructor(t,e,a,s){super(e,a,s),this.sndataIteValue=M(t.sndataItemName,e),this.beginDataItemValue=M(t.beginDataItemName,e),this.endDataItemValue=M(t.endDataItemName,e),this.prevDataItemValue=M(t.prevDataItemName,e),this.finishDataItemValue=M(t.finishDataItemName,e),this.totalDataItemValue=M(t.totalDataItemName,e)}}),fo=d("GanttDataSetNodeData",class extends Ye{constructor(t,e,a,s){super(e,a,s);const{data:i}=s;this.sndataIteValue=M(t.sndataItemName,e,i),this.beginDataItemValue=M(t.beginDataItemName,e,i),this.endDataItemValue=M(t.endDataItemName,e,i),this.prevDataItemValue=M(t.prevDataItemName,e,i),this.finishDataItemValue=M(t.finishDataItemName,e,i),this.totalDataItemValue=M(t.totalDataItemName,e,i)}}),mo=d("GanttCodeListNodeData",class extends Qs{constructor(t,e,a,s){super(e,a,s);const{data:i}=s;this.sndataIteValue=M(t.sndataItemName,e,i),this.beginDataItemValue=M(t.beginDataItemName,e,i),this.endDataItemValue=M(t.endDataItemName,e,i),this.prevDataItemValue=M(t.prevDataItemName,e,i),this.finishDataItemValue=M(t.finishDataItemName,e,i),this.totalDataItemValue=M(t.totalDataItemName,e,i)}}),Eo=d("MqttService",class{constructor(t,e,a){if(this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new Dt,this.options={connectTimeout:6e3,clientId:j(),username:"",password:"",keepalive:60,clean:!0},k(t)||k(e))throw new Error("mqttTopic or token is empty");this.options.username=t,this.options.password=e}async connect(){const t=await da.import("mqtt/dist/mqtt.min"),e=t.default?t.default:t,{location:a}=window;this.client=e.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",s=>{ibiz.log.error("mqtt error",s)}),this.client.on("message",(s,i)=>{this.evt.emit("message",JSON.parse(i.toString())),ibiz.log.debug("mqtt message",s,i.toString())}),this.client.on("reconnect",()=>{ibiz.log.debug("mqtt reconnect")}),this.client.on("close",()=>{console.debug("mqtt close")})}close(){var t;(t=this.client)==null||t.end()}}),go=d("DEServiceUtil",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map}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 f("\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[".concat(t,"]"));const a=this.constructorCache.get(t);let s;a?s=await a(e):s=new Pn(e),this.cache.set(t,s)}return this.cache.get(t)}clearTempCache(t){this.cache.forEach(e=>{e.local.clear(t)})}async exec(t,e,a,s,i){return(await this.getService(t)).exec(e,a,s,i)}}),Js=class vi{constructor(){ibiz.commands.register(vi.TAG,this.exec.bind(this))}async exec(e,a,s={},i={}){const r=I(a),n=await ibiz.hub.config.view.get(e);if(!n)throw new f("\u5E94\u7528\u89C6\u56FE[".concat(e,"]\u4E0D\u5B58\u5728"));if((r.srfkey||s.srfuf===0)&&n.appDataEntityId){const u=B(n.appDataEntityId);r.srfkey&&(r[u]=r.srfkey,r.srfkey=void 0),s.srfuf===0&&(r[u]=void 0,delete s.srfuf)}if(n.redirectView){const u=await ibiz.hub.getAppView(e);return is(u,r,s,i)}const{openMode:o="INDEXVIEWTAB"}=n;switch(i.openMode||o){case"INDEXVIEWTAB":return i.noWaitRoute?(this.openIndexViewTab(n,r,s),{ok:!0}):this.openIndexViewTab(n,r,s);case"POPUP":throw new D(n,"\u672A\u652F\u6301\u7684\u89C6\u56FE\u6253\u5F00\u6A21\u5F0F: POPUP");case"POPUPMODAL":return this.openModal(n,r,s);case"POPUPAPP":throw new D(n,"\u672A\u652F\u6301\u7684\u89C6\u56FE\u6253\u5F00\u6A21\u5F0F: POPUPAPP");case"POPOVER":return this.openPopover(n,i.event,r,s);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(n,r,s);case"USER":return this.openUserCustom(n,r,s);default:return this.openIndexViewTab(n,r,s)}}openIndexViewTab(e,a,s={}){return ibiz.openView.root(e.id,a,s)}async openModal(e,a,s={}){return ibiz.openView.modal(e.id,a,s)}async openPopover(e,a,s,i={}){if(!a)throw new f("\u6C14\u6CE1\u6253\u5F00\u7F3A\u5C11event");return ibiz.openView.popover(e.id,a,s,i)}async openDrawer(e,a,s={}){return ibiz.openView.drawer(e.id,a,s)}async openUserCustom(e,a,s={}){return ibiz.openView.custom(e.id,a,s)}};Js.TAG="ibiz.app-view.open";var et=d("OpenAppViewCommand",Js),Zs=class Ii{constructor(){ibiz.commands.register(Ii.TAG,this.exec.bind(this))}async exec(e,a,s={},i={}){const n=(await ibiz.hub.getAppAsync(a.srfappid)).getAppFunc(e);if(!n)throw new f("\u627E\u4E0D\u5230\u53EB".concat(e,"\u7684\u5E94\u7528\u529F\u80FD"));const{navigateContexts:o,navigateParams:u,appFuncType:c}=n,l=a.clone();Object.assign(l,F(o,s,a));const h=F(u,s,a);switch(c){case"APPVIEW":return this.openAppView(n,l,h,i);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 D(n,"\u672A\u652F\u6301\u7684\u5E94\u7528\u529F\u80FD\u7C7B\u578B: ".concat(c))}}async openAppView(e,a,s,i){if(!e.appViewId)throw new f("\u5E94\u7528\u89C6\u56FE[".concat(e.appViewId,"]\u4E0D\u5B58\u5728"));return ibiz.commands.execute(et.TAG,e.appViewId,a,s,i)}openHtmlPage(e){const a=e.htmlPageUrl;window.open(a,"_blank")}openPdAppFunc(e,a,s){throw ibiz.log.warn("openPdAppFunc",e,a,s),new f("\u672A\u5B9E\u73B0")}executeJavaScript(e,a,s){throw ibiz.log.warn("executeJavaScript",e,a,s),new f("\u672A\u5B9E\u73B0")}custom(e,a,s){throw ibiz.log.warn("custom",e,a,s),new f("\u672A\u5B9E\u73B0")}};Zs.TAG="ibiz.app-func.exec";var qe=d("AppFuncCommand",Zs);function ti(){new qe,new et}var wo=d("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new fa({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new Bt(t.appId,"PSSysApp",t.codeName),this.deService=new go(t),this.codeList=new An(t),this.authority=new Ln(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),ibiz.env.enableMqtt&&ibiz.appData&&(this.mqtt=new Eo(ibiz.appData.mqtttopic,ma(),this.model.appId),this.mqtt.evt.on("message",t=>{ibiz.mc.command.asyncAction.next(t)}),await this.mqtt.connect())}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(s=>s.id===t)||null}async getUIAction(t){const[,e]=t.split("@");if(e){const s=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find(i=>i.id===t);if(s)return s}return this.model.appDEUIActions.find(a=>a.id===t)}async getOPPriv(t,e){var a,s;let i=(a=this.model.deopprivs)==null?void 0:a.find(r=>r.name===t);return!i&&e&&(i=(s=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)==null?void 0:s.find(n=>n.name===t)),i}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find(s=>s.id===t)}}),Do=class{parse(t){return t}},Co=class{constructor(){this.appMenu=new Do}},vo=class{constructor(){this.viewConfigs=new Map}has(t){return this.viewConfigs.has(t)}set(t,e){this.viewConfigs.set(t,e)}async get(t){if(!this.viewConfigs.has(t)){const e=await ibiz.hub.getAppView(t);if(!e)throw new f("\u89C6\u56FE[".concat(t,"]\u4E0D\u5B58\u5728"));this.set(e.id,{id:e.id,codeName:e.codeName,openMode:e.openMode,viewType:e.viewType,width:e.width,height:e.height,appDataEntityId:e.appDataEntityId,redirectView:e.redirectView})}return this.viewConfigs.get(t)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},Io=class{constructor(){this.view=new vo}},Ao=d("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ao||{})),yo=d("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(yo||{})),Fo=d("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Fo||{})),ei=d("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return this.state==="Used"?this.count:(this.count+=1,this.count)}decrement(t){if(this.state!=="Used"){if(this.count===0)throw new f("\u9519\u8BEF\u7684\u8C03\u7528\uFF01decrement\u4E0D\u80FD\u5BF9count\u4E3A0\u8C03\u7528");this.count-=1,this.count===0&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Po=d("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new ei(Ea)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement(()=>{this.isLoading=!1})}}),bo=d("CTXState",class{}),No=d("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new Dt(3e3),this.controllersMap=new Map,this.state=new bo}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){if(this.controllersMap.has(t))return this.controllersMap.get(t);if(this.parent&&e)return this.parent.getController(t)}getTopView(){return this.parent?this.view.modal.routeDepth===2?this.view:this.parent.getTopView():this.view}}),So=d("ActivityCounter",class extends ei{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){this.state==="Unused"&&!this.registration.has(t)&&(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&this.registration.get(t)===!1&&(this.registration.set(t,!0),this.decrement())}}),Et=d("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId){this.isInit=!0;return}const t=await Qt(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:s,uiactionMode:i,uiactionTag:r}=t;this.dataAccessAction=e,a===1?this.noPermissionHidden=!1:a===6&&(this.visible=!1),(s&&s!=="NONE"||i==="SYS"&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(r))&&(this.noDataDisabled=!0,(s==="SINGLEKEY"||s==="MULTIKEY")&&(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"\u754C\u9762\u884C\u4E3A\u7684\u5B9E\u4F53").concat(this.appDeName,"\u548C\u6570\u636E\u7684\u5B9E\u4F53").concat(e,"\u4E0D\u4E00\u81F4")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),gt=d("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>this.children.length===0?!1:!!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:!1})}async update(t,e){await Promise.all(this.children.map(a=>a.update(t,e)))}}),Lo=d("QXEventEx",class extends Dt{constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach(a=>{a(t,...e)})}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),s=this.anyEventFns.map(o=>o(t,...e)),i=Promise.all(s),r=await a,n=await i;return r.concat(...n)}reset(){super.reset(),_a(this.anyEventFns)}}),Ro=d("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new Lo}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 Qe(t){return window.location.hash.split("/").length>t*2+2}function $e(t,e){return(C(t)||t==="")&&(C(e)||e==="")?!1:t!==e}function ai(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof K&&(e=e.getOrigin()),e}function Je(t,e,a){const s=[];return t.forEach(i=>{const{valueRuleType:r}=i,n=i.sysValueRule,o=i.defvalueRule;if(r==="SYSVALUERULE"&&n)n.ruleType==="REG"?s.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):n.ruleType==="SCRIPT"&&s.push({validator:(u,c,l,h)=>{if(!c)return!0;try{R.execScriptFn({rule:u,value:c,callback:l,source:h},n.scriptCode,{isAsync:!1})}catch(p){return console.error(p),!1}return!0},trigger:"change blur"});else if(r==="DEFVALUERULE"&&o){const u=a||e;s.push({validator:(c,l,h,p)=>{if(k(p[u]))return!0;const{isPast:E,infoMessage:w}=_e(u,p,o.groupCond);return E||h(new f(w||o.ruleInfo)),!0},trigger:"change blur"})}}),s}function Ze(t){const e=[],{maxLength:a,minLength:s}=t,{maxValue:i,minValue:r}=t;return a&&e.push({validator:(n,o,u)=>{if(!C(o)&&o.length>a)u(new Error("\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E".concat(a,",\u5F53\u524D\u957F\u5EA6\u4E3A").concat(o.length)));else return!0}}),s&&e.push({validator:(n,o,u)=>{if(!C(o)&&o.length<s)u(new Error("\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E".concat(s,",\u5F53\u524D\u957F\u5EA6\u4E3A").concat(o.length)));else return!0}}),C(i)||e.push({validator:(n,o,u)=>{if(!C(o)&&ye(o)&&o>i)u(new Error("\u503C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E".concat(i)));else return!0}}),C(r)||e.push({validator:(n,o,u)=>{if(!C(o)&&ye(o)&&o<r)u(new Error("\u503C\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E".concat(r)));else return!0}}),e}var To=d("ValueExUtil",class{static mergeDefault(t){return Pe(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(C(e)||e==="")return"";const{valueType:a,objectNameField:s,textSeparator:i}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!s)throw new f("\u7F3A\u5C11objectNameField");const r=s.toLowerCase();return a==="OBJECTS"?e.map(n=>n[r]||"---").join(i):e[r]}return a==="SIMPLES"?e.join(i):"".concat(e)}});function ta(t,e){var a;const{name:s,valueType:i,defaultValue:r,valueFormat:n}=t,{data:o,context:u,params:c}=e;if(C(i)&&C(r))return;if(i==="RESET")return null;const l=o[s];if(!be(l)){if(!i&&r)return r;switch(i){case"APPDATA":if(Object.prototype.hasOwnProperty.call(c,r))return c[r];if(Object.prototype.hasOwnProperty.call(u,r))return u[r];break;case"OPERATORNAME":return u.srfusername;case"OPERATOR":return u.srfuserid;case"CURTIME":return S().format(n);case"PARAM":return o[r];case"SESSION":case"APPLICATION":if(!((a=ibiz.appData)!=null&&a.context))throw new f("appdata.context\u4E0D\u5B58\u5728");return ibiz.appData.context[r];case"CONTEXT":return c[r];case"UNIQUEID":return j();default:throw new D({},"\u9ED8\u8BA4\u503C\u7C7B\u578B[".concat(i,"]\u672A\u652F\u6301"))}}}var Bo="asyncimportdata2",Oo="importdata2";function _o(t){return new Promise(e=>{const a=s=>{const i=s.messageid||s.data.asyncacitonid;if(t!==i)return;const r=s.data.actionstate;(r===30||r===40)&&(e(),ibiz.mc.command.asyncAction.off(a))};ibiz.mc.command.asyncAction.on(a)})}async function xo(t,e,a){const s=new FormData;s.append("file",t);let i="".concat(e.codeName2.toLowerCase(),"/").concat(Bo);a?.codeName&&(i+="?srfimporttag=".concat(a.codeName));const r=await ibiz.net.request(i,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});await _o(r.data.asyncacitonid),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED")}async function Mo(t,e,a){const s=new FormData;s.append("file",t);let i="".concat(e.codeName2.toLowerCase(),"/").concat(Oo);return a?.codeName&&(i+="?srfimporttag=".concat(a.codeName)),(await ibiz.net.request(i,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}})).data}async function si(t,e,a){if(!ibiz.util.getExcelUtil)throw new f("ibiz.util.getExportExcel\u4E0D\u5B58\u5728");const s=await ibiz.util.getExcelUtil();if(!s)throw new f("\u5BFC\u51FA\u6A21\u5757\u52A0\u8F7D\u9519\u8BEF");try{return s.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch{return{ok:!1}}}var ea="__self",ii=d("BaseController",class{constructor(t,e,a,s){this.model=t,this.context=e,this.params=a,this.ctx=s,this.state={},this.name="",this.evt=new Ro(this.getEventArgs.bind(this)),this.mountCounter=new So(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(ea),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(ea)||this.mountCounter.attend(ea)}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)}}),Vo=class Ai{constructor(e){this.msgGroupId=e,this.viewMsgMap=new Map}async init(e){var a,s;const i=ibiz.hub.getApp(e.srfappid).model,r=(a=i.appViewMsgGroups)==null?void 0:a.find(o=>o.id===this.msgGroupId);if(!r)throw new f("\u627E\u4E0D\u5230\u89C6\u56FE\u6D88\u606F\u7EC4".concat(this.msgGroupId,"\u7684\u6A21\u578B"));this.msgGroup=r;const n=r.appViewMsgGroupDetails.map(o=>o.appViewMsgId);if((s=i.appViewMsgs)==null||s.forEach(o=>{const u=n.indexOf(o.id);u!==-1&&(this.viewMsgMap.set(o.id,o),n.splice(u,1))}),n.length)throw new f("\u6CA1\u6709\u627E\u5230".concat(n.join(","),"\u89C6\u56FE\u6D88\u606F\u6A21\u578B"))}getDeFieldName(e,a){var s,i;if(a)return(i=(s=At(e,a))==null?void 0:s.name)==null?void 0:i.toLowerCase()}static async fetchDataSet(e,a,s){const{appDataEntityId:i,appDEDataSetId:r}=e;if(!r)throw new m(e,"\u672A\u914D\u7F6E\u5B9E\u4F53\u6570\u636E\u96C6");const n=await ibiz.hub.getApp(a.srfappid).deService.exec(i,r,a,s);return n.data.length?n.data:[]}async calcViewMessages(e,a){const s=this.msgGroup.appViewMsgGroupDetails,i=[];return s?.length&&await Promise.all(s.map(async r=>{if(this.viewMsgMap.get(r.appViewMsgId).dynamicMode===1){const o=await this.calcDynaMsgs(r,e,a);i.push(...o)}else{const o=this.calcStaticMsg(r);i.push(o)}})),i}calcStaticMsg(e){const{position:a}=e,s=this.viewMsgMap.get(e.appViewMsgId),{title:i,message:r,removeMode:n,position:o,messageType:u}=s,{userTag:c,userTag2:l,userTag3:h,userTag4:p}=s;return{title:i,message:r,position:a||o,messageType:u,removeMode:n,extraParams:{userTag:c,userTag2:l,userTag3:h,userTag4:p}}}async calcDynaMsgs(e,a,s){const i=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:r,orderValueAppDEFieldId:n,titleAppDEFieldId:o,removeFlagAppDEFieldId:u,msgTypeAppDEFieldId:c,contentAppDEFieldId:l,msgPosAppDEFieldId:h}=i;if(!r)throw new m(i,"\u672A\u914D\u7F6E\u5E94\u7528\u5B9E\u4F53");const p=await ibiz.hub.getAppDataEntity(r,a.srfappid),E={...s},w=this.getDeFieldName(p,n);w&&(E.sort="".concat(w,",asc"));const y=await Ai.fetchDataSet(i,a,E);if(!y.length)return[];const v=this.calcStaticMsg(e),P=this.getDeFieldName(p,o),b=this.getDeFieldName(p,h),A=this.getDeFieldName(p,l),L=this.getDeFieldName(p,c),G=this.getDeFieldName(p,u);return y.map(N=>{const at={};return b&&!C(N[b])&&(at.position=N[b]),P&&!C(N[P])&&(at.title=N[P]),A&&!C(N[A])&&(at.message=N[A]),L&&!C(N[L])&&(at.messageType=N[L]),G&&!C(N[G])&&(at.removeMode=N[G]),Fe(v,at)})}},ri=d("ViewController",class extends ii{constructor(t,e,a,s){const i=ibiz.util.layoutPanel.fill(t);super(i,Vt.create({},e),a||{},new No(s)),this.session={},this.modal=new Wr({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Po,this.isCloseView=!1,this._isActive=!0,s&&s.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return(t=this.ctx.parent)==null?void 0:t.view}get isActive(){return this._isActive}onActivated(){this._isActive=!0,ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u6FC0\u6D3B"))}onDeactivated(){this._isActive=!1,ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u6682\u505C"))}initEngines(){const t=ts(this.model);if(t.length)t.forEach(e=>{const a=ibiz.engine.getEngine(e,this);a?this.engines.push(a):ibiz.log.warn("\u672A\u627E\u5230\u89C6\u56FE\u5F15\u64CE\u5B9E\u73B0\uFF1A",e)});else{const e=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);e&&this.engines.push(e)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map(async a=>{const s=await Us.getCounterByRef(a,this.context);this.counters[a.id]=s}))}catch(a){console.error(a)}}initState(){super.initState(),this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise(async i=>{be(this.state.closeOK)&&(i.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...i})}),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 ft(t);this.providers[t.name]=e;const a=Ja(this.model);a&&await Promise.all(a.map(async i=>{const r=await ft(i);this.providers[i.name||i.id]=r})),await this.initCounters();const s=Za(this.model);s.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(s),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll((i,r)=>{this.scheduler.triggerViewEvent(r)})),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map(i=>i.onCreated()))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map(e=>e.onMounted())),(t=this.scheduler)==null||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map(t=>t.onDestroyed())),this.ctx.destroy(),this.context.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u9500\u6BC1"))}handleContextParams(){this.context.srfappid=this.model.appId,(C(this.context.srfsessionid)||T(this.context.srfsessionid))&&(this.context.srfsessionid=j());const t=this.model.appViewNavContexts;let e={};x(t)&&(e=F(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let s={};x(a)&&(s=F(a,this.params,this.context)),Object.assign(this.params,s),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const s of this.engines)if(a=await s.call(t,e),a!==void 0)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(a===void 0)throw new f("\u6CA1\u6709\u5F15\u64CE\u652F\u6301\u9884\u7F6E\u754C\u9762\u884C\u4E3A".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",()=>{this.mountCounter.attend(this.layoutPanel.model.name)}),(e=this.scheduler)!=null&&e.hasControlEventTrigger&&t.evt.on("onControlEvent",a=>{this.scheduler.triggerControlEvent(a.triggerControlName,a.triggerEventName,a.triggerEvent)})}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;t&&(this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Vo(t),await this.viewMsgController.init(this.context),(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach(a=>{["TOP","BOTTOM","BODY","POPUP"].includes(a.position)&&this.state.viewMessages[a.position].push(a)}),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP))}async alertViewMessage(t){const[e,...a]=t,s={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(s,{confirmButtonText:e.extraParams.userTag}),e.messageType==="WARN"?await ibiz.modal.warning(s):e.messageType==="ERROR"?await ibiz.modal.error(s):await ibiz.modal.info(s),a.length&&this.alertViewMessage(a)}}),Nc=d("MobViewController",class extends ri{}),Sc=d("WFStepTraceViewController",class extends ri{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid);if((t=this.ctx.parent)!=null&&t.view.model.appDataEntityId){const a=await e.deService.getService(this.ctx.parent.view.model.appDataEntityId),s=Object.assign(this.context.clone(),this.params),i=await a.wf.getWFHistory(s);i.data&&(this.state.historyData=i.data)}}}),ko=d("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}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;t>0&&t<=1?this.style.width="".concat(t*100,"%"):this.style.width="".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;t>0&&t<=1?this.style.height="".concat(t*100,"%"):this.style.height="".concat(t,"px")}}handlePublicParams(t,e,a){const{navigateContexts:s,navigateParams:i}=this.model;let r={};s&&t&&(r=F(s,t,a,e));const n=Object.assign(e.clone(),r);let o={};return i&&t&&(o=F(i,t,a,e)),{context:n,params:o}}toObj(t){return t?new Function("return (".concat(t,");"))():void 0}toBoolean(t){return Object.is("true",t)}}),Lc=d("CodeListEditorController",class extends ko{async loadCodeList(t){const{context:e,params:a}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const s=await ibiz.hub.getApp(this.context.srfappid);let i=[];return i=await s.codeList.get(this.model.appCodeListId,e,a),i}throw new m(this.model,"\u7F16\u8F91\u5668\u7C7B\u578B[".concat(this.model.editorType,"]\uFF0C\u672A\u914D\u7F6E\u4EE3\u7801\u8868"))}}),H=d("ControlController",class extends ii{constructor(t,e,a,s){if(super(t,Vt.create({},e),new ga({},a),s),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=ja(t),!this.controlPanel){const i=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));i&&(this.controlPanel=I(i))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const e=await ft(this.controlPanel);this.providers[this.controlPanel.name]=e}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(t=this.scheduler)!=null&&t.hasControlEventTrigger&&this._evt.onAll((e,a)=>{this.scheduler.triggerControlEvent(a.targetName,a.eventName,a)})}async onMounted(){var t;await super.onMounted(),(t=this.scheduler)==null||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let s={};x(e)&&(s=F(e,this.params,this.context)),Object.assign(this.context,s);let i={};x(a)&&(i=F(a,this.params,this.context)),Object.assign(this.params,i)}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()}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let s=this.getData()||[];return t?.data&&(s=Array.isArray(t.data)?t.data:[t.data]),t?.context&&Object.assign(e,t.context),t?.viewParam&&Object.assign(a,t.viewParam),{context:e,params:a,data:s}}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={};x(t)&&(e=F(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){t.length!==0&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:s}=this.model,i=(a=s?.ctrlMsgItems)==null?void 0:a.find(o=>o.name===t);let r,n;if(i&&i.content){n=C(i.timeout)?void 0:i.timeout/1e3;const o={...this.getEventArgs()};e?.data&&(o.data=e.data),r=R.execScriptFn(o,"`".concat(i.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const o="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();r=ibiz.i18n.t(o,""),r===o&&(r="")}if(!r&&e?.default&&(r=e.default),!r&&e?.error&&(r=r||e.error.message),!!r){if(e?.error)throw ibiz.log.error(e.error),new Ee(r,n);ibiz.message.success(r,n,n===0)}}}),$=d("MDControlController",class extends H{constructor(){super(...arguments),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=[]}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),(t=this.dataEntity.appDEFields)==null||t.forEach(a=>{this.fieldIdNameMap.set(a.id,a.name)});const e=this.onDataChange.bind(this);this.onDataChange=Ht(a=>{e(a)},300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&this.refresh()}setSort(t,e){t&&e&&(this.state.sortQuery="".concat(t,",").concat(e))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:s,noSort:i}=this.state,r={...this.params};return a&&(r.page=e-1,r.size=a),!i&&s&&(r.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(r,{...this.state.searchParams}),t&&Object.assign(r,t),r}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=t.isInitialLoad===!0,a=t.isLoadMore===!0;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:s}=this.handlerAbilityParams(t),i=await this.getFetchParams(t?.viewParam),r=await this.service.fetch(s,i);typeof r.total=="number"&&(this.state.total=r.total),a?this.state.items.push(...r.data):this.state.items=r.data,await this.afterLoad(t,r.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(e){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:e}),e}finally{await this.endLoading()}return this.state.items.forEach((e,a)=>{e.srfserialnum=a+1}),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:s}=this.handlerAbilityParams(t);if(!s?.length)throw new f("\u672A\u9009\u4E2D\u6570\u636E");if(t?.silent!==!0&&!await ibiz.confirm.error({title:"\u6570\u636E\u5220\u9664",desc:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F"}))return;await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let i=!1;try{const r=B(this.model.appDataEntityId);await it(s.map(async n=>{if(n.srfuf!==0){const o=e.clone();o[r]=n.srfkey,await this.service.remove(o,a),i=!0}this.afterRemove(n)})),t?.silent!==!0&&this.actionNotification("REMOVESUCCESS",{data:s,default:"\u6570\u636E[".concat(s.map(n=>n.srfmajortext).join("\u3001"),"]\u5220\u9664\u6210\u529F!")}),i&&!t?.notRefresh&&await this.refresh()}catch(r){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:r,data:s}),r}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex(a=>a.srfkey===t.srfkey);e!==-1&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){const{selectedData:e}=this.state;wa(e,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}))}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter(s=>s.srfkey!==t.srfkey);a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),this.state.mdctrlActiveMode===1&&await this.setActive(t)}async onDbRowClick(t){this.state.mdctrlActiveMode===2&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,s=await ibiz.hub.getAppDataEntity(e,this.model.appId),i=(t=s.appDEDataImports)==null?void 0:t.find(o=>o.id===a);if(!i)throw new f("\u65E0\u5BFC\u5165\u6A21\u578B\uFF01");let r="DataImport";i.enableCustomized&&(r="DataImport2");const n=ibiz.overlay.createModal(r,{dismiss:()=>n.dismiss(),appDataEntity:s},{width:"auto",placement:"center"});n.present(),await n.onWillDismiss()}async exportData(t){}}),Wo=d("AppMenuController",class extends H{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),(t=this.model.appMenuItems)==null||t.forEach(e=>{this.initMenuItemState(e)})}async onClickMenuItem(t,e,a=!0){const s=ge(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new f("\u627E\u4E0D\u5230\u540D\u4E3A".concat(t,"\u7684\u83DC\u5355\u9879"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!s.appFuncId)throw new m(s,"\u6CA1\u6709\u914D\u7F6E\u5E94\u7528\u529F\u80FD");const i=this.context.clone();i.srfappid=s.appId,this.routeDepth&&a&&Object.assign(i,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(qe.TAG,s.appFuncId,i,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let s=!0;t.accessKey&&(s=this.app.authority.calcByResCode(t.accessKey));let i=s;if((e=t.appMenuItems)!=null&&e.length){const r=t.appMenuItems.map(n=>this.initMenuItemState(n).visible);i=i&&r.includes(!0)}a.permitted=s,a.visible=i}return this.state.menuItemsState[t.id]=a,a}getAllItems(){const t=[],e=a=>{a.forEach(s=>{t.push(s),s.appMenuItems&&s.appMenuItems.length>0&&e(s.appMenuItems)})};return e(this.model.appMenuItems),t}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}}),Rc=d("AppMenuIconViewController",class extends Wo{async onClickMenuItem(t,e){const a=ge(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!a)throw new f("\u627E\u4E0D\u5230\u540D\u4E3A".concat(t,"\u7684\u83DC\u5355\u9879"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!a.appFuncId)throw new m(a,"\u6CA1\u6709\u914D\u7F6E\u5E94\u7528\u529F\u80FD");const s=this.context.clone();this.routeDepth===1&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(qe.TAG,a.appFuncId,s,this.params)}}),Uo=d("CalendarService",class extends rt{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const s=a.map(async n=>{const o=n.appDEDataSetId||"fetchdefault";return this.exec2(o,t,e,void 0,n.appDataEntityId)});return(await Promise.all(s)).map((n,o)=>this.setCalendarConfigData(n.data,o)).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new f("\u672A\u627E\u5230\u65E5\u5386\u9879\u6A21\u578B");const s=a[e];if(!s)throw new f("\u672A\u627E\u5230\u65E5\u5386\u9879\u6A21\u578B");return t.map(i=>new io(s,i))}async exec2(t,e,a={},s={},i=this.model.appDataEntityId){return await this.app.deService.exec(i,t,e,a,s)}}),Tc=d("CalendarController",class extends ${initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Uo(this.model),await this.service.init(this.context)}async load(t={}){const e=t.isInitialLoad===!0,{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(t?.viewParam);await this.startLoading();let i;try{i=await this.service.search(a,s)}finally{await this.endLoading()}return await this.afterLoad(t,i),this.state.isLoaded=!0,this.state.items=i,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),i}sortItems(){this.model.calendarStyle==="TIMELINE"&&this.state.items.sort((t,e)=>{const a=t.beginTime,s=e.beginTime;let i=0;return S(a).isAfter(s)?i=-1:S(a).isBefore(s)&&(i=1),i})}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:s}=t;if(!a||!s){const i=new Date(e.getFullYear(),e.getMonth(),1),r=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:S(i).format("YYYY-MM-DD HH:mm:ss"),srfenddate:S(r).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:s}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:s,noSort:i}=this.state,r={...this.params};if(!i&&s&&(r.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(r,{...this.state.searchParams}),a&&(r.page=e-1,r.size=a),t&&Object.assign(r,t),this.model.calendarStyle!=="TIMELINE"){const n=this.getCurSelectDate(r);Object.assign(r,n)}return r}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter(s=>s.deData.srfkey!==t.deData.srfkey);a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),this.state.mdctrlActiveMode===1&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});S.extend(Pi),S.extend(Ni),S.extend(Li),S.extend(Ti),S.extend(Oi);var de="$default_group",Ft=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:a,caption:s,id:i,userParam:r}=t;if(!t.catalogField)throw new m(t,"\u7F3A\u5C11\u5206\u7C7B\u5C5E\u6027\u914D\u7F6E");if(!t.valueField)throw new m(t,"\u7F3A\u5C11\u503C\u5C5E\u6027\u914D\u7F6E");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:n,chartYAxisId:o}=a||{};this.xAxisIndex=De(n),this.yAxisIndex=De(o),this.seriesName=s||i,this.staticOptions=this.calcStaticOptions(),r&&(this.seriesUserParam=aa(r))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(C(e))return;if(C(t))return e;const s=this.chartGenerator.codeListMap.get(t);if(s?.length){const i=s.find(r=>r.value===e);if(i)return i.text}return a?void 0:e}prepareChartData(t,e,a,s){var i;this.groupField&&Object.assign(e,{[this.groupField]:s}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const r=new ho(e,this.model,a,s);t[s].get(a).chartData=r,(i=this.chartDataArr)==null||i.push(r)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:s}=this.model;return t.forEach(i=>{let r=de;if(this.groupField){const o=this.translateVal(a,i[this.groupField]);if(C(o))return;r=o}e[r]||(e[r]=new Map,s&&this.autoCompleteCategory&&this.chartGenerator.codeListMap.get(s).forEach(u=>{e[r].set(u.text,{value:0})}));const n=this.translateVal(s,i[this.catalogField],!0);if(!n){s&&this.autoCompleteCategory&&this.chartGenerator.codeListMap.get(s).forEach(u=>{this.prepareChartData(e,{[this.valueField]:0},u.text,r)});return}e[r].get(n)||e[r].set(n,{value:0}),e[r].get(n).value=Kt(e[r].get(n).value,i[this.valueField]),e[r].get(n).chartData?this.prepareChartData(e,{[this.valueField]:e[r].get(n).value},n,r):this.prepareChartData(e,i,n,r)}),e}calcGroupSeries(t){return Object.keys(t).map(e=>{const a=t[e],s=this.calcSeriesData(a);let i={...this.staticOptions,data:s};return e!==de&&(i.name=e),this.seriesUserParam&&(i=vt(i,this.seriesUserParam)),i})}calcSeriesData(t){const e=[];return t.forEach((a,s)=>{e.push([s,a.value,a.chartData])}),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,s;return this.groupData&&Object.keys(this.groupData).length===1?(e=this.groupData[de].get(t.name))==null?void 0:e.chartData:(s=(a=this.groupData)==null?void 0:a[t.seriesName].get(t.name))==null?void 0:s.chartData}dataPreprocess(t){const e=[];t.forEach(s=>{e.push(I(s))});const{groupMode:a}=this.model;return a&&e.forEach(s=>{let i="";if(a==="DAY"||a==="YEAR"||a==="MONTH"){if(a==="DAY"?i="YYYY-MM-DD":a==="YEAR"?i="YYYY":a==="MONTH"&&(i="YYYY-MM"),s[this.catalogField]){const r=S(s[this.catalogField]).format(i);s[this.catalogField]=r}}else if(a==="QUARTER"){if(s[this.catalogField]){const r="".concat(S(s[this.catalogField]).format("YYYY"),"-").concat(S(s[this.catalogField]).quarter());s[this.catalogField]=r}}else if(a==="YEARWEEK"&&s[this.catalogField]){const r="".concat(S(s[this.catalogField]).format("YYYY"),"-").concat(S(s[this.catalogField]).week());s[this.catalogField]=r}}),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach(a=>{const s=t[a];let i=[];e==="DAY"||e==="YEAR"||e==="MONTH"?i=Array.from(s.keys()).sort((n,o)=>S(n).diff(S(o))):(e==="QUARTER"||e==="YEARWEEK")&&(i=Array.from(s.keys()).sort((n,o)=>{const[u,c]=n.split("-"),[l,h]=o.split("-");return u!==l?parseInt(u,10)-parseInt(l,10):parseInt(c,10)-parseInt(h,10)}));const r=new Map;i.forEach(n=>{r.set(n,s.get(n))}),t[a]=r})}addTimeData(t){const{groupMode:e}=this.model;if(!e||e==="CODELIST")return;const a=[];Object.keys(t).forEach(r=>{t[r].forEach((n,o)=>{a.push(S(o))})});const s=S.max(a),i=S.min(a);if(e==="DAY"){let r=i;const n=s;for(;r?.isSameOrBefore(n,"day");){const o=r.format("YYYY-MM-DD");Object.keys(t).forEach(u=>{t[u].get(o)||t[u].set(o,{value:0})}),r=r.add(1,"day")}}else if(e==="YEAR"){let r=i.year();const n=s.year();for(;r<=n;){const o=r.toString();Object.keys(t).forEach(u=>{t[u].get(o)||t[u].set(o,{value:0})}),r+=1}}else if(e==="MONTH"){let r=i.clone().startOf("month");const n=s.clone().startOf("month");for(;r.isSameOrBefore(n);){const o=r.format("YYYY-MM");Object.keys(t).forEach(u=>{t[u].get(o)||t[u].set(o,{value:0})}),r=r.add(1,"month")}}else if(e==="QUARTER"){const r=[];Object.keys(t).forEach(l=>{t[l].forEach((h,p)=>{r.push(p)})});const n=r.reduce((l,h)=>h<l?h:l,r[0]),o=r.reduce((l,h)=>h>l?h:l,r[0]),[u]=n.split("-"),[c]=o.split("-");for(let l=parseInt(u,10);l<=parseInt(c,10);l++)for(let h=1;h<=4;h++){const p="".concat(l,"-").concat(h);Object.keys(t).forEach(E=>{t[E].get(p)||t[E].set(p,{value:0})})}}else if(e==="YEARWEEK"){const r=[];Object.keys(t).forEach(l=>{t[l].forEach((h,p)=>{r.push(p)})});const n=r.reduce((l,h)=>h<l?h:l,r[0]),o=r.reduce((l,h)=>h>l?h:l,r[0]),[u]=n.split("-"),[c]=o.split("-");for(let l=parseInt(u,10);l<=parseInt(c,10);l++){const h=S("".concat(l,"-12-31")).isoWeek();for(let p=1;p<=h;p++){const E="".concat(l,"-").concat(p);Object.keys(t).forEach(w=>{t[w].get(E)||t[w].set(E,{value:0})})}}}this.sortTimeData(t)}},zo=class extends Ft{calcStaticOptions(){if(this.xAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EX\u5750\u6807\u8F74");if(this.yAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EY\u5750\u6807\u8F74");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}},Go=class extends Ft{calcStaticOptions(){if(this.xAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EX\u5750\u6807\u8F74");if(this.yAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EY\u5750\u6807\u8F74");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},jo=class extends Ft{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach((a,s)=>{e.push({name:s,value:[a.value,a.chartData]})}),e}},Ko=class extends Ft{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach((a,s)=>{e.push({name:s,value:[a.value,a.chartData]})}),e}},Ho=class extends Ft{calcStaticOptions(){if(this.xAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EX\u5750\u6807\u8F74");if(this.yAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EY\u5750\u6807\u8F74");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},Xo=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return(!this._indicatorKeys||this._indicatorKeys.length!==Object.keys(this.indicator).length)&&(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map(e=>e.max));return{indicator:this.indicatorKeys.map(e=>({name:e,max:t}))}}},Yo=class extends Ft{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Xo(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach(s=>{s.forEach((i,r)=>{a.updateIndicator(r,i.value)})})}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),s=Object.keys(e).map(r=>{const n=e[r],o=a.indicatorKeys.map(u=>n.has(u)?n.get(u).value:0);return{name:r===de?this.seriesName:r,value:o}});let i={...this.staticOptions,data:s};return this.seriesUserParam&&(i=vt(i,this.seriesUserParam)),i}};function aa(t){const e={};return t&&Object.keys(t).forEach(a=>{const s=a.indexOf(".");if(s===-1)return;const i=a.slice(s+1);if(i)try{e[i]=JSON.parse(t[a])}catch{e[i]=t[a]}}),e}var qo=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:s,chartYAxises:i,userParam:r}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),s?.length&&(this.staticOptions.xAxis=this.calcXYAxisOption(s)),i?.length&&(this.staticOptions.yAxis=this.calcXYAxisOption(i)),r&&(this.chartUserParam=aa(r))}initSeriesGenerators(){var t;(t=this.model.dechartSerieses)==null||t.forEach(e=>{let a;switch(e.seriesType){case"line":a=new zo(e,this);break;case"bar":a=new Go(e,this);break;case"scatter":a=new Ho(e,this);break;case"pie":a=new Ko(e,this);break;case"funnel":a=new jo(e,this);break;case"radar":a=new Yo(e,this);break;default:ibiz.log.error("\u56FE\u8868\u6682\u672A\u652F\u6301\u5E8F\u5217\u7C7B\u578B".concat(e.seriesType));break}a&&this.seriesGenerators.push(a)})}calcTitleOption(t){const{showTitle:e,title:a,subTitle:s,titlePos:i}=t,r={show:e,text:a,subtext:s};r.left="center";const n=i?.toLowerCase();return n==="left"||n==="right"?r.left=n:(n==="bottom"||n==="top")&&(r.top=n),r}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,s={};s.show=e;const i=a?.toLowerCase();return i==="left"||i==="right"?(s.left=i,s.top="middle",s.orient="vertical"):i==="bottom"&&(s.top=i),s}calcXYAxisOption(t){const e=[];return t.forEach(a=>{const{position:s,dataShowMode:i,userParam:r}=a;let n={type:a.echartsType,name:a.caption,max:a.maxValue,min:a.minValue,position:s,axisLabel:{formatter:o=>(typeof o=="number"&&(o=o.toString()),i===1?o.length>4?"".concat(o.slice(0,4).split("").join(`
1
+ System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],function(d,da){"use strict";var m,f,w,ha,xt,pa,q,Vt,U,ut,fa,ma,Ea,ga,we,Da,Ce,wa,V,ve,kt,Wt,Ut,zt,Ca,Gt,Ie,va,Ia,Z,Aa,ya,jt,Fa,Dt,Pa,ba,Na,Sa,La,Ra,Ta,Ba,Oa,k,z,Ae,wt,K,ye,Kt,Ct,Ht,Xt,_a,Ma,Fe,xa,C,Pe,_,A,ct,vt,be,Ne,It,L,Se,Le;return{setters:[function(g){m=g.RuntimeModelError,f=g.RuntimeError,w=g.ModelError,ha=g.downloadFileFromBlob,xt=g.IBizContext,pa=g.clone,q=g.CoreConst,Vt=g.DataTypes,U=g.HttpResponse,ut=g.HttpError,fa=g.Net,ma=g.getToken,Ea=g.NOOP,ga=g.IBizParams,we=g.NoticeError,Da=g.isElementSame,Ce=g.findRecursiveChild,wa=g.StringUtil,V=g.recursiveIterate,ve=g.debounceAndAsyncMerge,kt=g.isOverlap,Wt=g.BitMask,Ut=g.mergeInLeft,zt=g.awaitTimeout,Ca=g.mergeDefaultInLeft,Gt=g.plus,Ie=g.toNumberOrNil},function(g){va=g.isEmpty,Ia=g.isString,Z=g.isArray,Aa=g.isObject,ya=g.isNil,jt=g.debounce,Fa=g.camelCase,Dt=g.eq,Pa=g.gt,ba=g.gte,Na=g.findIndex,Sa=g.lt,La=g.lte,Ra=g.upperFirst,Ta=g.snakeCase,Ba=g.kebabCase,Oa=g.isFunction},function(g){k=g.notNilEmpty,z=g.isNilOrEmpty,Ae=g.AsyncSeriesHook,wt=g.QXEvent,K=g.createUUID,ye=g.ascSort,Kt=g.isArray,Ct=g.setCookie,Ht=g.clearCookie,Xt=g.getCookie,_a=g.descSort,Ma=g.clearAll,Fe=g.isNumber},function(g){xa=g.default},function(g){C=g.isNil,Pe=g.mergeRight,_=g.isEmpty,A=g.clone,ct=g.equals,vt=g.where,be=g.mergeLeft,Ne=g.isNotNil,It=g.mergeDeepRight},function(g){L=g.default},function(g){Se=g.default},function(g){Le=g.default}],execute:function(){d({asyncImportData:Vo,calcContentAlignStyle:ur,calcDeCodeNameById:B,calcDynaClass:At,calcGridLayoutPos:cr,calcLayoutHeightWidth:qt,calcMainStateOPPrivsStrs:Xa,calcNavParams:Yt,calcResPath:ue,compare:St,compareNumber:_e,contains:Lt,convertNavData:N,convertNavDataByArray:ja,convertObjectToNavParams:Re,execDELogic:he,execDELogicAction:Hs,execDELogicById:Ks,execFieldLogics:Ot,execUILogic:me,exportData:si,fieldValueToBoolean:He,filterFieldLogics:qa,filterValueRules:ke,findChildFormDetails:$a,findDELogic:Oe,findEditItem:Qa,findFieldById:yt,findModelChild:lt,formatMultiData:Te,generateEditorRules:ta,generateRules:Ze,getAllPanelField:is,getAppCounterProvider:hs,getAppViewRef:nr,getAsyncActionProvider:on,getChildNodeRSs:Ft,getControl:rr,getControlPanel:Ka,getControlProvider:Et,getControlsByView:Za,getDEMethodProvider:xs,getDeACMode:lr,getDefaultValue:pe,getEditorProvider:ie,getFormDetailProvider:gs,getGridColumnProvider:re,getMatchResPath:Ws,getOriginData:ai,getPFPlugin:or,getPanelItemProvider:Cs,getPlatformProvider:Os,getPlatformType:Ls,getPortletProvider:As,getRootNode:$t,getTreeNode:Jt,getUIActionById:Qt,getUIActionProvider:Fs,getUILogicNodeProvider:bs,getViewEngines:es,getViewLogics:ts,getViewProvider:sn,getWFContext:os,getWFSubmitViewId:Br,handleAllSettled:it,hasDeCodeName:Ya,hasSubRoute:$e,importData:ko,install:Sc,installCommand:ti,isDataContainer:as,isFormDataContainer:Ja,isValueChange:Je,matchMainState:Ha,openRedirectView:rs,parseUserParams:Be,presetAppCounterProvider:Vs,presetDEMethodProvider:qs,presetUIActionProvider:oi,registerAppCounterProvider:ds,registerAsyncActionProvider:rn,registerControlProvider:qr,registerDEMethodProvider:oe,registerEditorProvider:Qr,registerFormDetailProvider:$r,registerGridColumnProvider:Jr,registerPanelItemProvider:Zr,registerPlatformProvider:Ts,registerPortletProvider:tn,registerUIActionProvider:Pt,registerUILogicNodeProvider:en,registerViewProvider:an,strContain:Zt,testCond:at,toLocalOpenWFRedirectView:ns,verifyDeRules:Me,verifyFormGroupLogic:te,verifyPanelGroupLogic:ee});var g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Va={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){return function(a,s,i){var r=function(n,o){if(!o||!o.length||o.length===1&&!o[0]||o.length===1&&Array.isArray(o[0])&&!o[0].length)return null;var u;o.length===1&&o[0].length>0&&(o=o[0]),u=(o=o.filter(function(l){return l}))[0];for(var c=1;c<o.length;c+=1)o[c].isValid()&&!o[c][n](u)||(u=o[c]);return u};i.max=function(){var n=[].slice.call(arguments,0);return r("isAfter",n)},i.min=function(){var n=[].slice.call(arguments,0);return r("isBefore",n)}}})})(Va);var Pi=Va.exports,bi=Nt(Pi),ka={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){return function(a,s){s.prototype.isSameOrBefore=function(i,r){return this.isSame(i,r)||this.isBefore(i,r)}}})})(ka);var Ni=ka.exports,Si=Nt(Ni),Wa={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){var a="month",s="quarter";return function(i,r){var n=r.prototype;n.quarter=function(c){return this.$utils().u(c)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(c-1))};var o=n.add;n.add=function(c,l){return c=Number(c),this.$utils().p(l)===s?this.add(3*c,a):o.bind(this)(c,l)};var u=n.startOf;n.startOf=function(c,l){var h=this.$utils(),p=!!h.u(l)||l;if(h.p(c)===s){var E=this.quarter()-1;return p?this.month(3*E).startOf(a).startOf("day"):this.month(3*E+2).endOf(a).endOf("day")}return u.bind(this)(c,l)}}})})(Wa);var Li=Wa.exports,Ri=Nt(Li),Ua={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){var a="week",s="year";return function(i,r,n){var o=r.prototype;o.week=function(u){if(u===void 0&&(u=null),u!==null)return this.add(7*(u-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var l=n(this).startOf(s).add(1,s).date(c),h=n(this).endOf(a);if(l.isBefore(h))return 1}var p=n(this).startOf(s).date(c).startOf(a).subtract(1,"millisecond"),E=this.diff(p,a,!0);return E<0?n(this).startOf("week").week():Math.ceil(E)},o.weeks=function(u){return u===void 0&&(u=null),this.week(u)}}})})(Ua);var Ti=Ua.exports,Bi=Nt(Ti),za={exports:{}};(function(t,e){(function(a,s){t.exports=s()})(g,function(){var a="day";return function(s,i,r){var n=function(c){return c.add(4-c.isoWeekday(),a)},o=i.prototype;o.isoWeekYear=function(){return n(this).year()},o.isoWeek=function(c){if(!this.$utils().u(c))return this.add(7*(c-this.isoWeek()),a);var l,h,p,E,D=n(this),y=(l=this.isoWeekYear(),h=this.$u,p=(h?r.utc:r)().year(l).startOf("year"),E=4-p.isoWeekday(),p.isoWeekday()>4&&(E+=7),p.add(E,a));return D.diff(y,"week")+1},o.isoWeekday=function(c){return this.$utils().u(c)?this.day()||7:this.day(this.day()%7?c:c-7)};var u=o.startOf;o.startOf=function(c,l){var h=this.$utils(),p=!!h.u(l)||l;return h.p(c)==="isoweek"?p?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):u.bind(this)(c,l)}}})})(za);var Oi=za.exports,_i=Nt(Oi),Mi=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:60*60*1e3},this.form={mdCtrlConfirmBeforeRemove:!0}}},xi=d("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),et=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};et.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var x=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Vi=class extends x{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const s=t.filter(i=>!!i).length===t.length;return et.handleJudgmentExecute(this,s,e)}},ki=class extends x{constructor(t){super(t,"camelCase")}onExecute(t){return t?Fa(t):""}},Wi=class extends x{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Ui=class extends x{constructor(t){super(t,"eq")}onExecute(t,e,a){const s=Dt(t,e);return et.handleJudgmentExecute(this,s,a)}},zi=class extends x{constructor(t){super(t,"gt")}onExecute(t,e,a){const s=Pa(t,e);return et.handleJudgmentExecute(this,s,a)}},Gi=class extends x{constructor(t){super(t,"gte")}onExecute(t,e,a){const s=ba(t,e);return et.handleJudgmentExecute(this,s,a)}},ji=class extends x{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,s){let i=!1;return Z(t)?i=!Dt(Na(t,r=>Dt(r[e],a)),-1):i=t.hasOwnProperty(e)&&(i=Dt(t[e],a)),et.handleJudgmentExecute(this,i,s)}},Ki=class extends x{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},Hi=class extends x{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,typeof e=="number"?e:void 0)}},Xi=class extends x{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Yi=class extends x{constructor(t){super(t,"lt")}onExecute(t,e,a){const s=Sa(t,e);return et.handleJudgmentExecute(this,s,a)}},qi=class extends x{constructor(t){super(t,"lte")}onExecute(t,e,a){const s=La(t,e);return et.handleJudgmentExecute(this,s,a)}},Qi=class extends x{constructor(t){super(t,"neq")}onExecute(t,e,a){const s=!Dt(t,e);return et.handleJudgmentExecute(this,s,a)}},$i=class extends x{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return et.handleJudgmentExecute(this,a,e)}},Ji=class extends x{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const s=t.find(i=>!!i);if(a.fn){const i=((e=a.data)==null?void 0:e.root)||{};return s?a.fn(i):a.inverse(i)}return s||""}},Zi=class extends x{constructor(t){super(t,"pascalCase")}onExecute(t){return t?Ra(t):""}},tr=class extends x{constructor(t){super(t,"snakeCase")}onExecute(t){return t?Ta(t):""}},er=class extends x{constructor(t){super(t,"spinalCase")}onExecute(t){return t?Ba(t):""}},ar=class extends x{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};function sr(t){new Vi(t),new ki(t),new Wi(t),new Ui(t),new zi(t),new Gi(t),new Ki(t),new Hi(t),new Xi(t),new Yi(t),new qi(t),new Qi(t),new $i(t),new Ji(t),new Zi(t),new tr(t),new er(t),new ar(t),new ji(t)}var ir=d("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=da.import("handlebars");const t=await this.p;return this.hsb=t.default||t,this.p=null,sr(this.hsb),this.hsb}async render(t,e){return this.hsb||await this.init(),this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function Re(t){const e=[],a=/^%(.+)%$/;for(const s in t){let i=!0,r=t[s];k(t[s])&&a.test(t[s])&&(i=!1,r=t[s].substring(1,t[s].length-1)),e.push({key:s.toLowerCase(),rawValue:i,value:r})}return e}function N(t,...e){if(!t||va(t))return{};const a=Array.isArray(t)?t:Re(t);return ja(a,...e)}function Ga(t,e){const a=t.find(s=>z(s)?!1:s[e]||Object.prototype.hasOwnProperty.call(s,e));return{find:!!a,value:a?.[e]}}function ja(t,...e){const a=/\$\{[^}]*\}/g,s={};for(const i of t)if(i.rawValue)s[i.key.toLowerCase()]=i.value||null;else{const r=i.value.match(a);if(r!==null){let n=i.value;r.forEach(o=>{const{find:u,value:c}=Ga(e,o.slice(2,-1).toLowerCase());u&&(n=n.replace(o,"".concat(c)))}),s[i.key.toLowerCase()]=n}else{const{find:n,value:o}=Ga(e,i.value.toLowerCase());n&&(s[i.key.toLowerCase()]=o)}}return s}function Te(t,e){const a={};if(!t)return a;const s=Array.isArray(t)?t:Re(t),i=e[0];return s.forEach(r=>{const{rawValue:n,value:o}=r;!n&&o&&Object.prototype.hasOwnProperty.call(i,o)&&(a[o]=e.map(u=>u[o]).join(";"))}),a}function Yt(t,e){const{deName:a,navFilter:s,pickupDEFName:i,navContexts:r,navParams:n}=t,{context:o,params:u,data:c,derValue:l}=e,h={},p={},E=l||c.srfkey;E&&(a&&(h[a]=E),s&&(p[s]=E),i&&(p["n_".concat(i.toLowerCase(),"_eq")]=E));const D=N(r,c,u,o),y=N(n,c,u,o);return Object.assign(h,D),Object.assign(p,y),{resultContext:h,resultParams:p}}function lt(t,e){if(t&&e){const a=t.find(s=>s.id?s.id.toLowerCase()===e.toLowerCase():!1);if(a)return a}return null}function rr(t,e){var a,s;let i=t.controls||[];return(s=(a=t.viewLayoutPanel)==null?void 0:a.controls)!=null&&s.length&&(i=i.concat(t.viewLayoutPanel.controls)),i.find(r=>r.name===e||r.codeName===e||r.id===e)}function nr(t,e){var a,s;let i=t.appViewRefs||[];return(s=(a=t.viewLayoutPanel)==null?void 0:a.appViewRefs)!=null&&s.length&&(i=i.concat(t.viewLayoutPanel.appViewRefs)),i.find(r=>r.name===e||r.id===e)}function Be(t){const e={},a={},s={};for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i];if(i.indexOf(".")!==-1){const n=i.split(".");switch(n[0]){case"SRFNAVPARAM":Object.assign(a,{[n[1]]:r});break;case"SRFNAVCTX":Object.assign(e,{[n[1]]:r});break;default:Object.assign(s,{key:r});break}}}return{navigateContexts:e,navigateParams:a,other:s}}function or(t,e){const a=ibiz.hub.getApp(e);if(!a)throw new m(a,"\u672A\u627E\u5230\u5E94\u7528");const{model:s}=a;if(!s.appPFPluginRefs)throw new m(s,"\u5E94\u7528\u672A\u914D\u7F6E\u63D2\u4EF6");const i=s.appPFPluginRefs.find(r=>r.pluginCode.toLowerCase()===t.toLowerCase());if(!i)throw new Error("\u672A\u627E\u5230\u63D2\u4EF6".concat(t));return i}function Ka(t){let e;if(t.controlRenders){const a=t.controlRenders.find(s=>s.renderType==="LAYOUTPANEL"&&!!s.layoutPanel);e=a?.layoutPanel}return e}function qt(t){const{width:e,height:a,widthMode:s,heightMode:i}=t,r={width:"",height:""};return s==="FULL"?r.width="100%":e&&e>0&&(e>0&&e<=1?r.width="".concat(e*100,"%"):s==="PERCENTAGE"?r.width="".concat(e,"%"):r.width="".concat(e,"px")),i==="FULL"?r.height="100%":a&&a>0&&(a>0&&a<=1?r.height="".concat(a*100,"%"):i==="PERCENTAGE"?r.height="".concat(a,"%"):r.height="".concat(a,"px")),r}function ur(t){const{valignSelf:e,halignSelf:a}=t;let s;if(e||a){switch(s={display:"flex"},e){case"TOP":Object.assign(s,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(s,{"align-items":"center"});break;case"BOTTOM":Object.assign(s,{"align-items":"flex-end"});break}switch(a){case"LEFT":Object.assign(s,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(s,{"justify-content":"center"});break;case"RIGHT":Object.assign(s,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(s,{"justify-content":"space-between"});break}}return s}function cr(t){const{layout:e,colXS:a,colXSOffset:s,colSM:i,colSMOffset:r,colMD:n,colMDOffset:o,colLG:u,colLGOffset:c}=t,l=(h,p)=>({span:(!h||h===-1?e==="TABLE_24COL"?24:12:h)*(e==="TABLE_24COL"?1:2),offset:!p||p===-1?void 0:p});return{xs:l(a,s),sm:l(i,r),md:l(n,o),lg:l(u,c)}}function At(t,e){const a=[],s=O.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return Ia(s)?a.push(s):Z(s)?a.push(...s):Aa(s)&&Object.keys(s).forEach(i=>{s[i]&&a.push(i)}),a}function Ha(t,e){const{mainStateAppDEFieldIds:a,demainStates:s}=t;if(a&&s){const i=[];return a.forEach(r=>{i.push(e[r])}),s.find(r=>{const{stateValue:n,state2Value:o,state3Value:u}=r;let c=!0;const l=[n,o,u];for(let h=0;h<i.length;h++)if("".concat(i[h])!=="".concat(l[h])){c=!1;break}return c})}}function Xa(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:s,opprivAllowMode:i}=t,r=s?.map(o=>o.name)||[];let n=[];return i?n=r:n=[...a.deopprivs,...e.deopprivs].filter(u=>!r.includes(u.name)).map(u=>u.name),n}function B(t){return t.split(".").pop()}function Ya(t,e){const a=B(e);return k(t[a])}async function lr(t,e,a){var s;return(s=(await ibiz.hub.getAppDataEntity(e,a)).appDEACModes)==null?void 0:s.find(n=>n.id===t)}function Oe(t,e){var a;return(a=e.appDELogics)==null?void 0:a.find(s=>s.id===t)}function qa(t,e){var a,s;const i=[];return(a=t.appDEFields)==null||a.forEach(r=>{e==="compute"&&r.computeAppDEFLogicId?i.push(r.computeAppDEFLogicId):e==="change"&&r.onChangeAppDEFLogicId?i.push(r.onChangeAppDEFLogicId):e==="default"&&r.defaultValueAppDEFLogicId&&i.push(r.defaultValueAppDEFLogicId)}),((s=t.appDELogics)==null?void 0:s.filter(r=>i.includes(r.id)))||[]}function yt(t,e){var a;return(a=t.appDEFields)==null?void 0:a.find(s=>s.id===e)}async function Qt(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function $t(t){return t.detreeNodes.find(e=>e.rootNode)}function Jt(t,e){return t.detreeNodes.find(a=>a.id===e)}function dr(t,e){return t===3||(e?t===1:t===2)}function Ft(t,e){const a=e.parentId||$t(t).id;return t.detreeNodeRSs.filter(s=>s.parentDETreeNodeId===a&&dr(s.searchMode,e.hasQuery))}function Qa(t,e){var a;return(a=t.degridEditItems)==null?void 0:a.find(s=>s.codeName===e)}function $a(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails;break}return e||[]}function Ja(t){return t.detailType==="MDCTRL"}function Za(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function ts(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function es(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter(s=>{switch(s.engineCat){case"CTRL":return ibiz.log.warn("\u672A\u652F\u6301\u7684\u5F15\u64CE\u5206\u7C7B\uFF1A".concat(s.engineType)),!1;default:return!0}})}function as(t){return t.itemType==="CONTAINER"&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var hr=["panelItems","panelTabPages","rootPanelItems"];function ss(t){let e=[];for(const s of hr)if(t[s]){e=t[s];break}const a=[];return e.length&&(a.push(...e.filter(s=>s.itemType==="FIELD")),e.forEach(s=>{as(s)||a.push(...ss(s))})),a}function is(t){return ss(t)}async function rs(t,e,a={},s={}){return pr(t,e,a,s)}async function ns(t,e,a={}){const s=e.lastIndexOf("?"),i=decodeURIComponent(e.substring(s+1,e.length)),r=xa.parse(i,{delimiter:";"}),n=r.srfdename||"";if(!n)throw new f("\u91CD\u5B9A\u5411\u53C2\u6570\u7F3A\u5C11\u5B9E\u4F53\u540D\u79F0");const u=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(n.toUpperCase());if(!u)throw new f("\u672A\u627E\u5230\u6307\u5B9A\u5B9E\u4F53\u7684codeName: ".concat(n));r[u.toLowerCase()]=r[n.toLowerCase()];const c="".concat(u).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(c);if(delete r.srfdename,r.srfwf!=="undo"){const p=r.processDefinitionKey.split("-")[3],E=p.substring(0,p.lastIndexOf("v")),D=p.substring(p.lastIndexOf("v"));r.wf=E,r.wfVersion=D}r.srfprocessinstanceid&&(t.srfprocessinstanceid=r.srfprocessinstanceid,delete r.srfprocessinstanceid),await ibiz.commands.execute(st.TAG,l.id,t,r,a)}async function pr(t,e,a={},s={}){var i;const r=t.appViewNavContexts||[],n=N(r,a,e);e=Object.assign(e.clone(),n);const o=t.appViewNavParams||[],u=N(o,a,e);Object.assign(a,u);const c=t.appDataEntityId,l=B(c);let h=((i=s.data)==null?void 0:i[0])||{};e[l]=h[l]||e[l]||a[l];const p=t.getDataAppDEActionId,D=await ibiz.hub.getApp(t.appId).deService.getService(c);ibiz.loading.showRedirect();try{const T=await D.exec(p||"get",e,a);if(T.ok){h=T.data;let P=h.linkurl;if(P)return e.srfprocessinstanceid&&(P+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&P.indexOf("appredirectview?")!==-1&&(P=P.slice(P.indexOf("appredirectview?"))),P.startsWith("http://")||P.startsWith("https://")?new Promise(j=>{const Di=window.open(P,"_blank");Di&&(Di.callback=()=>{j({ok:!0,data:[]})})}):P.startsWith("appredirectview?")?(await ns(e,P,s),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const y=await ibiz.hub.getAppDataEntity(c,t.appId),v=await fr(y,t,a,h),b=v.split(":"),F=b.length===2?v:b.slice(0,2).join(":"),I="".concat(y.name.toUpperCase(),":").concat(v),S=t.redirectAppViewRefs,R=S?.find(T=>{const P=T.name||T.id;return P===I||P===v||P===F});if(R){const T=R.refAppViewId;if(T){const P=await ibiz.commands.execute(st.TAG,T,e,a,{...s,data:[h]});if(P)return P}else throw new m(R,"\u672A\u914D\u7F6E\u5B9E\u9645\u5F15\u7528\u89C6\u56FE")}else throw ibiz.log.error("\u91CD\u5B9A\u5411\u89C6\u56FE\u5F15\u7528\u6709\uFF1A",S?.map(({refAppViewId:T,name:P,realTitle:j})=>({viewId:T,tag:P,title:j}))),new m(t,"\u672A\u627E\u5230\u91CD\u5B9A\u5411\u6807\u8BC6[".concat(v,"]\u6216[").concat(I,"]\u6216\u5DE5\u4F5C\u6D41[").concat(F,"]\u5BF9\u5E94\u89C6\u56FE"));return{ok:!0,data:[]}}async function fr(t,e,a,s){let i="";const r=e.typeAppDEFieldId;if(r){const{codeName:c}=yt(t,r),l=s[c.toLowerCase()];if(k(l))return"".concat(l);ibiz.log.warn("\u91CD\u5B9A\u5411\u89C6\u56FE[".concat(e.name,"]\u81EA\u5B9A\u4E49\u7C7B\u522B\u5C5E\u6027[").concat(r,"]\u503C\u4E3A\u7A7A"),s)}const n="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),o=a.srfwf;if(k(o))return k(a.wf)?"".concat(n,":").concat(o.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(n,":").concat(o.toUpperCase());let u="";if(t.indexTypeAppDEFieldId){const{codeName:c}=yt(t,t.indexTypeAppDEFieldId);u=s[c.toLowerCase()]}if(z(u)&&t.formTypeAppDEFieldId){const{codeName:c}=yt(t,t.formTypeAppDEFieldId);u=s[c.toLowerCase()]}return k(u)?i="".concat(n,":").concat(u.toString().toUpperCase()):i="".concat(n),i}function at(t,e,a){if(Object.is(e,"IN"))return Lt(t,a);if(Object.is(e,"NOTIN"))return!Lt(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return St(t,a)<0;case"LTANDEQ":return St(t,a)<=0;case"GT":return St(t,a)>0;case"GTANDEQ":return St(t,a)>=0;case"ISNULL":return z(t);case"ISNOTNULL":return k(t);case"TESTNULL":return C(t);case"IN":return Lt(t,a);case"NOTIN":return!Lt(t,a);case"LIKE":return Zt(t,a);case"LEFTLIKE":return Zt(t,a,"start");case"RIGHTLIKE":return Zt(t,a,"end");default:throw new f("\u503C\u64CD\u4F5C\uFF1A".concat(e,"\uFF0C\u6682\u672A\u652F\u6301"))}}function St(t,e){const a=Number(t),s=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(s))return _e(a,s);const i=new Date(t).getTime(),r=new Date(e).getTime();if(!Number.isNaN(i)&&!Number.isNaN(r))return _e(i,r);throw new f("".concat(t," \u548C ").concat(e," \u65E0\u6CD5\u6BD4\u8F83\u5927\u5C0F"))}function _e(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Lt(t,e){if(!e||typeof e!="string")throw new f("\u8303\u56F4\u6BD4\u8F83\u7684\u6761\u4EF6\u503C\u4E0D\u5B58\u6216\u8005\u4E0D\u662F\u5B57\u7B26\u4E32");return t?e.split(",").includes("".concat(t)):!1}function Zt(t,e,a){if(!t||!e)return!1;const s="".concat(t).toUpperCase(),i="".concat(e).toUpperCase(),r=s.indexOf(i);switch(a){case"start":return r===0;case"end":return r+i.length===s.length;default:return r!==-1}}var mr={singleRowReturn:!1,isAsync:!0},Er=d("ScriptFunction",class{constructor(t,e,a=mr){this.argKeys=[],this.options=a;const s=this.formatCode(e,a);this.calcArgKeys(t,a);const i=new Function(...this.argKeys,s);this.scriptFn=function(...n){try{return i.apply({},n)}catch(o){throw console.log("\u62A5\u9519\u811A\u672C",s),o}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);const s=["document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"];a.push(...s),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?Pe(e,t):t;a.document=document,a.selector=i=>document.getElementsByClassName(i);const s=[];return this.argKeys.forEach(i=>{a[i]===void 0&&this.fillDefaultParams(i,a),s.push(a[i])}),s}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;break}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session;break}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),O=d("ScriptFactory",class{static createScriptFn(t,e,a){return new Er(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function gr(t){return t.condType==="GROUP"}function Dr(t){return t.condType==="SIMPLE"}function wr(t){return t.condType==="VALUERANGE2"}function Cr(t){return t.condType==="REGEX"}function vr(t){return t.condType==="STRINGLENGTH"}function Ir(t){return t.condType==="SYSVALUERULE"}function Me(t,e,a){const s={isPast:!0,infoMessage:a.ruleInfo};if(gr(a)){const i=a.conds;i&&i.length>0&&(s.isPast=Ar(i,r=>{const{isPast:n,infoMessage:o}=Me(t,e,r);return s.infoMessage=o,n},a.condOp,!!a.notMode),!s.isPast&&(a.condOp==="AND"&&a.notMode||a.condOp==="OR"&&!a.notMode)&&(s.infoMessage=a.ruleInfo))}else{t=a?.defname.toLowerCase()||t;try{if(Dr(a))s.isPast=!yr(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(wr(a))s.isPast=!Pr(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(Cr(a))s.isPast=!xe(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(vr(a))s.isPast=!Fr(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(Ir(a)&&a?.sysValueRule){const{ruleType:i,regExCode:r,scriptCode:n,ruleInfo:o}=a.sysValueRule;if(s.infoMessage=a.ruleInfo||o,i==="REG")s.isPast=!xe(e[t],r,s.infoMessage,a.keyCond);else if(i==="SCRIPT"){const{isPast:u,infoMessage:c}=br(e[t],e,n,s.infoMessage,a.keyCond);s.isPast=u,s.infoMessage=c||s.infoMessage}}}catch{s.isPast=!1}s.isPast=a.notMode?!s.isPast:s.isPast}return s}function Ar(t,e,a="AND",s=!1){if(!(t?.length>0))return!1;let i=a==="AND";for(let r=0,n=t.length;r<n;r++){const o=e(t[r],r);if(a==="AND"){if(!o){i=!1;break}}else if(a==="OR"&&o){i=!0;break}}return s?!i:i}function yr(t,e,a,s,i,r,n){Object.is(i,"CURTIME")&&(a="".concat(new Date)),Object.is(i,"ENTITYFIELD")&&(a=a?a.toLowerCase():"",a=r[a]?r[a]:a),(C(s)||_(s))&&(s="\u5185\u5BB9\u5FC5\u987B\u7B26\u5408\u503C\u89C4\u5219");const o=at(t,e,a);if(!o&&n)throw new f(s);return!o}function Fr(t,e,a,s,i,r,n){if(z(r)&&(r="\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u7B26\u5408\u8303\u56F4\u89C4\u5219"),z(t)){if(n)throw new f("\u503C\u4E3A\u7A7A");return r="\u503C\u4E3A\u7A7A",!0}const u=t.length;if(e!==null){if(a){if(u<e){if(n)throw new f(r);return!0}}else if(u<=e){if(n)throw new f(r);return!0}}if(s!==null){if(i){if(u>s){if(n)throw new f(r);return!0}}else if(u>=s){if(n)throw new f(r);return!0}}return r="",!1}function xe(t,e,a,s){if(z(a)&&(a="\u503C\u5FC5\u987B\u7B26\u5408\u6B63\u5219\u89C4\u5219"),z(t)){if(s)throw new f("\u503C\u4E3A\u7A7A");return a="\u503C\u4E3A\u7A7A",!0}if(!new RegExp(e).test(t)){if(s)throw new f(a);return!0}return a="",!1}function Pr(t,e,a,s,i,r,n){if(z(r)&&(r="\u503C\u5FC5\u987B\u7B26\u5408\u503C\u8303\u56F4\u89C4\u5219"),z(t)){if(n)throw new f("\u503C\u4E3A\u7A7A");return r="\u503C\u4E3A\u7A7A",!0}if(xe(t,/^-?\d*\.?\d+$/,"",n))return!0;const c=Number.parseFloat(t);if(e!==null){if(a){if(c<e){if(n)throw new f(r);return!0}}else if(c<=e){if(n)throw new f(r);return!0}}if(s!=null){if(i){if(c>s){if(n)throw new f(r);return!0}}else if(c>=s){if(n)throw new f(r);return!0}}return r="",!1}function br(t,e,a,s,i){z(s)&&(s="\u503C\u5FC5\u987B\u7B26\u5408\u811A\u672C\u89C4\u5219");const r=e;let n="",o=!0;const u=c=>{o=!1,c?.length>0?c.forEach(l=>{l?.message&&(n+=l.message)}):c?.message&&(n=c.message)};try{const c=O.execScriptFn({value:t,data:r},a,{isAsync:!1});typeof c=="boolean"&&(o=c)}catch(c){ibiz.log.error(c),u(c)}if(s="",!o&&i)throw new f(s);return{isPast:o,infoMessage:n||s}}function Nr(t){return t.logicType==="GROUP"}function Sr(t){return t.logicType==="SINGLE"}function te(t,e){if(Nr(e)){const a=e.defdlogics;if(!a||a.length===0)throw new m(e,"\u53D1\u73B0\u7A7A\u903B\u8F91\u7EC4\uFF0C\u903B\u8F91\u65E0\u6CD5\u6B63\u5E38\u6267\u884C\uFF01");let s=!0;return e.groupOP==="AND"?s=a.find(r=>!te(t,r))===void 0:e.groupOP==="OR"&&(s=e.defdlogics.find(r=>te(t,r))!==void 0),e.notMode?!s:s}if(Sr(e))return at(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new w(e,"\u672A\u652F\u6301\u7684\u903B\u8F91\u7C7B\u578B".concat(e.logicType))}function Lr(t){return t.logicType==="GROUP"}function Rr(t){return t.logicType==="SINGLE"}function ee(t,e){if(Lr(e)){const a=e.panelItemLogics;if(!a||a.length===0)throw new m(e,"\u53D1\u73B0\u7A7A\u903B\u8F91\u7EC4\uFF0C\u903B\u8F91\u65E0\u6CD5\u6B63\u5E38\u6267\u884C\uFF01");let s=!0;return e.groupOP==="AND"?s=a.find(r=>!ee(t,r))===void 0:e.groupOP==="OR"&&(s=e.panelItemLogics.find(r=>ee(t,r))!==void 0),e.notMode?!s:s}if(Rr(e))return at(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new w(e,"\u672A\u652F\u6301\u7684\u903B\u8F91\u7C7B\u578B".concat(e.logicType))}var Tr=d("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||e.useDefaultLayout===!0){const a=this.calcLayoutTag(t);if(this.cache.has(a)){const s=A(this.cache.get(a));t.viewLayoutPanel=s,t.appCounterRefs&&(s.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(s.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(s.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(s.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(s.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;switch(e){case"APPINDEXVIEW":return this.calcIndexViewLayoutTag(t);default:return"".concat(e,"_").concat(a)}}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:s,mainMenuAlign:i}=t;let r="";s?r="BLANK_MODE":i&&(r=i.toUpperCase());let n="";return r!==""?n="".concat(e,"_").concat(a,"_").concat(r):n="".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(n)&&(n+="_NO_NAV"),n}});function os(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}function Br(t,e){var a;const{type:s,sequenceflowview:i,sequenceflowmobview:r}=e,n=((a=t.viewLayoutPanel)==null?void 0:a.appViewRefs)||t.appViewRefs,o=s?"WFUTILACTION@".concat(s.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?r:i),u=n?.find(c=>c.name.indexOf(o)!==-1);return u?.refAppViewId}var Or=d("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))(Or||{})),_r=d("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))(_r||{})),Mr=d("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Mr||{})),xr=d("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(xr||{})),Vr=d("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))(Vr||{})),kr=d("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))(kr||{})),Wr=d("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))(Wr||{})),Ve=d("StudioViewEvents",class{});Ve.onViewMounted="onMounted",Ve.onViewDestroyed="onDestroyed";var ae=d("StudioPanelEvents",class{});ae.onClick="onClick",ae.onChange="onChange",ae.onEnter="onEnter",ae.onLeave="onLeave";var H=d("StudioControlEvents",class{});H.onBeforeLoad="onBeforeLoad",H.onLoadSuccess="onLoadSuccess",H.onLoadError="onLoadError",H.onBeforeLoadDraft="onBeforeLoadDraft",H.onLoadDraftSuccess="onLoadDraftSuccess",H.onLoadDraftError="onLoadDraftError",H.onBeforeSave="onBeforeSave",H.onSaveSuccess="onSaveSuccess",H.onSaveError="onSaveError",H.onBeforeRemove="onBeforeRemove",H.onRemoveSuccess="onRemoveSuccess",H.onRemoveError="onRemoveError",H.CLICK="onClick";var Ur=d("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new Ae,beforeDismiss:new Ae},this._dismiss=e=>{ibiz.log.error("\u5916\u90E8\u5173\u95ED\u80FD\u529B\u672A\u6CE8\u518C",e)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return this.ignoreDismissCheck!==!0&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss\u7ED3\u679C\u4E3Afalse,\u5173\u95ED\u4E2D\u65AD\u3002"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function ke(t,e){return t.filter(a=>{const{checkMode:s}=a,i=a.deformItemName||a.degridEditItemName;return s!==2&&i===e})}var zr=d("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")}}),Gr=d("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=A(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let s=":root.".concat(t.themeTag,"{");for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];s+="".concat(r,": ").concat(n).concat(n.endsWith(";")?"":";")}s+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=s,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),jr=d("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return t!==void 0&&(t==="true"||t==="false"?e=t==="true":this.isNumber(t)&&(e=parseFloat(t))),e}});async function it(t,e=!0){const a=await Promise.allSettled(t),s=[],i=[];if(a.forEach(r=>{r.status==="fulfilled"?s.push(r.value):i.push(r.reason)}),i.length>0){const r=i.length===1?i[0]:i;if(e)throw r;ibiz.util.error.handle(r)}return s}var Kr=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if(t==="ISNULL")return e==null;if(t==="ISNOTNULL")return e!=null;if(t==="EQ"||t==="ABSEQ"||t==="GT"||t==="GTANDEQ"||t==="LT"||t==="LTANDEQ"||t==="NOTEQ"){let s=-1;if(e==a?s=0:e>a&&(s=1),t==="EQ"||t==="ABSEQ")return s===0;if(t==="GT")return s>0;if(t==="GTANDEQ")return s>=0;if(t==="LT")return s<0;if(t==="LTANDEQ")return s<=0;if(t==="NOTEQ")return s!==0}if(t==="LIKE")return e!=null&&a!=null?e.toString().toUpperCase().indexOf(a.toString().toUpperCase())!==-1:!1;if(t==="LEFTLIKE")return e!=null&&a!=null?e.toString().toUpperCase().indexOf(a.toString().toUpperCase())===0:!1}catch(s){ibiz.log.error(s)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},us=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},We=class extends us{parse(t){const e=t.length;let a=!0,s=!1,i=!1;for(let r=0;r<e;r++){if(a){const n=t[r];this.setCondOp(n),a=!1,s=!0;continue}if(s){const n=t[r];this.setParam(n),s=!1,i=!0;continue}if(i){const n=t[r];if(n instanceof Object&&!(n instanceof Array)){const o=n;o.type!=null&&this.setValueType(o.type.toString()),o.value!=null&&this.setValue(o.value.toString())}else this.setValue(n);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}},cs=class wi extends us{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let s=!0,i=!0,r=!1;for(let n=0;n<a;n++){if(s&&i&&e[n]==="!"){this.setNotMode(!0),s=!1;continue}if(i){const o=e[n];this.setCondOp(o),i=!1,s=!1,r=!0;continue}if(r){const o=e[n];if(o instanceof Array)o.forEach(u=>{if(u.length>0){const c=u[0].toString();if(c==="!"||c==="OR"||c==="AND"){const l=new wi;l.parse(u),this.childCondList.push(l)}else{const l=new We;l.parse(u),this.childCondList.push(l)}}});else throw new f("\u503C\u5FC5\u987B\u4E3A\u6570\u7EC4")}}}setNotMode(e){this.bNotMode=e}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Hr=class extends cs{},Xr=class extends We{},Ue=class ca extends Kr{test(e,a){return this.testCond(this.getPSModelGroupCondBase(),e,a)}testCond(e,a,s){if(e instanceof cs){const i=e.getChildPSModelCondBases();if(i==null||_(i))return!e.isNotMode();const r=e.getCondOp()==="AND";let n=r;for(let o=0;o<i.length;o++){const u=i[o];if(this.testCond(u,a,s)){if(!r){n=!0;break}}else if(r){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof We){_(e.getParam())&&ibiz.log.warn("\u6CA1\u6709\u6307\u5B9A\u5C5E\u6027\u540D\u79F0",e);const i=a[e.getParam().toLowerCase()];let r=null;const n=e.getValueType(),o=e.getValue();return n!=null&&!_(n)?(_(o)&&ibiz.log.warn("\u6CA1\u6709\u6307\u5B9A\u4E0A\u4E0B\u6587\u53C2\u6570\u540D\u79F0"),ca.PARAMTYPE_WEBCONTEXT===n?r=s.data[o.toLowerCase()]:ca.PARAMTYPE_DATACONTEXT===n&&(r=s.getValue(o.toLowerCase()))):r=e.getValue(),this.testSingleCond(e.getCondOp(),i,r)}return ibiz.log.warn("\u65E0\u6CD5\u8BC6\u522B\u7684\u6761\u4EF6\u5BF9\u8C61",e),!1}createPSModelSingleCond(){return new Xr}createPSModelGroupCond(){return new Hr}};Ue.PARAMTYPE_DATACONTEXT="DATACONTEXT",Ue.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Yr=d("PSDEDQCondEngine",Ue);async function Q(t,e){var a;const i=(a=ibiz.hub.getApp(e).model.appPFPluginRefs)==null?void 0:a.find(r=>r.pluginCode.toLowerCase()===t);if(!i){ibiz.log.error("\u672A\u5339\u914D\u5230\u63D2\u4EF6[".concat(t,"]\u6A21\u578B"));return}return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode)}var ls=d("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function ds(t,e){ibiz.register.register("".concat(ls,"_").concat(t),e)}function ze(t){return ibiz.register.get("".concat(ls,"_").concat(t))}async function hs(t){let e;const{codeName:a,counterType:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(e=ze(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7CFB\u7EDF\u8BA1\u6570\u5668\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s==="CUSTOM"){if(e=ze(a),e)return e;throw new f("\u627E\u4E0D\u5230\u81EA\u5B9A\u4E49\u7CFB\u7EDF\u8BA1\u6570\u5668".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}if(e=ze(s),e)return e;throw new f("\u627E\u4E0D\u7CFB\u7EDF\u8BA1\u6570\u5668\u7C7B\u578B".concat(s,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}var ps=d("CONTROL_PROVIDER_PREFIX","CONTROL");function qr(t,e){ibiz.register.register("".concat(ps,"_").concat(t),e)}function Ge(t){return ibiz.register.get("".concat(ps,"_").concat(t))}async function Et(t){let e;const{controlType:a,controlStyle:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(e=Ge(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u90E8\u4EF6\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s&&s!=="DEFAULT"){const n="".concat(a,"_").concat(s);if(e=Ge(n),!e)ibiz.log.error("\u627E\u4E0D\u5230\u90E8\u4EF6\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u90E8\u4EF6\u6837\u5F0F\uFF1A[").concat(s,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}if(e=Ge(a),e)return e;switch(a){case"DATAINFOBAR":return;default:ibiz.log.error("\u627E\u4E0D\u5230\u90E8\u4EF6\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}}var fs=d("EDITOR_PROVIDER_PREFIX","EDITOR");function Qr(t,e){ibiz.register.register("".concat(fs,"_").concat(t),e)}function se(t){return ibiz.register.get("".concat(fs,"_").concat(t))}async function ie(t){let e;const{editorType:a,editorStyle:s,predefinedType:i,sysPFPluginId:r,appId:n}=t;if(r){const o=await Q(r,n);if(o&&(e=se(o)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u63D2\u4EF6".concat(o,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s&&s!=="DEFAULT"){const o="".concat(a,"_").concat(s);if(e=se(o),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u7F16\u8F91\u5668\u6837\u5F0F\uFF1A[").concat(s,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}if(i){let o="".concat(i,"_").concat(a);if(s&&s!=="DEFAULT"&&(o+="_".concat(s)),e=se(o),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u9884\u7F6E\u7C7B\u578B\uFF1A[").concat(i,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}if(e=se(a),!e)ibiz.log.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var ms=d("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function $r(t,e){ibiz.register.register("".concat(ms,"_").concat(t),e)}function Es(t){return ibiz.register.get("".concat(ms,"_").concat(t))}async function gs(t){let e;const{detailType:a,sysPFPluginId:s,appId:i}=t;if(s){const r=await Q(s,i);if(r&&(e=Es(r)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u5355\u6210\u5458\u63D2\u4EF6".concat(r,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=Es(a),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u5355\u6210\u5458\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var Ds=d("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Jr(t,e){ibiz.register.register("".concat(Ds,"_").concat(t),e)}function je(t){return ibiz.register.get("".concat(Ds,"_").concat(t))}async function re(t){let e;const{columnType:a,enableRowEdit:s,sysPFPluginId:i,appId:r}=t,{renderSysPFPluginId:n}=t;if(i){const u=await Q(i,r);if(u&&(e=je(u)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u683C\u5217\u63D2\u4EF6".concat(u,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(n){const u=await Q(n,r);if(u&&(e=je(u)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u6811\u8868\u683C\u5217\u63D2\u4EF6".concat(u,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}const o=s?"".concat(a,"_EDIT"):a;if(e=je(o),!e)ibiz.log.error("\u627E\u4E0D\u5230\u8868\u683C\u5217\u7C7B\u578B".concat(o,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var ws=d("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Zr(t,e){ibiz.register.register("".concat(ws,"_").concat(t.toUpperCase()),e)}function Rt(t){return ibiz.register.get("".concat(ws,"_").concat(t.toUpperCase()))}async function Cs(t){var e;let a;const{itemType:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(a=Rt(n)),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u6210\u5458\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return a}if(s==="CONTAINER"){const n=t.predefinedType||"DEFAULT",o="CONTAINER_".concat(n);if(a=Rt(o),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u5BB9\u5668\u9884\u7F6E\u7C7B\u578B\u4E3A".concat(n,"\u7684\u9002\u914D\u5668\uFF0C\u6CE8\u518Ckey\u4E3A").concat(o));else return a}if(s==="RAWITEM"){const n=((e=t.rawItem)==null?void 0:e.predefinedType)||"DEFAULT",o="RAWITEM_".concat(n);if(a=Rt(o),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u6210\u5458\u76F4\u63A5\u5185\u5BB9\u9884\u7F6E\u7C7B\u578B\u4E3A".concat(n,"\u7684\u9002\u914D\u5668\uFF0C\u6CE8\u518Ckey\u4E3A").concat(o));else return a}if(s==="FIELD"){const{editor:n}=t;if(n&&n.predefinedType){const o="FIELD_".concat(n.predefinedType.toUpperCase());if(a=Rt(o),a)return a}}if(a=Rt(s),!a)ibiz.log.error("\u627E\u4E0D\u5230\u9762\u677F\u6210\u5458\u7C7B\u578B".concat(s,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return a}var vs=d("PORTLET_PROVIDER_PREFIX","PORTLET");function tn(t,e){ibiz.register.register("".concat(vs,"_").concat(t),e)}function Is(t){return ibiz.register.get("".concat(vs,"_").concat(t))}async function As(t){let e;const{portletType:a,sysPFPluginId:s,appId:i}=t;if(s){const r=await Q(s,i);if(r&&(e=Is(r)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u95E8\u6237\u90E8\u4EF6\u63D2\u4EF6".concat(r,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=Is(a),!e)ibiz.log.error("\u627E\u4E0D\u5230\u95E8\u6237\u90E8\u4EF6\u6210\u5458\u7C7B\u578B".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}var ys=d("UIACTION_PROVIDER_PREFIX","UIACTION");function Pt(t,e){ibiz.register.register("".concat(ys,"_").concat(t),e)}function Ke(t){return ibiz.register.get("".concat(ys,"_").concat(t))}async function Fs(t){let e;const{uiactionMode:a,sysPFPluginId:s,appId:i,uiactionTag:r}=t;if(s){const n=await Q(s,i);if(n&&(e=Ke(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u754C\u9762\u884C\u4E3A\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=Ke("".concat(a,"_").concat(r)),e||(e=Ke(a),e))return e;throw new f("\u627E\u4E0D\u754C\u9762\u884C\u4E3A\u6A21\u5F0F".concat(a,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}var Ps=d("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");function en(t,e){ibiz.register.register("".concat(Ps,"_").concat(t),e)}async function bs(t){let e;const{sysPFPluginId:a,appId:s}=t,i=await Q(a,s);if(i){if(e=ibiz.register.get("".concat(Ps,"_").concat(i)),e)return e;throw new f("\u627E\u4E0D\u5230\u754C\u9762\u903B\u8F91\u524D\u7AEF\u63D2\u4EF6\u8282\u70B9\uFF0C\u63D2\u4EF6".concat(i,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}}var Ns=d("VIEW_PROVIDER_PREFIX","VIEW");function an(t,e){ibiz.register.register("".concat(Ns,"_").concat(t),e)}function ne(t){return ibiz.register.get("".concat(Ns,"_").concat(t))}async function sn(t){let e;const{viewType:a,viewStyle:s,sysPFPluginId:i,appId:r}=t;if(i){const n=await Q(i,r);if(n&&(e=ne(n)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u89C6\u56FE\u63D2\u4EF6".concat(n,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(s&&s!=="DEFAULT"){const n="".concat(a,"_").concat(s);if(e=ne(n),!e)ibiz.log.error("\u627E\u4E0D\u5230\u89C6\u56FE\u7C7B\u578B\uFF1A[".concat(a,"]\u7684\u89C6\u56FE\u6837\u5F0F\uFF1A[").concat(s,"]\u5BF9\u5E94\u7684\u9002\u914D\u5668"),t);else return e}return e||(e=ne(a)),e||(e=ne("DEFAULT")),e}var Ss=d("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");function rn(t,e){ibiz.register.register("".concat(Ss,"_").concat(t),e)}function nn(t){return ibiz.register.get("".concat(Ss,"_").concat(t))}function on(t){const e=nn(t);if(e)return e;throw new f("\u627E\u4E0D\u5F02\u6B65\u64CD\u4F5C\u7C7B\u578B".concat(t,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"))}var un=d("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(a.status!==200)throw new f("\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25");if(a.data){const s=e;return ha(a.data,s),Promise.resolve(!0)}else throw new f("\u6587\u4EF6\u6D41\u6570\u636E\u4E0D\u5B58\u5728")}}),cn=d("BrowserPlatformProvider",class extends un{});function ln(){const t=new cn;Ts("Browser",()=>t)}var Tt=window.navigator.userAgent.toLowerCase();function dn(){return/Android|Adr/i.test(Tt)}function hn(){return/iPhone|iPod|iPad/i.test(Tt)}function pn(){return/MicroMessenger/i.test(Tt)}function fn(){return/DingTalk/i.test(Tt)}function mn(){return/miniProgram/i.test(Tt)||window.__wxjs_environment==="miniprogram"}function Ls(){return dn()?"Android":hn()?"IOS":pn()?"WeChat":fn()?"DingTalk":mn()?"WeChatMiniProgram":"Browser"}var Rs=d("PLATFORM_PROVIDER_PREFIX","PLATFORM");function Ts(t,e){ibiz.register.register("".concat(Rs,"_").concat(t),e)}function Bs(t){return ibiz.register.get("".concat(Rs,"_").concat(t))}function Os(){const t=Ls(),e=Bs(t);return e||Bs("Browser")}var _s=d("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function oe(t,e){ibiz.register.register("".concat(_s,"_").concat(t),e)}function Ms(t){return ibiz.register.get("".concat(_s,"_").concat(t))}async function xs(t){let e;const{methodType:a,sysPFPluginId:s,appId:i}=t;if(s){const r=await Q(s,i);if(r&&(e=Ms(r)),!e)ibiz.log.error("\u627E\u4E0D\u5230\u5B9E\u4F53\u884C\u4E3A\u63D2\u4EF6".concat(r,"\u5BF9\u5E94\u7684\u9002\u914D\u5668"));else return e}if(e=Ms(a),e)return e;throw new f("\u627E\u4E0D\u5B9E\u4F53\u884C\u4E3A\u65B9\u6CD5\u7C7B\u578B\u4E3A".concat(a,"\u7684\u9002\u914D\u5668"))}var En=d("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=xt.create(),this.params={},this.evt=new wt,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=A(t)),e&&(this.params=A(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval(()=>{this.evt.getSize("change")>0&&this.load()},this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new f("\u672A\u5B9E\u73B0\u8BA1\u6570\u5668\u52A0\u8F7D\u65B9\u6CD5")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&k(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()}}),gn=d("AppDECounter",class extends En{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const a=this.model.getAppDEActionId;if(!a)throw new m(this.model,"\u672A\u627E\u5230\u83B7\u53D6\u8BA1\u6570\u5668\u884C\u4E3A!");this.action=a,await super.init(t,e)}async load(){const e=await ibiz.hub.getApp(this.context.srfappid).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}}),Dn=d("AppDECounterProvider",class{createCounter(t){return new gn(t)}});function Vs(){ds("DEDR",()=>new Dn)}var wn=d("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Yr;return a.parse(["OR",this.calcCond(e)]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach(a=>{const s=[];if(a.condType==="GROUP"){const i=a;i.notMode&&s.push("!"),s.push(a.condOp);const r=i.dedqconditions;if(r){const n=this.calcCond(r);s.push(n)}}else if(a.condType==="SINGLE"){const i=a;s.push(i.fieldName),i.condValue||s.push("")}else throw new w(a,"\u6682\u672A\u652F\u6301\u7684\u67E5\u8BE2\u6761\u4EF6\u7C7B\u578B: ".concat(a.condType));e.push(s)}),e}});wn.map=new WeakMap;var Cn=d("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){const t=async()=>{const{predefinedType:e}=this.codeList;if(e){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(e))throw new w(this.codeList,"\u9884\u5B9A\u4E49\u7C7B\u578B".concat(e,"\u6682\u4E0D\u652F\u6301"));return}this.initPromise=void 0};return this.initPromise=t(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:s,iconClsAppDEFieldId:i,iconClsXAppDEFieldId:r,iconPathAppDEFieldId:n,iconPathXAppDEFieldId:o,disableAppDEFieldId:u,dataAppDEFieldId:c}=this.codeList,l=a?t[a]:t.srfkey;if(e.id=l,e.value=l,e.text=s?t[s]:t.srfmajortext,(i||r||n||o)&&(e.sysImage={appId:this.codeList.appId},i&&(e.sysImage.cssClass=t[i]),r&&(e.sysImage.cssClassX=t[r]),n&&(e.sysImage.imagePath=t[n]),o&&(e.sysImage.imagePathX=t[o])),u&&(e.disableSelect=He(t[u])),c&&t[c])try{e.data=O.execSingleLine(t[c])}catch{ibiz.log.error("\u52A8\u6001\u4EE3\u7801\u8868\u6570\u636E\u5C5E\u6027\u8FD4\u56DE\u503C\u4E0D\u4E3A\u5BF9\u8C61\u683C\u5F0F\u7684\u5B57\u7B26\u4E32\uFF0C\u65E0\u6CD5\u8F6C\u6362\uFF01")}return e}async load(t={},e={}){const a=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:i,minorSortAppDEFieldId:r,minorSortDir:n,pvalueAppDEFieldId:o,customCond:u}=this.codeList,c={...e};if(r&&n&&Object.assign(c,{sort:"".concat(r.toLowerCase(),",").concat(n.toLowerCase())}),u){const p=O.execSingleLine(u),E=N(p,c,t);Object.assign(c,E)}if(c.size||(c.size=1e4),this.isPredefined){const p=await a.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),c);return Object.freeze(p.data.items)}if(!s)throw new m(this.codeList,"\u672A\u914D\u7F6E\u5E94\u7528\u5B9E\u4F53");if(!i)throw new m(this.codeList,"\u672A\u914D\u7F6E\u6570\u636E\u96C6");const l=await a.deService.exec(s,i,t,void 0,c);let h=[];return l.data.length&&l.data.forEach(p=>{if(o){const E=this.prepareTreeData(l.data);E&&(h=E)}else h.push(this.convertData(p))}),Object.freeze(h)}prepareTreeData(t,e){const{pvalueAppDEFieldId:a}=this.codeList;let s=[];if(s=t.filter(i=>e?i[a]===e:!i[a]),s.length!==0)return s.map(i=>{const r=this.convertData(i);return r.children=this.prepareTreeData(t,r.value),r})}async get(t={},e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const u=this.cache.get(a);if(u.expirationTime>new Date().getTime())return u.promise?u.promise:u.items;this.cache.delete(a)}const s=this.load(t,e),{cacheTimeout:i}=this.codeList,r=i===-1||C(i)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,n={expirationTime:new Date().getTime()+r,promise:s};this.cache.set(a,n);const o=await s;return n.items=o,delete n.promise,o}});function ks(t,e){if(e!=null){const{srfkey:a}=e;if(!C(a)&&!_(a))return!0}throw new f("\u6267\u884C\u300C".concat(t,"\u300D\u4E0D\u5B58\u5728\u300Csrfkey\u300D\u65E0\u6CD5\u5904\u7406"))}function dt(t,e){const{srfsessionid:a}=e;if(!C(a)&&!_(a))return!0;throw new f("\u6267\u884C\u300C".concat(t,"\u300D\u4E0D\u5B58\u5728\u300Csrfsessionid\u300D\u65E0\u6CD5\u5904\u7406"))}var vn=d("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!((t=this.entity.unionKeyValueAppDEFieldIds)!=null&&t.length)}forceAdd(t,e){const s=this.getCacheByTag(t).get(e.srfkey);s&&(s.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.getCacheByTag(t).set(e.srfkey,A(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.getCacheByTag(t).delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new f("\u65B0\u5EFA\u8054\u5408\u4E3B\u952E\u6570\u636E\u5931\u8D25\uFF0C\u5DF2\u6709\u4E3B\u952E\u4E3A".concat(e.srfkey,"\u7684\u6570\u636E"));try{return dt("add",t),(C(e.srfkey)||_(e.srfkey))&&(e.srfkey=K()),e.srftempdate=new Date().getTime(),this.getCacheByTag(t).set(e.srfkey,A(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(a){return ibiz.log.error(a),null}}get(t,e){try{dt("get",t);const s=this.getCacheByTag(t).get(e);return ibiz.log.warn("get",e,s),A(s)}catch(a){return ibiz.log.error(a),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new f("\u66F4\u65B0\u8054\u5408\u4E3B\u952E\u6570\u636E\u5931\u8D25\uFF0C\u5DF2\u6709\u4E3B\u952E\u4E3A".concat(e.srfkey,"\u7684\u6570\u636E"));try{dt("update",t),ks("update",e),e.srftempdate=new Date().getTime();const s=this.getCacheByTag(t),i=s.get(a);if(i)return i.assign(e),s.set(a,i),ibiz.log.warn("update",a,e),A(i);throw new Error("\u6570\u636E\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u66F4\u65B0!")}catch(s){return ibiz.log.error(s),null}}delete(t,e){try{dt("delete",t);const a=this.getCacheByTag(t),s=e;if(a.has(s)){const i=a.get(s);return i.srftempdate=new Date().getTime(),a.delete(s),ibiz.log.warn("delete",s),i}return null}catch(a){return ibiz.log.error(a),null}}createBatch(t,e){try{dt("add",t);const a=this.getCacheByTag(t);for(let s=0;s<e.length;s++){const i=e[s];(C(i.srfkey)||_(i.srfkey))&&(i.srfkey=K()),i.srftempdate=new Date().getTime();const r=A(i);a.set(i.srfkey,r),e[s]=r,ibiz.log.warn("add",i.srfkey,i)}return e}catch(a){ibiz.log.error(a)}return[]}updateBatch(t,e){try{dt("update",t);const a=this.getCacheByTag(t);for(let s=0;s<e.length;s++){const i=e[s];ks("update",i),i.srftempdate=new Date().getTime();const r=a.get(i.srfkey);if(r)r.assign(i),a.set(i.srfkey,r),ibiz.log.warn("update",i.srfkey,i),e[s]=A(r);else throw new Error("\u6570\u636E[".concat(i.srfdename,"-").concat(i.srfmajortext,"(").concat(i.srfkey,")]\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u66F4\u65B0!"))}return e}catch(a){return ibiz.log.error(a),null}}deleteBatch(t,e){try{dt("delete",t)}catch(i){return ibiz.log.error(i),e}const a=this.getCacheByTag(t),s=[];for(let i=0;i<e.length;i++){const r=e[i];a.has(r)||s.push(r)}if(s.length>0)throw new Error("\u672A\u627E\u5230\u4EE5\u4E0B\u6570\u636E\u300C".concat(s.join("\u3001"),"\u300D\uFF0C\u65E0\u6CD5\u5220\u9664!"));for(let i=0;i<e.length;i++){const r=e[i];a.delete(r),ibiz.log.warn("delete",r)}return[]}checkData(t,e){return this.getList(t).findIndex(i=>i.srfkey===e)!==-1}getList(t){try{dt("getList",t);const e=this.getCacheByTag(t);if(!e)return[];const a=e.values();return Array.from(a)}catch(e){return ibiz.log.error(e),[]}}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ct(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const s=t[a];e[a]=ct(s)}return vt(e)}clear(t){const e=t.srfsessionid;this.cacheMap.size>0&&this.cacheMap.delete(e)}getCacheByTag(t){const e=t.srfsessionid;return this.cacheMap.has(e)||this.cacheMap.set(e,new Map),this.cacheMap.get(e)}calcUnionKey(t){const a=this.entity.unionKeyValueAppDEFieldIds.map(s=>lt(this.entity.appDEFields||[],s).codeName.toLowerCase()).map(s=>C(t[s])?"__empty__":t[s]);t.srfkey=a.join("||")}}),In=/\$\{(.*?)\}/g;function Ws(t,e){const i=(e.requestPaths||[]).map(r=>{const n=r.match(In),o=n?.map(u=>u.substring(2,u.length-1))||[];return{path:r,keys:o}}).filter(r=>{const{keys:n}=r;return n.length===0?!0:n.every((o,u)=>u===n.length-1?!0:t[o]!=null)}).sort((r,n)=>n.keys.length-r.keys.length);if(i.length>0)return i[0]}function ue(t,e){const a=Ws(t,e);if(a){if(a.keys.length>0){let{path:s}=a;return a.keys.forEach((i,r)=>{r===a.keys.length-1?s=s.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):s=s.replace("${".concat(i,"}"),t[i])}),s}return a.path}return""}var An=d("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(!C(e.page)&&!_(e.page)&&(this.page=e.page),!C(e.size)&&!_(e.size)&&(this.size=e.size),!C(e.query)&&!_(e.query)&&(this.query=e.query),!C(e.sort)&&!_(e.sort)){const a=e.sort.split(",");a.length>=1&&([this.sortField]=a),a.length>=2&&(this.sortMode=a[1].toUpperCase())}!C(e.srfparentkey)&&!_(e.srfparentkey)&&(this.srfparentkey=e.srfparentkey),!C(e.srfparentdename)&&!_(e.srfparentdename)&&(this.srfparentdename=e.srfparentdename),this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort,delete this.data.srfparentkey,delete this.data.srfparentdename}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function He(t){return[1,"1",!0,"true"].includes(t)}var yn=d("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let s=[];return a?.length&&(s=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(s)),s}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map(a=>{var s;let i=a.text;a.textLanguageRes&&(i=ibiz.i18n.t(a.textLanguageRes.lanResTag,a.text));let{tooltip:r}=a;a.tooltipLanguageRes&&(r=ibiz.i18n.t(a.tooltipLanguageRes.lanResTag,a.tooltip));const n={text:i,value:e?Number(a.value):a.value,color:a.color,id:a.codeName,textCls:a.textCls,disableSelect:a.disableSelect,tooltip:r,data:a.data?O.execSingleLine(a.data):void 0,sysImage:a.sysImage};return(s=a.codeItems)!=null&&s.length&&(n.children=this.formatStaticItems(a.codeItems,e)),Object.freeze(n)})}async getDynamicCodeList(t,e={},a={}){let s;const i=t.codeName;return this.cache.has(i)?s=this.cache.get(i):(s=new Cn(t),this.cache.set(i,s),await s.init()),s.get(e,a)}async get(t,e,a){const s=this.allCodeLists.get(t);if(!s)throw new f("\u627E\u4E0D\u5230".concat(t,"\u4EE3\u7801\u8868"));return s.codeListType==="STATIC"?this.getStatic(s):s.codeListType==="DYNAMIC"?this.getDynamicCodeList(s,e,a):[]}}),Bt=d("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return e.ok?e.data:!1}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok?t.data||{}:{}}}),Us=d("CounterService",class{static async getCounter(t,e,a){const s=t.id;if(this.counterMap.has(s)){const n=this.counterMap.get(s);if(n.isDestroyed===!1)return n;this.counterMap.delete(s)}const r=(await hs(t)).createCounter(t);return await r.init(e,a),this.counterMap.set(s,r),r}static async getCounterByRef(t,e,a){const{appCounter:s}=t;if(!s)throw new m(t,"\u672A\u914D\u7F6E\u5E94\u7528\u8BA1\u6570\u5668!");return this.getCounter(s,e,a)}});Us.counterMap=new Map;var Fn=d("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:s}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(s,"/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(){return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},s={}){switch(t){case"wfstart":return this.wfStart(e,a,s);case"wfsubmit":return this.wfSubmit(e,a,s);case"reassign":return this.wfReassign(e,a,s);case"addstepbefore":return this.wfAddStepBefore(e,a,s);case"addstepafter":return this.wfAddStepAfter(e,a,s);case"sendback":return this.wfSendBack(e,a,s);case"sendcopy":return this.wfSendCopy(e,a,s);default:throw new f("\u300C".concat(t,"\u300D\u672A\u5B9E\u73B0"))}}}),Pn=class{constructor(t){this.model=t}exportData(t,e,a,s){const i=ue(a,this.model),r="".concat(i,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(r,{method:"post",data:s,responseType:"blob"})}},bn=d("DEService",class{constructor(t){this.model=t,this.methodMap=new Map,this.local=new vn(t),this.configCache=new Bt(t.appId,"PSAppDataEntity",t.codeName),this.wf=new Fn(t),this.file=new Pn(t)}async getMethod(t,e=!1){const a=e?"ac-".concat(t):t;if(this.methodMap.has(a))return this.methodMap.get(a);const s=lt(this.model.appDEMethods,t),i=await xs(s);if(!i)throw new w(s,"\u672A\u652F\u6301\u7684\u670D\u52A1\u65B9\u6CD5\u7C7B\u578B: ".concat(s.methodType));const r=i.create(this.model,s,{acMode:e});return this.methodMap.set(a,r),r}async exec(t,e,a,s){const i=await this.getMethod(t);if(i)return i.exec(e,a,s);throw new f("".concat(this.model.codeName,"\u672A\u652F\u6301\u300C").concat(t,"\u300D\u65B9\u6CD5"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async selectLocal(t,e={}){let a=this.local.getList(t);a=ye(a,"srfordervalue");const s={},i={},r={},n={};e.srfkey&&(s.srfkey=ct(e.srfkey),delete e.srfkey);for(const u in e)if(Object.prototype.hasOwnProperty.call(e,u)){const c=e[u];c==null?(i[u]=ct(null),r[u]=ct(void 0),n[u]=ct("")):s[u]=ct(c)}if(!_(s)){const u=vt(s),c=vt(i),l=vt(r),h=vt(n);a=a.filter(p=>{if(_(i)){if(u(p))return!0}else if(u(p)&&(c(p)||l(p)||h(p)))return!0;return!1})}return a.map(u=>u.clone())}async execAc(t,e,a,s={}){const i=await this.getMethod(t,!0);if(i)return i.exec(e,a,s);throw new f("".concat(this.model.codeName,"\u672A\u652F\u6301\u300C").concat(t,"\u300D\u65B9\u6CD5"))}aiChatSse(t,e,a={},s={}){const i=ibiz.hub.getApp(this.model.appId),r=this.calcSsePath(e);return new Promise((n,o)=>{i.net.sse("/".concat(r),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(s),onmessage:u=>{if(u.data){const c=JSON.parse(u.data);t(c)}},onclose:()=>{n()},onerror:u=>{o(u)}})})}aiChatHistory(t,e={},a={}){const s=ibiz.hub.getApp(this.model.appId),i=this.calcSsePath(t,!0);return s.net.post(i,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],s="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return ue(t,this.model)+s}}),Nn=d("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(Nn||{})),Sn=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],X=d("ControlVO",class la{constructor(e={},a=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:e||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:a||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(s){this.$origin.srfactionparam=s},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.$origin,s))Object.defineProperty(this,s,{get(){return this.$origin[s]},set(i){this.$origin[s]=i},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(s)){const{dataKey:i}=this.$dataUIMap.get(s);Object.defineProperty(this,s,{get(){return this.$origin[i]},set(r){this.$origin[i]=r},enumerable:!1,configurable:!0})}else Object.defineProperty(this,s,{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(s){this.$origin.tempsrfkey=s},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:C(this.srfkey)?K():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(s=>{Object.defineProperty(this,s,{get(){return this.$origin[s]},enumerable:!1,configurable:!0})}),this.$dataUIMap.forEach((s,i)=>{const r=s.dataKey;this.linkProperty(i,r,s)}),Object.keys(e).forEach(s=>{Object.prototype.hasOwnProperty.call(this,s)||this.linkProperty(s,s)})}linkProperty(e,a,s){const i=s?s.isOriginField:!0;Sn.includes(e)||(i||Object.prototype.hasOwnProperty.call(this.$origin,e)?Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get(){return this.$origin[a]},set(r){this.$origin[a]=r}}):Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof la?e.getOrigin():e}clone(){const e=A(this.$origin),a=new la(e,this.$dataUIMap);return Object.keys(this).forEach(s=>{a[s]=this[s]}),a}}),ce=d("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,s){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,s)}handleResponse(t){return pa(t)}toUIData(t){return new X(t,this.dataUIMap)}}),rt=d("MDControlService",class extends ce{async fetch(t,e={}){var a;const s=((a=this.model.fetchControlAction)==null?void 0:a.appDEMethodId)||"fetchdefault";let i=await this.exec(s,t,e);return i=this.handleResponse(i),i}async get(t,e={}){var a;const s=((a=this.model.getControlAction)==null?void 0:a.appDEMethodId)||"get";let i=await this.exec(s,t,void 0,e);return i=this.handleResponse(i),i}async getDraft(t,e={}){var a;const s=((a=this.model.getDraftControlAction)==null?void 0:a.appDEMethodId)||"getdraft";let i=await this.exec(s,t,void 0,e);return i=this.handleResponse(i),i}async remove(t,e={}){var a;const s=((a=this.model.removeControlAction)==null?void 0:a.appDEMethodId)||"remove";return await this.exec(s,t,void 0,e)}async create(t,e){var a;const s=((a=this.model.createControlAction)==null?void 0:a.appDEMethodId)||"create";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}async update(t,e){var a;const s=((a=this.model.updateControlAction)==null?void 0:a.appDEMethodId)||"update";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}async exportData(t,e,a={}){throw new f("\u672A\u5B9E\u73B0")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&(Kt(e.data)?e.data=e.data.map(a=>this.toUIData(a)):e.data=this.toUIData(e.data)),e}}),Ln=d("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){return!(e.srfopprivs&&!e.srfopprivs.includes(t)||!await this.calcByDeMainState(t,e))}async calcByDeMainState(t,e){let a=!0;const s=this.entityModel;if(!s.enableDEMainState)return ibiz.log.debug("".concat(s.codeName,"\u5B9E\u4F53\u4E0D\u5B58\u5728\u6216\u8005\u4E3A\u542F\u7528\u4E3B\u72B6\u6001\uFF0C\u8FD4\u56DEtrue")),a;ibiz.log.debug("\u64CD\u4F5C\u6807\u8BC6".concat(t,"\u4E3B\u72B6\u6001\u8BA1\u7B97\u5F00\u59CB"),e,s);const i=Ha(s,e);if(i){ibiz.log.debug("\u5339\u914D\u4E3B\u72B6\u6001",i);const r=Xa(i,s);ibiz.log.debug("\u5141\u8BB8\u7684\u4E3B\u72B6\u6001\u6743\u9650\u96C6\u5408",r),a=r.includes(t)}else ibiz.log.debug("\u6CA1\u5339\u914D\u4E3B\u72B6\u6001\uFF0C\u8FD4\u56DEfalse"),a=!1;return ibiz.log.debug("\u64CD\u4F5C\u6807\u8BC6".concat(t,"\u6743\u9650\u8BA1\u7B97\u7ED3\u675F\uFF1A").concat(a)),a}}),Rn=d("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 f("\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[".concat(t,"]"));const a=this.constructorCache.get(t);let s;a?s=await a(e):s=new Ln(e),this.cache.set(t,s)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),t.enablepermissionvalid===!0&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const r=await(await ibiz.hub.getApp(this.appModel.appId)).getOPPriv(t,a);if(this.enablePermission&&r?.mapSysUniResCode&&!this.calcByResCode(r.mapSysUniResCode))return!1}return e&&a?(await this.getService(a)).calcByDataAccessAction(t,e):!0}}),Tn=d("V7AuthService",class{async login(t,e,a){try{const s=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:i}=s;if(i&&i.token){a&&Ct(q.TOKEN_REMEMBER,"1",7,!0),Ct(q.TOKEN,i.token,a?7:0,!0);const r=new Date().getTime()+(i.expirein||7199)*1e3;Ct(q.TOKEN_EXPIRES,"".concat(r),a?7:0,!0)}return!0}catch(s){ibiz.notification.error({title:"\u767B\u5F55\u5931\u8D25",desc:s.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),Ht(q.TOKEN),Ht(q.TOKEN_EXPIRES),Ht(q.TOKEN_REMEMBER),!0}catch(t){ibiz.notification.error({title:"\u767B\u51FA\u5931\u8D25",desc:t.message||""})}return!1}async extendLogin(){const t=Xt(q.TOKEN),e=Xt(q.TOKEN_EXPIRES),a=Xt(q.TOKEN_REMEMBER);if(t&&e){let s=Number(e)-new Date().getTime();const i=5*60*1e3;s=s>i?s-i:0,setTimeout(async()=>{const r=await ibiz.net.get("/uaa/refreshtoken2");if(r.ok){Ct(q.TOKEN,r.data.token,a?7:0,!0);const n=new Date().getTime()+(r.data.expirein||7199)*1e3;Ct(q.TOKEN_EXPIRES,"".concat(n),a?7:0,!0)}this.extendLogin()},s)}}}),Bn=d("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return C(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),le=d("AppDataEntity",class De{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:a instanceof De?A(a._data):A(a)}),Object.defineProperty(this,"srfdeid",{get(){return e.id}}),Object.defineProperty(this,"srfdecodename",{get(){return e.codeName}});const s=lt(e.appDEFields||[],e.keyAppDEFieldId);if(s){const r=s.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get(){return r}}),Object.defineProperty(this,"srfkey",{set(n){this._data[r]=n},get(){return this._data[r]}})}else ibiz.log.warn("\u5B9E\u4F53[".concat(e.codeName,"]\u672A\u914D\u7F6E\u4E3B\u952E\u5B57\u6BB5"));const i=lt(e.appDEFields||[],e.majorAppDEFieldId);if(i){const r=i.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get(){return r}}),Object.defineProperty(this,"srfmajortext",{set(n){this._data[r]=n},get(){return this._data[r]}})}else ibiz.log.warn("\u5B9E\u4F53[".concat(e.codeName,"]\u672A\u914D\u7F6E\u4E3B\u6587\u672C\u5B57\u6BB5"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:C(this.srfkey)?K():this.srfkey}),this.defineProperties()}defineProperties(){var e;const{_data:a,convertVal:s}=this,i={};Object.keys(a).forEach(n=>{i[n]={enumerable:!0,set(o){a[n]=o},get(){return a[n]}}}),(e=this._entity.appDEFields)==null||e.forEach(n=>{const o=n.codeName.toLowerCase();i[o]={enumerable:!0,set(u){a[o]=s(u,n.stdDataType)},get(){return a[o]}},a[o]=s(a[o],n.stdDataType)}),Object.defineProperties(this,i)}clone(){const e=new De(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return e instanceof De?a=e._data:a=e,Object.keys(a).forEach(s=>{a[s]===void 0&&delete a[s]}),Object.assign(this._data,a),this}convertVal(e,a){if(e==null||C(a))return e;if(Vt.isNumber(a)){const s=!C(e)&&e!==""?Number(e):e;return Number.isNaN(s)?(ibiz.log.debug("".concat(e,"\u4E0D\u80FD\u8F6C\u6362\u6210\u6570\u5B57")),e):s}return e}}),zs=d("MethodDto",class Ci{constructor(e,a,s){this.entity=e,this.isLocalMode=a,this.dto=s,this.dtoMap=new Map,s?(this.app=ibiz.hub.getApp(e.appId),this.fields=s.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(e){const a={};return e.forEach((s,i)=>{a[i+1]=s}),a}convertListMapToArray(e){const a=[];return Object.keys(e).forEach(s=>{const i=parseInt(s,10);a[i-1]=e[i]}),a}async get(e,a){const s={};for(let i=0;i<this.fields.length;i++){const r=this.fields[i],n=r.codeName.toLowerCase();switch(r.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":{if(r.listMap)a[n]&&(s[n]=a[n].length===0?null:this.convertArrayToListMap(a[n]));else{if(a[n]!==void 0||!r.refAppDataEntityId)break;const o=await this.getFieldDto(r),c=await(await this.app.deService.getService(r.refAppDataEntityId)).selectLocal(e,{srfpkey:a[this.entity.keyAppDEFieldId]});if(c){const l=[];for(let h=0;h<c.length;h++)l.push(await o.get(e,c[h]));s[n]=l}}break}default:throw new w(r,"\u672A\u652F\u6301\u7684\u5E94\u7528\u5B9E\u4F53\u65B9\u6CD5\u8F93\u5165\u5C5E\u6027\u7C7B\u578B: ".concat(r.type))}}return{...a,...s}}async sets(e,a){const s=await this.app.deService.getService(this.entity.id);return this.isLocalMode&&s.local.clear(e),Promise.all(a.map(async i=>{const r=this.fields.filter(o=>o.type==="DTOS").map(async o=>{const u=o.codeName.toLowerCase();if(o.listMap&&typeof i[u]=="object")i[u]=this.convertListMapToArray(i[u]);else{if(!o.refAppDataEntityId)return;const c=await this.getFieldDto(o),l=i[u];if(l){const h=i[this.entity.keyAppDEFieldId];l.forEach(p=>{p.srfpkey=h}),await c.sets(e,l)}else await c.sets(e,[])}});for(let o=0;o<r.length;o++)await r[o];const n=new le(this.entity,i);return this.isLocalMode&&await s.local.add(e,n),n}))}async getFieldDto(e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),s=lt(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),i=new Ci(a,!0,s);return this.dtoMap.set(e.codeName,i),i}});function de(t){return t.actionType==="BUILTIN"||t.dataSetType==="DATAQUERY"}var On=d("MethodInput",class{constructor(t,e){this.entity=t,this.method=e;const a=e.appDEMethodInput;if(a){const s=lt(t.appDEMethodDTOs||[],a.appDEMethodDTOId);s&&(this.dto=new zs(t,this.isLocalMode,s))}}get isLocalMode(){return de(this.method)}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),_n=d("MethodReturn",class{constructor(t,e){this.entity=t,this.method=e;const a=e.appDEMethodReturn;if(a){const s=lt(t.appDEMethodDTOs||[],a.appDEMethodDTOId);s&&(this.dto=new zs(t,this.isLocalMode,s))}}get isLocalMode(){return de(this.method)}async handle(t,e){return this.dto?(await this.dto.sets(t,[e]))[0]:(z(e)&&(e={}),new le(this.entity,e))}}),Gs=d("Method",class{constructor(t,e){this.entity=t,this.method=e,this.app=ibiz.hub.getApp(t.appId),this.input=new On(t,e),this.result=new _n(t,e)}async request(t,e,a,s){const{actionType:i,requestMethod:r}=this.method;if(i==="REMOTE"){const n=this.method.codeName.toLowerCase();let o=null;switch(r){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,n),a||s||{});break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,n),a||s);break;case"PUT":{o=await this.app.net.put(this.mergeRequestPath(t,n),a||s||{});break}case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,n),a||s);break;default:throw r?new m(this.method,"\u672A\u652F\u6301\u7684\u8BF7\u6C42\u65B9\u5F0F: ".concat(r)):new m(this.method,"\u672A\u914D\u7F6E\u8BF7\u6C42\u65B9\u5F0F")}return o}throw new m(this.method,"\u672A\u652F\u6301\u7684\u884C\u4E3A\u7C7B\u578B[".concat(i,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return ue(t,this.entity)+e}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(t){const e=a=>a instanceof le?a.clone():new le(this.entity,a);return Z(t)?t.map(a=>e(a)):e(t)}}),Mn=class{constructor(t,e,a,s){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:Z(a)?a:[a],params:s}}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;(e=this.deLogicParams.get(t))==null||e.calc(this)}renewParam(t){var e;(e=this.deLogicParams.get(t))==null||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)}},js=class{},xn=class extends js{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,a){const s=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=a[this.value]!=null?a[this.value]:e[this.value];return at(s[this.dstField],this.op,i)}case"SRCENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6E90\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=t.params[this.srcParam];return at(s[this.dstField],this.op,i[this.value])}case"CURTIME":throw new w(this.model,"\u6682\u672A\u652F\u6301\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u5F53\u524D\u65F6\u95F4]");default:return at(s[this.dstField],this.op,this.value)}}},Vn=class vi extends js{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map(s=>s.logicType==="SINGLE"?new xn(s):new vi(s))}get op(){return this.model.groupOP}get notMode(){return this.model.notMode===!0}test(e,a,s){let i=!0;if(this.conds.length===0)throw new m(this.model,"\u754C\u9762\u8FDE\u63A5\u6761\u4EF6\u903B\u8F91\u7EC4\u672A\u914D\u7F6E\u903B\u8F91\u9879");for(let r=0;r<this.conds.length;r++){const o=this.conds[r].test(e,a,s);if(this.op==="AND"&&o===!1){i=!1;break}if(this.op==="OR"&&o===!0){i=!0;break}}return this.notMode?!i:i}},kn=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new Vn(e))}async exec(t){const{defaultLink:e}=this.model;return e||!this.groupCond?!0:this.groupCond.test(t,t.context,t.data[0]||{})}},$=class{constructor(t){this.model=t;var e;this.links=(e=t.links||[])==null?void 0:e.map(a=>new kn(a))}},Wn=class extends ${async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDELogicParamId:s,retDELogicParamId:i}=this.model;if(!e)throw new m(this.model,"\u672A\u6307\u5B9A\u5E94\u7528\u5B9E\u4F53");if(!a)throw new m(this.model,"\u672A\u6307\u5B9A\u5B9E\u4F53\u884C\u4E3A");const r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(e,a,t.context,r,t.viewParam);o.ok&&(t.params[i]=o.data)}},Un=class extends ${async exec(t){}},zn=class extends ${async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;case"LOGICPARAMFIELD":case"BREAK":default:throw new w(this.model,"\u6682\u672A\u652F\u6301\u7684\u7ED3\u675F\u8282\u70B9\u8FD4\u56DE\u503C\u7C7B\u578B: ".concat(a))}}};function gt(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:i}=e,r=e.srcValueType||"SRCDLPARAM";let n=s,o;switch(r){case"SRCDLPARAM":o=t.params[a],t.isEntityParam(a)&&(n=n?.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(i);case"WEBCONTEXT":case"VIEWPARAM":o=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":o=t.parameters.context;break;case"ENVPARAM":o=A(ibiz.env);break;default:throw new w(e,"\u6682\u672A\u652F\u6301\u6E90\u503C\u7C7B\u578B".concat(r))}if(o&&n)try{Array.isArray(o)?o=o[Number(n)]:o=O.execScriptFn({srcValue:o},"srcValue.".concat(n),{singleRowReturn:!0,isAsync:!1})}catch(u){throw ibiz.log.error("\u4ECE\u6E90\u53C2\u6570\u53D6\u5C5E\u6027".concat(n,"\u62A5\u9519\uFF0C\u6E90\u53C2\u6570\uFF1A"),o),u}return o}var Gn=class extends ${async exec(t){const e=this.model.delogicNodeParams;e?.length&&await Promise.all(e.map(a=>{switch(a.paramAction){case"SETPARAMVALUE":return this.setParamValue(a,t);case"RESETPARAM":return this.resetParam(a,t);case"COPYPARAM":return this.copyParam(a,t);case"BINDPARAM":return this.bindParam(a,t);case"RENEWPARAM":return this.renewParam(a,t);case"APPENDPARAM":return this.appendParam(a,t);case"SORTPARAM":return this.sortParam(a,t);default:throw new w(a,"\u6682\u672A\u652F\u6301\u903B\u8F91\u5904\u7406\u53C2\u6570\u64CD\u4F5C".concat(a.paramAction))}}))}copyParam(t,e){const{dstDELogicParamId:a}=t,s=gt(e,t);e.params[a]=A(s)}bindParam(t,e){const a=gt(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:s}=t;let i=a;e.isEntityParam(s)&&(i=i?.toLowerCase());const r=gt(e,t);i?e.params[s][i]=r:e.params[s]=r}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=t,n=gt(e,t),o=s||0,u=i||0,c=r||n.length;e.params[a].splice(o,0,...n.slice(u,c))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:s,dstSortDir:i}=t,r=s.toLowerCase();e.params[a].sort((o,u)=>i==="ASC"?o[r]-u[r]:u[r]-o[r])}},jn=class extends ${async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:s,retDELogicParamId:i}=this.model,r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(a,e,t.context,r);o.ok&&(t.params[i]=o.data)}},Kn=class extends ${async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=gt(t,this.model);t.params[e]=s}},Hn=class extends ${async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.resetParam(e)}},Xn=class extends ${async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.renewParam(e)}},Yn=class extends ${async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=gt(t,this.model);t.params[e]=A(s)}},qn=class extends ${async exec(t){const{dstDELogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u76EE\u6807\u5C5E\u6027\u914D\u7F6E");const i=s.toLowerCase();t.params[e].sort((n,o)=>a==="ASC"?n[i]-o[i]:o[i]-n[i])}},Qn=class extends ${async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const n=gt(t,this.model),o=s||0,u=i||0,c=r||n.length;t.params[e].splice(o,0,...n.slice(u,c))}},$n=class extends ${async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new ut({response:{status:e,statusText:a}})}},Jn=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=A(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u5206\u9875\u67E5\u8BE2\u7ED3\u679C");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=A(t.data||{});else{if(a.envParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF");if(a.fileListParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u6587\u4EF6\u5BF9\u8C61\u5217\u8868\u53D8\u91CF");if(a.fileParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u6587\u4EF6\u5BF9\u8C61\u53D8\u91CF");if(a.filterParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u8FC7\u6EE4\u5668\u5BF9\u8C61\u53D8\u91CF");if(a.lastParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u6700\u540E\u6570\u636E\u53D8\u91CF");if(a.originEntity)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u539F\u59CB\u6570\u636E\u5BF9\u8C61");if(a.sessionParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u64CD\u4F5C\u4F1A\u8BDD\u53D8\u91CF")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else if(a.simpleParam||a.entityParam)t.params[e]={};else throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B\u91CD\u65B0\u5EFA\u7ACB\u53D8\u91CF")}},Zn=class{constructor(t){this.model=t,this.nodes=new Map,this.params=new Map;var e,a;if(t.customCode){if(!t.scriptCode)throw new m(t,"\u811A\u672C\u4EE3\u7801\u6A21\u5F0F\u6CA1\u6709\u914D\u7F6E\u811A\u672C\u4EE3\u7801");this.scriptFn=O.createScriptFn([],t.scriptCode,{isAsync:!0});return}if(!((e=t.delogicNodes)!=null&&e.length))throw new m(t,"\u5B9E\u4F53\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u903B\u8F91\u8282\u70B9");t.delogicNodes.forEach(s=>{const{logicNodeType:i}=s;let r;switch(i){case"BEGIN":r=new Un(s);break;case"END":r=new zn(s);break;case"DEACTION":r=new Wn(s);break;case"PREPAREPARAM":r=new Gn(s);break;case"DEDATASET":r=new jn(s);break;case"THROWEXCEPTION":r=new $n(s);break;case"BINDPARAM":r=new Kn(s);break;case"RESETPARAM":r=new Hn(s);break;case"COPYPARAM":r=new Yn(s);break;case"RENEWPARAM":r=new Xn(s);break;case"APPENDPARAM":r=new Qn(s);break;case"SORTPARAM":r=new qn(s);break;default:throw new w(s,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8282\u70B9\u7C7B\u578B: ".concat(i))}this.nodes.set(s.id,r)}),(a=t.delogicParams)==null||a.forEach(s=>{this.params.set(s.id,new Jn(s))}),this.nodes.forEach(s=>{s.links.forEach(i=>{i.srcNode=s,this.nodes.has(i.model.thenId)&&(i.dstNode=this.nodes.get(i.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 Mn(this.params,t,e,a);this.initLogicParams(s);const{startDELogicNodeId:i}=this.model;if(i&&this.nodes.has(i)){const r=this.nodes.get(i);await this.deepExec(r,s)}else throw new m(this.model,"\u672A\u8BBE\u7F6E\u8D77\u59CB\u8282\u70B9");return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let s=0;s<a.length;s++){const i=a[s];if(await i.exec(e)&&i.dstNode&&(await this.deepExec(i.dstNode,e),t.model.parallelOutput===!1))break}}},Xe=new Map;async function to(t,e,a){const s=await ibiz.hub.getAppDataEntity(e,a);return Oe(t,s)}async function he(t,e,a={},s={}){return Xe.has(t)||Xe.set(t,new Zn(t)),Xe.get(t).exec(e,a,s)}async function Ks(t,e,a,s,i){const r=await to(t,e,a.srfappid);if(!r)throw new f("".concat(e,"\u627E\u4E0D\u5230\u5B9E\u4F53\u903B\u8F91").concat(t));return he(r,a,s,i)}async function Hs(t,e,a,s){const i=A(e),r=a&&A(a),n=s&&A(s);try{const o=await he(t,i,r,n);return new U(o)}catch(o){if(o instanceof ut)return new U(o,500);throw o}}async function Xs(t,e,a,s,i){const r=qa(t,e);r.length&&(await Promise.all(r.map(o=>he(o,a,s,i)))).forEach(o=>{Object.assign(s,o)})}async function Ot(t,e,a,s,i={}){if(s){if(Z(s)){await Promise.all(s.map(r=>Xs(t,e,a,r,i)));return}return Xs(t,e,a,s,i)}}var eo=d("DEActionMethod",class extends Gs{get isLocalMode(){return de(this.method)}async inputHandle(t,e){return Z(e)?e:this.input.handle(t,e)}async exec(t,e,a){if(e&&await Ot(this.entity,"change",t,e,a),this.method.actionType==="DELOGIC"){const i=Oe(this.method.appDELogicId,this.entity);if(!i)throw new m(this.method,"\u7F3A\u5C11\u5B9E\u4F53\u5904\u7406\u903B\u8F91");return Hs(i,t,e,a)}e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await Ot(this.entity,"change",t,e,a);let s;switch(this.method.codeName){case"Create":s=await this.create(t,e,a||{});break;case"Get":s=await this.get(t,a);break;case"GetDraft":s=await this.getDraft(t,a);break;case"Remove":s=await this.remove(t,a);break;case"Update":s=await this.update(t,e,a);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,a);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let i=this.calcPath(t);if(this.method.needResourceKey){let n=t[this.entity.codeName.toLowerCase()];ya(n)&&(n=Z(e)?null:e?.[this.entity.keyAppDEFieldId]),i="".concat(i,"/").concat(n)}const r=await this.request(i,t,e,a);r.data=await this.result.handle(t,r.data),s=r}}return s.data&&await Ot(this.entity,"compute",t,s.data,a),s}async create(t,e,a){if(!e)throw new f("create\u884C\u4E3A\u6CA1\u6709\u4F20data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const s=this.calcPath(t),i=await this.app.net.post(s,e,a);return i.data=await this.result.handle(t,i.data),i}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new f("update\u884C\u4E3A\u6CA1\u6709\u4F20data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const s=this.calcPath(t),i=await this.app.net.put("".concat(s,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return i.data=await this.result.handle(t,i.data),i}async get(t,e={}){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);return s.data=await this.result.handle(t,s.data),s}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get("".concat(a,"/getdraft"),e);return s.data=await this.result.handle(t,s.data),s}async createTemp(t,e){try{const a=await this.getService(),s=this.createEntity(e);let i;return Z(s)?i=await Promise.all(s.map(r=>a.local.add(t,r))):i=await a.local.add(t,s),new U(i)}catch(a){throw new ut(a)}}async getDraftTemp(t,e){try{const a=this.createEntity({});return a?new U(a):new U(a,500)}catch(a){return new U(a,500)}}async removeTemp(t,e){try{let a=null;!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=(await this.getService()).local.delete(t,a);return i?new U(i):new U(i,500)}catch(a){throw new ut(a)}}async updateTemp(t,e){try{const a=await this.getService(),s=this.createEntity(e);let i;return Z(s)?i=await Promise.all(s.map(r=>a.local.update(t,r))):i=await a.local.update(t,s),i?new U(i):new U(i,500)}catch(a){throw new ut(a)}}async getTemp(t,e){try{let a=null;!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=(await this.getService()).local.get(t,a);return i?new U(i):new U(i,500)}catch(a){throw new ut(a)}}async removeBatchTemp(t,e){return new U(!0)}}),ao=class{create(t,e,a){return new eo(t,e)}},Ys=d("FetchMethod",class extends Gs{get isLocalMode(){return de(this.method)}async exec(t,e,a){const s=e&&!Z(e)?e:a||{};if(this.isLocalMode){const n=await this.searchLocal(null,new An(t,s));return new U(n,200)}let i;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":i=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const n=this.calcPath(t);i=await this.request(n,t,e,a)}break;default:throw new w(this.method,"\u6570\u636E\u6765\u6E90\u7C7B\u578B".concat(this.method.dataSetType,"\u6682\u672A\u652F\u6301"))}const r=i.data||[];return i.data=r.map(n=>this.createEntity(n)),i.data&&await Ot(this.entity,"compute",t,i.data,s),i}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){const s=await this.getService();let i=[];t?(i=s.local.getList(e.context),i.length>0&&(i=i.filter(l=>t.test(l,e)))):(i=await s.selectLocal(e.context,e.data),i.length>0&&e.query&&e.query!==""&&a&&(i=i.filter(l=>{const h=new RegExp(e.query);for(let p=0;p<a.length;p+=1){const E=a[p],D=l[E];if(h.test(D))return!0}return!1}))),!C(e.sortField)&&!_(e.sortField)&&(e.sortMode==="DESC"?i=_a(i,e.sortField):i=ye(i,e.sortField));const{page:r,size:n}=e,o=r*n,u=(r+1)*n-1;return i.slice(o,u).map(l=>A(l))}async fetchCodeListSet(t,e){const{appCodeListId:a}=this.method;if(!a)throw new m(this.method,"\u6CA1\u6709\u6307\u5B9A\u6570\u636E\u6765\u6E90\u4EE3\u7801\u8868");const s=await this.app.codeList.get(a,t,e),{keyAppDEFieldId:i,majorAppDEFieldId:r}=this.entity,n=s.map(o=>({[i]:o.value,[r]:o.text}));return new U(n,200)}}),so=d("AcFetchMethod",class extends Ys{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),io=class{create(t,e,a){return a.acMode?new so(t,e):new Ys(t,e)}};function qs(){const t=new ao;oe("DEACTION",()=>t);const e=new io;oe("FETCH",()=>e),oe("FETCHTEMP",()=>e)}var Ye=d("TreeNodeData",class{constructor(t,e,a){this._uuid=K(),this.leaf=!1,this.leaf=a.leaf===!0,this.parent=e,this.parent&&(this.context={...this.parent.context}),a.navContext&&(this.context=Object.assign(this.context||{},a.navContext)),a.navParams&&(this.params={...a.navParams}),this.nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath)),Object.values(a).length>0?a:void 0}}),Qs=d("TreeCodeListNodeData",class extends Ye{constructor(t,e,a){super(t,e,a);const{data:s}=a;this.text=s.text,this.value=s.value;const i="".concat(t.id,"@").concat(this.value).toLowerCase();if(Object.defineProperty(this,"id",{get(){return this.parent?"".concat(this.parent.id,":").concat(i):i},enumerable:!0,configurable:!0}),t.appDataEntityId){const r=B(t.appDataEntityId);this.context=Object.assign(this.context||{},{[r]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text,this.icon=this.calcIcon(t)}}),qe=d("TreeDataSetNodeData",class extends Ye{constructor(t,e,a){super(t,e,a);const{data:s}=a;this.deData=s,this.text=t.textAppDEFieldId?s[t.textAppDEFieldId]:s.srfmajortext,this.value=t.idAppDEFieldId?s[t.idAppDEFieldId]:s.srfkey;const i="".concat(t.id,"@").concat(s.srfkey).toLowerCase();if(Object.defineProperty(this,"id",{get(){return this.parent?"".concat(this.parent.id,":").concat(i):i},enumerable:!0,configurable:!0}),t.appDataEntityId){const r=B(t.appDataEntityId);this.context=Object.assign(this.context||{},{[r]:s.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext,this.icon=this.calcIcon(t),this.textHtml=this.calcTextHtml(t),t.leafFlagAppDEFieldId&&(this.leaf=He(s[t.leafFlagAppDEFieldId]))}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:s}=t;a&&this.deData[a]&&(e.imagePath=this.deData[a]),e&&(this.icon=e);const i=s?.find(r=>r.id==="icon");return i&&(e.htmlStr=this.calcDataItemScript(i)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return O.execScriptFn({data:this.deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,s=a?.find(i=>i.id==="text");return s&&(e=this.calcDataItemScript(s)),e}}),$s=d("TreeStaticNodeData",class extends Ye{constructor(t,e,a){var s,i;super(t,e,a);const r=t.nodeValue==="root"?void 0:t.nodeValue,n="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"id",{get(){return this.parent?"".concat(this.parent.id,":").concat(n):n},enumerable:!0,configurable:!0}),this.text=t.text,this.value=r,e&&a.parentValueLevel){let o=e;for(let u=1;u<a.parentValueLevel;u++)o=o?.parent;o?.deData&&(this.deData=o.deData),this.value=r||o?.value}this.srfkey=((s=this.deData)==null?void 0:s.srfkey)||this.value,this.srfmajortext=((i=this.deData)==null?void 0:i.srfmajortext)||this.text,this.icon=this.calcIcon(t)}}),J=d("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,C(a.isOriginField)||(this.isOriginField=a.isOriginField),C(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(Vt.isNumber(this.dataType)){const e=!C(t)&&t!==""?Number(t):t;return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"\u4E0D\u80FD\u8F6C\u6362\u6210\u6570\u5B57")),t):e}return t}}),ro=d("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}});function no(t,e){e.forEach(a=>{Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{enumerable:!0,configurable:!0,writable:!0,value:void 0})})}var oo=["REGION","REGION2","REGION3","REGION4"],uo=d("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:s,longitudeAppDEFieldId:i,latitudeAppDEFieldId:r,textAppDEFieldId:n,dataAppDEFieldId:o,tipsAppDEFieldId:u,sysImage:c}=e,l=new Map;return this._id=a+t.srfkey,this._itemStyle=s,this._mapItemId=a,oo.includes(this._itemStyle)?i&&l.set("_areaCode",i):(i&&l.set("_longitude",i),r&&l.set("_latitude",r)),u&&l.set("_tooltip",u),n&&l.set("_text",n),o&&l.set("_value",o),c&&(this._symbol=c.rawContent||c.imagePath),new Proxy(this,{set(h,p,E){return Object.prototype.hasOwnProperty.call(t,p)?t[p]=E:l.has(p)?t[l.get(p)]=E:h[p]=E,!0},get(h,p,E){if(h[p]!==void 0)return h[p];if(l.has(p))return t[l.get(p)];if(t[p]!==void 0)return t[p]},ownKeys(h){const p=[...new Set([...Object.keys(h),...Object.keys(t)])];return no(h,p),p}})}});function co(t,e){e.forEach(a=>{Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{enumerable:!0,configurable:!0,writable:!0,value:void 0})})}var lo=d("PanelData",class{constructor(t,e){const a=new wt,s={},i={};return t.forEach(r=>{var n;s[r.id]=(n=r.viewFieldName)==null?void 0:n.toLowerCase(),r.viewFieldName&&(i[r.viewFieldName.toLowerCase()]=r.id)}),new Proxy(this,{set(r,n,o){return Object.prototype.hasOwnProperty.call(s,n)?s[n]?e[s[n]]=o:r[n]=o:e[n]=o,a.emit("change",n),s[n]&&s[n]!==n&&a.emit("change",s[n]),i[n]&&i[n]!==n&&a.emit("change",i[n]),!0},get(r,n,o){return n==="_evt"?a:s[n]?e[s[n]]:Object.prototype.hasOwnProperty.call(e,n)?e[n]:r[n]},ownKeys(r){const n=Object.keys(e);return co(r,n),n}})}destroy(){this._evt.reset()}});function ho(t,e){e.forEach(a=>{Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{enumerable:!0,configurable:!0,writable:!0,value:void 0})})}var po=d("ChartData",class{constructor(t,e,a,s){return this._seriesModelId=e?.id,this._catalog=a,this._groupName=s,this._uuid=K(),new Proxy(this,{set(i,r,n){return Object.prototype.hasOwnProperty.call(t,r)?t[r]=n:i[r]=n,!0},get(i,r,n){if(i[r]!==void 0)return i[r];if(t[r]!==void 0)return t[r]},ownKeys(i){const r=[...new Set([...Object.keys(i),...Object.keys(t)])];return ho(i,r),r}})}}),W=(t,e,a={})=>{let s="";if(!t||!e.detreeNodeDataItems)return s;const i=e.detreeNodeDataItems.find(r=>r.id===t);return i&&i.appDEFieldId&&(s=a[i.appDEFieldId]),s},fo=(t,e)=>{var a;const s={};return(a=t.detreeNodeDataItems)==null||a.forEach(i=>{i.id&&i.appDEFieldId&&Object.assign(s,{[i.id.toLowerCase()]:e[i.appDEFieldId.toLowerCase()]})}),s},mo=d("GanttStaticNodeData",class extends $s{constructor(t,e,a,s){super(e,a,s),this.sndataIteValue=W(t.sndataItemName,e),this.beginDataItemValue=W(t.beginDataItemName,e),this.endDataItemValue=W(t.endDataItemName,e),this.prevDataItemValue=W(t.prevDataItemName,e),this.finishDataItemValue=W(t.finishDataItemName,e),this.totalDataItemValue=W(t.totalDataItemName,e)}}),Eo=d("GanttDataSetNodeData",class extends qe{constructor(t,e,a,s){super(e,a,s);const{data:i}=s;this.sndataIteValue=W(t.sndataItemName,e,i),this.beginDataItemValue=W(t.beginDataItemName,e,i),this.endDataItemValue=W(t.endDataItemName,e,i),this.prevDataItemValue=W(t.prevDataItemName,e,i),this.finishDataItemValue=W(t.finishDataItemName,e,i),this.totalDataItemValue=W(t.totalDataItemName,e,i),this.nodeDataItem=fo(e,i)}}),go=d("GanttCodeListNodeData",class extends Qs{constructor(t,e,a,s){super(e,a,s);const{data:i}=s;this.sndataIteValue=W(t.sndataItemName,e,i),this.beginDataItemValue=W(t.beginDataItemName,e,i),this.endDataItemValue=W(t.endDataItemName,e,i),this.prevDataItemValue=W(t.prevDataItemName,e,i),this.finishDataItemValue=W(t.finishDataItemName,e,i),this.totalDataItemValue=W(t.totalDataItemName,e,i)}}),Do=d("MqttService",class{constructor(t,e,a){if(this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new wt,this.options={connectTimeout:6e3,clientId:K(),username:"",password:"",keepalive:60,clean:!0},z(t)||z(e))throw new Error("mqttTopic or token is empty");this.options.username=t,this.options.password=e}async connect(){const t=await da.import("mqtt/dist/mqtt.min"),e=t.default?t.default:t,{location:a}=window;this.client=e.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",s=>{ibiz.log.error("mqtt error",s)}),this.client.on("message",(s,i)=>{this.evt.emit("message",JSON.parse(i.toString())),ibiz.log.debug("mqtt message",s,i.toString())}),this.client.on("reconnect",()=>{ibiz.log.debug("mqtt reconnect")}),this.client.on("close",()=>{console.debug("mqtt close")})}close(){var t;(t=this.client)==null||t.end()}}),wo=d("DEServiceUtil",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map}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 f("\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[".concat(t,"]"));const a=this.constructorCache.get(t);let s;a?s=await a(e):s=new bn(e),this.cache.set(t,s)}return this.cache.get(t)}clearTempCache(t){this.cache.forEach(e=>{e.local.clear(t)})}async exec(t,e,a,s,i){return(await this.getService(t)).exec(e,a,s,i)}}),Js=class Ii{constructor(){ibiz.commands.register(Ii.TAG,this.exec.bind(this))}async exec(e,a,s={},i={}){const r=A(a),n=await ibiz.hub.config.view.get(e);if(!n)throw new f("\u5E94\u7528\u89C6\u56FE[".concat(e,"]\u4E0D\u5B58\u5728"));if((r.srfkey||s.srfuf===0)&&n.appDataEntityId){const u=B(n.appDataEntityId);r.srfkey&&(r[u]=r.srfkey,r.srfkey=void 0),s.srfuf===0&&(r[u]=void 0,delete s.srfuf)}if(n.redirectView){const u=await ibiz.hub.getAppView(e);return rs(u,r,s,i)}const{openMode:o="INDEXVIEWTAB"}=n;switch(i.openMode||o){case"INDEXVIEWTAB":return i.noWaitRoute?(this.openIndexViewTab(n,r,s),{ok:!0}):this.openIndexViewTab(n,r,s);case"POPUP":throw new w(n,"\u672A\u652F\u6301\u7684\u89C6\u56FE\u6253\u5F00\u6A21\u5F0F: POPUP");case"POPUPMODAL":return this.openModal(n,r,s);case"POPUPAPP":throw new w(n,"\u672A\u652F\u6301\u7684\u89C6\u56FE\u6253\u5F00\u6A21\u5F0F: POPUPAPP");case"POPOVER":return this.openPopover(n,i.event,r,s);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(n,r,s);case"USER":return this.openUserCustom(n,r,s);default:return this.openIndexViewTab(n,r,s)}}openIndexViewTab(e,a,s={}){return ibiz.openView.root(e.id,a,s)}async openModal(e,a,s={}){return ibiz.openView.modal(e.id,a,s)}async openPopover(e,a,s,i={}){if(!a)throw new f("\u6C14\u6CE1\u6253\u5F00\u7F3A\u5C11event");return ibiz.openView.popover(e.id,a,s,i)}async openDrawer(e,a,s={}){return ibiz.openView.drawer(e.id,a,s)}async openUserCustom(e,a,s={}){return ibiz.openView.custom(e.id,a,s)}};Js.TAG="ibiz.app-view.open";var st=d("OpenAppViewCommand",Js),Zs=class Ai{constructor(){ibiz.commands.register(Ai.TAG,this.exec.bind(this))}async exec(e,a,s={},i={}){const n=(await ibiz.hub.getAppAsync(a.srfappid)).getAppFunc(e);if(!n)throw new f("\u627E\u4E0D\u5230\u53EB".concat(e,"\u7684\u5E94\u7528\u529F\u80FD"));const{navigateContexts:o,navigateParams:u,appFuncType:c}=n,l=a.clone();Object.assign(l,N(o,s,a));const h=N(u,s,a);switch(c){case"APPVIEW":return this.openAppView(n,l,h,i);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 w(n,"\u672A\u652F\u6301\u7684\u5E94\u7528\u529F\u80FD\u7C7B\u578B: ".concat(c))}}async openAppView(e,a,s,i){if(!e.appViewId)throw new f("\u5E94\u7528\u89C6\u56FE[".concat(e.appViewId,"]\u4E0D\u5B58\u5728"));return ibiz.commands.execute(st.TAG,e.appViewId,a,s,i)}openHtmlPage(e){const a=e.htmlPageUrl;window.open(a,"_blank")}openPdAppFunc(e,a,s){throw ibiz.log.warn("openPdAppFunc",e,a,s),new f("\u672A\u5B9E\u73B0")}executeJavaScript(e,a,s){throw ibiz.log.warn("executeJavaScript",e,a,s),new f("\u672A\u5B9E\u73B0")}custom(e,a,s){throw ibiz.log.warn("custom",e,a,s),new f("\u672A\u5B9E\u73B0")}};Zs.TAG="ibiz.app-func.exec";var Qe=d("AppFuncCommand",Zs);function ti(){new Qe,new st}var Co=d("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new fa({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new Bt(t.appId,"PSSysApp",t.codeName),this.deService=new wo(t),this.codeList=new yn(t),this.authority=new Rn(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),ibiz.env.enableMqtt&&ibiz.appData&&(this.mqtt=new Do(ibiz.appData.mqtttopic,ma(),this.model.appId),this.mqtt.evt.on("message",t=>{ibiz.mc.command.asyncAction.next(t)}),await this.mqtt.connect())}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(s=>s.id===t)||null}async getUIAction(t){const[,e]=t.split("@");if(e){const s=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find(i=>i.id===t);if(s)return s}return this.model.appDEUIActions.find(a=>a.id===t)}async getOPPriv(t,e){var a,s;let i=(a=this.model.deopprivs)==null?void 0:a.find(r=>r.name===t);return!i&&e&&(i=(s=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)==null?void 0:s.find(n=>n.name===t)),i}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find(s=>s.id===t)}}),vo=class{parse(t){return t}},Io=class{constructor(){this.appMenu=new vo}},Ao=class{constructor(){this.viewConfigs=new Map}has(t){return this.viewConfigs.has(t)}set(t,e){this.viewConfigs.set(t,e)}async get(t){if(!this.viewConfigs.has(t)){const e=await ibiz.hub.getAppView(t);if(!e)throw new f("\u89C6\u56FE[".concat(t,"]\u4E0D\u5B58\u5728"));this.set(e.id,{id:e.id,codeName:e.codeName,openMode:e.openMode,viewType:e.viewType,width:e.width,height:e.height,appDataEntityId:e.appDataEntityId,redirectView:e.redirectView})}return this.viewConfigs.get(t)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},yo=class{constructor(){this.view=new Ao}},Fo=d("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Fo||{})),Po=d("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Po||{})),bo=d("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(bo||{})),ei=d("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return this.state==="Used"?this.count:(this.count+=1,this.count)}decrement(t){if(this.state!=="Used"){if(this.count===0)throw new f("\u9519\u8BEF\u7684\u8C03\u7528\uFF01decrement\u4E0D\u80FD\u5BF9count\u4E3A0\u8C03\u7528");this.count-=1,this.count===0&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),No=d("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new ei(Ea)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement(()=>{this.isLoading=!1})}}),So=d("CTXState",class{}),Lo=d("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new wt(3e3),this.controllersMap=new Map,this.state=new So}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){if(this.controllersMap.has(t))return this.controllersMap.get(t);if(this.parent&&e)return this.parent.getController(t)}getTopView(){return this.parent?this.view.modal.routeDepth===2?this.view:this.parent.getTopView():this.view}}),Ro=d("ActivityCounter",class extends ei{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){this.state==="Unused"&&!this.registration.has(t)&&(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&this.registration.get(t)===!1&&(this.registration.set(t,!0),this.decrement())}}),ht=d("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId){this.isInit=!0;return}const t=await Qt(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:s,uiactionMode:i,uiactionTag:r}=t;this.dataAccessAction=e,a===1?this.noPermissionHidden=!1:a===6&&(this.visible=!1),(s&&s!=="NONE"||i==="SYS"&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(r))&&(this.noDataDisabled=!0,(s==="SINGLEKEY"||s==="MULTIKEY")&&(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"\u754C\u9762\u884C\u4E3A\u7684\u5B9E\u4F53").concat(this.appDeName,"\u548C\u6570\u636E\u7684\u5B9E\u4F53").concat(e,"\u4E0D\u4E00\u81F4")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),pt=d("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>this.children.length===0?!1:!!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:!1})}async update(t,e){await Promise.all(this.children.map(a=>a.update(t,e)))}}),To=d("QXEventEx",class extends wt{constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach(a=>{a(t,...e)})}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),s=this.anyEventFns.map(o=>o(t,...e)),i=Promise.all(s),r=await a,n=await i;return r.concat(...n)}reset(){super.reset(),Ma(this.anyEventFns)}}),Bo=d("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new To}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 $e(t){return window.location.hash.split("/").length>t*2+2}function Je(t,e){return(C(t)||t==="")&&(C(e)||e==="")?!1:t!==e}function ai(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof X&&(e=e.getOrigin()),e}function Ze(t,e,a){const s=[];return t.forEach(i=>{const{valueRuleType:r}=i,n=i.sysValueRule,o=i.defvalueRule;if(r==="SYSVALUERULE"&&n)n.ruleType==="REG"?s.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):n.ruleType==="SCRIPT"&&s.push({validator:(u,c,l,h)=>{if(!c)return!0;try{O.execScriptFn({rule:u,value:c,callback:l,source:h},n.scriptCode,{isAsync:!1})}catch(p){return console.error(p),!1}return!0},trigger:"change blur"});else if(r==="DEFVALUERULE"&&o){const u=a||e;s.push({validator:(c,l,h,p)=>{if(z(p[u]))return!0;const{isPast:E,infoMessage:D}=Me(u,p,o.groupCond);return E||h(new f(D||o.ruleInfo)),!0},trigger:"change blur"})}}),s}function ta(t){const e=[],{maxLength:a,minLength:s}=t,{maxValue:i,minValue:r}=t;return a&&e.push({validator:(n,o,u)=>{if(!C(o)&&o.length>a)u(new Error("\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E".concat(a,",\u5F53\u524D\u957F\u5EA6\u4E3A").concat(o.length)));else return!0}}),s&&e.push({validator:(n,o,u)=>{if(!C(o)&&o.length<s)u(new Error("\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E".concat(s,",\u5F53\u524D\u957F\u5EA6\u4E3A").concat(o.length)));else return!0}}),C(i)||e.push({validator:(n,o,u)=>{if(!C(o)&&Fe(o)&&o>i)u(new Error("\u503C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E".concat(i)));else return!0}}),C(r)||e.push({validator:(n,o,u)=>{if(!C(o)&&Fe(o)&&o<r)u(new Error("\u503C\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E".concat(r)));else return!0}}),e}var Oo=d("ValueExUtil",class{static mergeDefault(t){return be(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(C(e)||e==="")return"";const{valueType:a,objectNameField:s,textSeparator:i}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!s)throw new f("\u7F3A\u5C11objectNameField");const r=s.toLowerCase();return a==="OBJECTS"?e.map(n=>n[r]||"---").join(i):e[r]}return a==="SIMPLES"?e.join(i):"".concat(e)}});function pe(t,e){var a;const{name:s,valueType:i,defaultValue:r,valueFormat:n}=t,{data:o,context:u,params:c}=e;if(C(i)&&C(r))return;if(i==="RESET")return null;const l=o[s];if(!Ne(l)){if(!i&&r)return r;switch(i){case"APPDATA":if(Object.prototype.hasOwnProperty.call(c,r))return c[r];if(Object.prototype.hasOwnProperty.call(u,r))return u[r];break;case"OPERATORNAME":return u.srfusername;case"OPERATOR":return u.srfuserid;case"CURTIME":return L().format(n);case"PARAM":return o[r];case"SESSION":case"APPLICATION":if(!((a=ibiz.appData)!=null&&a.context))throw new f("appdata.context\u4E0D\u5B58\u5728");return ibiz.appData.context[r];case"CONTEXT":return c[r];case"UNIQUEID":return K();default:throw new w({},"\u9ED8\u8BA4\u503C\u7C7B\u578B[".concat(i,"]\u672A\u652F\u6301"))}}}var _o="asyncimportdata2",Mo="importdata2";function xo(t){return new Promise(e=>{const a=s=>{const i=s.messageid||s.data.asyncacitonid;if(t!==i)return;const r=s.data.actionstate;(r===30||r===40)&&(e(),ibiz.mc.command.asyncAction.off(a))};ibiz.mc.command.asyncAction.on(a)})}async function Vo(t,e,a){const s=new FormData;s.append("file",t);let i="".concat(e.codeName2.toLowerCase(),"/").concat(_o);a?.codeName&&(i+="?srfimporttag=".concat(a.codeName));const r=await ibiz.net.request(i,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});await xo(r.data.asyncacitonid),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED")}async function ko(t,e,a){const s=new FormData;s.append("file",t);let i="".concat(e.codeName2.toLowerCase(),"/").concat(Mo);return a?.codeName&&(i+="?srfimporttag=".concat(a.codeName)),(await ibiz.net.request(i,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}})).data}async function si(t,e,a){if(!ibiz.util.getExcelUtil)throw new f("ibiz.util.getExportExcel\u4E0D\u5B58\u5728");const s=await ibiz.util.getExcelUtil();if(!s)throw new f("\u5BFC\u51FA\u6A21\u5757\u52A0\u8F7D\u9519\u8BEF");try{return s.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch{return{ok:!1}}}var ea="__self",ii=d("BaseController",class{constructor(t,e,a,s){this.model=t,this.context=e,this.params=a,this.ctx=s,this.state={},this.name="",this.evt=new Bo(this.getEventArgs.bind(this)),this.mountCounter=new Ro(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(ea),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(ea)||this.mountCounter.attend(ea)}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(){}}),Wo=class yi{constructor(e){this.msgGroupId=e,this.viewMsgMap=new Map}async init(e){var a,s;const i=ibiz.hub.getApp(e.srfappid).model,r=(a=i.appViewMsgGroups)==null?void 0:a.find(o=>o.id===this.msgGroupId);if(!r)throw new f("\u627E\u4E0D\u5230\u89C6\u56FE\u6D88\u606F\u7EC4".concat(this.msgGroupId,"\u7684\u6A21\u578B"));this.msgGroup=r;const n=r.appViewMsgGroupDetails.map(o=>o.appViewMsgId);if((s=i.appViewMsgs)==null||s.forEach(o=>{const u=n.indexOf(o.id);u!==-1&&(this.viewMsgMap.set(o.id,o),n.splice(u,1))}),n.length)throw new f("\u6CA1\u6709\u627E\u5230".concat(n.join(","),"\u89C6\u56FE\u6D88\u606F\u6A21\u578B"))}getDeFieldName(e,a){var s,i;if(a)return(i=(s=yt(e,a))==null?void 0:s.name)==null?void 0:i.toLowerCase()}static async fetchDataSet(e,a,s){const{appDataEntityId:i,appDEDataSetId:r}=e;if(!r)throw new m(e,"\u672A\u914D\u7F6E\u5B9E\u4F53\u6570\u636E\u96C6");const n=await ibiz.hub.getApp(a.srfappid).deService.exec(i,r,a,s);return n.data.length?n.data:[]}async calcViewMessages(e,a){const s=this.msgGroup.appViewMsgGroupDetails,i=[];return s?.length&&await Promise.all(s.map(async r=>{if(this.viewMsgMap.get(r.appViewMsgId).dynamicMode===1){const o=await this.calcDynaMsgs(r,e,a);i.push(...o)}else{const o=this.calcStaticMsg(r);i.push(o)}})),i}calcStaticMsg(e){const{position:a}=e,s=this.viewMsgMap.get(e.appViewMsgId),{title:i,message:r,removeMode:n,position:o,messageType:u}=s,{userTag:c,userTag2:l,userTag3:h,userTag4:p}=s;return{title:i,message:r,position:a||o,messageType:u,removeMode:n,extraParams:{userTag:c,userTag2:l,userTag3:h,userTag4:p}}}async calcDynaMsgs(e,a,s){const i=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:r,orderValueAppDEFieldId:n,titleAppDEFieldId:o,removeFlagAppDEFieldId:u,msgTypeAppDEFieldId:c,contentAppDEFieldId:l,msgPosAppDEFieldId:h}=i;if(!r)throw new m(i,"\u672A\u914D\u7F6E\u5E94\u7528\u5B9E\u4F53");const p=await ibiz.hub.getAppDataEntity(r,a.srfappid),E={...s},D=this.getDeFieldName(p,n);D&&(E.sort="".concat(D,",asc"));const y=await yi.fetchDataSet(i,a,E);if(!y.length)return[];const v=this.calcStaticMsg(e),b=this.getDeFieldName(p,o),F=this.getDeFieldName(p,h),I=this.getDeFieldName(p,l),S=this.getDeFieldName(p,c),R=this.getDeFieldName(p,u);return y.map(P=>{const j={};return F&&!C(P[F])&&(j.position=P[F]),b&&!C(P[b])&&(j.title=P[b]),I&&!C(P[I])&&(j.message=P[I]),S&&!C(P[S])&&(j.messageType=P[S]),R&&!C(P[R])&&(j.removeMode=P[R]),Pe(v,j)})}},ri=d("ViewController",class extends ii{constructor(t,e,a,s){const i=ibiz.util.layoutPanel.fill(t);super(i,xt.create({},e),a||{},new Lo(s)),this.session={},this.modal=new Ur({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new No,this.isCloseView=!1,s&&s.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return(t=this.ctx.parent)==null?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u6FC0\u6D3B"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u6682\u505C"))}initEngines(){const t=es(this.model);if(t.length)t.forEach(e=>{const a=ibiz.engine.getEngine(e,this);a?this.engines.push(a):ibiz.log.warn("\u672A\u627E\u5230\u89C6\u56FE\u5F15\u64CE\u5B9E\u73B0\uFF1A",e)});else{const e=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);e&&this.engines.push(e)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map(async a=>{const s=await Us.getCounterByRef(a,this.context);this.counters[a.id]=s}))}catch(a){console.error(a)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise(async i=>{Ne(this.state.closeOK)&&(i.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...i})}),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 Et(t);this.providers[t.name]=e;const a=Za(this.model);a&&await Promise.all(a.map(async i=>{const r=await Et(i);this.providers[i.name||i.id]=r})),await this.initCounters();const s=ts(this.model);s.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(s),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll((i,r)=>{this.scheduler.triggerViewEvent(r)})),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map(i=>i.onCreated()))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map(e=>e.onMounted())),(t=this.scheduler)==null||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map(t=>t.onDestroyed())),this.ctx.destroy(),this.context.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u9500\u6BC1"))}handleContextParams(){this.context.srfappid=this.model.appId,(C(this.context.srfsessionid)||_(this.context.srfsessionid))&&(this.context.srfsessionid=K());const t=this.model.appViewNavContexts;let e={};k(t)&&(e=N(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let s={};k(a)&&(s=N(a,this.params,this.context)),Object.assign(this.params,s),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const s of this.engines)if(a=await s.call(t,e),a!==void 0)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(a===void 0)throw new f("\u6CA1\u6709\u5F15\u64CE\u652F\u6301\u9884\u7F6E\u754C\u9762\u884C\u4E3A".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",()=>{this.mountCounter.attend(this.layoutPanel.model.name)}),(e=this.scheduler)!=null&&e.hasControlEventTrigger&&t.evt.on("onControlEvent",a=>{this.scheduler.triggerControlEvent(a.triggerControlName,a.triggerEventName,a.triggerEvent)})}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;t&&(this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Wo(t),await this.viewMsgController.init(this.context),(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach(a=>{["TOP","BOTTOM","BODY","POPUP"].includes(a.position)&&this.state.viewMessages[a.position].push(a)}),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP))}async alertViewMessage(t){const[e,...a]=t,s={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(s,{confirmButtonText:e.extraParams.userTag}),e.messageType==="WARN"?await ibiz.modal.warning(s):e.messageType==="ERROR"?await ibiz.modal.error(s):await ibiz.modal.info(s),a.length&&this.alertViewMessage(a)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}}),Lc=d("MobViewController",class extends ri{}),Rc=d("WFStepTraceViewController",class extends ri{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid);if((t=this.ctx.parent)!=null&&t.view.model.appDataEntityId){const a=await e.deService.getService(this.ctx.parent.view.model.appDataEntityId),s=Object.assign(this.context.clone(),this.params),i=await a.wf.getWFHistory(s);i.data&&(this.state.historyData=i.data)}}}),Uo=d("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}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;t>0&&t<=1?this.style.width="".concat(t*100,"%"):this.style.width="".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;t>0&&t<=1?this.style.height="".concat(t*100,"%"):this.style.height="".concat(t,"px")}}handlePublicParams(t,e,a){const{navigateContexts:s,navigateParams:i}=this.model;let r={};s&&t&&(r=N(s,t,a,e));const n=Object.assign(e.clone(),r);let o={};return i&&t&&(o=N(i,t,a,e)),{context:n,params:o}}toObj(t){return t?new Function("return (".concat(t,");"))():void 0}toBoolean(t){return Object.is("true",t)}}),Tc=d("CodeListEditorController",class extends Uo{async loadCodeList(t){const{context:e,params:a}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const s=await ibiz.hub.getApp(this.context.srfappid);let i=[];return i=await s.codeList.get(this.model.appCodeListId,e,a),i}throw new m(this.model,"\u7F16\u8F91\u5668\u7C7B\u578B[".concat(this.model.editorType,"]\uFF0C\u672A\u914D\u7F6E\u4EE3\u7801\u8868"))}}),Y=d("ControlController",class extends ii{constructor(t,e,a,s){if(super(t,xt.create({},e),new ga({},a),s),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=Ka(t),!this.controlPanel){const i=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));i&&(this.controlPanel=A(i))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const e=await Et(this.controlPanel);this.providers[this.controlPanel.name]=e}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(t=this.scheduler)!=null&&t.hasControlEventTrigger&&this._evt.onAll((e,a)=>{this.scheduler.triggerControlEvent(a.targetName,a.eventName,a)})}async onMounted(){var t;await super.onMounted(),(t=this.scheduler)==null||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let s={};k(e)&&(s=N(e,this.params,this.context)),Object.assign(this.context,s);let i={};k(a)&&(i=N(a,this.params,this.context)),Object.assign(this.params,i)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u6FC0\u6D3B"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name,"](").concat(this.model.id,")\u6682\u505C"))}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let s=this.getData()||[];return t?.data&&(s=Array.isArray(t.data)?t.data:[t.data]),t?.context&&Object.assign(e,t.context),t?.viewParam&&Object.assign(a,t.viewParam),{context:e,params:a,data:s}}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={};k(t)&&(e=N(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){t.length!==0&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:s}=this.model,i=(a=s?.ctrlMsgItems)==null?void 0:a.find(o=>o.name===t);let r,n;if(i&&i.content){n=C(i.timeout)?void 0:i.timeout/1e3;const o={...this.getEventArgs()};e?.data&&(o.data=e.data),r=O.execScriptFn(o,"`".concat(i.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const o="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();r=ibiz.i18n.t(o,""),r===o&&(r="")}if(!r&&e?.default&&(r=e.default),!r&&e?.error&&(r=r||e.error.message),!!r){if(e?.error)throw ibiz.log.error(e.error),new we(r,n);ibiz.message.success(r,n,n===0)}}}),tt=d("MDControlController",class extends Y{constructor(){super(...arguments),this.commandDataChange=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),(t=this.dataEntity.appDEFields)==null||t.forEach(a=>{this.fieldIdNameMap.set(a.id,a.name)});const e=this.onDataChange.bind(this);this.onDataChange=jt(a=>{e(a)},300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&(this.state.activated?this.refresh():this.commandDataChange=!0)}onActivated(){super.onActivated(),this.commandDataChange&&(this.refresh(),this.commandDataChange=!1)}setSort(t,e){t&&e&&(this.state.sortQuery="".concat(t,",").concat(e))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:s,noSort:i}=this.state,r={...this.params};return a&&(r.page=e-1,r.size=a),!i&&s&&(r.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(r,{...this.state.searchParams}),t&&Object.assign(r,t),r}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=t.isInitialLoad===!0,a=t.isLoadMore===!0;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:s}=this.handlerAbilityParams(t),i=await this.getFetchParams(t?.viewParam),r=await this.service.fetch(s,i);typeof r.total=="number"&&(this.state.total=r.total),a?this.state.items.push(...r.data):this.state.items=r.data,await this.afterLoad(t,r.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(e){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:e}),e}finally{await this.endLoading()}return this.state.items.forEach((e,a)=>{e.srfserialnum=a+1}),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:s}=this.handlerAbilityParams(t);if(!s?.length)throw new f("\u672A\u9009\u4E2D\u6570\u636E");if(t?.silent!==!0&&!await ibiz.confirm.error({title:"\u6570\u636E\u5220\u9664",desc:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F"}))return;await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let i=!1;try{const r=B(this.model.appDataEntityId);await it(s.map(async n=>{if(n.srfuf!==0){const o=e.clone();o[r]=n.srfkey,await this.service.remove(o,a),i=!0}this.afterRemove(n)})),t?.silent!==!0&&this.actionNotification("REMOVESUCCESS",{data:s,default:"\u6570\u636E[".concat(s.map(n=>n.srfmajortext).join("\u3001"),"]\u5220\u9664\u6210\u529F!")}),i&&!t?.notRefresh&&await this.refresh()}catch(r){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:r,data:s}),r}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex(a=>a.srfkey===t.srfkey);e!==-1&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){const{selectedData:e}=this.state;Da(e,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}))}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter(s=>s.srfkey!==t.srfkey);a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),this.state.mdctrlActiveMode===1&&await this.setActive(t)}async onDbRowClick(t){this.state.mdctrlActiveMode===2&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,s=await ibiz.hub.getAppDataEntity(e,this.model.appId),i=(t=s.appDEDataImports)==null?void 0:t.find(o=>o.id===a);if(!i)throw new f("\u65E0\u5BFC\u5165\u6A21\u578B\uFF01");let r="DataImport";i.enableCustomized&&(r="DataImport2");const n=ibiz.overlay.createModal(r,{dismiss:()=>n.dismiss(),appDataEntity:s},{width:"auto",placement:"center"});n.present(),await n.onWillDismiss()}async exportData(t){}}),zo=d("AppMenuController",class extends Y{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),(t=this.model.appMenuItems)==null||t.forEach(e=>{this.initMenuItemState(e)})}async onClickMenuItem(t,e,a=!0){const s=Ce(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new f("\u627E\u4E0D\u5230\u540D\u4E3A".concat(t,"\u7684\u83DC\u5355\u9879"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!s.appFuncId)throw new m(s,"\u6CA1\u6709\u914D\u7F6E\u5E94\u7528\u529F\u80FD");const i=this.context.clone();i.srfappid=s.appId,this.routeDepth&&a&&Object.assign(i,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(Qe.TAG,s.appFuncId,i,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let s=!0;t.accessKey&&(s=this.app.authority.calcByResCode(t.accessKey));let i=s;if((e=t.appMenuItems)!=null&&e.length){const r=t.appMenuItems.map(n=>this.initMenuItemState(n).visible);i=i&&r.includes(!0)}a.permitted=s,a.visible=i}return this.state.menuItemsState[t.id]=a,a}getAllItems(){const t=[],e=a=>{a.forEach(s=>{t.push(s),s.appMenuItems&&s.appMenuItems.length>0&&e(s.appMenuItems)})};return e(this.model.appMenuItems),t}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach(a=>{var s;a.capLanguageRes&&a.capLanguageRes.lanResTag&&(a.caption=ibiz.i18n.t(a.capLanguageRes.lanResTag,a.caption)),(s=a.appMenuItems)!=null&&s.length&&t(a.appMenuItems)})};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),Bc=d("AppMenuIconViewController",class extends zo{async onClickMenuItem(t,e){const a=Ce(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!a)throw new f("\u627E\u4E0D\u5230\u540D\u4E3A".concat(t,"\u7684\u83DC\u5355\u9879"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!a.appFuncId)throw new m(a,"\u6CA1\u6709\u914D\u7F6E\u5E94\u7528\u529F\u80FD");const s=this.context.clone();this.routeDepth===1&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(Qe.TAG,a.appFuncId,s,this.params)}}),Go=d("CalendarService",class extends rt{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const s=a.map(async n=>{const o=n.appDEDataSetId||"fetchdefault";return this.exec2(o,t,e,void 0,n.appDataEntityId)});return(await Promise.all(s)).map((n,o)=>this.setCalendarConfigData(n.data,o)).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new f("\u672A\u627E\u5230\u65E5\u5386\u9879\u6A21\u578B");const s=a[e];if(!s)throw new f("\u672A\u627E\u5230\u65E5\u5386\u9879\u6A21\u578B");return t.map(i=>new ro(s,i))}async exec2(t,e,a={},s={},i=this.model.appDataEntityId){return await this.app.deService.exec(i,t,e,a,s)}}),Oc=d("CalendarController",class extends tt{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Go(this.model),await this.service.init(this.context)}async load(t={}){const e=t.isInitialLoad===!0,{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(t?.viewParam);await this.startLoading();let i;try{i=await this.service.search(a,s)}finally{await this.endLoading()}return await this.afterLoad(t,i),this.state.isLoaded=!0,this.state.items=i,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),i}sortItems(){this.model.calendarStyle==="TIMELINE"&&this.state.items.sort((t,e)=>{const a=t.beginTime,s=e.beginTime;let i=0;return L(a).isAfter(s)?i=-1:L(a).isBefore(s)&&(i=1),i})}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:s}=t;if(!a||!s){const i=new Date(e.getFullYear(),e.getMonth(),1),r=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:L(i).format("YYYY-MM-DD HH:mm:ss"),srfenddate:L(r).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:s}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:s,noSort:i}=this.state,r={...this.params};if(!i&&s&&(r.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(r,{...this.state.searchParams}),a&&(r.page=e-1,r.size=a),t&&Object.assign(r,t),this.model.calendarStyle!=="TIMELINE"){const n=this.getCurSelectDate(r);Object.assign(r,n)}return r}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter(s=>s.deData.srfkey!==t.deData.srfkey);a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),this.state.mdctrlActiveMode===1&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});L.extend(bi),L.extend(Si),L.extend(Ri),L.extend(Bi),L.extend(_i);var fe="$default_group",bt=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:a,caption:s,id:i,userParam:r}=t;if(!t.catalogField)throw new m(t,"\u7F3A\u5C11\u5206\u7C7B\u5C5E\u6027\u914D\u7F6E");if(!t.valueField)throw new m(t,"\u7F3A\u5C11\u503C\u5C5E\u6027\u914D\u7F6E");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:n,chartYAxisId:o}=a||{};this.xAxisIndex=Ie(n),this.yAxisIndex=Ie(o),this.seriesName=s||i,this.staticOptions=this.calcStaticOptions(),r&&(this.seriesUserParam=aa(r))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(C(e))return;if(C(t))return e;const s=this.chartGenerator.codeListMap.get(t);if(s?.length){const i=s.find(r=>r.value===e);if(i)return i.text}return a?void 0:e}prepareChartData(t,e,a,s){var i;this.groupField&&Object.assign(e,{[this.groupField]:s}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const r=new po(e,this.model,a,s);t[s].get(a).chartData=r,(i=this.chartDataArr)==null||i.push(r)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:s}=this.model;return t.forEach(i=>{let r=fe;if(this.groupField){const o=this.translateVal(a,i[this.groupField]);if(C(o))return;r=o}e[r]||(e[r]=new Map,s&&this.autoCompleteCategory&&this.chartGenerator.codeListMap.get(s).forEach(u=>{e[r].set(u.text,{value:0})}));const n=this.translateVal(s,i[this.catalogField],!0);if(!n){s&&this.autoCompleteCategory&&this.chartGenerator.codeListMap.get(s).forEach(u=>{this.prepareChartData(e,{[this.valueField]:0},u.text,r)});return}e[r].get(n)||e[r].set(n,{value:0}),e[r].get(n).value=Gt(e[r].get(n).value,i[this.valueField]),e[r].get(n).chartData?this.prepareChartData(e,{[this.valueField]:e[r].get(n).value},n,r):this.prepareChartData(e,i,n,r)}),e}calcGroupSeries(t){return Object.keys(t).map(e=>{const a=t[e],s=this.calcSeriesData(a);let i={...this.staticOptions,data:s};return e!==fe&&(i.name=e),this.seriesUserParam&&(i=It(i,this.seriesUserParam)),i})}calcSeriesData(t){const e=[];return t.forEach((a,s)=>{e.push([s,a.value,a.chartData])}),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,s;return this.groupData&&Object.keys(this.groupData).length===1?(e=this.groupData[fe].get(t.name))==null?void 0:e.chartData:(s=(a=this.groupData)==null?void 0:a[t.seriesName].get(t.name))==null?void 0:s.chartData}dataPreprocess(t){const e=[];t.forEach(s=>{e.push(A(s))});const{groupMode:a}=this.model;return a&&e.forEach(s=>{let i="";if(a==="DAY"||a==="YEAR"||a==="MONTH"){if(a==="DAY"?i="YYYY-MM-DD":a==="YEAR"?i="YYYY":a==="MONTH"&&(i="YYYY-MM"),s[this.catalogField]){const r=L(s[this.catalogField]).format(i);s[this.catalogField]=r}}else if(a==="QUARTER"){if(s[this.catalogField]){const r="".concat(L(s[this.catalogField]).format("YYYY"),"-").concat(L(s[this.catalogField]).quarter());s[this.catalogField]=r}}else if(a==="YEARWEEK"&&s[this.catalogField]){const r="".concat(L(s[this.catalogField]).format("YYYY"),"-").concat(L(s[this.catalogField]).week());s[this.catalogField]=r}}),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach(a=>{const s=t[a];let i=[];e==="DAY"||e==="YEAR"||e==="MONTH"?i=Array.from(s.keys()).sort((n,o)=>L(n).diff(L(o))):(e==="QUARTER"||e==="YEARWEEK")&&(i=Array.from(s.keys()).sort((n,o)=>{const[u,c]=n.split("-"),[l,h]=o.split("-");return u!==l?parseInt(u,10)-parseInt(l,10):parseInt(c,10)-parseInt(h,10)}));const r=new Map;i.forEach(n=>{r.set(n,s.get(n))}),t[a]=r})}addTimeData(t){const{groupMode:e}=this.model;if(!e||e==="CODELIST")return;const a=[];Object.keys(t).forEach(r=>{t[r].forEach((n,o)=>{a.push(L(o))})});const s=L.max(a),i=L.min(a);if(e==="DAY"){let r=i;const n=s;for(;r?.isSameOrBefore(n,"day");){const o=r.format("YYYY-MM-DD");Object.keys(t).forEach(u=>{t[u].get(o)||t[u].set(o,{value:0})}),r=r.add(1,"day")}}else if(e==="YEAR"){let r=i.year();const n=s.year();for(;r<=n;){const o=r.toString();Object.keys(t).forEach(u=>{t[u].get(o)||t[u].set(o,{value:0})}),r+=1}}else if(e==="MONTH"){let r=i.clone().startOf("month");const n=s.clone().startOf("month");for(;r.isSameOrBefore(n);){const o=r.format("YYYY-MM");Object.keys(t).forEach(u=>{t[u].get(o)||t[u].set(o,{value:0})}),r=r.add(1,"month")}}else if(e==="QUARTER"){const r=[];Object.keys(t).forEach(l=>{t[l].forEach((h,p)=>{r.push(p)})});const n=r.reduce((l,h)=>h<l?h:l,r[0]),o=r.reduce((l,h)=>h>l?h:l,r[0]),[u]=n.split("-"),[c]=o.split("-");for(let l=parseInt(u,10);l<=parseInt(c,10);l++)for(let h=1;h<=4;h++){const p="".concat(l,"-").concat(h);Object.keys(t).forEach(E=>{t[E].get(p)||t[E].set(p,{value:0})})}}else if(e==="YEARWEEK"){const r=[];Object.keys(t).forEach(l=>{t[l].forEach((h,p)=>{r.push(p)})});const n=r.reduce((l,h)=>h<l?h:l,r[0]),o=r.reduce((l,h)=>h>l?h:l,r[0]),[u]=n.split("-"),[c]=o.split("-");for(let l=parseInt(u,10);l<=parseInt(c,10);l++){const h=L("".concat(l,"-12-31")).isoWeek();for(let p=1;p<=h;p++){const E="".concat(l,"-").concat(p);Object.keys(t).forEach(D=>{t[D].get(E)||t[D].set(E,{value:0})})}}}this.sortTimeData(t)}},jo=class extends bt{calcStaticOptions(){if(this.xAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EX\u5750\u6807\u8F74");if(this.yAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EY\u5750\u6807\u8F74");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}},Ko=class extends bt{calcStaticOptions(){if(this.xAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EX\u5750\u6807\u8F74");if(this.yAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EY\u5750\u6807\u8F74");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},Ho=class extends bt{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach((a,s)=>{e.push({name:s,value:[a.value,a.chartData]})}),e}},Xo=class extends bt{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach((a,s)=>{e.push({name:s,value:[a.value,a.chartData]})}),e}},Yo=class extends bt{calcStaticOptions(){if(this.xAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EX\u5750\u6807\u8F74");if(this.yAxisIndex===void 0)throw new m(this.model,"\u5E8F\u5217\u6CA1\u6709\u914D\u7F6EY\u5750\u6807\u8F74");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},qo=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return(!this._indicatorKeys||this._indicatorKeys.length!==Object.keys(this.indicator).length)&&(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map(e=>e.max));return{indicator:this.indicatorKeys.map(e=>({name:e,max:t}))}}},Qo=class extends bt{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new qo(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach(s=>{s.forEach((i,r)=>{a.updateIndicator(r,i.value)})})}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),s=Object.keys(e).map(r=>{const n=e[r],o=a.indicatorKeys.map(u=>n.has(u)?n.get(u).value:0);return{name:r===fe?this.seriesName:r,value:o}});let i={...this.staticOptions,data:s};return this.seriesUserParam&&(i=It(i,this.seriesUserParam)),i}};function aa(t){const e={};return t&&Object.keys(t).forEach(a=>{const s=a.indexOf(".");if(s===-1)return;const i=a.slice(s+1);if(i)try{e[i]=JSON.parse(t[a])}catch{e[i]=t[a]}}),e}var $o=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:s,chartYAxises:i,userParam:r}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),s?.length&&(this.staticOptions.xAxis=this.calcXYAxisOption(s)),i?.length&&(this.staticOptions.yAxis=this.calcXYAxisOption(i)),r&&(this.chartUserParam=aa(r))}initSeriesGenerators(){var t;(t=this.model.dechartSerieses)==null||t.forEach(e=>{let a;switch(e.seriesType){case"line":a=new jo(e,this);break;case"bar":a=new Ko(e,this);break;case"scatter":a=new Yo(e,this);break;case"pie":a=new Xo(e,this);break;case"funnel":a=new Ho(e,this);break;case"radar":a=new Qo(e,this);break;default:ibiz.log.error("\u56FE\u8868\u6682\u672A\u652F\u6301\u5E8F\u5217\u7C7B\u578B".concat(e.seriesType));break}a&&this.seriesGenerators.push(a)})}calcTitleOption(t){const{showTitle:e,title:a,subTitle:s,titlePos:i}=t,r={show:e,text:a,subtext:s};r.left="center";const n=i?.toLowerCase();return n==="left"||n==="right"?r.left=n:(n==="bottom"||n==="top")&&(r.top=n),r}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,s={};s.show=e;const i=a?.toLowerCase();return i==="left"||i==="right"?(s.left=i,s.top="middle",s.orient="vertical"):i==="bottom"&&(s.top=i),s}calcXYAxisOption(t){const e=[];return t.forEach(a=>{const{position:s,dataShowMode:i,userParam:r}=a;let n={type:a.echartsType,name:a.caption,max:a.maxValue,min:a.minValue,position:s,axisLabel:{formatter:o=>(typeof o=="number"&&(o=o.toString()),i===1?o.length>4?"".concat(o.slice(0,4).split("").join(`
2
2
  `),`
3
3
  ...`):o.split("").join(`
4
- `):i===2&&o.length>4?"".concat(o.slice(0,4),"..."):o),rotate:i===3?45:0}};r&&(n=vt(n,aa(r))),e.push(n)}),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find(a=>a.name===t);return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!((a=this.model.dechartSerieses)!=null&&a.length))return;const s=ibiz.hub.getApp(t.srfappid),i=async r=>{if(!r||this.codeListMap.has(r))return;const n=await s.codeList.get(r,t,e);this.codeListMap.set(r,n)};await Promise.all(this.model.dechartSerieses.map(async r=>{const{seriesCodeListId:n,catalogCodeListId:o}=r;await i(n),await i(o)}))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach(a=>{a.model.seriesType==="radar"&&a.calcRadarCoordSystem(t)}),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map(a=>a.toOptions()));const e=[];return this.seriesGenerators.forEach(a=>{const s=e.length,i=a.calcByData(t);i instanceof Array?e.push(...i):e.push(i);const r=e.length-1;for(let n=s;n<=r;n++)this.seriesGeneratorIndexMap.set(n,a)}),this.options.series=e,this.seriesGenerators.length===1&&this.seriesGenerators[0].groupData&&Object.keys(this.seriesGenerators[0].groupData).length===1&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=vt(this.staticOptions,this.options),this.chartUserParam&&(this.options=vt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new f("\u627E\u4E0D\u5230".concat(t.seriesIndex,"\u5E8F\u5217\u7684generator\uFF01"));return e.getChartDataByParams(t)}},Qo=d("ChartService",class extends rt{}),Bc=d("ChartController",class extends ${initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Qo(this.model),await this.service.init(this.context),this.generator=new qo(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach(s=>{Object.assign(s,{srfcount:1})}),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",e=>{const a=this.generator.getChartDataByParams(e);a&&this.setActive(a)})}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new f("chart\u5BF9\u8C61\u6CA1\u6709\u6B63\u786E\u521D\u59CB\u5316");if(!this.options)throw new f("options\u8FD8\u6CA1\u8BA1\u7B97");this.chart.setOption(this.options),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),(t=this.chart)==null||t.dispose()}}),Oc=d("CaptionBarController",class extends H{initState(){super.initState(),this.view.model.capLanguageRes?this.state.caption=ibiz.i18n.t(this.view.model.capLanguageRes.lanResTag,this.view.model.caption):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):"")})}}),$o=class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;(e=this.deLogicParams.get(t))==null||e.calc(this)}renewParam(t){var e;(e=this.deLogicParams.get(t))==null||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)}},ni=class{};function nt(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:i}=e,r=e.srcValueType||"SRCDLPARAM",n=s;let o;switch(r){case"SRCDLPARAM":o=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(i);case"WEBCONTEXT":case"VIEWPARAM":o=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":o=t.parameters.context;break;case"ENVPARAM":o=I(ibiz.env);break;default:throw new D(e,"\u6682\u672A\u652F\u6301\u6E90\u503C\u7C7B\u578B".concat(r))}if(o&&n)try{Array.isArray(o)?o=o[Number(n)]:o=R.execScriptFn({srcValue:o},"srcValue.".concat(n),{singleRowReturn:!0,isAsync:!1})}catch(u){throw ibiz.log.error("\u4ECE\u6E90\u53C2\u6570\u53D6\u5C5E\u6027".concat(n,"\u62A5\u9519\uFF0C\u6E90\u53C2\u6570\uFF1A"),o),u}return o}var Jo=class extends ni{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,a){const s=nt(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=a[this.value]!=null?a[this.value]:e[this.value];return tt(s,this.op,i)}case"SRCENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6E90\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=nt(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return tt(s,this.op,i)}case"CURTIME":throw new D(this.model,"\u6682\u672A\u652F\u6301\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u5F53\u524D\u65F6\u95F4]");default:return tt(s,this.op,this.value)}}},Zo=class yi extends ni{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map(s=>s.logicType==="SINGLE"?new Jo(s):new yi(s))}get op(){return this.model.groupOP}get notMode(){return this.model.notMode===!0}test(e,a,s){let i=!0;if(this.conds.length===0)throw new m(this.model,"\u754C\u9762\u8FDE\u63A5\u6761\u4EF6\u903B\u8F91\u7EC4\u672A\u914D\u7F6E\u903B\u8F91\u9879");for(let r=0;r<this.conds.length;r++){const o=this.conds[r].test(e,a,s);if(this.op==="AND"&&o===!1){i=!1;break}if(this.op==="OR"&&o===!0){i=!0;break}}return this.notMode?!i:i}},tu=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;(e||0)===0&&a&&(this.groupCond=new Zo(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return this.groupCond?this.groupCond.test(t,a,s&&s.length>0?s[0]:{}):!0;case 1:return!0;case 2:throw new D(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B: \u5F02\u6B65\u7ED3\u675F");case 3:throw new D(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B: \u5F02\u6B65\u62D2\u7EDD");case 9:throw new D(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B: \u5F02\u5E38\u5904\u7406");default:throw new D(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B:".concat(e))}}},O=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map(e=>new tu(e))}},eu=class extends O{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDEUILogicParamId:s,retDEUILogicParamId:i}=this.model;if(!e)throw new m(this.model,"\u672A\u6307\u5B9A\u5E94\u7528\u5B9E\u4F53");if(!a)throw new m(this.model,"\u672A\u6307\u5B9A\u5B9E\u4F53\u884C\u4E3A");const r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(e,a,t.context,r,t.viewParam);o.ok&&(t.params[i]=o.data)}},au=class extends O{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:a}=this.model,{data:s,parameters:i}=t;if(!e)throw new m(this.model,"\u672A\u914D\u7F6E\u754C\u9762\u884C\u4E3A");let r=[s];if(a){const n=t.params[a];n instanceof Array?r=n:r=[n]}await U.execAndResolved(e,{...i,context:t.context,params:t.viewParam,data:r},this.model.appId)}},su=class extends O{async exec(t){}},iu=class extends O{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;case"LOGICPARAMFIELD":case"BREAK":default:throw new D(this.model,"\u6682\u672A\u652F\u6301\u7684\u7ED3\u675F\u8282\u70B9\u8FD4\u56DE\u503C\u7C7B\u578B: ".concat(e))}}},ru=class extends O{async exec(t){const e=this.model.deuilogicNodeParams;if(e?.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new D(a,"\u6682\u672A\u652F\u6301\u903B\u8F91\u5904\u7406\u53C2\u6570\u64CD\u4F5C".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:s}=t;if(!s)throw new f("\u6CA1\u6709\u76EE\u6807\u53C2\u6570\u5BF9\u8C61id");let i=a;e.isEntityParam(s)&&(i=i?.toLowerCase());const r=nt(e,t);if(i)try{R.execScriptFn({srcVal:r,dstParam:e.params[s]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(n){throw ibiz.log.error("\u7ED9\u76EE\u6807\u53C2\u6570\u5C5E\u6027".concat(a,"\u8D4B\u503C\u62A5\u9519\uFF0C\u76EE\u6807\u53C2\u6570\uFF1A"),e.params[s]),n}else e.params[s]=r}copyParam(t,e){const{dstDEUILogicParamId:a}=t,s=nt(e,t);e.params[a]=I(s)}bindParam(t,e){const a=nt(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=t,n=nt(e,t),o=s||0,u=i||0,c=r||n.length;e.params[a].splice(o,0,...n.slice(u,c))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:s,dstSortDir:i}=t,r=s;e.params[a].sort((o,u)=>i==="ASC"?o[r]-u[r]:u[r]-o[r])}},nu=class extends O{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:a,invokeParamId:s}=this.model;if(!a)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u5BF9\u8C61");if(!s)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u64CD\u4F5C\u53C2\u6570");if(!e)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u8C03\u7528\u65B9\u6CD5");const i=t.params[s];if(!i)throw new f("\u6CA1\u6709\u627E\u5230\u64CD\u4F5C\u53C2\u6570".concat(s));const r=t.params[a];if(!r)throw new f("\u6CA1\u6709\u627E\u5230\u754C\u9762\u5BF9\u8C61".concat(a));if(!r[e]||!Ba(r[e]))throw new f("\u6CA1\u6709\u627E\u5230\u8C03\u7528\u65B9\u6CD5".concat(e));await r[e](i)}},ou=class extends O{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=nt(t,this.model);t.params[e]=s}},uu=class extends O{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:a,msgBoxParamId:s}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u6D88\u606F\u7C7B\u578B\u7684\u914D\u7F6E");if(!a)throw new m(this.model,"\u7F3A\u5C11\u6309\u94AE\u7C7B\u578B\u7684\u914D\u7F6E");let{title:i}=this.model,{message:r}=this.model;if(s){const l=t.params[s];l.title&&(i=l.title),l.message&&(r=l.message)}const o={type:this.typeMap[e],title:i||"\u6D88\u606F",desc:r};let u=[];switch(a){case"YESNO":o.confirmButtonText="\u662F",o.cancelButtonText="\u5426",o.showConfirmButton=!0,o.showCancelButton=!0,u=["yes","no"];break;case"OK":o.confirmButtonText="\u786E\u5B9A",o.showConfirmButton=!0,o.showCancelButton=!1,u=["ok"];break;case"OKCANCEL":o.confirmButtonText="\u786E\u5B9A",o.cancelButtonText="\u53D6\u6D88",o.showConfirmButton=!0,o.showCancelButton=!0,u=["ok","cancel"];break;default:throw new D(this.model,"".concat(a,"\u6682\u672A\u652F\u6301"))}const c=await ibiz.modal.confirm(o);t.setLastReturn(u[c?0:1])}},cu=class extends O{async exec(t){const e=await bs(this.model);e&&await e.exec(this.model,t)}},lu=class extends O{async exec(t){const{dstDEUILogicParamId:e,name:a}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=t.params[e];console.log("\u903B\u8F91\u8282\u70B9".concat(a,"\u64CD\u4F5C\u53C2\u6570\u503C:"),s)}},du=class extends O{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.resetParam(e)}},hu=class extends O{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=nt(t,this.model);t.params[e]=I(s)}},pu=class extends O{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const n=nt(t,this.model),o=s||0,u=i||0,c=r||n.length;t.params[e].splice(o,0,...n.slice(u,c))}},fu=class extends O{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u76EE\u6807\u5C5E\u6027\u914D\u7F6E");const i=s;t.params[e].sort((n,o)=>a==="ASC"?n[i]-o[i]:o[i]-n[i])}},mu=class extends O{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.renewParam(e)}},Eu=class extends O{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:i}=this.model;if(!s)throw new m(this.model,"\u7F3A\u5C11\u914D\u7F6E\u8FC7\u6EE4\u53C2\u6570");const r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(a,e,t.context,r);o.ok&&(t.params[i]=o.data)}},gu=class extends O{async exec(t){const{errorInfo:e}=this.model;throw new f(e)}},wu=class extends O{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:a,fireCtrlId:s}=this.model;if(!s)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u89E6\u53D1\u5BF9\u8C61");if(!e)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u4E8B\u4EF6\u540D\u79F0\u53C2\u6570");if(!a)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u4E8B\u4EF6\u53C2\u6570");const i=t.params[s];if(!i)throw new f("\u6CA1\u6709\u627E\u5230\u89E6\u53D1\u5BF9\u8C61".concat(s));const r=t.params[a];if(!r)throw new f("\u6CA1\u6709\u627E\u5230\u4E8B\u4EF6\u53C2\u6570\u5BF9\u8C61".concat(a));await i.evt.emit(e,r)}},Du=class extends O{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:i}=this.model;if(!a)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53");if(!e)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u903B\u8F91");if(!s)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u4F20\u5165\u903B\u8F91\u53C2\u6570");const r=t.params[s];if(!r)throw new f("\u6CA1\u6709\u627E\u5230\u4F20\u5165\u53C2\u6570".concat(s));const n=await Ks(e,a,t.context,r,t.params);i&&(t.params[i]=n)}},Cu=class extends O{async exec(t){console.log(t),R.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},vu=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:i,params:r,data:n}=s,o=ibiz.hub.getApp(i.srfappid);if(a.codeName==="layoutPanel"){t.params[e]=s.view.layoutPanel.panelItems;return}if(a.default)a.entityListParam?t.params[e]=n||[]:t.params[e]=n&&n.length>0?n[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const u=s.view.getController(a.codeName.toLowerCase());u?t.params[e]=u:ibiz.log.error("\u89C6\u56FE\u903B\u8F91\u521D\u59CB\u5316\u53C2\u6570\uFF0C\u672A\u627E\u5230".concat(a.codeName,"\u6307\u5B9A\u90E8\u4EF6\u5BF9\u8C61"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=o;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u5206\u9875\u67E5\u8BE2\u7ED3\u679C");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=i;else{if(a.navViewParamParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u89C6\u56FE\u8DEF\u7531\u53C2\u6570");if(a.routeViewSessionParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u8DEF\u7531\u89C6\u56FE\u4F1A\u8BDD");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=r;else if(a.viewSessionParam)throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u5F53\u524D\u89C6\u56FE\u4F1A\u8BDD")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else if(a.simpleParam||a.entityParam)t.params[e]={};else throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B\u91CD\u65B0\u5EFA\u7ACB\u53D8\u91CF")}},Iu=class{constructor(t){this.model=t,this.nodes=new Map,this.params=new Map;var e;if(!((e=t.deuilogicNodes)!=null&&e.length))throw new m(t,"\u754C\u9762\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u903B\u8F91\u8282\u70B9");t.deuilogicNodes.forEach(a=>{const{logicNodeType:s}=a;let i;switch(s){case"BEGIN":i=new su(a);break;case"END":i=new iu(a);break;case"DEACTION":i=new eu(a);break;case"DEUIACTION":i=new au(a);break;case"PREPAREJSPARAM":i=new ru(a);break;case"RESETPARAM":i=new du(a);break;case"COPYPARAM":i=new hu(a);break;case"BINDPARAM":i=new ou(a);break;case"VIEWCTRLINVOKE":i=new nu(a);break;case"MSGBOX":i=new uu(a);break;case"DEBUGPARAM":i=new lu(a);break;case"APPENDPARAM":i=new pu(a);break;case"SORTPARAM":i=new fu(a);break;case"RENEWPARAM":i=new mu(a);break;case"DEDATASET":i=new Eu(a);break;case"THROWEXCEPTION":i=new gu(a);break;case"VIEWCTRLFIREEVENT":i=new wu(a);break;case"DELOGIC":i=new Du(a);break;case"PFPLUGIN":i=new cu(a);break;case"RAWJSCODE":i=new Cu(a);break;default:throw new D(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8282\u70B9\u7C7B\u578B: ".concat(s))}this.nodes.set(a.id,i)}),t.deuilogicParams.forEach(a=>{this.params.set(a.id,new vu(a))}),this.nodes.forEach(a=>{a.links.forEach(s=>{s.srcNode=a,this.nodes.has(s.model.dstDEUILogicNodeId)&&(s.dstNode=this.nodes.get(s.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 $o(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:a}=this.model;if(a&&this.nodes.has(a)){const s=this.nodes.get(a);await this.deepExec(s,e)}else throw new m(this.model,"\u672A\u8BBE\u7F6E\u8D77\u59CB\u8282\u70B9");return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let s=0;s<a.length;s++){const i=a[s];if(await i.exec(e)&&i.dstNode&&(await this.deepExec(i.dstNode,e),t.model.parallelOutput===!1))break}}},sa=new Map;async function he(t,e,a){const i=await ibiz.hub.getApp(a.context.srfappid).getDEUILogic(t,e);if(!i)throw new f("\u627E\u4E0D\u5230\u5B9E\u4F53".concat(e,"\u7684\u754C\u9762\u903B\u8F91").concat(t));return sa.has(i)||sa.set(i,new Iu(i)),await sa.get(i).exec(a),null}var U=d("UIActionUtil",class{static async exec(t,e,a){const s=await Qt(t,a);if(!s)throw new f("\u6CA1\u627E\u5230".concat(t,"\u7684\u754C\u9762\u884C\u4E3A\u6A21\u578B"));return s.actionTarget==="SINGLEDATA"&&await e.view.call("Validate")===!1?{cancel:!0}:(await Fs(s)).exec(s,e)}static async execAndResolved(t,e,a){var s,i;const r=await this.exec(t,e,a);if(r.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(r.refresh)switch(r.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:(s=e.view.parentView)==null||s.callUIAction("Refresh");break;case 3:(i=e.view.getTopView())==null||i.callUIAction("Refresh");break}}}),xt=d("UIActionProviderBase",class{async exec(t,e){const{context:a,params:s,data:i}=e,r={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:n,appDataEntityId:o,uilogicAttachMode:u}=t;if(u==="REPLACE"){if(!n)throw new m(t,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");return await he(n,o,e),r}if(!await this.isConfirm(t,e))return this.returnError(r);const c=await this.execAction(t,e);if(Object.assign(r,c),r.cancel===!0)return this.returnError(r);const l={...e,context:r.nextContext||a,data:r.data||i,params:r.nextParams||s};if(t.closeEditView)this.doNextAction(t,l,t.appId);else{const h=await this.doNextAction(t,l,t.appId);if(h&&(Object.assign(r,h),h.cancel===!0))return this.returnError(r)}if(t.uilogicAttachMode==="AFTER"){if(!n)throw new m(t,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");await he(n,o,e)}return r}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return t.enableConfirm&&a?ibiz.confirm.warning({title:"\u64CD\u4F5C\u786E\u8BA4",desc:a}):!0}async doNextAction(t,e,a){const s=t.nextId;if(s)return U.exec(s,e,a)}async handleParams(t,e,a,s){let i=[];const r=B(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":i=[];break;case"SINGLEDATA":i=[a[0]];break;case"MULTIDATA":i=a;break;case"MULTIKEY":i=r&&a.length>0?a.map(w=>({[o]:w.srfkey||w[o]})):[{}];break;case"SINGLEKEY":{const w=a[0]||{};i=r?[{[o]:w.srfkey||w[o]}]:[{}]}break}const u=e.clone(),c=[...t.navigateContexts||[]];if(r&&t.actionTarget!=="NONE"){const{valueItem:w,paramItem:y}=t,v=y||r,P=w||"srfkey";c.unshift({key:v,value:P,rawValue:!1})}const l=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,h=F(c,l?Re(c,a):a[0]||{},s,e);Object.assign(u,h);const p=t.navigateParams,E=F(p,l?Re(p,a):a[0]||{},s,u);return{resultContext:u,resultData:i,resultParams:E}}calcMessage(t,e,a){let s,i;const{confirmMsg:r,cmlanguageRes:n,successMsg:o,smlanguageRes:u}=e;switch(t){case"confirm":s=r,i=n;break;case"success":s=o,i=u;break}if(i){const c=ibiz.i18n.t(i.lanResTag,i.defaultContent||s);c!==i.lanResTag&&(s=c)}if(s){const{data:c}=a,l={...a};return c.length===1?[l.data]=c:c.length===0&&delete l.data,R.execScriptFn(l,"`".concat(s,"`"),{isAsync:!1,singleRowReturn:!0})}}}),Au=d("BackendUIActionProvider",class extends xt{async execAction(t,e){const{context:a,params:s,data:i,event:r}=e,n={},o=t.appDataEntityId,u=t.appDEMethodId;if(!o||!u)throw new m(t,"\u672A\u914D\u7F6E\u5B9E\u4F53\u6216\u5B9E\u4F53\u884C\u4E3A");const{resultContext:c,resultParams:l,resultData:h}=await this.handleParams(t,a,i,s),p={...l},E=t.frontAppViewId;if(E){const b=await ibiz.commands.execute(et.TAG,E,c,l,{event:r});if(!b?.ok)return n.cancel=!0,n;if(b?.ok&&b.data){h.length===0&&h.push({});const A=b.data.map(L=>{var G;return((G=L.getOrigin)==null?void 0:G.call(L))||L||{}});h.forEach(L=>{L.srfactionparam=A})}}const w=ibiz.hub.getApp(a?.srfappid),y=h.map(b=>{var A;return((A=b.getOrigin)==null?void 0:A.call(b))||b||{}}).map(b=>Object.assign(b,p)),v=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),P=await w.deService.exec(o,u,c,v?y:y[0],p);if(P.ok){const b=this.calcMessage("success",t,e);b&&ibiz.message.success(b)}return Object.assign(n,{data:Xt(P.data)?P.data:[P.data],nextContext:c,nextParams:p}),n}}),yu=d("SysUIActionProvider",class extends xt{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,s=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;return s==="Exit"?{closeView:!0}:await a.callUIAction(s,e)||{}}}),Fu=d("FrontUIActionProvider",class extends xt{async execAction(t,e){const{context:a,params:s,data:i,event:r,noWaitRoute:n}=e;let o={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const u=Da.fill(t.htmlPageUrl,a,i?.[0]);window.open(u,"_blank");break}case"TOP":case"WIZARD":{const u=t.frontAppViewId;if(!u)throw new m(t,"\u672A\u914D\u7F6E\u6253\u5F00\u89C6\u56FE");const{resultContext:c,resultParams:l}=await this.handleParams(t,a,i,s),h=await ibiz.commands.execute(et.TAG,u,c,l,{event:r,noWaitRoute:n});h?.ok||(o.cancel=!0),h?.ok&&h.data&&(o.data=h.data,o.nextContext=c,o.nextParams={...s,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":o=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":o=this.doOther(t,e);break;default:throw new D(t,"\u672A\u652F\u6301\u7684\u524D\u53F0\u5904\u7406\u6A21\u5F0F[".concat(t.frontProcessType,"]"))}return o}doOther(t,e){const{scriptCode:a}=t,{context:s,params:i,data:r,event:n,view:o}=e;if(a)return R.execScriptFn({context:s,params:i,data:r,el:n?.target,view:o},a)||{};throw new m(t,"\u81EA\u5B9A\u4E49\u7C7B\u578B\u7F3A\u5C11\u914D\u7F6E\u811A\u672C\u4EE3\u7801")}async executePrint(t,e){var a,s,i;const{resultContext:r,resultParams:n}=await this.handleParams(t,e.context,e.data,e.params),o=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),u=(a=o.appDEPrints)==null?void 0:a.find(c=>c.id===t.appDEPrintId);if(u){let c="";if(r&&r[o.codeName.toLowerCase()])c+="/".concat((s=o.codeName2)==null?void 0:s.toLowerCase(),"/printdata/").concat(r[o.codeName.toLowerCase()]);else throw new f("\u6CA1\u6709\u627E\u5230\u6570\u636E\u4E3B\u952E");const l=await ibiz.net.request(c,{method:"get",responseType:"blob",params:{srfprinttag:u.codeName,...n}});if(l.ok)if(n&&n.srfcontenttype){const p=(i=l.headers["content-disposition"].split(";").find(y=>y.indexOf("filename=")!==-1))==null?void 0:i.slice(9),E=URL.createObjectURL(l.data),w=document.createElement("a");w.href=E,w.download=p,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(E)}else{const h=window.URL.createObjectURL(l.data);window.open(h,"_blank")}else throw new f("\u6253\u5370\u5931\u8D25")}else throw new f("\u6CA1\u6709\u627E\u5230\u5B9E\u4F53\u6253\u5370\u9879")}async executeDataImport(t,e){var a;const s=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),i=(a=s.appDEDataImports)==null?void 0:a.find(n=>n.id===t.appDEDataImportId);let r="DataImport";if(i&&i.enableCustomized&&(r="DataImport2"),i){const n=ibiz.overlay.createModal(r,{dismiss:()=>n.dismiss(),appDataEntity:s,dataImport:i},{width:"auto",placement:"center"});return n.present(),await n.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new f("\u6CA1\u6709\u627E\u5230\u5B9E\u4F53\u5BFC\u5165\u9879")}async executeDataExport(t,e){var a,s;const{resultParams:i}=await this.handleParams(t,e.context,e.data,e.params),r=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),n=(a=r.appDEDataExports)==null?void 0:a.find(o=>o.id===t.appDEDataExportId);if(n){const o="/".concat((s=r.codeName2)==null?void 0:s.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(n.codeName),u={page:0,size:n.maxRowCount?n.maxRowCount:1e3,...e.params,...i},c=await ibiz.net.request(o,{method:"post",data:u});if(c.status===200){let l="".concat(r.logicName,"\u8868.xlsx");l=decodeURIComponent(l);const h=new Blob([c.data],{type:"application/vnd.ms-excel"}),p=document.createElement("a");p.download=l,p.style.display="none",p.href=URL.createObjectURL(h),document.body.appendChild(p),p.click(),URL.revokeObjectURL(p.href),document.body.removeChild(p)}else throw new f("\u5BFC\u51FA\u8BF7\u6C42\u5931\u8D25")}else throw new f("\u6CA1\u6709\u627E\u5230\u5B9E\u4F53\u5BFC\u51FA\u9879")}}),Pu=d("WFWithdrawUIActionProvider",class extends xt{async execAction(t,e){const{view:a}=e,s=await ibiz.modal.confirm({title:"\u63D0\u793A",desc:"\u662F\u5426\u786E\u8BA4\u6267\u884C\u64A4\u56DE\u64CD\u4F5C\uFF1F"});let i=!1;return s&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),bu=class extends xt{async execAction(t,e){return await ibiz.confirm.info({title:"\u786E\u8BA4\u9000\u51FA\u767B\u5F55",desc:"\u60A8\u786E\u5B9A\u8981\u9000\u51FA\u767B\u5F55\u5417\uFF1F\u9000\u51FA\u540E\u60A8\u5C06\u65E0\u6CD5\u7EE7\u7EED\u8BBF\u95EE\u5DF2\u767B\u5F55\u72B6\u6001\u7684\u529F\u80FD\u548C\u4FE1\u606F\uFF0C\u8BF7\u786E\u4FDD\u60A8\u5DF2\u4FDD\u5B58\u6240\u6709\u672A\u5B8C\u6210\u7684\u64CD\u4F5C\u3002"})&&await ibiz.auth.logout()&&window.location.reload(),{}}};function oi(){const t=new Fu;yt("FRONT",()=>t);const e=new Au;yt("BACKEND",()=>e);const a=new yu;yt("SYS",()=>a);const s=new Pu;yt("DEUIACTION_WFWithdraw",()=>s);const i=new bu;yt("SYS_Logout",()=>i)}var Nu=d("ToolbarController",class extends H{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new gt,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if(t.itemType==="DEUIACTION"){const s=t.uiactionId,i=await Qt(s,t.appId);if(!i)throw new f("\u6CA1\u6709\u627E\u5230\u754C\u9762\u884C\u4E3A\u6A21\u578B".concat(s));const r=["SYS","BACKEND","WFBACKEND"].includes(i.uiactionMode)&&i.showBusyIndicator!==!1;r&&this.state.buttonsState.setLoading(t.id);try{const o=await this.ctx.view.call("GetData")||[],u=this.getEventArgs();u.params=Object.assign(a,u.params),await U.execAndResolved(s,{...u,data:o,event:e},t.appId)}finally{r&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,W(this.model,t=>{if(t.itemType==="DEUIACTION"){const e=t,a=new Et(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}},{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const s=t.buttonType==="extra";await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:s?"extra":"deuiaction"}),s||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof K&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const s={};a&&(s.data=[a]),W(this.model,i=>{const r=this.state.buttonsState[i.id];if(r){if(r.visible){const n=this.scheduler.triggerItemVisible(i.id,s);n!==void 0&&(r.visible=n)}if(!r.disabled){const n=this.scheduler.triggerItemEnable(i.id,s);n!==void 0&&(r.disabled=!n)}}},{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){t===void 0?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];W(this.model,a=>{a.controlLogics&&e.push(...a.controlLogics)},{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}}),ui=d("ContextMenuController",class extends Nu{}),_c=d("DashboardController",class extends H{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",e=>{const a=ai(e.data);a&&this.dataChangeNotify(a)})}async initPortlets(t,e){if(!t?.length)return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map(async s=>{var i;if(s.controlType&&a.includes(s.controlType))return;const r=await As(s);if(r){this.providers[s.id]=r;const n=await r.createController(s,this,e);this.portlets[s.id]=n,(i=s.controls)!=null&&i.length&&await this.initPortlets(s.controls,n)}}))}async dataChangeNotify(t){await it(Object.values(this.portlets).map(async e=>e.dataChangeNotify(t)))}}),xc=d("CustomDashboardController",class{constructor(t){this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null;var e,a;this.model=t,this.config=new Bt(t.appId,"dynadashboard","dashboard_".concat(((e=this.model.appDataEntityId)==null?void 0:e.toLowerCase())||"app","_").concat((a=this.model.codeName)==null?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),Su=d("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}}),ht=d("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:a,height:s}=qt(this.model);this.state.layout.width="".concat(a),this.state.layout.height="".concat(s)}e?.cssName&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new Su}onDataChange(t){let e=t.data[0];e&&e instanceof K&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!((t=e?.uiactionGroupDetails)!=null&&t.length))return;const a=new gt;e.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new Et(i.id,this.dashboard.context.srfappid,r);a.addState(i.id,n)}}),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:s}=this.dashboard.view.model;s&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const s=t.uiactionId;await U.execAndResolved(s,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=It(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)}}),Mc=d("ContainerPortletController",class extends ht{}),Vc=d("ViewPortletController",class extends ht{}),kc=d("MenuPortletController",class extends ht{}),Wc=d("ChartPortletController",class extends ht{}),Uc=d("ActionBarPortletController",class extends ht{}),zc=d("HtmlPortletController",class extends ht{}),Gc=d("ListPortletController",class extends ht{}),jc=d("RawItemPortletController",class extends ht{}),ci=d("DataViewControlService",class extends rt{initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.dedataViewDataItems)==null||t.forEach(e=>{const a=e.id.toLowerCase(),s=e.appDEFieldId;let i;if(s){const r=s.toLowerCase();i=new Y(a,r,{isOriginField:!0,dataType:e.dataType})}else i=new Y(a,a);this.dataUIMap.set(a,i)})}}),Lu=d("DataViewControlController",class extends ${get enableNew(){return this.model.enableCardNew===!0}initState(){super.initState(),this.state.noSort=this.model.noSort===!0,this.state.size=this.model.pagingSize||20,this.state.singleSelect=this.model.singleSelect===!0,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new ci(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(t=e?.uiactionGroupDetails)!=null&&t.length&&this.state.groups.forEach(async a=>{const s=new gt;e.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new Et(i.id,this.context.srfappid,r);s.addState(i.id,n)}}),await s.update(),a.groupActionGroupState=s})}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach(s=>{s.selectedData=[]}),this.state.selectedData.forEach(s=>{const i=s[a],r=this.state.groups.find(n=>n.key===i);r&&r.selectedData.push(s)}),this.state.singleSelect)this.state.groups.forEach(s=>{var i,r;let n=t;s.selectedData.indexOf(n)!==-1?(n&&n instanceof K&&(n=n.getOrigin()),n&&((i=s.groupActionGroupState)==null||i.update(n,this.model.appDataEntityId))):(r=s.groupActionGroupState)==null||r.update(void 0,this.model.appDataEntityId)});else{const s=this.state.groups.find(i=>i.children.indexOf(t)!==-1);s&&((e=s.groupActionGroupState)==null||e.update(s.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)e[a].itemType==="ACTIONITEM"&&(t=e[a]);return t}getOptItemAction(t){var e;const a=new gt,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new m(this.model,"\u64CD\u4F5C\u9879\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A\u7EC4");if(!((e=s.deuiactionGroup.uiactionGroupDetails)!=null&&e.length))return ibiz.log.debug("\u64CD\u4F5C\u9879\u754C\u9762\u884C\u4E3A\u7EC4\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A"),a;s.deuiactionGroup.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new Et(i.id,this.context.srfappid,r);a.addState(i.id,n)}}),a.update(t.getOrigin())}return a}async onActionClick(t,e,a){const s=t.uiactionId;await U.execAndResolved(s,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new m(this.model,"\u5206\u7EC4\u5C5E\u6027\u6CA1\u6709\u914D\u7F6E");e==="AUTO"?this.handleAutoGroup():e==="CODELIST"&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach(i=>{const r=i[t];C(r)||(a.has(r)||a.set(r,[]),a.get(r).push(i))});const s=[];a.forEach((i,r)=>{s.push({caption:r,key:r,children:[...i]})}),this.state.groups=s}}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 m(this.model,"\u5206\u7EC4\u4EE3\u7801\u8868\u6CA1\u6709\u914D\u7F6E");const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach(r=>{s.set(r.value,[])}),a.forEach(r=>{const n=r[t],o=s.get(n);o&&o.push(r)});const i=[];s.forEach((r,n)=>{const o=this.groupCodeListItems.find(u=>u.value===n);i.push({caption:o.text,key:o.value,children:r})}),this.state.groups=i}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;if(a&&s){const i=this.fieldIdNameMap.get(a);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(s.toLowerCase())}else this.state.sortQuery=""}}onClickNew(t,e){const a={...this.params,srfgroup:e};U.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const s=t.uiactionId,i={...this.params,srfgroup:a.key};await U.execAndResolved(s,{context:this.context,params:i,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!((t=this.model.dedataViewItems)!=null&&t.length))return;const e=[],{minorSortAppDEFieldId:a,minorSortDir:s}=this.model,i=a&&s;this.model.dedataViewItems.forEach(r=>{if(!r.enableSort)return;let{caption:n}=r;if(r.capLanguageRes&&(n=ibiz.i18n.t(r.capLanguageRes.lanResTag,r.caption)),!r.appDEFieldId)throw new m(r,"\u542F\u7528\u6392\u5E8F\u7684\u9879\u5FC5\u987B\u5173\u8054\u5B9E\u4F53\u5C5E\u6027");const o={caption:n,key:r.appDEFieldId};i&&a===r.appDEFieldId&&(o.order=s.toLowerCase()),e.push(o)}),e.length>0&&(this.state.sortItems=e)}}),ia=d("ExpBarControlController",class extends H{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 m(this.model,"\u65E0\u6CD5\u83B7\u53D6\u591A\u6570\u636E\u90E8\u4EF6[".concat(this.model.xdataControlName,"]\u63A7\u5236\u5668"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return(t=this.model.controls)==null?void 0:t.find(a=>a.name===this.model.xdataControlName)}get isCache(){return this.controlParams.expcache==="CACHE"?!0:this.controlParams.expcache==="NO_CACHE"?!1:ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=(t=e.appDEFields)==null?void 0:t.filter(i=>i.enableQuickSearch),s=[];a?.forEach(i=>{i?.lnlanguageRes&&i.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(i.lnlanguageRes.lanResTag,i.logicName)):i?.logicName&&s.push(i.logicName)}),s.length>0&&(this.state.placeHolder=s.join("\u3001"))}}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){t.isInitialLoad&&(this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem())}navBySrfnav(){var t;const e=(t=this.xDataController)==null?void 0:t.state.items.find(s=>s[this.navKeyName]===this.state.srfnav);if(this.routeDepth&&Qe(this.routeDepth)){e&&this.xDataController.setSelection([e]),this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});return}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){this.state.srfnav="",this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});return}this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:s}=t,i=this.getNavViewMsg(e[0],a,s);this._evt.emit("onNavViewChange",{navViewMsg:i})}prepareParams(t,e,a,s){const{navDER:i,navFilter:r,navigateContexts:n,navigateParams:o,appDataEntityId:u}=t,c={deName:u?B(u):void 0,navFilter:r,pickupDEFName:i?.pickupDEFName,navContexts:n,navParams:o},l={context:a,params:s,data:e},{resultContext:h,resultParams:p}=Yt(c,l),E=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];const w={...p};return{context:E,params:w}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes(((t=this.XDataModel)==null?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new f("\u591A\u8282\u70B9\u89C6\u56FE\u7531\u5B50\u7C7B\u5B9E\u73B0")}getNavViewMsg(t,e,a){const s=this.calcViewModelId(),i=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:i.context,params:i.params,viewId:s,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const e=this.layoutPanel.panelItems.control_toolbar;e&&(e.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 a=this.layoutPanel.panelItems.control_header;a&&(a.state.visible=!1)}})}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),Kc=d("CalendarExpBarController",class extends ia{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find(a=>a.itemType===t)}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new m(this.model,"\u65E0\u6CD5\u83B7\u53D6\u591A\u6570\u636E\u90E8\u4EF6[".concat(this.model.xdataControlName,"]\u63A7\u5236\u5668"));return t}navBySrfnav(){var t;const e=(t=this.xDataController)==null?void 0:t.state.items.find(s=>s.navId===this.state.srfnav);if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:s}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:s,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),Hc=d("TreeExpBarController",class extends ia{constructor(){super(...arguments),this.navKeyName="id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new m(this.model,"\u65E0\u6CD5\u83B7\u53D6\u591A\u6570\u636E\u90E8\u4EF6[".concat(this.model.xdataControlName,"]\u63A7\u5236\u5668"));return t}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach(s=>{s.id===t&&(a=s)}),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const s=t.id,i=t.deData||t,r=this.getNodeModel(t.nodeId);if(!r)throw new f("\u627E\u4E0D\u5230".concat(t.nodeId,"\u7684\u8282\u70B9\u6A21\u578B"));const n=this.prepareParams(r,i,e,a);return n.context.currentSrfNav=s,this.state.srfnav=s,{key:s,viewId:r.navAppViewId,isCache:this.isCache,...n}}navByFirstItem(){const t=this.xDataController.state.items.find(e=>!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(e)?!1:this.state.noNeedNavView?!0:this.navNodeModelIds.includes(e.nodeId));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;t?.forEach(e=>{e.navAppViewId&&this.navNodeModelIds.push(e.id)}),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach((a,s)=>{s===0?e.push(a):e.push("".concat(e[s-1],":").concat(a))}),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 e=this.layoutPanel.panelItems.control_toolbar;e&&(e.state.visible=!1)}return t||!!(this.model.showTitleBar&&this.model.title)}}),Xc=d("ChartExpBarController",class extends ia{navByFirstItem(){if(!this.xDataController.state.items[0]){this.state.srfnav="",this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});return}const e=this.xDataController.generator.seriesGenerators.find(a=>a.chartDataArr.length>0&&a.model.navAppViewId);e&&this.xDataController.setActive(e.chartDataArr[0])}prepareParams(t,e,a,s){var i;const{context:r,params:n}=super.prepareParams(t,e,a,s);if(e._seriesModelId){const o=(i=t.dechartSerieses)==null?void 0:i.find(u=>u.id===e._seriesModelId);if(o){const{navigateContexts:u,navigateParams:c}=o,l=F(u,e,s,r),h=F(c,e,s,n);return{context:Object.assign(r.clone(),l),params:h}}}return{context:r,params:n}}getNavViewMsg(t,e,a){var s;let i;if(t._seriesModelId){const n=(s=this.XDataModel.dechartSerieses)==null?void 0:s.find(o=>o.id===t._seriesModelId);i=n?.navAppViewId}const r=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:r.context,params:r.params,viewId:i,isCache:this.isCache}}}),li=d("FormController",class extends H{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new K,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await it(Object.values(this.details).map(async e=>e.dataChangeNotify(t)))}formStateNotify(t){Object.values(this.details).forEach(e=>{e.formStateNotify(t)})}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=we(this.dataChangeNotify.bind(this),(t,e)=>[Array.from(new Set([...t[0],...e[0]]))],200),this._evt.on("onFormDetailEvent",t=>{var e;(e=this.scheduler)==null||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)})}async getDraftParams(){const t={};return await Promise.all(this.formItems.map(e=>e.setDefaultValue(!0,t))),t}async initDetailControllers(t=this.model.deformPages,e=this,a=void 0){await Promise.all(t.map(async s=>{const i=await Es(s);if(!i)return;e.providers[s.id]=i;const r=await i.createController(s,e,a);if(e.details[s.id]=r,s.detailType==="FORMITEM"&&e.formItems.push(r),s.detailType==="MDCTRL"&&e.formMDCtrls.push(r),$a(s))return;const n=Qa(s);n.length&&await this.initDetailControllers(n,e,r)}))}getData(){return[this.state.data]}async setDataValue(t,e){if(!(Object.prototype.hasOwnProperty.call(this.state.data,t)&&!$e(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(await Promise.all([...this.formItems,...this.formMDCtrls].map(e=>e.validate()))).findIndex(e=>!e)===-1}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];W(this.model,a=>{a.controlLogics&&e.push(...a.controlLogics)},{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}}),Ru=d("SearchFormService",class extends Ot{async getDraft(t,e={}){let s={ok:!0,status:200,data:this.getFilteredData({...e})};return s=this.handleResponse(s),s}initUIDataMap(){W(this.model,t=>{if(t.detailType==="FORMITEM"){const e=t.id.toLowerCase();this.dataUIMap.set(e,new Y(e,e))}},{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach(a=>{t[a.dataKey]!==void 0&&(e[a.dataKey]=t[a.dataKey])}),e}}),Yc=d("SearchFormController",class extends li{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Bt(this.model.appId,"dynafilter","searchform_".concat(((t=this.model.appDataEntityId)==null?void 0:t.toLowerCase())||"app","_").concat((e=this.model.codeName)==null?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new Ru(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params},e=await this.getDraftParams();Object.assign(t,e),await this.evt.emit("onBeforeLoadDraft",{params:t});let a;try{a=await this.service.getDraft(this.context,t)}catch(s){throw this.actionNotification("GETDRAFTERROR",{error:s}),s}return this.state.data=a.data,Wt(this.data,e),this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach(e=>{const a=this.state.data[e];a!=null&&a!==""&&(t[e]=a)}),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&e.code==="Enter"&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const s=this.model.searchButtonPos||"RIGHT";e=s==="BOTTOM",a=s!=="BOTTOM",t==="NONE"&&(e=!0,a=!0);const i=r=>{let n,o="";if(["rootPanelItems","panelItems"].find(u=>r[u]?(n=r[u],o=u,!0):!1),n&&n.length>0){const u=[];n.forEach(c=>{e&&c.id==="control_buttons_right"||a&&c.id==="control_buttons_bottom"||(u.push(c),i(c))}),u.length<n.length&&(r[o]=u)}};(a||e)&&i(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 f("\u6CA1\u6709\u627E\u5230\u53EF\u4EE5\u5E94\u7528\u7684\u641C\u7D22\u6761\u4EF6");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new f("\u6CA1\u6709\u627E\u5230\u4FDD\u5B58\u7684\u641C\u7D22\u6761\u4EF6");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),ot=d("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){return this.parent&&(this.parent.visible===!1||this.showMoreMode===1&&this.parent.isShowMore===!1)?!1:e},set(s){return e=s,!0}});let a;Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return a!==void 0?a:this.parent?this.parent.keepAlive:!1},set(s){return a=s,!0}})}}),Tu=d("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Tu||{})),Bu=d("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Bu||{})),pt=d("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:s,height:i}=qt(t);this.state.layout.width="".concat(s),this.state.layout.height="".concat(i)}e?.cssName&&this.state.class.container.push(e.cssName),a?.cssName&&this.state.class.label.push(a.cssName)}createState(){var t;return new ot((t=this.parent)==null?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||(a=this.model.defdgroupLogics)==null||a.forEach(s=>{const i=s.relatedDetailNames||[];if(e||Ut(i,t))try{const r=te(this.data,s);switch(s.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!r;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!r;break;case"PANELVISIBLE":this.dynaLogicResult.visible=r;break;default:}}catch(r){ibiz.log.error(r)}})}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=It(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=It(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(e!==!0&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(e!==!1&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});a!==void 0&&(e=a)}e!==void 0&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(e!==!0&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.required=e)}async onClick(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),Ou=d("FormButtonState",class extends ot{constructor(){super(...arguments),this.loading=!1}}),qc=d("FormButtonController",class extends pt{createState(){var t;return new Ou((t=this.parent)==null?void 0:t.state)}async onClick(t){this.state.loading=!0;try{this.model.actionType==="UIACTION"&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await U.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)}}),_u=d("FormDruipartState",class extends ot{constructor(){super(...arguments),this.showMask=!1}}),Qc=d("FormDRUIPartController",class extends pt{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new _u((t=this.parent)==null?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(e=>!!e),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),Ut(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData=t==="DRAFT",this.model.maskMode!==0&&(this.state.showMask=this.isNewData),(t==="LOAD"||t==="DRAFT"||t==="SAVE")&&this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;x(e)&&(t=Object.assign(t,F(e,this.data,this.form.params,this.form.context)));const a=F(this.model.navigateParams,this.data,this.form.params,this.form.context);if(!this.state.viewComponentKey)this.state.viewComponentKey=j(),this.navContext=t,this.navParams=a;else if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",()=>{this.isNewData||this.embedView.call("Load")}),this.embedView.evt.on("onDataChange",e=>{["LOAD","LOADDRAFT"].includes(e.actionType)||(ibiz.log.debug("\u63A5\u6536\u5230\u5173\u7CFB\u754C\u9762\u7684\u6570\u636E\u53D8\u66F4\u4E8B\u4EF6",e),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))})}}),di=d("FormGroupPanelState",class extends ot{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}}),xu=d("FormGroupPanelController",class extends pt{get disableClose(){const{titleBarCloseMode:t}=this.model;return t===0||t===void 0}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||t===1}createState(){var t;return new di((t=this.parent)==null?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const e=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(e)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!((t=e?.uiactionGroupDetails)!=null&&t.length))return;const a=new gt;e.uiactionGroupDetails.forEach(s=>{const i=s.uiactionId;if(i){const r=new Et(s.id,this.form.context.srfappid,i);a.addState(s.id,r)}}),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await U.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Mu=d("FormItemState",class extends ot{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?!0:e},set(a){return e=a,!0}})}}),$c=d("FormItemController",class extends pt{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new Mu((t=this.parent)==null?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&this.model.editor.editorType!=="HIDDEN"&&(this.editorProvider=await ie(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=Ve(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Je(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...Ze(this.model.editor)),this.rules.length>0&&(this.validator=new Ne({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=this.data.srfuf===0;(e&&t===2||!e&&t===1)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach(s=>{t.includes(s)&&(a=!0)}),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond(),t==="LOAD"&&this.setDefaultValue(!1)}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&&k(this.data[this.name]))return this.state.error="\u8BF7\u586B\u5199".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}setDefaultValue(t,e=this.data){const{createDVT:a,createDV:s,updateDVT:i,updateDV:r}=this.model,n=t?a:i,o=t?s:r,u=ta({name:this.name,valueType:n,defaultValue:o,valueFormat:this.model.valueFormat},{data:e,context:this.context,params:this.params});u!==void 0&&(e[this.name]=u)}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})}}),ra=d("FormMDCtrlController",class extends pt{get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return zt.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return zt.checkPermission(this.model.buildInActions,2)}get enableDelete(){return zt.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}}),Jc=d("FormMDCtrlMDController",class extends ra{get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new m(this.model,"\u591A\u6570\u636E\u90E8\u4EF6\u672A\u914D\u7F6E\u5185\u5BB9\u90E8\u4EF6");t.controlType==="GRID"&&Gt(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await ft(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",()=>{this.updateFormItem()}),t.evt.on("onRemoveSuccess",()=>{this.updateFormItem()})}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if(this.model.contentType==="GRID")this.mdController.newRow();else throw new D(this.model,"\u591A\u6570\u636E\u90E8\u4EF6\u7C7B\u578B".concat(this.model.contentType,"\u6682\u4E0D\u652F\u6301\u6DFB\u52A0\u6570\u636E"))}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController\u4E0D\u5B58\u5728")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh()}}),Vu=class extends ot{},Zc=d("FormMDCtrlFormController",class extends ra{constructor(){super(...arguments),this.formMap=new Map}createState(){var t;return new Vu((t=this.parent)==null?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new m(this.model,"\u591A\u6570\u636E\u90E8\u4EF6\u672A\u914D\u7F6E\u5185\u5BB9\u90E8\u4EF6");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await ft(t);e&&(this.formProvider=e);const{appDataEntityId:a}=this.model.contentControl;this.deName=B(a)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e="fetchdefault",a=await ibiz.hub.getApp(this.model.appId).deService.exec(t,e,this.context,this.params);a.ok&&(this.state.items=a.data.map(s=>{const i=this.context.clone();i[this.deName]=s.srfkey;const r={...this.params};return{id:s.srfkey,context:i,params:r}}))}async formStateNotify(t){await super.formStateNotify(t),await this.fetchData()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",a=>{const s=a.data[0],i=this.state.items.find(r=>r.id===t);i&&i.context[this.deName]!==s.srfkey&&(i.context[this.deName]=s.srfkey),this.updateFormItem()}),e.evt.on("onRemoveSuccess",()=>{this.updateFormItem()})}async remove(t){const e=this.formMap.get(t);if(!e)throw new f("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94".concat(t,"\u7684\u8868\u5355\u63A7\u5236\u5668"));await e.remove();const a=this.state.items.findIndex(s=>s.id===t);a!==-1&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const s={id:j(),context:e,params:a};t!==void 0?this.state.items.splice(t,0,s):this.state.items.push(s)}refresh(){this.fetchData()}async dataChangeNotify(t){await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh()}}),tl=d("FormMDCtrlRepeaterController",class extends ra{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get name(){return this.model.id}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 D(this.model,"\u6682\u4E0D\u652F\u6301\u91CD\u590D\u5668\u6837\u5F0F".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach(s=>{e[s]=this.form.model[s]}),this.repeatedForm=I(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],t!==void 0?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData){this.setValue(null);return}const e=this.value.filter((a,s)=>t!==s);this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach(s=>{t.includes(s)&&(a=!0)}),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),ku=d("FormPageState",class extends di{}),el=d("FormPageController",class extends xu{createState(){var t;return new ku((t=this.parent)==null?void 0:t.state)}}),Wu=d("FormRawItemState",class extends ot{}),al=d("FormRawItemController",class extends pt{createState(){var t;return new Wu((t=this.parent)==null?void 0:t.state)}}),Uu=d("FormTabPageState",class extends ot{}),sl=d("FormTabPageController",class extends pt{createState(){var t;return new Uu((t=this.parent)==null?void 0:t.state)}}),zu=d("FormTabPanelState",class extends ot{}),il=d("FormTabPanelController",class extends pt{createState(){var t;return new zu((t=this.parent)==null?void 0:t.state)}}),Gu=d("EditFormService",class extends Ot{async get(t,e={}){var a;let s=await this.exec(((a=this.model.getControlAction)==null?void 0:a.appDEMethodId)||"get",t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var a;let s=await this.exec(((a=this.model.getDraftControlAction)==null?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var a;return await this.exec(((a=this.model.removeControlAction)==null?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const s=e instanceof K?e.getOrigin():e,i=this.getFilteredData(s);let r=await this.exec(((a=this.model.createControlAction)==null?void 0:a.appDEMethodId)||"create",t,i);return r=this.handleResponse(r),r}async update(t,e){var a;const s=e instanceof K?e.getOrigin():e,i=this.getFilteredData(s);let r=await this.exec(((a=this.model.updateControlAction)==null?void 0:a.appDEMethodId)||"update",t,i);return r=this.handleResponse(r),r}async goBack(t,e){var a;const i=(a=this.model.goBackControlAction)==null?void 0:a.appDEMethodId;if(!i)throw new m(this.model,"\u7F3A\u5C11\u8FD4\u56DE\u64CD\u4F5C\u5B9E\u4F53\u884C\u4E3A");let r=await this.exec(i,t,e instanceof K?e.getOrigin():e);return r=this.handleResponse(r),r}async updateFormItem(t,e,a={}){let s=await this.exec(t,e,a);return s=this.handleResponse(s),s}async wfStart(t,e,a){var s;const r=((s=this.model.wfstartControlAction)==null?void 0:s.appDEMethodId)||"wfstart";return(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(r,t,e,a instanceof K?a.getOrigin():a)}async wfSubmit(t,e,a){var s;const i=this.model;let r="";return e.type?r=e.type:r=((s=i.wfsubmitControlAction)==null?void 0:s.appDEMethodId)||"wfsubmit",(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(r,t,e,a instanceof K?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];W(this.model,e=>{if(e.detailType==="FORMITEM"||e.detailType==="MDCTRL"){const a=e,s=a.id.toLowerCase(),i=a.fieldName||e.appDEFieldId;let r;i?r=new Y(s,i,{isOriginField:!0,dataType:a.dataType}):r=new Y(s,s,{isOriginField:t.includes(s)}),this.dataUIMap.set(s,r)}},{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach(a=>{t[a.dataKey]!==void 0&&(e[a.dataKey]=t[a.dataKey])}),e}}),rl=d("EditFormController",class extends li{get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new Gu(this.model),await this.service.init(this.context),this.autoSave=Ht(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t),s=await this.getDraftParams();Object.assign(a,s);let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),i=await this.service.getDraft(e,a)}catch(r){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:r}),r}finally{await this.endLoading()}return this.state.data=i.data,Wt(this.data,s),this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=I(this.context),e=I(this.params),s=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(s&&this.params[s]){const r=B(this.model.appDataEntityId);t[r]=this.params[s],delete e[s],delete this.params[s],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(r){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:r}),r}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=j(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Xa(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:s,params:i}=this.handlerAbilityParams(t),r=I(i);let n;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),n=await this.service.get(s,r)}catch(o){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:o}),o}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=n.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=t?.silent===!0;if(this.state.processing)return await jt(500,this.save.bind(this),[t]);if(!await this.validate())throw new f("\u8BF7\u68C0\u67E5\u8868\u5355\u586B\u5199\uFF01");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:s,data:i}=this.handlerAbilityParams(t),r=i[0],n=r.srfuf===0;let o;try{o=n?await this.service.create(s,r):await this.service.update(s,r)}catch(c){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:c}),c}finally{e||await this.endLoading()}const u=t?.noFillBack===!0;return o.data&&(u?(this.data.updatedate=o.data.updatedate,this.data.srfkey=o.data.srfkey):Gt(this.data,o.data),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","\u4FDD\u5B58\u6210\u529F")}),this.view.modal.mode==="ROUTE"&&ibiz.mc.command.send(this.data.$origin,n?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let s,i=!1;if(await this.evt.emit("onBeforeRemove",void 0),this.data.srfuf===1){if(i=await ibiz.modal.confirm({title:"\u63D0\u793A",desc:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F"}),!i)return!1;await this.startLoading();try{s=await this.service.remove(e,a)}catch(r){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:r}),r}finally{await this.endLoading()}i=s.ok}return this.state.data=new K,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),this.view.modal.mode==="ROUTE"&&ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),i}async goBack(){await this.startLoading();let t;try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&Gt(this.data,t.data),this.data}async updateFormItem(t){var e;const a=(e=this.model.deformItemUpdates)==null?void 0:e.find(c=>c.id===t);if(!a)throw new f("\u6CA1\u627E\u5230".concat(t,"\u8868\u5355\u9879\u66F4\u65B0"));const{appDEMethodId:s,defiupdateDetails:i,customCode:r,scriptCode:n,showBusyIndicator:o}=a,u=i?.map(c=>c.id);try{o&&this.startLoading();let c;if(r&&n)c=R.execScriptFn({...this.getEventArgs(),data:this.data},n,{isAsync:!1});else{const l={...this.params,...this.data.getOrigin()};c=(await this.service.updateFormItem(s,this.context,l)).data}c&&u?.length&&await Promise.all(u.map(l=>this.setDataValue(l,c[l]))),await jt(2e3)}finally{o&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new f("\u8BF7\u68C0\u67E5\u8868\u5355\u586B\u5199\uFF01");await this.startLoading();const{context:a,params:s}=this.handlerAbilityParams(t);try{await this.service.wfStart(a,s,this.data),this.view.modal.mode==="ROUTE"&&(ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED"))}catch(i){throw this.actionNotification("WFSTARTERROR",{error:i}),i}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"\u6D41\u7A0B\u542F\u52A8\u6210\u529F"})}async wfSubmit(t){if(!await this.validate())throw new f("\u8BF7\u68C0\u67E5\u8868\u5355\u586B\u5199\uFF01");await this.startLoading();const{context:a,params:s}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(a,s,this.data),this.view.modal.mode==="ROUTE"&&(ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED"))}catch(i){throw this.actionNotification("WFSUBMITERROR",{error:i}),i}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"\u6D41\u7A0B\u63D0\u4EA4\u6210\u529F"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(this.model.enableAutoSave)try{await this.save({silent:!0,noFillBack:!0})}catch(t){ibiz.log.error(t)}}setSimpleData(t){const e={...t};this.formItems.forEach(a=>{Object.prototype.hasOwnProperty.call(e,a.name)||(e[a.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)}}),na=d("GridColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1;var a;this.model=t,this.grid=e,this.isAdaptiveColumn=t.widthUnit==="STAR",this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(a=this.deGridDataItem)!=null&&a.customCode&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!!(this.grid.model.enableRowEdit&&this.model.enableRowEdit)}get deGridDataItem(){var t;return(t=this.grid.model.degridDataItems)==null?void 0:t.find(e=>e.id===this.model.id)}get valueFormat(){var t;return(t=this.deGridDataItem)==null?void 0:t.format}get dataType(){var t;return(t=this.deGridDataItem)==null?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if((e=this.deGridDataItem)!=null&&e.scriptCode)return R.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}}),hi=d("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach(a=>{this.errors[a]===void 0&&(this.errors[a]=null)}),Object.values(e.uaColumns).forEach(a=>{a.initActionStates(this)}),Object.values(e.editColumns).forEach(a=>{this.editColStates[a.fieldName]={disabled:!1,readonly:!1,editable:ibiz.config.grid.editShowMode==="all",required:!1}})}}),pi=d("GridService",class extends rt{initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.degridDataItems)==null||t.forEach(e=>{const a=e.id.toLowerCase(),s=e.appDEFieldId;let i;if(s){const r=s.toLowerCase();i=new Y(a,r,{isOriginField:!0,dataType:e.dataType})}else i=new Y(a,a);this.dataUIMap.set(a,i)})}async updateGridEditItem(t,e,a={}){let i=await(await this.app.deService.getService(this.model.appDataEntityId)).exec(t,e,a);return i=this.handleResponse(i),i}}),ju=d("GridController",class extends ${constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="\u5408\u8BA1"}get groupCodeListItems(){var t;return(t=this.groupFieldColumn)==null?void 0:t.codeListItems}get enableAgg(){return this.model.aggMode!=="NONE"}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=this.model.noSort===!0,this.state.size=this.model.pagingSize||20,this.state.singleSelect=this.model.singleSelect===!0,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await super.onCreated(),this.service=new pi(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=we(this.dataChangeNotify.bind(this),(t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))],200),await this.initGroup()}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:a}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find(r=>r.model.appDEFieldId===t),!this.groupFieldColumn)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u5206\u7EC4\u5C5E\u6027\u7684\u5C5E\u6027\u5217");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new m(this.groupFieldColumn.model,"\u5206\u7EC4\u5C5E\u6027\u7684\u5C5E\u6027\u5217".concat(s,"\u6CA1\u6709\u914D\u7F6E\u4EE3\u7801\u8868"));const i=this.state.columnStates.findIndex(r=>r.key===this.groupFieldColumn.model.codeName);if(i!==-1&&i!==0){if(this.isMultistageHeader)throw new m(this.model,"\u8BF7\u5C06\u5206\u7EC4\u5C5E\u6027\u5217".concat(s,"\u914D\u7F6E\u4E3A\u7B2C\u4E00\u5217"));const r=this.state.columnStates.splice(i,1);this.state.columnStates.unshift(...r)}if(a==="CODELIST"){if(!e)throw new m(this.model,"\u4EE3\u7801\u8868\u5206\u7EC4\u6A21\u5F0F\u9700\u8981\u914D\u7F6E\u4EE3\u7801\u8868");if(this.groupFieldColumn.model.appCodeListId!==e)throw new m(this.model,"\u5206\u7EC4\u4EE3\u7801\u8868\u4E0E\u5C5E\u6027\u5217".concat(s,"\u7684\u4EE3\u7801\u8868\u4E0D\u4E00\u81F4"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await it(Object.values(this.fieldColumns).map(async a=>{await a.loadCodeList()}),!1),this.state.rows=e.map(a=>{const s=new hi(a,this);return this.gridStateNotify(s,"LOAD"),s}),this.state.rows.forEach(a=>{Object.values(a.uaColStates).forEach(s=>{s.update(a.data.getOrigin(),this.model.appDataEntityId)})}),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const s=new Map,i=a==="CODELIST",r=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach(n=>{s.set(n.value,[])}),t.forEach(n=>{const o=n[r];!i&&!s.has(o)&&s.set(o,[]),s.has(o)&&s.get(o).push(n)}),this.state.groups=[],s.forEach((n,o)=>{const u=this.groupCodeListItems.find(c=>c.value===o);this.state.groups.push({caption:u?.text||"".concat(o),key:o,children:n})})}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:a}=this.model;if(t!=="ALL")return;if(!a||!e)throw new m(this.model,"\u7F3A\u5C11\u914D\u7F6E\u805A\u5408\u5B9E\u4F53\u6216\u805A\u5408\u6570\u636E\u96C6");const s=await this.getFetchParams(),r=await ibiz.hub.getApp(this.context.srfappid).deService.exec(e,a,this.context,void 0,s);r.data.length&&([this.state.remoteAggResult]=r.data)}calcAggResult(t){Object.values(this.fieldColumns).forEach(e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)})}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach(a=>{if(a.children.length){const s=a.children.findIndex(i=>i.srfkey===t.srfkey);s!==-1&&a.children.splice(s,1)}})}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a)){ibiz.log.error("\u4E0D\u652F\u6301\u65B0\u5EFA\u884C");return}if(a==="row"&&this.state.rows.find(c=>c.showRowEdit))throw new f("\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u884C\u7F16\u8F91\u4E2D\u7684\u884C\u7684\u64CD\u4F5C");const s={...this.params},i=this.calcDefaultValue({},!0);Object.assign(s,i);let r;try{r=await this.service.getDraft(this.context,s)}catch(u){throw this.actionNotification("GETDRAFTERROR",{error:u}),u}const n=r.data;Wt(n,i),this.state.items.unshift(n);const o=new hi(n,this);this.state.rows.unshift(o),this.gridStateNotify(o,"DRAFT"),a==="row"&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:n})}async save(t){if(this.state.isSimple)return;const e=t.srfuf===0,a=this.findRowState(t);if(!a)throw new f("\u884C\u6570\u636E\u4E0D\u5B58\u5728");if(!a.modified){ibiz.log.debug("\u503C\u6CA1\u6709\u53D1\u751F\u6539\u53D8");return}if(a.processing){await jt(500,this.save.bind(this),[t]);return}if(!await this.validate(a))throw new f("\u884C\u6570\u636E\u6821\u9A8C\u4E0D\u901A\u8FC7\uFF0C\u4FDD\u5B58\u53D6\u6D88");let i;const r=B(this.model.appDataEntityId),n=this.context.clone();n[r]=t.srfkey;try{i=e?await this.service.create(n,t):await this.service.update(n,t)}catch(u){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:u,data:a.data}),u}const o=this.findRowStateIndex(t);this.state.items.splice(o,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter(e=>e.modified).map(e=>e.data);t.length&&await it(t.map(e=>this.save(e)))}async initColumnsController(t){var e;const a=await Ge(t);if(!a)return;this.providers[t.codeName]=a;const s=await a.createController(t,this);this.columns[t.codeName]=s,t.columnType==="DEFGRIDCOLUMN"||t.columnType==="DEFTREEGRIDCOLUMN"?(this.fieldColumns[t.codeName]=s,t.enableRowEdit&&(this.editColumns[t.codeName]=s)):t.columnType==="UAGRIDCOLUMN"?this.uaColumns[t.codeName]=s:t.columnType==="GROUPGRIDCOLUMN"&&(this.isMultistageHeader=!0,await Promise.all(((e=t.degridColumns)==null?void 0:e.map(async i=>{await this.initColumnsController(i)}))||[]))}initColumnStates(){W(this.model,t=>{t.columnType!=="GROUPGRIDCOLUMN"&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:t.columnType==="UAGRIDCOLUMN"})},{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter(i=>!i.hidden),e=t.length,{frozenFirstColumn:a,frozenLastColumn:s}=this.model;t.forEach((i,r)=>{i.uaColumn?i.fixed=r+1<=Math.floor(e/2)?"left":"right":a&&r<a?i.fixed="left":s&&r>=e-s&&(i.fixed="right")})}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map(async t=>this.initColumnsController(t)))}async setRowValue(t,e,a){if(!(Object.prototype.hasOwnProperty.call(t.data,e)&&!$e(t.data[e],a))){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this.evt.emit("onGridDataChange",{data:this.state.rows.map(s=>s.data)})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await it(Object.values(this.editColumns).map(async a=>a.dataChangeNotify(t,e)))}gridStateNotify(t,e){Object.values(this.editColumns).forEach(a=>{a.gridStateNotify(t,e)})}async validate(t){return(await Promise.all(Object.values(this.editColumns).map(a=>a.validate(t)))).findIndex(a=>!a)===-1}async toggleRowEdit(){if(!this.model.enableRowNew)throw new f("\u5F53\u524D\u8868\u683C\u4E0D\u652F\u6301\u884C\u7F16\u8F91\uFF0C\u65E0\u6CD5\u5207\u6362\u5F00\u542F\u884C\u7F16\u8F91");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const s=e===void 0?!t.showRowEdit:e;if(t.showRowEdit!==s){if(s===!1)if(a)await this.save(t.data);else{if(t.data.srfuf===0)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(r=>r.showRowEdit))throw new f("\u540C\u65F6\u53EA\u80FD\u6709\u4E00\u884C\u5F00\u542F\u884C\u7F16\u8F91");if(t.data.srfuf===1){t.cacheData=I(t.data);const r=this.calcDefaultValue(t.data,!1);Object.assign(t.data,r)}}t.showRowEdit=s,Object.values(this.editColumns).forEach(i=>{t.editColStates[i.fieldName].editable=s}),this.evt.emit("onRowEditChange",{row:t})}}setSort(t,e){if(t&&e){const a=this.fieldIdNameMap.get(t).toLowerCase();super.setSort(a,e)}else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;if(a&&s){const i=this.fieldIdNameMap.get(a);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(s.toLowerCase())}else this.state.sortQuery=""}}async updateGridEditItem(t,e){var a;const s=(a=this.model.degridEditItemUpdates)==null?void 0:a.find(l=>l.id===e);if(!s)throw new f("\u6CA1\u627E\u5230".concat(e,"\u7F16\u8F91\u5217\u66F4\u65B0"));const{appDEMethodId:i,degeiupdateDetails:r,customCode:n,scriptCode:o}=s,u=r.map(l=>l.id);let c;if(n&&o)c=R.execScriptFn({...this.getEventArgs(),data:t.data},o,{isAsync:!1});else{const l={...this.params,...t.data.getOrigin()};c=(await this.service.updateGridEditItem(i,this.context,l)).data}c&&u?.length&&await Promise.all(u.map(l=>this.setRowValue(t,l,c[l])))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(t?.viewParam);let s;await this.startLoading();try{s=await this.service.fetch(e,a)}finally{await this.endLoading()}return s.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),s=(e=t.dedataExportItems)==null?void 0:e.map(async i=>{const r={...i};return i.codeListId&&(r.codeList=a.codeList.getCodeList(i.codeListId),r.codeListItems=await a.codeList.get(i.codeListId)),r});if(s)return Promise.all(s)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=(e=this.dataEntity.appDEDataExports)==null?void 0:e.find(u=>u.id===this.model.dedataExportId),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=u=>{var c;const l=new Map;this.allExportColumns&&this.allExportColumns.length>0?(c=this.allExportColumns)==null||c.forEach(p=>{p.codeListItems&&l.set(p.appDEFieldId,p.codeListItems)}):Object.keys(this.fieldColumns).forEach(p=>{this.fieldColumns[p].codeList&&l.set(p,this.fieldColumns[p].codeListItems)});const h=I(u.map(p=>p.getOrigin()));return h.forEach(p=>{Object.keys(p).forEach(w=>{var y;l.get(w)&&(p[w]=((y=l.get(w).find(v=>v.value===p[w]))==null?void 0:y.text)||p[w])})}),h},s=async()=>{var u;const c=(u=t.params)==null?void 0:u.type;let l=[];if(c==="activatedPage"&&(l=this.state.rows.map(h=>h.data)),c==="maxRowCount"||c==="customPage"){const{size:h}=this.state,{startPage:p,endPage:E}=t.params,w=c==="customPage"?{page:0,offset:(p-1)*h,size:(E-p+1)*h}:{size:1e3,page:0};l=await this.loadData({viewParam:w})}if(c==="selectedRows"&&(l=this.getData()),l.length===0)throw new f("\u65E0\u5BFC\u51FA\u6570\u636E");return a(l)},i=(u,c)=>c.map(l=>u.map(h=>l[h]));let r=[],n=[];this.allExportColumns&&this.allExportColumns.length>0?(r=this.allExportColumns.map(u=>u.appDEFieldId),n=this.allExportColumns.map(u=>u.caption)):(r=Object.keys(this.fieldColumns).map(u=>this.fieldColumns[u].model.id),n=Object.keys(this.fieldColumns).map(u=>this.fieldColumns[u].model.caption));const o=i(r,await s());await si(n,o,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach(s=>{const{createDV:i,createDVT:r,updateDV:n,updateDVT:o}=s.editItem,u=e?r:o,c=e?i:n,l=ta({name:s.fieldName,valueType:u,defaultValue:c,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});l!==void 0&&(a[s.fieldName]=l)}),a}findRowStateIndex(t){const a=t.srfuf===0?"tempsrfkey":"srfkey";return this.state.rows.findIndex(s=>s.data[a]===t[a])}findRowState(t){const e=this.findRowStateIndex(t);return e!==-1?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),this.state.mdctrlActiveMode===1&&await this.setActive(t)}}),Ku=d("GridFieldColumnController",class extends na{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}async onInit(){await super.onInit(),this.loadCodeList=Ht(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}clickable(t){const e=t.data[this.model.codeName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:s}=this.model;if(!s)return{context:e,params:a};const{navigateContexts:i,navigateParams:r}=Te(s);let n={};i&&t&&(n=F(i,t,a,e));const o=Object.assign(e.clone(),n);let u={};r&&t&&(u=F(r,t,a,e));const c={...a,...u};return{context:o,params:c}}async openLinkView(t,e){if(!t.data[this.model.codeName])return;const s=this.model.linkValueItem||"srfkey",i=t.data[s];if(i==null)throw new D(this.model,"\u672A\u5728\u884C\u6570\u636E\u4E2D\u53D6\u5230 ".concat(s," \u7684\u503C"));const{linkAppViewId:r}=this.model;if(!r)return;const n=ns(t.data),o=Object.assign(this.context.clone(),{srfkey:i,...n}),u=I(this.params),{context:c,params:l}=this.handlePublicParams(t.data,o,u),h=await ibiz.commands.execute(et.TAG,r,c,l,{event:e});h?.ok&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await U.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:i}=this.model;if(a==="NONE")return;const r=e||this.model.id;t=t.filter(u=>!C(u[r]));let n;if(this.grid.model.aggMode==="PAGE")switch(a){case"SUM":n=t.map(u=>u[r]).reduce((u,c)=>Kt(u,c),0);break;case"AVG":n=t.map(u=>u[r]).reduce((u,c)=>Kt(u,c),0)/t.length;break;case"MAX":n=Math.max(...t.map(u=>u[r]));break;case"MIN":n=Math.min(...t.map(u=>u[r]));break;default:throw new D(this.model,"\u6682\u672A\u652F\u6301\u5C5E\u6027\u5217\u805A\u5408\u6A21\u5F0F".concat(a))}else throw this.grid.model.aggMode==="ALL"?new D(this.model,"\u8FDC\u7A0B\u805A\u5408\u6682\u672A\u652F\u6301"):new D(this.grid.model,"\u6682\u672A\u652F\u6301\u805A\u5408\u6A21\u5F0F".concat(this.grid.model.aggMode));let o="".concat(n);if(s)try{o=ibiz.util.text.format("".concat(n),s)}catch{ibiz.log.error("".concat(n," \u503C\u683C\u5F0F\u5316\u9519\u8BEF"))}return o&&i&&(o+=i),o}formatValue(t=""){if(this.model.valueType!=="SIMPLE")return To.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(kt.isDate(this.dataType)){const s=S(e).format(this.valueFormat);return s!=="Invalid Date"?s:e}return ibiz.util.text.format(e,this.valueFormat)}}),nl=d("GridUAColumnController",class extends na{initActionStates(t){var e;const{deuiactionGroup:a}=this.model;if(!a)throw new m(this.model,"\u64CD\u4F5C\u5217\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A\u7EC4");if(!((e=a.uiactionGroupDetails)!=null&&e.length)){ibiz.log.debug("\u64CD\u4F5C\u5217\u754C\u9762\u884C\u4E3A\u7EC4\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A");return}const s=new gt;a.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new Et(i.id,this.grid.context.srfappid,r);s.addState(i.id,n)}}),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const s=t.uiactionId;await U.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),ol=d("GridFieldEditColumnController",class extends Ku{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}get fieldName(){return this.model.dataItemName}async onInit(){await super.onInit();const t=qa(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&this.editItem.editor.editorType!=="HIDDEN"&&(this.editorProvider=await ie(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=Ve(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Je(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...Ze(this.editItem.editor)),this.rules.length>0&&(this.validator=new Ne({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let s=!1;a&&a.length>0&&a.forEach(n=>{e.includes(n)&&(s=!0)}),s&&this.setRowValue(t,null),this.calcColumnDisabled(t);const i=t.editColStates[this.fieldName].required;if(this.calcColumnRequired(t),(i!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName))&&!await this.validate(t))throw new f("".concat(this.editItem.codeName,"\u6821\u9A8C\u62A5\u9519,").concat(t.errors[this.fieldName]));e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});a!==void 0&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=this.editItem.allowEmpty!==!1;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});a!==void 0&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!((e=this.editItem.editor)!=null&&e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=t.data.srfuf===0;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if(ibiz.config.grid.editShowMode!=="cell"&&t.editColStates[e].required&&k(t.data[e]))return t.errors[e]="\u8BF7\u586B\u5199".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:s}=a;return t.errors[e]=s[0].message,!1}return t.errors[e]=null,!0}}),ul=d("GridGroupColumnController",class extends na{}),Hu=d("ListService",class extends rt{initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.delistDataItems)==null||t.forEach(e=>{const a=e.id.toLowerCase(),s=e.appDEFieldId;let i;if(s){const r=s.toLowerCase();i=new Y(a,r,{isOriginField:!0,dataType:e.dataType})}else i=new Y(a,a);this.dataUIMap.set(a,i)})}}),cl=d("ListController",class extends ${initState(){super.initState(),this.state.noSort=this.model.noSort===!0}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new Hu(this.model),await this.service.init(this.context)}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;if(a&&s){const i=this.fieldIdNameMap.get(a);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(s.toLowerCase())}else this.state.sortQuery=""}}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}setSelection(t){var e,a;super.setSelection(t);const s=t?.[0];(e=this.batchToolbarController)==null||e.calcButtonState(s,this.model.appDataEntityId),(a=this.quickToolbarController)==null||a.calcButtonState(s,this.model.appDataEntityId)}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&(e==="AUTO"?this.handleAutoGroup():e==="CODELIST"&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach(i=>{const r=a.get(i[t])||[];r.push(i),a.set(i[t],r)});const s=[];a.forEach((i,r)=>{s.push({caption:r,key:r,children:[...i]})}),this.state.groups=s}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,s=[],r=await ibiz.hub.getApp(this.context.srfappid).codeList.get(e,this.context,this.params),n=[];r.forEach(u=>{const c=a.filter(l=>l[t]===u.value);s.push({caption:u.text,key:u.value,children:[...c]}),n.push(u.value)});const o=a.filter(u=>n.indexOf(u[t])===-1);o.length>0&&s.push({caption:"\u5176\u4ED6",key:"\u5176\u4ED6",children:[...o]}),this.state.groups=s}}}),Xu=d("PanelController",class extends H{constructor(t,e,a,s,i){super(t,e,a,s),this.panelItems={},this.providers={},this.container=i}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(),(t=this.scheduler)!=null&&t.hasControlEventTrigger&&this._evt.on("onPanelItemEvent",e=>{this.scheduler.triggerControlEvent(e.panelItemName,e.panelItemEventName,e)})}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),(e=(t=this.data).destroy)==null||e.call(t),Object.values(this.panelItems).forEach(a=>{a.destroy()})}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map(async s=>{var i,r;const n=await Cs(s);if(!n)return;e.providers[s.id]=n;const o=await n.createController(s,e,a);e.panelItems[s.id]=o,(i=s.panelItems)!=null&&i.length&&!o.isDataContainer&&await this.initPanelItemControllers(s.panelItems,e,o),(r=s.panelTabPages)!=null&&r.length&&await this.initPanelItemControllers(s.panelTabPages,e,o)}))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new f("\u672A\u83B7\u53D6\u5230\u9762\u677F\u6570\u636E");const s=this.convertData(a);(e=(t=this.data).destroy)==null||e.call(t),this.state.data=s,this.panelStateNotify("LOAD")}async prepareData(){let t;switch(this.model.dataMode){case 1:this.inputData&&(t=this.inputData);break;default:t=this.inputData||{}}return t}convertData(t){const e=ss(this.model),a=e.map(i=>i.id),s=new co(e,t);return s._evt.on("change",i=>{a.includes(i)&&this.dataChangeNotify([i])}),s}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];W(this.model,a=>{a.controlLogics&&e.push(...a.controlLogics)},{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}}),ll=d("ViewLayoutPanelController",class extends Xu{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(t=this.scheduler)!=null&&t.hasControlEventTrigger&&this.evt.on("onControlEvent",e=>{this.scheduler.triggerControlEvent(e.triggerControlName,e.triggerEventName,e.triggerEvent)})}registerToCtx(){}preprocessModel(t){var e;const a=s=>{const i=[];return s.forEach(r=>{r.itemType==="CONTAINER"&&r.predefinedType==="PANELPART"?i.push(...r.panelItems||[]):i.push(r)}),i.forEach(r=>{r.itemType==="CONTAINER"&&this.preprocessModel(r)}),i};t?t.panelItems=a(t.panelItems||[]):(e=this.model.rootPanelItems)!=null&&e.length&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),Yu=d("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var s;return((s=this.parent)==null?void 0:s.visible)!==!1&&e},set(s){return e=s,!0}});let a;Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return a!==void 0?a:this.parent?this.parent.keepAlive:!1},set(s){return a=s,!0}})}}),dl=d("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:s,height:i}=qt(t);this.state.layout.width="".concat(s),this.state.layout.height="".concat(i)}e?.cssName&&this.state.class.container.push(e.cssName),a?.cssName&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new Yu((t=this.parent)==null?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(e!==!0&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(e!==!1&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});a!==void 0&&(e=a)}e!==void 0&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(e!==!0&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||(a=this.model.panelItemGroupLogics)==null||a.forEach(s=>{const i=s.relatedItemNames||[];if(e||Ut(i,t))try{const r=ee(this.data,s);switch(s.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!r;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!r;break;case"PANELVISIBLE":this.dynaLogicResult.visible=r;break;default:}}catch(r){ibiz.log.error(r)}})}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=It(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=It(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),hl=d("PickupViewPanelController",class extends H{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),s={...this.params};t&&Object.assign(a,F(t,this.params,this.context)),e&&Object.assign(s,F(e,this.params,this.context)),this.state.context=a,this.state.params=s}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",e=>{this.evt.emit("onSelectionChange",e)}),this.embedView.evt.on("onDataActive",e=>{this.evt.emit("onDataActive",{data:e.data})})}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),qu=class{constructor(t,e){this.model=t,this.searchBar=e;var a;let s;t.appDEFieldId&&(s=At(e.appDataEntity,t.appDEFieldId)),this.fieldName=s?s.codeName.toLowerCase():t.id,this.label=t.caption||s?.logicName||t.id,this.valueOP=(a=t.defsearchMode)==null?void 0:a.valueOP}get context(){return this.searchBar.context}get params(){return this.searchBar.params}async init(){if(!this.model.editor)throw new m(this.model,"\u7F3A\u5C11\u7F16\u8F91\u5668\u6A21\u578B");this.editorProvider=await ie(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}},pl=d("SearchBarController",class extends H{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[]}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.model.enableFilter),this.model.enableFilter&&this.resetFilter()}async onCreated(){await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),await this.initSearchBarFilters()}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter(e=>e.enableQuickSearch);if(t.length){const e=[];t.forEach(a=>{a.lnlanguageRes&&a.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(a.lnlanguageRes.lanResTag,a.logicName)):a.logicName&&e.push(a.logicName)}),e.length>0&&(this.placeHolder=e.join("\u3001"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(t=this.state.selectedGroupItem)!=null&&t.data){const s=R.execSingleLine(this.state.selectedGroupItem.data),i=F(s,this.params,this.context);Object.assign(e,i)}const a=this.calcFilters();return a&&(e.filters=a),e}resetFilter(){this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}async initSearchBarFilters(){var t;(t=this.model.searchBarFilters)!=null&&t.length&&(this.model.searchBarFilters.forEach(e=>{const a=new qu(e,this);this.filterControllers.push(a)}),await Promise.all(this.filterControllers.map(e=>e.init())))}calcFilters(){if(!this.model.enableFilter)return;let t=!1,e=!1;if(W(this.state.filterNodes[0],a=>{a.leaf&&(a.field&&a.valueOP&&!C(a.value)?t=!0:e=!0)}),t&&!e)return this.formatFilters(this.state.filterNodes[0])}formatFilters(t){return t.leaf?{["".concat(t.field)]:{["$".concat(t.valueOP.toLowerCase())]:t.value}}:{["$".concat(t.logicType.toLowerCase())]:t.children.map(e=>this.formatFilters(e))}}}),fl=d("TabExpPanelController",class extends H{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return this.controlParams.expcache==="CACHE"?!0:this.controlParams.expcache==="NO_CACHE"?!1:ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach(a=>{e.push({caption:a.caption,tabTag:a.id,class:a.sysCss?[a.sysCss.cssName]:[],sysImage:a.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;break}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find(e=>e.tabTag===this.state.defaultTabName);if(t){this.state.activeName=t.tabTag,this.changeToTab(this.activeTabViewPanelModel,this.routeDepth!==void 0&&Qe(this.routeDepth));return}}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);e===!0&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find(a=>a.id===t)}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:s,navigateParams:i,appDataEntityId:r}=t,n={deName:B(r),navFilter:a,pickupDEFName:e?.pickupDEFName,navContexts:s,navParams:i},o={context:this.context,params:this.params,data:{}},{resultContext:u,resultParams:c}=Yt(n,o),l=Object.assign(this.context.clone(),u,{currentSrfNav:this.state.activeName}),h={...c};return{context:l,params:h}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}}),oa=d("TreeService",class extends rt{async fetchChildNodes(t,e){const{hasQuery:a}=e;let s=[];if(t){const i=Nt(this.model,{parentId:t?.nodeId,hasQuery:a});if(i.length===0)return;(await it(i.map(async n=>{const o=Jt(this.model,n.childDETreeNodeId);return this.fetchNodeDatasByType(o,n,t,e)}),!1)).forEach(n=>{s.push(...n)})}else{const i=$t(this.model);s=await this.fetchNodeDatasByType(i,void 0,void 0,e)}return s}async fetchNodeDatasByType(t,e,a,s){const i=Nt(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length===0,r={...s,leaf:i};let n=[];switch(t.treeNodeType){case"STATIC":n=[await this.getStaticNodeData(t,e,a,r)];break;case"DE":n=await this.getDENodeDatas(t,e,a,r);break;case"CODELIST":n=await this.getCodeListNodeDatas(t,e,a,r);break;default:throw new D(t,"".concat(t.treeNodeType,"\u8282\u70B9\u7C7B\u578B\u672A\u652F\u6301"))}const{expandFirstOnly:o,expanded:u,rootNode:c}=t,l=c&&!this.model.rootVisible;return i||await Promise.all(n.map(async(h,p)=>{var E;if(u&&(!o||o&&p===0)||(E=s.defaultExpandedKeys)!=null&&E.length&&s.defaultExpandedKeys.includes(h.id)||l){const w=await this.fetchChildNodes(h,s);h.children=w}})),n}async getStaticNodeData(t,e,a,s){return new $s(t,a,{parentValueLevel:e?.parentValueLevel,leaf:!!s.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:s,navigateContexts:i,navigateParams:r,parentFilter:n,parentDER1N:o}=t,u=o?.pickupDEFName,c={...a.params},l={...a.context,...e?.context||{}};let h={},p;if(e){p=e;for(let P=1;P<s;P++)p=p?.parent}let E,w;if(p){h=p.deData||{};const P=Jt(this.model,p.nodeId);P.appDataEntityId&&(w=B(P.appDataEntityId)),E=p.value}const{resultContext:y,resultParams:v}=Yt({deName:w,navFilter:n?"n_".concat(n.toLowerCase(),"_eq"):void 0,pickupDEFName:u,navParams:r,navContexts:i},{derValue:E,context:l,params:c,data:h});return Object.assign(l,y),Object.assign(c,v),{context:l,params:c,navContext:y,navParams:v}}async getDENodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:r}=t,{context:n,params:o,navContext:u,navParams:c}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}};o.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(o,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(r,i,n,o);return l.data.length?l.data.map(p=>new Ye(t,a,{data:p,leaf:!!s.leaf,navContext:u,navParams:c})):[]}async getCodeListNodeDatas(t,e,a,s){const{context:i,params:r,navContext:n,navParams:o}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}},u=await this.app.codeList.get(t.codeListId,i,r);return u.length?u.map(l=>new Qs(t,a,{data:l,leaf:!!s.leaf,navContext:n,navParams:o})):[]}}),ml=d("TreeController",class extends ${constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1}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],(t=this.model.detreeNodes)!=null&&t[0].enableQuickSearch&&(this.enableQuickSearch=!0),this.dataEntity){const a=(e=this.dataEntity.appDEFields)==null?void 0:e.filter(i=>i.enableQuickSearch),s=[];a?.forEach(i=>{i?.lnlanguageRes&&i.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(i.lnlanguageRes.lanResTag,i.logicName)):i?.logicName&&s.push(i.logicName)}),s.length>0&&(this.state.placeHolder=s.join("\u3001"))}this.service=new oa(this.model),await this.service.init(this.context),this.model.detreeNodes.forEach(a=>{var s,i;(i=(s=a.decontextMenu)==null?void 0:s.detoolbarItems)!=null&&i.length&&(this.contextMenus[a.decontextMenu.id]=new ui(a.decontextMenu,this.context,this.params,this.ctx))}),await Promise.all(Object.values(this.contextMenus).map(a=>a.created()))}async load(t={}){const e=t.isInitialLoad===!0;e&&await this.startLoading();let a;try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;this.state.isLoading=!0;let s;try{s=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t.children=s:this.state.rootNodes=s,this.state.items=[],W({children:this.state.rootNodes},i=>{this.state.items.push(i)}),this.state.expandedKeys=this.calcExpandedKeys(s),s}async onTreeNodeClick(t){if(this.state.navigational){const e=this.getNodeModel(t.nodeId);if(!e?.navAppViewId)return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter(s=>s.id!==t.id);a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}this.state.mdctrlActiveMode===1&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t.id);if(e&&!a)this.state.expandedKeys.push(t.id);else if(!e&&a){const s=this.state.expandedKeys.indexOf(t.id);s!==-1&&this.state.expandedKeys.splice(s,1)}}async onDbTreeNodeClick(t){this.state.mdctrlActiveMode===2&&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(s=>s.id),a=this.state.items.filter(s=>e.includes(s.id));super.setSelection(a)}getNodeModel(t){var e;return(e=this.model.detreeNodes)==null?void 0:e.find(a=>a.id===t)}async doUIAction(t,e,a,s){const i=this.getEventArgs(),r=this.parseTreeNodeData(e),n=await U.exec(t,{...i,...r,event:a},s);if(n.closeView)this.view.closeView();else if(n.refresh)switch(n.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh();break}}parseTreeNodeData(t){return{data:[{...t,...t.deData||{}}],context:Object.assign(this.context.clone(),t.context||{}),params:{...this.params,...t.params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return W({children:t},a=>{var s;(s=a.children)!=null&&s.length&&e.push(a.id)}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"id",s=this.state.items.find(n=>n[a]===t[a]);if(!s){ibiz.log.error("\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u6811\u8282\u70B9\u6570\u636E",t);return}if(e){const{parent:n}=s;if(!n||!this.model.rootVisible&&this.state.rootNodes.includes(n)){this.refresh();return}}const i=e?s.parent:s,r=await this.loadNodes(i);this.evt.emit("onAfterRefreshParent",{parentNode:i,children:r})}async expandNodeByKey(t){const e=t.filter(s=>!this.state.expandedKeys.includes(s));if(e.length===0)return;const a=this.state.items.filter(s=>e.includes(s.id));this.state.expandedKeys.push(...e),a.length!==0&&await Promise.all(a.map(s=>this.loadNodes(s)))}}),Qu=d("WizardPanelService",class extends Ot{async initialize(t,e={},a={}){var s;const i=(s=this.model.initControlAction)==null?void 0:s.appDEMethodId;let r=await this.exec(i,t,e,a);return r=this.handleResponse(r),r}async finish(t,e={},a={}){var s;const i=(s=this.model.finishControlAction)==null?void 0:s.appDEMethodId;let r=await this.exec(i,t,e,a);return r=this.handleResponse(r),r}}),El=d("WizardPanelController",class extends H{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach(s=>{var i,r,n;s.firstForm&&(this.firstForm=s);const o="".concat(this.model.name,"_form_").concat((i=s.formTag)==null?void 0:i.toLowerCase()),u=(n=(r=this.model.dewizard)==null?void 0:r.dewizardSteps)==null?void 0:n.find(l=>l.id===s.dewizardStepId),c=u?.stepTag;this.stepTags[o]=c}),(e=(t=this.model.dewizard)==null?void 0:t.dewizardSteps)==null||e.forEach(s=>{this.steps.push(s.stepTag)}),this.service=new Qu(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map(async s=>{const{formTag:i}=s.dewizardForm;if(i){const r=await ft(s);r&&(this.providers[i]=r)}}))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find(a=>a.formTag===t);return e||ibiz.log.debug("\u627E\u4E0D\u5230".concat(t,"\u7684\u5411\u5BFC\u8868\u5355")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new f("\u627E\u4E0D\u5230".concat(t,"\u7684\u8868\u5355\u63A7\u5236\u5668"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const s=await a.load();Object.assign(this.formData,s)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=B(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!((e=this.model.dewizard)!=null&&e.dewizardForms))throw new f("\u6CA1\u6709\u914D\u7F6E\u5411\u5BFC\u8868\u5355\u96C6\u5408");const a=this.model.dewizard.dewizardForms.find(s=>s.formTag===t);if(!a)throw new f("\u627E\u4E0D\u5230\u6807\u8BC6\u4E3A".concat(t,"\u7684\u5411\u5BFC\u8868\u5355"));return a}async initialize(){var t;if((t=this.model.initControlAction)==null?void 0:t.appDEMethodId){const a=await this.service.initialize(this.context,{},this.params),s=B(this.model.appDataEntityId);if(a.data&&a.data.srfkey&&(this.formData=a.data,this.context[s]=a.data.srfkey),a.data&&this.model.stateAppDEFieldId&&a.data[this.model.stateAppDEFieldId]){const i=this.getWizardFormByTag(a.data[this.model.stateAppDEFieldId]);i&&(this.state.activeFormTag=i.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t;this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack());let e;if(this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]?this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId]):(this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1]),!e)throw new f("\u6CA1\u6709\u4E0A\u4E00\u4E2A\u8868\u5355");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform)this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e));else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId])this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId]);else{const a=this.model.dewizard.dewizardSteps,s=this.model.dewizard.dewizardForms;if(a&&s){const i=a.findIndex(o=>o.id===this.activeWizardForm.dewizardStepId),r=a[i+1];if(!r)throw new f("\u627E\u4E0D\u5230\u4E0B\u4E00\u4E2A\u5411\u5BFC\u6B65\u9AA4");const n=this.getWizardFormByTag(r.stepTag);n&&n.formTag&&(e=n.formTag)}}if(!e)throw new f("\u627E\u4E0D\u5230\u4E0B\u4E00\u4E2A\u5411\u5BFC\u8868\u5355");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),$u=d("MDCtrlService",class extends rt{initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.delistDataItems)==null||t.forEach(e=>{const a=e.id.toLowerCase(),s=e.appDEFieldId;let i;if(s){const r=s.toLowerCase();i=new Y(a,r,{isOriginField:!0,dataType:e.dataType})}else i=new Y(a,a);this.dataUIMap.set(a,i)})}}),pe=d("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),gl=d("MDCtrlController",class extends ${initState(){super.initState(),this.state.rows=[],this.state.noSort=this.model.noSort===!0,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new $u(this.model),await this.service.init(this.context),this.setSort()}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;a&&s?this.state.sortQuery="".concat(a.toLowerCase(),",").concat(s.toLowerCase()):this.state.sortQuery=""}}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map(a=>{const s=new pe(a,this);return this.initActionStates(s),s})),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map(a=>new pe(a,this));this.state.rows=e}getAllData(){return this.state.rows.map(t=>t.data)}async onActionClick(t,e,a){const s=t.uiactionId;await U.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(a=e.uiactionGroupDetails)!=null&&a.length||ibiz.log.debug("\u64CD\u4F5C\u5217\u754C\u9762\u884C\u4E3A\u7EC4\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A");const s=new gt;(e.uiactionGroupDetails||[]).forEach(r=>{const n=r.uiactionId;if(n){const o=new Et(r.id,this.context.srfappid,n);s.addState(r.id,o)}}),s.update(t.data.getOrigin()),t.uaColStates[e.id]=s}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new m(this.model,"\u5206\u7EC4\u5C5E\u6027\u6CA1\u6709\u914D\u7F6E");e==="AUTO"?this.handleAutoGroup():e==="CODELIST"&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach(i=>{const r=i[t];C(r)||(a.has(r)||a.set(r,[]),a.get(r).push(new pe(i,this)))});const s=[];a.forEach((i,r)=>{s.push({caption:r,key:r,children:[...i]})}),this.state.groups=s}}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 m(this.model,"\u5206\u7EC4\u4EE3\u7801\u8868\u6CA1\u6709\u914D\u7F6E");const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach(r=>{s.set(r.value,[])}),a.forEach(r=>{const n=r[t],o=s.get(n);o&&o.push(new pe(r,this))});const i=[];s.forEach((r,n)=>{const o=this.groupCodeListItems.find(u=>u.value===n);i.push({caption:o.text,key:o.value,children:r})}),this.state.groups=i}}),Ju=d("KanbanService",class extends ci{async updateGroup(t,e){var a;const s=((a=this.model.updateGroupControlAction)==null?void 0:a.appDEMethodId)||"update";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}}),wl=d("KanbanController",class extends Lu{get enableEditOrder(){return this.model.enableCardEditOrder===!0}get enableEditGroup(){return this.model.enableCardEditGroup===!0}async initControlService(){this.service=new Ju(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:a}=this.model;if(!e)throw new m(this.model,"\u6392\u5E8F\u5C5E\u6027\u6CA1\u914D\u7F6E");if(!a)throw new m(this.model,"\u6392\u5E8F\u65B9\u5411\u6CA1\u914D\u7F6E");const s=a==="ASC";t.forEach(i=>{const r=i[e];if(C(r))i[e]=0;else{const n=Number(r);if(Number.isNaN(n))throw new f("".concat(i.srfmajortext,"\u7684\u6392\u5E8F\u5C5E\u6027\u65E0\u6CD5\u8F6C\u6362\u6210\u6570\u503C"))}}),t.sort((i,r)=>s?i[e]-r[e]:r[e]-i[e])}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}handleDataGroup(){if(!this.model.enableGroup||this.model.groupMode==="NONE")throw new f("\u770B\u677F\u90E8\u4EF6\u5FC5\u987B\u5F00\u542F\u5206\u7EC4");return super.handleDataGroup()}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to){ibiz.message.warning("\u5F53\u524D\u770B\u677F\u4E0D\u5141\u8BB8\u8C03\u6574\u5206\u7EC4\uFF01");return}const e=this.model.minorSortDir==="ASC",{from:a,to:s,fromIndex:i,toIndex:r}=t,n=this.model.groupAppDEFieldId,o=this.model.minorSortAppDEFieldId,u=[],c=this.state.groups.find(A=>A.key===a),l=this.state.groups.find(A=>A.key===s);if(!this.enableEditOrder){if(t.from===t.to){ibiz.message.warning("\u5F53\u524D\u770B\u677F\u4E0D\u5141\u8BB8\u8C03\u6574\u6B21\u5E8F");return}const A=c.children[i];return A[n]=t.to,this.updateChangedItems([A])}const h=A=>A+(100-A%100),p=[...l.children],E=[...l.children],w=c.children[i];t.from!==t.to?(w[n]=t.to,E.splice(r,0,w)):(E.splice(i,1),E.splice(r,0,w));const y=c.children.splice(i,1);l.children.splice(r,0,...y),e||(p.reverse(),E.reverse());let v,P=[],b;E.forEach((A,L)=>{v===void 0?A!==p[L]&&(p[L]?v=p[L][o]||100:v=L===0?100:h(p[L-1][o]),A[o]=v,u.push(A)):(v>=A[o]?(P.length>0&&(P.forEach(G=>{G[o]=h(b),u.push(G),b=G[o]}),v=b,b=0,P=[]),A[o]=h(v),u.push(A)):(P.length===0&&(b=v),P.push(A)),v=A[o])}),this.updateChangedItems(u)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map(async e=>{const a=B(this.model.appDataEntityId),s=this.context.clone();s[a]=e.srfkey;const i=await this.service.updateGroup(s,e);if(i.data){const r=this.state.items.findIndex(n=>n.srfkey===e.srfkey);this.state.items.splice(r,1,i.data)}}))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}}),Zu=d("TreeGridExService",class extends oa{constructor(){super(...arguments),this.multipleUiMap=new Map}initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.detreeNodes)==null||t.forEach(e=>{var a;const s=new Map;(a=e.detreeNodeDataItems)==null||a.forEach(i=>{const r=i.id.toLowerCase(),o=i.appDEFieldId.toLowerCase(),u=new Y(r,o,{isOriginField:!0,dataType:i.dataType});s.set(r,u)}),this.multipleUiMap.set(e.id,s)})}async getDENodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:r}=t,{context:n,params:o,navContext:u,navParams:c}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}};o.size=t.maxSize||1e3,t.sortAppDEFieldId&&t.sortDir&&Object.assign(o,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir.toLowerCase())});const l=await this.app.deService.exec(r,i,n,o);if(l.data.length){const{data:h}=this.handleResponseForMultiple(l,t.id);return h.map(E=>new Ye(t,a,{data:E,leaf:!!s.leaf,navContext:u,navParams:c}))}return[]}handleResponseForMultiple(t,e){const a=super.handleResponse(t);return a.headers&&(a.headers["x-page"]&&(a.page=Number(a.headers["x-page"])),a.headers["x-per-page"]&&(a.size=Number(a.headers["x-per-page"])),a.headers["x-total"]&&(a.total=Number(a.headers["x-total"]))),a.ok&&(Xt(a.data)?a.data=a.data.map(s=>this.toUIDataForMultiple(s,e)):a.data=this.toUIDataForMultiple(a.data,e)),a}toUIDataForMultiple(t,e){const a=this.multipleUiMap.get(e);return new K(t,a)}}),Dl=d("TreeGridExController",class extends ${constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}initState(){super.initState(),this.state.size=0,this.state.columnStates=[],this.state.defaultExpandedKeys=[]}async onCreated(){await super.onCreated(),this.service=new Zu(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns()}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map(async t=>this.initColumnsController(t)))}async initColumnsController(t){const e=await Ge(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,t.columnType==="DEFGRIDCOLUMN"?this.fieldColumns[t.codeName]=a:t.columnType==="UAGRIDCOLUMN"&&(this.uaColumns[t.codeName]=a)}initColumnStates(){W(this.model,t=>{t.columnType!=="GROUPGRIDCOLUMN"&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:t.columnType==="UAGRIDCOLUMN"})},{childrenFields:["detreeColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter(a=>!a.hidden),e=t.length;t.forEach((a,s)=>{a.uaColumn?a.fixed=s+1<=Math.floor(e/2)?"left":"right":a.fixed="right"})}async load(t={}){const e=t.isInitialLoad===!0,a=await this.loadNodes();return this.state.expandedKeys=this.calcExpandedKeys(a),await this.afterLoad(t,a),this.state.isLoaded=!0,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query,s=t?void 0:this.state.defaultExpandedKeys;await this.startLoading();let i;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:s})||[]}finally{await this.endLoading()}return t?t.children=i:this.state.rootNodes=i,this.state.items=[],W({children:this.state.rootNodes},r=>{this.state.items.push(r)}),i}calcExpandedKeys(t){let e=[];return W({children:t},a=>{var s;(s=a.children)!=null&&s.length&&e.push(a.id)}),this.state.defaultExpandedKeys.length&&(e.push(...this.state.defaultExpandedKeys),e=Array.from(new Set(e))),e}}),Cl=d("TreeGridController",class extends ju{}),vl=d("TreeGridService",class extends pi{}),tc=d("MEditViewPanelService",class extends rt{}),Il=d("MEditViewPanelController",class extends ${constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new tc(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const s=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);a&&s?this.parameters=[{parameterName:(t=s.keyAppDEFieldId)==null?void 0:t.toLowerCase(),pathName:(e=s.codeName)==null?void 0:e.toLowerCase()}]:this.parameters=[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter(s=>s.id.startsWith("mockId:"));return this.state.panelUiItems=[],this.doItems(e,a),this.model.panelStyle==="TAB_TOP"&&this.state.panelUiItems.length>0&&a.length===0&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,s={id:t[e]?t[e]:"mockId:".concat(j()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach(i=>{const{parameterName:r,pathName:n}=i;t[r]&&!Object.is(t[r],"")&&Object.assign(s.context,{[n]:t[r]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(s,{srfmajortext:t.srfmajortext}):t.srfuf===0&&Object.assign(s,{srfmajortext:"\u8349\u7A3F--\u65B0\u5EFA"})}),s}doItems(t,e){t.forEach(a=>{const s=this.handlePanelItemParams(a);this.state.panelUiItems.push(s)}),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),this.model.panelStyle==="TAB_TOP"&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,t.data.srfuf===0){const e=this.state.panelUiItems.findIndex(a=>a===t);this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex(a=>a.data.srfkey===t.srfkey);e!==-1&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){t.eventName==="onSaveSuccess"&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex(i=>i.id===e);if(a<0)throw new f("\u7F16\u8F91\u89C6\u56FE\u9762\u677F\u90E8\u4EF6UI\u6570\u636E\u4E0D\u5B58\u5728");const s=this.state.panelUiItems[a];s.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):s.srfmajortext=t.srfmajortext,this.model.panelStyle==="TAB_TOP"&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),ec=d("MapService",class extends rt{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const s=[];if((a=this.model.sysMapItems)!=null&&a.length){const i=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map(async r=>{const{appDataEntityId:n,appDEDataSetId:o,customCond:u}=r,c=t.clone(),l={...e};if(u){const p=R.execSingleLine(u);if(p){const{navigateContexts:E,navigateParams:w}=Te(p);E&&Object.assign(c,F(E,e,t)),w&&Object.assign(l,F(E,e,t))}}const h=await i.deService.exec(n,o,c,l);h.data&&s.push(...h.data.map(p=>new oo(p,r)))}))}return new V(s,200)}}),Al=d("MapController",class extends ${initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new ec(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=t.isInitialLoad===!0,{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(t?.viewParam);a.srfareacode=this.state.areaCode;const i=await this.service.fetchAll(a,s);this.state.items=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(e){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:e}),e}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),s=[],i=[];return a.forEach(r=>{r._itemStyle==="REGION"?s.push(r):r._itemStyle==="POINT"&&i.push(r)}),this.state.pointData=i,this.state.areaData=s,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,(t=this.model.controlParam)!=null&&t.ctrlParams){const{ctrlParams:e}=this.model.controlParam;Object.keys(e).forEach(a=>{const s=e[a];switch(a.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=s;break;case"strareacode":this.state.strAreaCode=s==="true";break;case"jsonbaseurl":this.state.jsonBaseUrl=s;break}})}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]})}}),ac=d("ReportPanelService",class extends Ot{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const s="".concat((a=this.dataEntity.codeName2)==null?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let i=await ibiz.net.request(s,{method:"post",data:e});return i=this.handleResponse(i),i}}),fi=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},sc=class extends fi{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('/assets/images/user-avatar.png') : resource.dir('/assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},ic=class extends fi{},rc=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("\u62A5\u8868\u9762\u677F\u751F\u6210\u5668\u5DE5\u5382\u53C2\u6570\u9519\u8BEF\uFF0C\u62A5\u8868\u9762\u677F\u672A\u6307\u5B9A\u62A5\u8868\u7C7B\u578B");switch(t.appDEReport.reportType){case"USER":return new sc(t);case"USER2":return new ic(t);default:throw new Error("\u6307\u5B9A\u62A5\u8868".concat(t.appDEReport.reportType,"\u7C7B\u578B\u62A5\u8868\u9762\u677F\u751F\u6210\u5668\u6682\u672A\u5B9E\u73B0"))}}},yl=d("ReportPanelController",class extends H{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=rc.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new ac(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(t?.viewParam),s=await this.service.fetch(e,a);this.state.data=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(e){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:e}),e}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),nc=d("GanttService",class extends oa{async fetchGanttChildNodes(t,e){const{hasQuery:a}=e;let s=[];if(t){const i=Nt(this.model,{parentId:t.nodeId,hasQuery:a});if(i.length===0)return;(await it(i.map(async n=>{const o=Jt(this.model,n.childDETreeNodeId);return this.fetchGanttNodeDatasByType(o,n,t,e)}),!1)).forEach(n=>{s.push(...n)})}else{const i=$t(this.model);s=await this.fetchGanttNodeDatasByType(i,void 0,void 0,e)}return s}async fetchGanttNodeDatasByType(t,e,a,s){const i=Nt(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length===0,r={...s,leaf:i};let n=[];switch(t.treeNodeType){case"STATIC":n=[await this.getStaticGanttNodeData(t,e,a,r)];break;case"DE":n=await this.getDEGanttNodeDatas(t,e,a,r);break;case"CODELIST":n=await this.getCodeListGanttNodeDatas(t,e,a,r);break;default:throw new D(t,"".concat(t.treeNodeType,"\u8282\u70B9\u7C7B\u578B\u672A\u652F\u6301"))}const{expandFirstOnly:o,expanded:u,rootNode:c}=t,l=c&&!this.model.rootVisible;return i||await Promise.all(n.map(async(h,p)=>{if(u&&(!o||o&&p===0)||l){const E=await this.fetchGanttChildNodes(h,s);h.children=E}})),n}async getStaticGanttNodeData(t,e,a,s){return new po(this.model,t,a,{parentValueLevel:e?.parentValueLevel,leaf:!!s.leaf})}async getDEGanttNodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:r}=t,{context:n,params:o,navContext:u,navParams:c}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}};o.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(o,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(r,i,n,o);return l.data.length?l.data.map(p=>new fo(this.model,t,a,{data:p,leaf:!!s.leaf,navContext:u,navParams:c})):[]}async getCodeListGanttNodeDatas(t,e,a,s){const{context:i,params:r,navContext:n,navParams:o}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}},u=await this.app.codeList.get(t.codeListId,i,r);return u.length?u.map(l=>new mo(this.model,t,a,{data:l,leaf:!!s.leaf,navContext:n,navParams:o})):[]}}),Fl=d("GanttController",class extends ${constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1}initState(){super.initState(),this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),(t=this.model.detreeNodes)!=null&&t[0].enableQuickSearch&&(this.enableQuickSearch=!0),this.dataEntity){const a=(e=this.dataEntity.appDEFields)==null?void 0:e.filter(i=>i.enableQuickSearch),s=[];a?.forEach(i=>{i?.lnlanguageRes&&i.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(i.lnlanguageRes.lanResTag,i.logicName)):i?.logicName&&s.push(i.logicName)}),s.length>0&&(this.state.placeHolder=s.join("\u3001"))}this.service=new nc(this.model),await this.service.init(this.context),this.model.detreeNodes.forEach(a=>{var s,i;(i=(s=a.decontextMenu)==null?void 0:s.detoolbarItems)!=null&&i.length&&(this.contextMenus[a.decontextMenu.id]=new ui(a.decontextMenu,this.context,this.params,this.ctx))}),await Promise.all(Object.values(this.contextMenus).map(a=>a.created()))}async load(t={}){const e=t.isInitialLoad===!0;e&&await this.startLoading();let a;try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;this.state.isLoading=!0;let s;try{s=await this.service.fetchGanttChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:[]})||[]}finally{this.state.isLoading=!1}return t?t.children=s:this.state.rootNodes=s,this.state.items=[],W({children:this.state.rootNodes},i=>{this.state.items.push(i)}),s}}),oc=d("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}logout(){return ibiz.auth.logout()}}),uc=class{constructor(){this.convert=new Co,this.controller=new oc,this.appMap=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new Io,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(t.indexOf(".")!==-1){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName,t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map),this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId){const a=this.calcAppViewId(t);this.view2appMap.set(a,e)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const s=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(s),s}throw new f("\u89C6\u56FE[".concat(e,"]\u4E0D\u5B58\u5728"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return t.indexOf(".")!==-1?a=await this.modelLoaderProvider.getAppDataEntity(e,t):a=await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new f("\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new f("\u8BF7\u5148\u6CE8\u518C\u6A21\u578B\u52A0\u8F7D\u9002\u914D\u5668");const e=await this.modelLoaderProvider.getApp(t),a=new wo(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Bt(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return t?t instanceof Object?e=t.id:e=t:e=ibiz.env.appId,this.appMap.get(e)}},cc=d("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:s}=t,i="".concat(s,"_").concat(a),r=this.viewEngines.get(i);if(r)return r(...e);ibiz.log.error("\u6CA1\u6709".concat(i,"\u5BF9\u5E94\u7684\u5F15\u64CE"),t)}}),lc=d("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:s}=this.view;if(ibiz.log.debug("".concat(a.id,"\u7684\u5B50\u7EC4\u4EF6\uFF1A").concat(s.join(";"),"\u90FD\u5DF2mounted")),!this.calcViewHeaderVisible()){const r=(t=this.viewLayoutPanel)==null?void 0:t.panelItems.view_header;r&&(r.state.visible=!1)}if(ibiz.env.isMob&&!this.calcViewFooterVisible()){const n=(e=this.viewLayoutPanel)==null?void 0:e.panelItems.view_footer;n&&(n.state.visible=!1)}}async onDestroyed(){}async call(t,e){if(t==="GetData")return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,s;let i=!1;const{model:r}=this.view;if(r.showCaptionBar===!1){const n=(t=this.viewLayoutPanel)==null?void 0:t.panelItems.view_captionbar;n&&(n.state.visible=!1)}else i=!0;if(ibiz.env.isMob){if(this.leftToolbar)i=!0;else{const n=(e=this.viewLayoutPanel)==null?void 0:e.panelItems.lefttoolbar;n&&(n.state.visible=!1)}if(this.rightToolbar)i=!0;else{const n=(a=this.viewLayoutPanel)==null?void 0:a.panelItems.righttoolbar;n&&(n.state.visible=!1)}}else if(this.toolbar)i=!0;else{const n=(s=this.viewLayoutPanel)==null?void 0:s.panelItems.view_toolbar;n&&(n.state.visible=!1)}return i}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:s}=this.view;if(!t)throw new f("\u8BE5\u89C6\u56FE\u6CA1\u6709\u5B9E\u4F53\uFF0C\u65E0\u6CD5\u52A0\u8F7D\u5B9E\u4F53\u6570\u636E");const r=await ibiz.hub.getApp(a.srfappid).deService.exec(t,"get",a,s),{data:n}=r;n&&(this.view.state.srfactiveviewdata=n,e.emit("onDataChange",{actionType:"LOAD",data:[n]}),n.srfkey&&e.emit("onViewInfoChange",{dataInfo:n.srfmajortext||""}))}}),Pl=d("MDViewEngine",class extends lc{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",async a=>{var s;(s=this.toolbar)==null||s.calcButtonState(a.data[0],this.xdataControl.model.appDataEntityId)}),this.xdataControl.evt.on("onBeforeLoad",()=>{this.xdataControl.state.searchParams=this.getSearchParams()}),this.xdataControl.evt.on("onLoadSuccess",a=>{this.view.evt.emit("onDataChange",{...a,actionType:"LOAD"})}),this.xdataControl.evt.on("onRemoveSuccess",a=>{this.view.evt.emit("onDataChange",{...a,actionType:"REMOVE"})}),this.xdataControl.evt.on("onSaveSuccess",a=>{this.view.evt.emit("onDataChange",{...a,actionType:"SAVE"})});const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",()=>{this.reLoad()}),this.searchBar&&this.searchBar.evt.on("onSearch",()=>{this.reLoad()}),!this.view.state.noLoadDefault&&t.loadDefault&&this.load()}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return t==="ToggleFilter"?(this.toggleFilter(),null):t==="Edit"||t==="View"?this.openData(e):t==="New"?this.newData(e):t==="Remove"?(await this.remove(e),null):t==="Import"?(await this.importData(),null):t==="Refresh"?(await this.refresh(),null):t==="ExportExcel"?(await this.exportData(e),null):t==="Search"?(await this.searchForm.search(),null):t==="Reset"?(await this.searchForm.reset(),null):t==="Copy"?(this.copy(e),null):t==="Load"?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:s,event:i}=t,r=(t.context||this.view.context).clone(),n=t.params||this.view.params,o=((e=s[0].srfdecodename)==null?void 0:e.toLowerCase())||B(this.xdataControl.model.appDataEntityId);r[o.toLowerCase()]=s[0].srfkey;const u=await((a=this.view.scheduler)==null?void 0:a.triggerCustom("opendata",{context:r,params:n,data:s,event:i,view:this.view}));if(u===-1)throw new m(this.view.model,"\u7F3A\u5C11newdata\u7684\u89C6\u56FE\u903B\u8F91");return{cancel:!u.ok}}async newData(t){var e,a,s;const{data:i,event:r,copyMode:n}=t;if(!((a=(e=this.view.model.viewLayoutPanel)==null?void 0:e.appViewLogics)==null?void 0:a.find(l=>l.id==="newdata")))throw new m(this.view.model,"\u7F3A\u5C11newdata\u7684\u89C6\u56FE\u903B\u8F91");const u=I(this.view.params);n&&(u.srfcopymode=n);const c=await((s=this.view.scheduler)==null?void 0:s.triggerCustom("newdata",{context:this.view.context,params:u,data:i,event:r,view:this.view}));if(c===-1)throw new m(this.view.model,"\u7F3A\u5C11newdata\u7684\u89C6\u56FE\u903B\u8F91");return{cancel:!c.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){let t=super.calcViewHeaderVisible();if(!this.searchBar||!this.searchBar.state.visible){const e=this.viewLayoutPanel.panelItems.view_searchbar;e&&(e.state.visible=!1)}else t=!0;return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),dc=class{handle(t){return t instanceof m||t instanceof D?ibiz.message.error(t.message,10,!0):t instanceof ut?t.status===401?ibiz.message.error("\u6CA1\u6709\u6CE8\u518C\u65E0\u6743\u9650\u9519\u8BEF\u5904\u7406\u5668"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof Ee?ibiz.message.error(t.message,t.duration,t.duration===0):t instanceof f&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}},hc=class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find(a=>!!a.handle(t))||ibiz.log.error("\u6CA1\u6709\u627E\u5230\u80FD\u5904\u7406\u8BE5\u9519\u8BEF\u7684\u5904\u7406\u5668",t)}handle(t){t instanceof Array?t.forEach(e=>{this.handleSingle(e)}):this.handleSingle(t)}},pc=class{constructor(){this.layoutPanel=new Rr,this.theme=new zr,this.text=new Ur,this.hbs=new sr,this.rawValue=new Gr,this.action=U,this.error=new hc,this.error.register(new dc)}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)}},fe=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new f("Method not implemented.")}destroy(){}},fc=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new D(t,"\u903B\u8F91\u7C7B\u578B ".concat(t.logicType," \u6682\u672A\u652F\u6301\uFF01"));return a(t,e)}},mc=class extends fe{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const s=this.logic.scriptCode;this.scriptFn=R.createScriptFn(t,s,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},mi=class extends fe{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new m(this.logic,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");he(e,a,t)}},Ei=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach(e=>{try{const a=this.createExecutor(e);this.executors.set(e.id,a);const s=this.createTrigger(e);this.triggers.set(e.id,s),s.bindExecutor(a)}catch(a){ibiz.log.error(a.message)}})}destroy(){this.triggers.forEach(t=>t.destroy()),this.executors.forEach(t=>t.destroy())}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),Pe(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0;break}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach(a=>{a.match(t)&&e.push(a)}),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const s=this.getExecuteParams(e);return a.map(r=>r.execute(s))}}triggerItemDynaLogic(t,e,a){const s={itemName:t,triggerType:e},i=this.triggerAndExecute(s,a);if(i?.length)return i.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(e=>e.start())}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const s=this.getExecuteParams(e);return a.execute(s)}triggerControlEvent(t,e,a){const s={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(s,a)}},Ec=class extends Ei{constructor(t){const e=t.filter(a=>a.triggerType!=="APPVIEWENGINE");e.forEach(a=>{a.triggerType==="CTRLEVENT"&&(a.ctrlName=a.itemName||a.logicTag)}),super(e)}},gc=class extends Ei{constructor(t){t.forEach(e=>{e.triggerType=e.logicTrigger}),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},wc=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new D(t,"\u89E6\u53D1\u5668\u7C7B\u578B ".concat(t.triggerType," \u6682\u672A\u652F\u6301\uFF01"));return a(t,e)}},Dc=class{constructor(){this.executorFactory=new fc,this.triggerFactory=new wc}createViewScheduler(t){return new gc(t)}createControlScheduler(t){return new Ec(t)}},Mt=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,this.executor.type==="SCRIPT"&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],e=>e,{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new f("".concat(this.logic.id,"\u6CA1\u6709\u7ED1\u5B9Aexecutor"))}destroy(){this.executor=void 0}},Cc=class extends Mt{},ua=class extends Mt{bindExecutor(t){if(super.bindExecutor(t),this.executor.type!=="SCRIPT")throw new f("\u9884\u5B9A\u4E49\u903B\u8F91\u7C7B\u578B".concat(this.type,"\u7684\u89E6\u53D1\u5668\u7C7B\u578B\u53EA\u80FD\u662F\u811A\u672C"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],e=>{const{context:a,params:s,data:i}=e;return{context:a,params:s,data:i?.[0]||{},env:ibiz.env}},{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&((e=t.itemName)==null?void 0:e.toLowerCase())===((a=this.logic.itemName)==null?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},vc=class extends Mt{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new m(this.logic,"\u5B9A\u65F6\u5668\u7F3A\u5C11\u5B9A\u65F6\u95F4\u9694");this.timer=setInterval(()=>{if(!this.scheduler.defaultParamsCb)throw new f("\u5B9A\u65F6\u5668\u7F3A\u5C11\u9ED8\u8BA4\u53C2\u6570\u56DE\u8C03");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)},this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Ic=class extends fe{async execute(t){let e;try{this.logic.id==="opendata"&&this.logic.builtinAppUILogic?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.id==="newdata"&&this.logic.builtinAppUILogic&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(a){ibiz.log.error(a)}return e}async executeOpenDataAppUILogic(t,e){const{context:a,params:s,...i}=e,{data:r}=e;if(!r?.[0])throw new f("opendata\u6CA1\u6709\u53EF\u64CD\u4F5C\u6570\u636E\uFF01");const n=t.openDataAppViews;let o;if(n)o=await this.calcOpenViewRef(t,e);else if(o=t.openDataAppView,!o)throw new m(t,"opendata\u89C6\u56FE\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u9ED8\u8BA4\u6253\u5F00\u89C6\u56FE");const u=o.refAppViewId;if(!u)throw new m(t,"opendata\u89C6\u56FE\u903B\u8F91\u7684\u9ED8\u8BA4\u6253\u5F00\u89C6\u56FE\u6CA1\u6709\u5B9E\u9645\u5F15\u7528\u89C6\u56FE");const c=o.navigateContexts||[],l=Object.assign(a,F(c,r[0],s,a));let h={};const p=o.navigateParams;return x(p)&&(h=F(p,r[0],s,a)),ibiz.commands.execute(et.TAG,u,l,h,i)}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 m(t,"".concat(a.codeName,"[\u591A\u8868\u5355\u5B9E\u4F53] or [\u7D22\u5F15\u5B9E\u4F53]\u7F3A\u5C11\u7C7B\u578B\u5C5E\u6027\u914D\u7F6E"));const{data:i}=e,r=i[0][s];if(!r)throw new m(t,"\u6570\u636E\u6E90\u65E0\u8868\u5355\u7C7B\u578B\u5E94\u7528\u5B9E\u4F53\u5C5E\u6027\u503C");const n=t.openDataAppViews,o=n?.find(u=>u.refMode===r);if(!o)throw new f("\u6CA1\u6709\u627E\u5230\u4E0E\u8868\u5355\u7C7B\u578B".concat(r,"\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE"));return o}async executeNewDataAppUILogic(t,e){const{context:a,params:s,...i}=e,{data:r,view:n}=e,{enableWizardAdd:o,enableBatchAdd:u,batchAddOnly:c,newDataAppView:l}=t;let h;if(o){if(h=await this.getWizardNewViewRef(t,e),!h)return{ok:!1}}else if(u){const b=B(n.parentView.model.appDataEntityId),A=t.batchAddAppViews;if(h=A?.find(L=>L.refMode.toLowerCase()!==b),!h)throw new m(t,"\u6CA1\u6709\u627E\u5230\u6279\u6DFB\u52A0\u9700\u8981\u6253\u5F00\u7684\u9009\u62E9\u89C6\u56FE")}else{if(c)throw new D(t,"batchAddOnly\u6682\u672A\u652F\u6301");if(h=l,!h||!h.refAppViewId)throw new m(t,"newdata\u89C6\u56FE\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u9ED8\u8BA4\u65B0\u5EFA\u6570\u636E\u89C6\u56FE")}let p={},E={};const w=r?.[0]||{},y=h.navigateContexts;x(y)&&(p=F(y,w,s,a)),p=Object.assign(a,p);const v=h.navigateParams;if(x(v)&&(E=F(v,w,s,a)),s.srfcopymode){const A=(await ibiz.hub.getAppDataEntity(n.model.appDataEntityId,n.model.appId)).keyAppDEFieldId;A&&w&&(E[A]=w.srfkey,E.srfcopymode=!0)}E.srfuf=0;const P=await ibiz.commands.execute(et.TAG,h.refAppViewId,p,E,i);return u&&P.data&&await this.doBatchAdd(t,P.data,a,h),P}async getWizardNewViewRef(t,e){var a;const{wizardAppView:s,newDataAppViews:i}=t,{context:r,params:n,...o}=e;if(!s||!s.refAppViewId)throw new m(t,"\u7F3A\u5C11\u9ED8\u8BA4\u7D22\u5F15\u5B9E\u4F53\u9009\u62E9\u89C6\u56FE");const u=await ibiz.commands.execute(et.TAG,s.refAppViewId,r,n,{...o,openMode:"POPUPMODAL"});if(!u.ok)return;const c=(a=u.data)==null?void 0:a[0];if(!c)throw new f("\u8BF7\u9009\u4E2D\u4E00\u6761\u6570\u636E");const l=c.srfkey,h=i?.find(p=>{var E;return((E=p.refMode)==null?void 0:E.toUpperCase())===l.toUpperCase()});if(!h)throw new f("\u6CA1\u6709\u627E\u5230\u4E0E\u7D22\u5F15\u7C7B\u578B".concat(l,"\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE"));return h}async doBatchAdd(t,e,a,s){var i;if(e?.length){const r=await ibiz.hub.getAppDataEntity(t.appDataEntityId,a.srfappid),n=r.minorAppDERSs,o=s.refMode.toLowerCase();if(!n)throw new m(r,"\u5B9E\u4F53\u6CA1\u6709\u4ECE\u5173\u7CFB\u96C6\u5408\uFF01");let u;n?.forEach(p=>{const E=B(p.majorAppDataEntityId);o===E&&(u=p.parentAppDEFieldId)});const c=(i=s.navigateParams)==null?void 0:i.find(p=>p.key==="keymapping");let l=[];if(c){const p=c.value.split(";"),E={};for(const w of p){const[y,v]=w.split(":");y&&v&&(E[y]=v)}l=e.map(w=>{const y={[u]:w.srfkey};for(const v in E)if(Object.prototype.hasOwnProperty.call(E,v)){const P=E[v];Object.prototype.hasOwnProperty.call(w,v)&&(y[P]=w[v])}return y})}else l=e.map(p=>({[u]:p.srfkey}));await ibiz.hub.getApp(a.srfappid).deService.exec(r.id,"Create",a,l)}}},Ac=class extends Mt{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map(s=>Me[s]||s)}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},yc=class extends Mt{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map(s=>z[s]||s)}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},Fc=class extends fe{execute(t){if(!this.logic.appDEUIActionId)throw new m(this.logic,"\u903B\u8F91\u4E2D\u7F3A\u5C11\u89E6\u53D1\u5E94\u7528\u5B9E\u4F53\u754C\u9762\u884C\u4E3Aid");U.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};function Pc(){ibiz.scheduler=new Dc,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",(t,e)=>new ua(t,e)),ibiz.scheduler.triggerFactory.register("ITEMENABLE",(t,e)=>new ua(t,e)),ibiz.scheduler.triggerFactory.register("ITEMBLANK",(t,e)=>new ua(t,e)),ibiz.scheduler.triggerFactory.register("TIMER",(t,e)=>new vc(t,e)),ibiz.scheduler.triggerFactory.register("CUSTOM",(t,e)=>new Cc(t,e)),ibiz.scheduler.triggerFactory.register("VIEWEVENT",(t,e)=>new Ac(t,e)),ibiz.scheduler.triggerFactory.register("CTRLEVENT",(t,e)=>new yc(t,e)),ibiz.scheduler.executorFactory.register("SCRIPT",(t,e)=>new mc(t,e)),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",(t,e)=>new mi(t,e)),ibiz.scheduler.executorFactory.register("DEUILOGIC",(t,e)=>new mi(t,e)),ibiz.scheduler.executorFactory.register("APPUILOGIC",(t,e)=>new Ic(t,e)),ibiz.scheduler.executorFactory.register("APPDEUIACTION",(t,e)=>new Fc(t,e))}function bc(){const{ibiz:t}=window;t.util=new pc,t.hub=new uc,t.register=new xi,t.config=new _i,t.auth=new Rn,t.asyncAction=new Tn,t.engine=new cc,ti(),oi(),qs(),Vs(),Pc(),cn(),t.platform=Os()}var bl=d("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Se.dirname(this.url.pathname)}dir(t){return this.url.origin+Se.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map(a=>{const s=this.dir(a);return this.styleElementMap.has(s)?!1:(this.styleElementMap.set(s,null),new Promise((i,r)=>{const n=document.createElement("link");n.setAttribute("type","text/css"),n.setAttribute("rel","stylesheet"),n.setAttribute("href",s),n.onload=i,n.onerror=r,document.head.appendChild(n)}))});try{await Promise.all(e)}catch(a){ibiz.log.error(a)}}}),Nl=d("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}});
4
+ `):i===2&&o.length>4?"".concat(o.slice(0,4),"..."):o),rotate:i===3?45:0}};r&&(n=It(n,aa(r))),e.push(n)}),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find(a=>a.name===t);return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!((a=this.model.dechartSerieses)!=null&&a.length))return;const s=ibiz.hub.getApp(t.srfappid),i=async r=>{if(!r||this.codeListMap.has(r))return;const n=await s.codeList.get(r,t,e);this.codeListMap.set(r,n)};await Promise.all(this.model.dechartSerieses.map(async r=>{const{seriesCodeListId:n,catalogCodeListId:o}=r;await i(n),await i(o)}))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach(a=>{a.model.seriesType==="radar"&&a.calcRadarCoordSystem(t)}),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map(a=>a.toOptions()));const e=[];return this.seriesGenerators.forEach(a=>{const s=e.length,i=a.calcByData(t);i instanceof Array?e.push(...i):e.push(i);const r=e.length-1;for(let n=s;n<=r;n++)this.seriesGeneratorIndexMap.set(n,a)}),this.options.series=e,this.seriesGenerators.length===1&&this.seriesGenerators[0].groupData&&Object.keys(this.seriesGenerators[0].groupData).length===1&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=It(this.staticOptions,this.options),this.chartUserParam&&(this.options=It(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new f("\u627E\u4E0D\u5230".concat(t.seriesIndex,"\u5E8F\u5217\u7684generator\uFF01"));return e.getChartDataByParams(t)}},Jo=d("ChartService",class extends rt{}),_c=d("ChartController",class extends tt{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Jo(this.model),await this.service.init(this.context),this.generator=new $o(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach(s=>{Object.assign(s,{srfcount:1})}),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",e=>{const a=this.generator.getChartDataByParams(e);a&&this.setActive(a)})}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new f("chart\u5BF9\u8C61\u6CA1\u6709\u6B63\u786E\u521D\u59CB\u5316");if(!this.options)throw new f("options\u8FD8\u6CA1\u8BA1\u7B97");this.chart.setOption(this.options),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),(t=this.chart)==null||t.dispose()}}),Mc=d("CaptionBarController",class extends Y{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):"")})}}),Zo=class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;(e=this.deLogicParams.get(t))==null||e.calc(this)}renewParam(t){var e;(e=this.deLogicParams.get(t))==null||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)}},ni=class{};function nt(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:i}=e,r=e.srcValueType||"SRCDLPARAM",n=s;let o;switch(r){case"SRCDLPARAM":o=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(i);case"WEBCONTEXT":case"VIEWPARAM":o=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":o=t.parameters.context;break;case"ENVPARAM":o=A(ibiz.env);break;default:throw new w(e,"\u6682\u672A\u652F\u6301\u6E90\u503C\u7C7B\u578B".concat(r))}if(o&&n)try{Array.isArray(o)?o=o[Number(n)]:o=O.execScriptFn({srcValue:o},"srcValue.".concat(n),{singleRowReturn:!0,isAsync:!1})}catch(u){throw ibiz.log.error("\u4ECE\u6E90\u53C2\u6570\u53D6\u5C5E\u6027".concat(n,"\u62A5\u9519\uFF0C\u6E90\u53C2\u6570\uFF1A"),o),u}return o}var tu=class extends ni{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,a){const s=nt(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=a[this.value]!=null?a[this.value]:e[this.value];return at(s,this.op,i)}case"SRCENTITYFIELD":{if(!this.value)throw new m(this.model,"\u5F53\u524D\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u6E90\u6570\u636E\u5BF9\u8C61\u5C5E\u6027],\u7F3A\u5C11\u914D\u7F6E\u6761\u4EF6\u503C");const i=nt(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return at(s,this.op,i)}case"CURTIME":throw new w(this.model,"\u6682\u672A\u652F\u6301\u6761\u4EF6\u503C\u7C7B\u578B\u4E3A[\u5F53\u524D\u65F6\u95F4]");default:return at(s,this.op,this.value)}}},eu=class Fi extends ni{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map(s=>s.logicType==="SINGLE"?new tu(s):new Fi(s))}get op(){return this.model.groupOP}get notMode(){return this.model.notMode===!0}test(e,a,s){let i=!0;if(this.conds.length===0)throw new m(this.model,"\u754C\u9762\u8FDE\u63A5\u6761\u4EF6\u903B\u8F91\u7EC4\u672A\u914D\u7F6E\u903B\u8F91\u9879");for(let r=0;r<this.conds.length;r++){const o=this.conds[r].test(e,a,s);if(this.op==="AND"&&o===!1){i=!1;break}if(this.op==="OR"&&o===!0){i=!0;break}}return this.notMode?!i:i}},au=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;(e||0)===0&&a&&(this.groupCond=new eu(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return this.groupCond?this.groupCond.test(t,a,s&&s.length>0?s[0]:{}):!0;case 1:return!0;case 2:throw new w(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B: \u5F02\u6B65\u7ED3\u675F");case 3:throw new w(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B: \u5F02\u6B65\u62D2\u7EDD");case 9:throw new w(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B: \u5F02\u5E38\u5904\u7406");default:throw new w(this.model,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8FDE\u63A5\u7C7B\u578B:".concat(e))}}},M=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map(e=>new au(e))}},su=class extends M{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDEUILogicParamId:s,retDEUILogicParamId:i}=this.model;if(!e)throw new m(this.model,"\u672A\u6307\u5B9A\u5E94\u7528\u5B9E\u4F53");if(!a)throw new m(this.model,"\u672A\u6307\u5B9A\u5B9E\u4F53\u884C\u4E3A");const r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(e,a,t.context,r,t.viewParam);o.ok&&(t.params[i]=o.data)}},iu=class extends M{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:a}=this.model,{data:s,parameters:i}=t;if(!e)throw new m(this.model,"\u672A\u914D\u7F6E\u754C\u9762\u884C\u4E3A");let r=[s];if(a){const n=t.params[a];n instanceof Array?r=n:r=[n]}await G.execAndResolved(e,{...i,context:t.context,params:t.viewParam,data:r},this.model.appId)}},ru=class extends M{async exec(t){}},nu=class extends M{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;case"LOGICPARAMFIELD":case"BREAK":default:throw new w(this.model,"\u6682\u672A\u652F\u6301\u7684\u7ED3\u675F\u8282\u70B9\u8FD4\u56DE\u503C\u7C7B\u578B: ".concat(e))}}},ou=class extends M{async exec(t){const e=this.model.deuilogicNodeParams;if(e?.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new w(a,"\u6682\u672A\u652F\u6301\u903B\u8F91\u5904\u7406\u53C2\u6570\u64CD\u4F5C".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:s}=t;if(!s)throw new f("\u6CA1\u6709\u76EE\u6807\u53C2\u6570\u5BF9\u8C61id");let i=a;e.isEntityParam(s)&&(i=i?.toLowerCase());const r=nt(e,t);if(i)try{O.execScriptFn({srcVal:r,dstParam:e.params[s]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(n){throw ibiz.log.error("\u7ED9\u76EE\u6807\u53C2\u6570\u5C5E\u6027".concat(a,"\u8D4B\u503C\u62A5\u9519\uFF0C\u76EE\u6807\u53C2\u6570\uFF1A"),e.params[s]),n}else e.params[s]=r}copyParam(t,e){const{dstDEUILogicParamId:a}=t,s=nt(e,t);e.params[a]=A(s)}bindParam(t,e){const a=nt(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=t,n=nt(e,t),o=s||0,u=i||0,c=r||n.length;e.params[a].splice(o,0,...n.slice(u,c))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:s,dstSortDir:i}=t,r=s;e.params[a].sort((o,u)=>i==="ASC"?o[r]-u[r]:u[r]-o[r])}},uu=class extends M{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:a,invokeParamId:s}=this.model;if(!a)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u5BF9\u8C61");if(!s)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u64CD\u4F5C\u53C2\u6570");if(!e)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u8C03\u7528\u65B9\u6CD5");const i=t.params[s];if(!i)throw new f("\u6CA1\u6709\u627E\u5230\u64CD\u4F5C\u53C2\u6570".concat(s));const r=t.params[a];if(!r)throw new f("\u6CA1\u6709\u627E\u5230\u754C\u9762\u5BF9\u8C61".concat(a));if(!r[e]||!Oa(r[e]))throw new f("\u6CA1\u6709\u627E\u5230\u8C03\u7528\u65B9\u6CD5".concat(e));await r[e](i)}},cu=class extends M{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=nt(t,this.model);t.params[e]=s}},lu=class extends M{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:a,msgBoxParamId:s}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u6D88\u606F\u7C7B\u578B\u7684\u914D\u7F6E");if(!a)throw new m(this.model,"\u7F3A\u5C11\u6309\u94AE\u7C7B\u578B\u7684\u914D\u7F6E");let{title:i}=this.model,{message:r}=this.model;if(s){const l=t.params[s];l.title&&(i=l.title),l.message&&(r=l.message)}const o={type:this.typeMap[e],title:i||"\u6D88\u606F",desc:r};let u=[];switch(a){case"YESNO":o.confirmButtonText="\u662F",o.cancelButtonText="\u5426",o.showConfirmButton=!0,o.showCancelButton=!0,u=["yes","no"];break;case"OK":o.confirmButtonText="\u786E\u5B9A",o.showConfirmButton=!0,o.showCancelButton=!1,u=["ok"];break;case"OKCANCEL":o.confirmButtonText="\u786E\u5B9A",o.cancelButtonText="\u53D6\u6D88",o.showConfirmButton=!0,o.showCancelButton=!0,u=["ok","cancel"];break;default:throw new w(this.model,"".concat(a,"\u6682\u672A\u652F\u6301"))}const c=await ibiz.modal.confirm(o);t.setLastReturn(u[c?0:1])}},du=class extends M{async exec(t){const e=await bs(this.model);e&&await e.exec(this.model,t)}},hu=class extends M{async exec(t){const{dstDEUILogicParamId:e,name:a}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=t.params[e];console.log("\u903B\u8F91\u8282\u70B9".concat(a,"\u64CD\u4F5C\u53C2\u6570\u503C:"),s)}},pu=class extends M{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.resetParam(e)}},fu=class extends M{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const s=nt(t,this.model);t.params[e]=A(s)}},mu=class extends M{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a,dstIndex:s,srcIndex:i,srcSize:r}=this.model;if(!e||!a)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u8005\u6E90\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");const n=nt(t,this.model),o=s||0,u=i||0,c=r||n.length;t.params[e].splice(o,0,...n.slice(u,c))}},Eu=class extends M{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u6216\u76EE\u6807\u5C5E\u6027\u914D\u7F6E");const i=s;t.params[e].sort((n,o)=>a==="ASC"?n[i]-o[i]:o[i]-n[i])}},gu=class extends M{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new m(this.model,"\u7F3A\u5C11\u76EE\u6807\u53C2\u6570\u5BF9\u8C61\u914D\u7F6E");t.renewParam(e)}},Du=class extends M{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:i}=this.model;if(!s)throw new m(this.model,"\u7F3A\u5C11\u914D\u7F6E\u8FC7\u6EE4\u53C2\u6570");const r=t.params[s],o=await ibiz.hub.getApp(t.context.srfappid).deService.exec(a,e,t.context,r);o.ok&&(t.params[i]=o.data)}},wu=class extends M{async exec(t){const{errorInfo:e}=this.model;throw new f(e)}},Cu=class extends M{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:a,fireCtrlId:s}=this.model;if(!s)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u89E6\u53D1\u5BF9\u8C61");if(!e)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u4E8B\u4EF6\u540D\u79F0\u53C2\u6570");if(!a)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u4E8B\u4EF6\u53C2\u6570");const i=t.params[s];if(!i)throw new f("\u6CA1\u6709\u627E\u5230\u89E6\u53D1\u5BF9\u8C61".concat(s));const r=t.params[a];if(!r)throw new f("\u6CA1\u6709\u627E\u5230\u4E8B\u4EF6\u53C2\u6570\u5BF9\u8C61".concat(a));await i.evt.emit(e,r)}},vu=class extends M{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:i}=this.model;if(!a)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53");if(!e)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u903B\u8F91");if(!s)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u4F20\u5165\u903B\u8F91\u53C2\u6570");const r=t.params[s];if(!r)throw new f("\u6CA1\u6709\u627E\u5230\u4F20\u5165\u53C2\u6570".concat(s));const n=await Ks(e,a,t.context,r,t.params);i&&(t.params[i]=n)}},Iu=class extends M{async exec(t){console.log(t),O.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Au=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:i,params:r,data:n}=s,o=ibiz.hub.getApp(i.srfappid);if(a.codeName==="layoutPanel"){t.params[e]=s.view.layoutPanel.panelItems;return}if(a.default)a.entityListParam?t.params[e]=n||[]:t.params[e]=n&&n.length>0?n[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const u=s.view.getController(a.codeName.toLowerCase());u?t.params[e]=u:ibiz.log.error("\u89C6\u56FE\u903B\u8F91\u521D\u59CB\u5316\u53C2\u6570\uFF0C\u672A\u627E\u5230".concat(a.codeName,"\u6307\u5B9A\u90E8\u4EF6\u5BF9\u8C61"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=o;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u5206\u9875\u67E5\u8BE2\u7ED3\u679C");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=i;else{if(a.navViewParamParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u89C6\u56FE\u8DEF\u7531\u53C2\u6570");if(a.routeViewSessionParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u8DEF\u7531\u89C6\u56FE\u4F1A\u8BDD");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=r;else if(a.viewSessionParam)throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u5F53\u524D\u89C6\u56FE\u4F1A\u8BDD")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else if(a.simpleParam||a.entityParam)t.params[e]={};else throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B\u91CD\u65B0\u5EFA\u7ACB\u53D8\u91CF")}},yu=class{constructor(t){this.model=t,this.nodes=new Map,this.params=new Map;var e;if(!((e=t.deuilogicNodes)!=null&&e.length))throw new m(t,"\u754C\u9762\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u903B\u8F91\u8282\u70B9");t.deuilogicNodes.forEach(a=>{const{logicNodeType:s}=a;let i;switch(s){case"BEGIN":i=new ru(a);break;case"END":i=new nu(a);break;case"DEACTION":i=new su(a);break;case"DEUIACTION":i=new iu(a);break;case"PREPAREJSPARAM":i=new ou(a);break;case"RESETPARAM":i=new pu(a);break;case"COPYPARAM":i=new fu(a);break;case"BINDPARAM":i=new cu(a);break;case"VIEWCTRLINVOKE":i=new uu(a);break;case"MSGBOX":i=new lu(a);break;case"DEBUGPARAM":i=new hu(a);break;case"APPENDPARAM":i=new mu(a);break;case"SORTPARAM":i=new Eu(a);break;case"RENEWPARAM":i=new gu(a);break;case"DEDATASET":i=new Du(a);break;case"THROWEXCEPTION":i=new wu(a);break;case"VIEWCTRLFIREEVENT":i=new Cu(a);break;case"DELOGIC":i=new vu(a);break;case"PFPLUGIN":i=new du(a);break;case"RAWJSCODE":i=new Iu(a);break;default:throw new w(a,"\u672A\u652F\u6301\u7684\u903B\u8F91\u8282\u70B9\u7C7B\u578B: ".concat(s))}this.nodes.set(a.id,i)}),t.deuilogicParams.forEach(a=>{this.params.set(a.id,new Au(a))}),this.nodes.forEach(a=>{a.links.forEach(s=>{s.srcNode=a,this.nodes.has(s.model.dstDEUILogicNodeId)&&(s.dstNode=this.nodes.get(s.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 Zo(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:a}=this.model;if(a&&this.nodes.has(a)){const s=this.nodes.get(a);await this.deepExec(s,e)}else throw new m(this.model,"\u672A\u8BBE\u7F6E\u8D77\u59CB\u8282\u70B9");return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let s=0;s<a.length;s++){const i=a[s];if(await i.exec(e)&&i.dstNode&&(await this.deepExec(i.dstNode,e),t.model.parallelOutput===!1))break}}},sa=new Map;async function me(t,e,a){const i=await ibiz.hub.getApp(a.context.srfappid).getDEUILogic(t,e);if(!i)throw new f("\u627E\u4E0D\u5230\u5B9E\u4F53".concat(e,"\u7684\u754C\u9762\u903B\u8F91").concat(t));return sa.has(i)||sa.set(i,new yu(i)),await sa.get(i).exec(a),null}var G=d("UIActionUtil",class{static async exec(t,e,a){const s=await Qt(t,a);if(!s)throw new f("\u6CA1\u627E\u5230".concat(t,"\u7684\u754C\u9762\u884C\u4E3A\u6A21\u578B"));return s.actionTarget==="SINGLEDATA"&&await e.view.call("Validate")===!1?{cancel:!0}:(await Fs(s)).exec(s,e)}static async execAndResolved(t,e,a){var s,i;const r=await this.exec(t,e,a);if(r.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(r.refresh)switch(r.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:(s=e.view.parentView)==null||s.callUIAction("Refresh");break;case 3:(i=e.view.getTopView())==null||i.callUIAction("Refresh");break}}}),_t=d("UIActionProviderBase",class{async exec(t,e){const{context:a,params:s,data:i}=e,r={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:n,appDataEntityId:o,uilogicAttachMode:u}=t;if(u==="REPLACE"){if(!n)throw new m(t,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");return await me(n,o,e),r}if(!await this.isConfirm(t,e))return this.returnError(r);const c=await this.execAction(t,e);if(Object.assign(r,c),r.cancel===!0)return this.returnError(r);const l={...e,context:r.nextContext||a,data:r.data||i,params:r.nextParams||s};if(t.closeEditView)this.doNextAction(t,l,t.appId);else{const h=await this.doNextAction(t,l,t.appId);if(h&&(Object.assign(r,h),h.cancel===!0))return this.returnError(r)}if(t.uilogicAttachMode==="AFTER"){if(!n)throw new m(t,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");await me(n,o,e)}return r}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return t.enableConfirm&&a?ibiz.confirm.warning({title:"\u64CD\u4F5C\u786E\u8BA4",desc:a}):!0}async doNextAction(t,e,a){const s=t.nextId;if(s)return G.exec(s,e,a)}async handleParams(t,e,a,s){let i=[];const r=B(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":i=[];break;case"SINGLEDATA":i=[a[0]];break;case"MULTIDATA":i=a;break;case"MULTIKEY":i=r&&a.length>0?a.map(D=>({[o]:D.srfkey||D[o]})):[{}];break;case"SINGLEKEY":{const D=a[0]||{};i=r?[{[o]:D.srfkey||D[o]}]:[{}]}break}const u=e.clone(),c=[...t.navigateContexts||[]];if(r&&t.actionTarget!=="NONE"){const{valueItem:D,paramItem:y}=t,v=y||r,b=D||"srfkey";c.unshift({key:v,value:b,rawValue:!1})}const l=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,h=N(c,l?Te(c,a):a[0]||{},s,e);Object.assign(u,h);const p=t.navigateParams,E=N(p,l?Te(p,a):a[0]||{},s,u);return{resultContext:u,resultData:i,resultParams:E}}calcMessage(t,e,a){let s,i;const{confirmMsg:r,cmlanguageRes:n,successMsg:o,smlanguageRes:u}=e;switch(t){case"confirm":s=r,i=n;break;case"success":s=o,i=u;break}if(i){const c=ibiz.i18n.t(i.lanResTag,i.defaultContent||s);c!==i.lanResTag&&(s=c)}if(s){const{data:c}=a,l={...a};return c.length===1?[l.data]=c:c.length===0&&delete l.data,O.execScriptFn(l,"`".concat(s,"`"),{isAsync:!1,singleRowReturn:!0})}}}),Fu=d("BackendUIActionProvider",class extends _t{async execAction(t,e){const{context:a,params:s,data:i,event:r}=e,n={},o=t.appDataEntityId,u=t.appDEMethodId;if(!o||!u)throw new m(t,"\u672A\u914D\u7F6E\u5B9E\u4F53\u6216\u5B9E\u4F53\u884C\u4E3A");const{resultContext:c,resultParams:l,resultData:h}=await this.handleParams(t,a,i,s),p={...l},E=t.frontAppViewId;if(E){const F=await ibiz.commands.execute(st.TAG,E,c,l,{event:r});if(!F?.ok)return n.cancel=!0,n;if(F?.ok&&F.data){h.length===0&&h.push({});const I=F.data.map(S=>{var R;return((R=S.getOrigin)==null?void 0:R.call(S))||S||{}});h.forEach(S=>{S.srfactionparam=I})}}const D=ibiz.hub.getApp(a?.srfappid),y=h.map(F=>{var I;return((I=F.getOrigin)==null?void 0:I.call(F))||F||{}}).map(F=>Object.assign(F,p)),v=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),b=await D.deService.exec(o,u,c,v?y:y[0],p);if(b.ok){const F=this.calcMessage("success",t,e);F&&ibiz.message.success(F)}return Object.assign(n,{data:Kt(b.data)?b.data:[b.data],nextContext:c,nextParams:p}),n}}),Pu=d("SysUIActionProvider",class extends _t{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,s=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;return s==="Exit"?{closeView:!0}:await a.callUIAction(s,e)||{}}}),bu=d("FrontUIActionProvider",class extends _t{async execAction(t,e){const{context:a,params:s,data:i,event:r,noWaitRoute:n}=e;let o={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const u=wa.fill(t.htmlPageUrl,a,i?.[0]);window.open(u,"_blank");break}case"TOP":case"WIZARD":{const u=t.frontAppViewId;if(!u)throw new m(t,"\u672A\u914D\u7F6E\u6253\u5F00\u89C6\u56FE");const{resultContext:c,resultParams:l}=await this.handleParams(t,a,i,s),h=await ibiz.commands.execute(st.TAG,u,c,l,{event:r,noWaitRoute:n});h?.ok||(o.cancel=!0),h?.ok&&h.data&&(o.data=h.data,o.nextContext=c,o.nextParams={...s,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":o=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":o=this.doOther(t,e);break;default:throw new w(t,"\u672A\u652F\u6301\u7684\u524D\u53F0\u5904\u7406\u6A21\u5F0F[".concat(t.frontProcessType,"]"))}return o}doOther(t,e){const{scriptCode:a}=t,{context:s,params:i,data:r,event:n,view:o}=e;if(a)return O.execScriptFn({context:s,params:i,data:r,el:n?.target,view:o},a)||{};throw new m(t,"\u81EA\u5B9A\u4E49\u7C7B\u578B\u7F3A\u5C11\u914D\u7F6E\u811A\u672C\u4EE3\u7801")}async executePrint(t,e){var a,s,i;const{resultContext:r,resultParams:n}=await this.handleParams(t,e.context,e.data,e.params),o=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),u=(a=o.appDEPrints)==null?void 0:a.find(c=>c.id===t.appDEPrintId);if(u){let c="";if(r&&r[o.codeName.toLowerCase()])c+="/".concat((s=o.codeName2)==null?void 0:s.toLowerCase(),"/printdata/").concat(r[o.codeName.toLowerCase()]);else throw new f("\u6CA1\u6709\u627E\u5230\u6570\u636E\u4E3B\u952E");const l=await ibiz.net.request(c,{method:"get",responseType:"blob",params:{srfprinttag:u.codeName,...n}});if(l.ok)if(n&&n.srfcontenttype){const p=(i=l.headers["content-disposition"].split(";").find(y=>y.indexOf("filename=")!==-1))==null?void 0:i.slice(9),E=URL.createObjectURL(l.data),D=document.createElement("a");D.href=E,D.download=p,document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(E)}else{const h=window.URL.createObjectURL(l.data);window.open(h,"_blank")}else throw new f("\u6253\u5370\u5931\u8D25")}else throw new f("\u6CA1\u6709\u627E\u5230\u5B9E\u4F53\u6253\u5370\u9879")}async executeDataImport(t,e){var a;const s=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),i=(a=s.appDEDataImports)==null?void 0:a.find(n=>n.id===t.appDEDataImportId);let r="DataImport";if(i&&i.enableCustomized&&(r="DataImport2"),i){const n=ibiz.overlay.createModal(r,{dismiss:()=>n.dismiss(),appDataEntity:s,dataImport:i},{width:"auto",placement:"center"});return n.present(),await n.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new f("\u6CA1\u6709\u627E\u5230\u5B9E\u4F53\u5BFC\u5165\u9879")}async executeDataExport(t,e){var a,s;const{resultParams:i}=await this.handleParams(t,e.context,e.data,e.params),r=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),n=(a=r.appDEDataExports)==null?void 0:a.find(o=>o.id===t.appDEDataExportId);if(n){const o="/".concat((s=r.codeName2)==null?void 0:s.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(n.codeName),u={page:0,size:n.maxRowCount?n.maxRowCount:1e3,...e.params,...i},c=await ibiz.net.request(o,{method:"post",data:u});if(c.status===200){let l="".concat(r.logicName,"\u8868.xlsx");l=decodeURIComponent(l);const h=new Blob([c.data],{type:"application/vnd.ms-excel"}),p=document.createElement("a");p.download=l,p.style.display="none",p.href=URL.createObjectURL(h),document.body.appendChild(p),p.click(),URL.revokeObjectURL(p.href),document.body.removeChild(p)}else throw new f("\u5BFC\u51FA\u8BF7\u6C42\u5931\u8D25")}else throw new f("\u6CA1\u6709\u627E\u5230\u5B9E\u4F53\u5BFC\u51FA\u9879")}}),Nu=d("WFWithdrawUIActionProvider",class extends _t{async execAction(t,e){const{view:a}=e,s=await ibiz.modal.confirm({title:"\u63D0\u793A",desc:"\u662F\u5426\u786E\u8BA4\u6267\u884C\u64A4\u56DE\u64CD\u4F5C\uFF1F"});let i=!1;return s&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),Su=class extends _t{async execAction(t,e){return await ibiz.confirm.info({title:"\u786E\u8BA4\u9000\u51FA\u767B\u5F55",desc:"\u60A8\u786E\u5B9A\u8981\u9000\u51FA\u767B\u5F55\u5417\uFF1F\u9000\u51FA\u540E\u60A8\u5C06\u65E0\u6CD5\u7EE7\u7EED\u8BBF\u95EE\u5DF2\u767B\u5F55\u72B6\u6001\u7684\u529F\u80FD\u548C\u4FE1\u606F\uFF0C\u8BF7\u786E\u4FDD\u60A8\u5DF2\u4FDD\u5B58\u6240\u6709\u672A\u5B8C\u6210\u7684\u64CD\u4F5C\u3002"})&&await ibiz.auth.logout()&&window.location.reload(),{}}};function oi(){const t=new bu;Pt("FRONT",()=>t);const e=new Fu;Pt("BACKEND",()=>e);const a=new Pu;Pt("SYS",()=>a);const s=new Nu;Pt("DEUIACTION_WFWithdraw",()=>s);const i=new Su;Pt("SYS_Logout",()=>i)}var Lu=d("ToolbarController",class extends Y{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new pt,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if(t.itemType==="DEUIACTION"){const s=t.uiactionId,i=await Qt(s,t.appId);if(!i)throw new f("\u6CA1\u6709\u627E\u5230\u754C\u9762\u884C\u4E3A\u6A21\u578B".concat(s));const r=["SYS","BACKEND","WFBACKEND"].includes(i.uiactionMode)&&i.showBusyIndicator!==!1;r&&this.state.buttonsState.setLoading(t.id);try{const o=await this.ctx.view.call("GetData")||[],u=this.getEventArgs();u.params=Object.assign(a,u.params),await G.execAndResolved(s,{...u,data:o,event:e},t.appId)}finally{r&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,V(this.model,t=>{if(t.itemType==="DEUIACTION"){const e=t,a=new ht(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}},{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const s=t.buttonType==="extra";await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:s?"extra":"deuiaction"}),s||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof X&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const s={};a&&(s.data=[a]),V(this.model,i=>{const r=this.state.buttonsState[i.id];if(r){if(r.visible){const n=this.scheduler.triggerItemVisible(i.id,s);n!==void 0&&(r.visible=n)}if(!r.disabled){const n=this.scheduler.triggerItemEnable(i.id,s);n!==void 0&&(r.disabled=!n)}}},{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){t===void 0?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];V(this.model,a=>{a.controlLogics&&e.push(...a.controlLogics)},{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach(a=>{a.capLanguageRes&&a.capLanguageRes.lanResTag&&(a.caption=ibiz.i18n.t(a.capLanguageRes.lanResTag,a.caption)),a.itemType==="ITEMS"&&a.detoolbarItems&&t(a.detoolbarItems)})};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),ui=d("ContextMenuController",class extends Lu{}),xc=d("DashboardController",class extends Y{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",e=>{const a=ai(e.data);a&&this.dataChangeNotify(a)})}async initPortlets(t,e){if(!t?.length)return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map(async s=>{var i;if(s.controlType&&a.includes(s.controlType))return;const r=await As(s);if(r){this.providers[s.id]=r;const n=await r.createController(s,this,e);this.portlets[s.id]=n,(i=s.controls)!=null&&i.length&&await this.initPortlets(s.controls,n)}}))}async dataChangeNotify(t){await it(Object.values(this.portlets).map(async e=>e.dataChangeNotify(t)))}}),Vc=d("CustomDashboardController",class{constructor(t){this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null;var e,a;this.model=t,this.config=new Bt(t.appId,"dynadashboard","dashboard_".concat(((e=this.model.appDataEntityId)==null?void 0:e.toLowerCase())||"app","_").concat((a=this.model.codeName)==null?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),Ru=d("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}}),ft=d("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:a,height:s}=qt(this.model);this.state.layout.width="".concat(a),this.state.layout.height="".concat(s)}e?.cssName&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new Ru}onDataChange(t){let e=t.data[0];e&&e instanceof X&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!((t=e?.uiactionGroupDetails)!=null&&t.length))return;const a=new pt;e.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new ht(i.id,this.dashboard.context.srfappid,r);a.addState(i.id,n)}}),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:s}=this.dashboard.view.model;s&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const s=t.uiactionId;await G.execAndResolved(s,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=At(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)}}),kc=d("ContainerPortletController",class extends ft{}),Wc=d("ViewPortletController",class extends ft{}),Uc=d("MenuPortletController",class extends ft{}),zc=d("ChartPortletController",class extends ft{}),Gc=d("ActionBarPortletController",class extends ft{}),jc=d("HtmlPortletController",class extends ft{}),Kc=d("ListPortletController",class extends ft{}),Hc=d("RawItemPortletController",class extends ft{}),ci=d("DataViewControlService",class extends rt{initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.dedataViewDataItems)==null||t.forEach(e=>{const a=e.id.toLowerCase(),s=e.appDEFieldId;let i;if(s){const r=s.toLowerCase();i=new J(a,r,{isOriginField:!0,dataType:e.dataType})}else i=new J(a,a);this.dataUIMap.set(a,i)})}}),Tu=d("DataViewControlController",class extends tt{get enableNew(){return this.model.enableCardNew===!0}initState(){super.initState(),this.state.noSort=this.model.noSort===!0,this.state.size=this.model.pagingSize||20,this.state.singleSelect=this.model.singleSelect===!0,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new ci(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(t=e?.uiactionGroupDetails)!=null&&t.length&&this.state.groups.forEach(async a=>{const s=new pt;e.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new ht(i.id,this.context.srfappid,r);s.addState(i.id,n)}}),await s.update(),a.groupActionGroupState=s})}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach(s=>{s.selectedData=[]}),this.state.selectedData.forEach(s=>{const i=s[a],r=this.state.groups.find(n=>n.key===i);r&&r.selectedData.push(s)}),this.state.singleSelect)this.state.groups.forEach(s=>{var i,r;let n=t;s.selectedData.indexOf(n)!==-1?(n&&n instanceof X&&(n=n.getOrigin()),n&&((i=s.groupActionGroupState)==null||i.update(n,this.model.appDataEntityId))):(r=s.groupActionGroupState)==null||r.update(void 0,this.model.appDataEntityId)});else{const s=this.state.groups.find(i=>i.children.indexOf(t)!==-1);s&&((e=s.groupActionGroupState)==null||e.update(s.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)e[a].itemType==="ACTIONITEM"&&(t=e[a]);return t}getOptItemAction(t){var e;const a=new pt,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new m(this.model,"\u64CD\u4F5C\u9879\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A\u7EC4");if(!((e=s.deuiactionGroup.uiactionGroupDetails)!=null&&e.length))return ibiz.log.debug("\u64CD\u4F5C\u9879\u754C\u9762\u884C\u4E3A\u7EC4\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A"),a;s.deuiactionGroup.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new ht(i.id,this.context.srfappid,r);a.addState(i.id,n)}}),a.update(t.getOrigin())}return a}async onActionClick(t,e,a){const s=t.uiactionId;await G.execAndResolved(s,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new m(this.model,"\u5206\u7EC4\u5C5E\u6027\u6CA1\u6709\u914D\u7F6E");e==="AUTO"?this.handleAutoGroup():e==="CODELIST"&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach(i=>{const r=i[t];C(r)||(a.has(r)||a.set(r,[]),a.get(r).push(i))});const s=[];a.forEach((i,r)=>{s.push({caption:r,key:r,children:[...i]})}),this.state.groups=s}}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 m(this.model,"\u5206\u7EC4\u4EE3\u7801\u8868\u6CA1\u6709\u914D\u7F6E");const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach(r=>{s.set(r.value,[])}),a.forEach(r=>{const n=r[t],o=s.get(n);o&&o.push(r)});const i=[];s.forEach((r,n)=>{const o=this.groupCodeListItems.find(u=>u.value===n);i.push({caption:o.text,key:o.value,children:r})}),this.state.groups=i}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;if(a&&s){const i=this.fieldIdNameMap.get(a);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(s.toLowerCase())}else this.state.sortQuery=""}}onClickNew(t,e){const a={...this.params,srfgroup:e};G.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const s=t.uiactionId,i={...this.params,srfgroup:a.key};await G.execAndResolved(s,{context:this.context,params:i,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!((t=this.model.dedataViewItems)!=null&&t.length))return;const e=[],{minorSortAppDEFieldId:a,minorSortDir:s}=this.model,i=a&&s;this.model.dedataViewItems.forEach(r=>{if(!r.enableSort)return;let{caption:n}=r;if(r.capLanguageRes&&(n=ibiz.i18n.t(r.capLanguageRes.lanResTag,r.caption)),!r.appDEFieldId)throw new m(r,"\u542F\u7528\u6392\u5E8F\u7684\u9879\u5FC5\u987B\u5173\u8054\u5B9E\u4F53\u5C5E\u6027");const o={caption:n,key:r.appDEFieldId};i&&a===r.appDEFieldId&&(o.order=s.toLowerCase()),e.push(o)}),e.length>0&&(this.state.sortItems=e)}}),ia=d("ExpBarControlController",class extends Y{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 m(this.model,"\u65E0\u6CD5\u83B7\u53D6\u591A\u6570\u636E\u90E8\u4EF6[".concat(this.model.xdataControlName,"]\u63A7\u5236\u5668"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return(t=this.model.controls)==null?void 0:t.find(a=>a.name===this.model.xdataControlName)}get isCache(){return this.controlParams.expcache==="CACHE"?!0:this.controlParams.expcache==="NO_CACHE"?!1:ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=(t=e.appDEFields)==null?void 0:t.filter(i=>i.enableQuickSearch),s=[];a?.forEach(i=>{i?.lnlanguageRes&&i.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(i.lnlanguageRes.lanResTag,i.logicName)):i?.logicName&&s.push(i.logicName)}),s.length>0&&(this.state.placeHolder=s.join("\u3001"))}}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){t.isInitialLoad&&(this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem())}navBySrfnav(){var t;const e=(t=this.xDataController)==null?void 0:t.state.items.find(s=>s[this.navKeyName]===this.state.srfnav);if(this.routeDepth&&$e(this.routeDepth)){e&&this.xDataController.setSelection([e]),this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});return}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){this.state.srfnav="",this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});return}this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:s}=t,i=this.getNavViewMsg(e[0],a,s);this._evt.emit("onNavViewChange",{navViewMsg:i})}prepareParams(t,e,a,s){const{navDER:i,navFilter:r,navigateContexts:n,navigateParams:o,appDataEntityId:u}=t,c={deName:u?B(u):void 0,navFilter:r,pickupDEFName:i?.pickupDEFName,navContexts:n,navParams:o},l={context:a,params:s,data:e},{resultContext:h,resultParams:p}=Yt(c,l),E=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];const D={...p};return{context:E,params:D}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes(((t=this.XDataModel)==null?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new f("\u591A\u8282\u70B9\u89C6\u56FE\u7531\u5B50\u7C7B\u5B9E\u73B0")}getNavViewMsg(t,e,a){const s=this.calcViewModelId(),i=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:i.context,params:i.params,viewId:s,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const e=this.layoutPanel.panelItems.control_toolbar;e&&(e.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 a=this.layoutPanel.panelItems.control_header;a&&(a.state.visible=!1)}})}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),Xc=d("CalendarExpBarController",class extends ia{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find(a=>a.itemType===t)}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new m(this.model,"\u65E0\u6CD5\u83B7\u53D6\u591A\u6570\u636E\u90E8\u4EF6[".concat(this.model.xdataControlName,"]\u63A7\u5236\u5668"));return t}navBySrfnav(){var t;const e=(t=this.xDataController)==null?void 0:t.state.items.find(s=>s.navId===this.state.srfnav);if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:s}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:s,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),Yc=d("TreeExpBarController",class extends ia{constructor(){super(...arguments),this.navKeyName="id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new m(this.model,"\u65E0\u6CD5\u83B7\u53D6\u591A\u6570\u636E\u90E8\u4EF6[".concat(this.model.xdataControlName,"]\u63A7\u5236\u5668"));return t}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach(s=>{s.id===t&&(a=s)}),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const s=t.id,i=t.deData||t,r=this.getNodeModel(t.nodeId);if(!r)throw new f("\u627E\u4E0D\u5230".concat(t.nodeId,"\u7684\u8282\u70B9\u6A21\u578B"));const n=this.prepareParams(r,i,e,a);return n.context.currentSrfNav=s,this.state.srfnav=s,{key:s,viewId:r.navAppViewId,isCache:this.isCache,...n}}navByFirstItem(){const t=this.xDataController.state.items.find(e=>!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(e)?!1:this.state.noNeedNavView?!0:this.navNodeModelIds.includes(e.nodeId));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;t?.forEach(e=>{e.navAppViewId&&this.navNodeModelIds.push(e.id)}),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach((a,s)=>{s===0?e.push(a):e.push("".concat(e[s-1],":").concat(a))}),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 e=this.layoutPanel.panelItems.control_toolbar;e&&(e.state.visible=!1)}return t||!!(this.model.showTitleBar&&this.model.title)}}),qc=d("ChartExpBarController",class extends ia{navByFirstItem(){if(!this.xDataController.state.items[0]){this.state.srfnav="",this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});return}const e=this.xDataController.generator.seriesGenerators.find(a=>a.chartDataArr.length>0&&a.model.navAppViewId);e&&this.xDataController.setActive(e.chartDataArr[0])}prepareParams(t,e,a,s){var i;const{context:r,params:n}=super.prepareParams(t,e,a,s);if(e._seriesModelId){const o=(i=t.dechartSerieses)==null?void 0:i.find(u=>u.id===e._seriesModelId);if(o){const{navigateContexts:u,navigateParams:c}=o,l=N(u,e,s,r),h=N(c,e,s,n);return{context:Object.assign(r.clone(),l),params:h}}}return{context:r,params:n}}getNavViewMsg(t,e,a){var s;let i;if(t._seriesModelId){const n=(s=this.XDataModel.dechartSerieses)==null?void 0:s.find(o=>o.id===t._seriesModelId);i=n?.navAppViewId}const r=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:r.context,params:r.params,viewId:i,isCache:this.isCache}}}),li=d("FormController",class extends Y{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new X,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await it(Object.values(this.details).map(async e=>e.dataChangeNotify(t)))}formStateNotify(t){Object.values(this.details).forEach(e=>{e.formStateNotify(t)})}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=ve(this.dataChangeNotify.bind(this),(t,e)=>[Array.from(new Set([...t[0],...e[0]]))],200),this._evt.on("onFormDetailEvent",t=>{var e;(e=this.scheduler)==null||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)})}async initDetailControllers(t=this.model.deformPages,e=this,a=void 0){await Promise.all(t.map(async s=>{const i=await gs(s);if(!i)return;e.providers[s.id]=i;const r=await i.createController(s,e,a);if(e.details[s.id]=r,s.detailType==="FORMITEM"&&e.formItems.push(r),s.detailType==="MDCTRL"&&e.formMDCtrls.push(r),Ja(s))return;const n=$a(s);n.length&&await this.initDetailControllers(n,e,r)}))}getData(){return[this.state.data]}async setDataValue(t,e){if(!(Object.prototype.hasOwnProperty.call(this.state.data,t)&&!Je(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(await Promise.all([...this.formItems,...this.formMDCtrls].map(e=>e.validate()))).findIndex(e=>!e)===-1}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];V(this.model,a=>{a.controlLogics&&e.push(...a.controlLogics)},{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}}),di=class extends ce{setDefault(t,e,a,s){V(this.model,i=>{if(i.detailType==="FORMITEM"){const{createDVT:r,createDV:n,updateDVT:o,updateDV:u,valueFormat:c}=i,l=s==="create"?r:o,h=s==="create"?n:u,p=i.id.toLowerCase(),E=pe({name:p,valueType:l,defaultValue:h,valueFormat:c},{data:t,context:e,params:a});E!==void 0&&(t[p]=E)}},{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Bu=d("SearchFormService",class extends di{async getDraft(t,e={}){let s={ok:!0,status:200,data:this.getFilteredData({...e})};return s=this.handleResponse(s),s.ok&&s.data&&this.setDefault(s.data,t,e,"create"),s}initUIDataMap(){V(this.model,t=>{if(t.detailType==="FORMITEM"){const e=t.id.toLowerCase();this.dataUIMap.set(e,new J(e,e))}},{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach(a=>{t[a.dataKey]!==void 0&&(e[a.dataKey]=t[a.dataKey])}),e}}),Qc=d("SearchFormController",class extends li{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Bt(this.model.appId,"dynafilter","searchform_".concat(((t=this.model.appDataEntityId)==null?void 0:t.toLowerCase())||"app","_").concat((e=this.model.codeName)==null?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new Bu(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};await this.evt.emit("onBeforeLoadDraft",{params:t});let e;try{e=await this.service.getDraft(this.context,t)}catch(a){throw this.actionNotification("GETDRAFTERROR",{error:a}),a}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach(e=>{const a=this.state.data[e];a!=null&&a!==""&&(t[e]=a)}),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&e.code==="Enter"&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const s=this.model.searchButtonPos||"RIGHT";e=s==="BOTTOM",a=s!=="BOTTOM",t==="NONE"&&(e=!0,a=!0);const i=r=>{let n,o="";if(["rootPanelItems","panelItems"].find(u=>r[u]?(n=r[u],o=u,!0):!1),n&&n.length>0){const u=[];n.forEach(c=>{e&&c.id==="control_buttons_right"||a&&c.id==="control_buttons_bottom"||(u.push(c),i(c))}),u.length<n.length&&(r[o]=u)}};(a||e)&&i(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 f("\u6CA1\u6709\u627E\u5230\u53EF\u4EE5\u5E94\u7528\u7684\u641C\u7D22\u6761\u4EF6");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new f("\u6CA1\u6709\u627E\u5230\u4FDD\u5B58\u7684\u641C\u7D22\u6761\u4EF6");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),ot=d("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){return this.parent&&(this.parent.visible===!1||this.showMoreMode===1&&this.parent.isShowMore===!1)?!1:e},set(s){return e=s,!0}});let a;Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return a!==void 0?a:this.parent?this.parent.keepAlive:!1},set(s){return a=s,!0}})}}),Ou=d("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Ou||{})),_u=d("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(_u||{})),mt=d("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a,capLanguageRes:s}=this.model;if(t){const{width:i,height:r}=qt(t);this.state.layout.width="".concat(i),this.state.layout.height="".concat(r)}e?.cssName&&this.state.class.container.push(e.cssName),a?.cssName&&this.state.class.label.push(a.cssName),s&&s.lanResTag&&(this.model.caption=ibiz.i18n.t(s.lanResTag,this.model.caption))}createState(){var t;return new ot((t=this.parent)==null?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||(a=this.model.defdgroupLogics)==null||a.forEach(s=>{const i=s.relatedDetailNames||[];if(e||kt(i,t))try{const r=te(this.data,s);switch(s.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!r;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!r;break;case"PANELVISIBLE":this.dynaLogicResult.visible=r;break;default:}}catch(r){ibiz.log.error(r)}})}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=At(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=At(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(e!==!0&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(e!==!1&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});a!==void 0&&(e=a)}e!==void 0&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(e!==!0&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.required=e)}async onClick(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),Mu=d("FormButtonState",class extends ot{constructor(){super(...arguments),this.loading=!1}}),$c=d("FormButtonController",class extends mt{createState(){var t;return new Mu((t=this.parent)==null?void 0:t.state)}async onClick(t){this.state.loading=!0;try{this.model.actionType==="UIACTION"&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await G.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)}}),xu=d("FormDruipartState",class extends ot{constructor(){super(...arguments),this.showMask=!1}}),Jc=d("FormDRUIPartController",class extends mt{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new xu((t=this.parent)==null?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(e=>!!e),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),kt(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData=t==="DRAFT",this.model.maskMode!==0&&(this.state.showMask=this.isNewData),(t==="LOAD"||t==="DRAFT"||t==="SAVE")&&this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;k(e)&&(t=Object.assign(t,N(e,this.data,this.form.params,this.form.context)));const a=N(this.model.navigateParams,this.data,this.form.params,this.form.context);if(!this.state.viewComponentKey)this.state.viewComponentKey=K(),this.navContext=t,this.navParams=a;else if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",()=>{this.isNewData||this.embedView.call("Load")}),this.embedView.evt.on("onDataChange",e=>{["LOAD","LOADDRAFT"].includes(e.actionType)||(ibiz.log.debug("\u63A5\u6536\u5230\u5173\u7CFB\u754C\u9762\u7684\u6570\u636E\u53D8\u66F4\u4E8B\u4EF6",e),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))})}}),hi=d("FormGroupPanelState",class extends ot{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}}),Vu=d("FormGroupPanelController",class extends mt{get disableClose(){const{titleBarCloseMode:t}=this.model;return t===0||t===void 0}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||t===1}createState(){var t;return new hi((t=this.parent)==null?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const e=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(e)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!((t=e?.uiactionGroupDetails)!=null&&t.length))return;const a=new pt;e.uiactionGroupDetails.forEach(s=>{const i=s.uiactionId;if(i){const r=new ht(s.id,this.form.context.srfappid,i);a.addState(s.id,r)}}),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await G.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),ku=d("FormItemState",class extends ot{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?!0:e},set(a){return e=a,!0}})}}),Zc=d("FormItemController",class extends mt{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new ku((t=this.parent)==null?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&this.model.editor.editorType!=="HIDDEN"&&(this.editorProvider=await ie(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ke(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Ze(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...ta(this.model.editor)),this.rules.length>0&&(this.validator=new Se({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=this.data.srfuf===0;(e&&t===2||!e&&t===1)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach(s=>{t.includes(s)&&(a=!0)}),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&z(this.data[this.name]))return this.state.error="\u8BF7\u586B\u5199".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}setDefaultValue(t,e=this.data){const{createDVT:a,createDV:s,updateDVT:i,updateDV:r}=this.model,n=t?a:i,o=t?s:r,u=pe({name:this.name,valueType:n,defaultValue:o,valueFormat:this.model.valueFormat},{data:e,context:this.context,params:this.params});u!==void 0&&(e[this.name]=u)}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})}}),ra=d("FormMDCtrlController",class extends mt{get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return Wt.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return Wt.checkPermission(this.model.buildInActions,2)}get enableDelete(){return Wt.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}}),tl=d("FormMDCtrlMDController",class extends ra{get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new m(this.model,"\u591A\u6570\u636E\u90E8\u4EF6\u672A\u914D\u7F6E\u5185\u5BB9\u90E8\u4EF6");t.controlType==="GRID"&&Ut(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await Et(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",()=>{this.updateFormItem()}),t.evt.on("onRemoveSuccess",()=>{this.updateFormItem()})}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if(this.model.contentType==="GRID")this.mdController.newRow();else throw new w(this.model,"\u591A\u6570\u636E\u90E8\u4EF6\u7C7B\u578B".concat(this.model.contentType,"\u6682\u4E0D\u652F\u6301\u6DFB\u52A0\u6570\u636E"))}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController\u4E0D\u5B58\u5728")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh()}}),Wu=class extends ot{},el=d("FormMDCtrlFormController",class extends ra{constructor(){super(...arguments),this.formMap=new Map}createState(){var t;return new Wu((t=this.parent)==null?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new m(this.model,"\u591A\u6570\u636E\u90E8\u4EF6\u672A\u914D\u7F6E\u5185\u5BB9\u90E8\u4EF6");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await Et(t);e&&(this.formProvider=e);const{appDataEntityId:a}=this.model.contentControl;this.deName=B(a)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e="fetchdefault",a=await ibiz.hub.getApp(this.model.appId).deService.exec(t,e,this.context,this.params);a.ok&&(this.state.items=a.data.map(s=>{const i=this.context.clone();i[this.deName]=s.srfkey;const r={...this.params};return{id:s.srfkey,context:i,params:r}}))}async formStateNotify(t){await super.formStateNotify(t),await this.fetchData()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",a=>{const s=a.data[0],i=this.state.items.find(r=>r.id===t);i&&i.context[this.deName]!==s.srfkey&&(i.context[this.deName]=s.srfkey),this.updateFormItem()}),e.evt.on("onRemoveSuccess",()=>{this.updateFormItem()})}async remove(t){const e=this.formMap.get(t);if(!e)throw new f("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94".concat(t,"\u7684\u8868\u5355\u63A7\u5236\u5668"));await e.remove();const a=this.state.items.findIndex(s=>s.id===t);a!==-1&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const s={id:K(),context:e,params:a};t!==void 0?this.state.items.splice(t,0,s):this.state.items.push(s)}refresh(){this.fetchData()}async dataChangeNotify(t){await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh()}}),al=d("FormMDCtrlRepeaterController",class extends ra{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get name(){return this.model.id}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 w(this.model,"\u6682\u4E0D\u652F\u6301\u91CD\u590D\u5668\u6837\u5F0F".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach(s=>{e[s]=this.form.model[s]}),this.repeatedForm=A(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],t!==void 0?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData){this.setValue(null);return}const e=this.value.filter((a,s)=>t!==s);this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach(s=>{t.includes(s)&&(a=!0)}),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),Uu=d("FormPageState",class extends hi{}),sl=d("FormPageController",class extends Vu{createState(){var t;return new Uu((t=this.parent)==null?void 0:t.state)}}),zu=d("FormRawItemState",class extends ot{}),il=d("FormRawItemController",class extends mt{createState(){var t;return new zu((t=this.parent)==null?void 0:t.state)}}),Gu=d("FormTabPageState",class extends ot{}),rl=d("FormTabPageController",class extends mt{createState(){var t;return new Gu((t=this.parent)==null?void 0:t.state)}}),ju=d("FormTabPanelState",class extends ot{}),nl=d("FormTabPanelController",class extends mt{createState(){var t;return new ju((t=this.parent)==null?void 0:t.state)}}),Ku=d("EditFormService",class extends di{async get(t,e={}){var a;let s=await this.exec(((a=this.model.getControlAction)==null?void 0:a.appDEMethodId)||"get",t,void 0,e);return s=this.handleResponse(s),s.ok&&s.data&&this.setDefault(s.data,t,e,"update"),s}async getDraft(t,e={}){var a;let s=await this.exec(((a=this.model.getDraftControlAction)==null?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return s=this.handleResponse(s),s.ok&&s.data&&this.setDefault(s.data,t,e,"create"),s}async remove(t,e={}){var a;return await this.exec(((a=this.model.removeControlAction)==null?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const s=e instanceof X?e.getOrigin():e,i=this.getFilteredData(s);let r=await this.exec(((a=this.model.createControlAction)==null?void 0:a.appDEMethodId)||"create",t,i);return r=this.handleResponse(r),r}async update(t,e){var a;const s=e instanceof X?e.getOrigin():e,i=this.getFilteredData(s);let r=await this.exec(((a=this.model.updateControlAction)==null?void 0:a.appDEMethodId)||"update",t,i);return r=this.handleResponse(r),r}async goBack(t,e){var a;const i=(a=this.model.goBackControlAction)==null?void 0:a.appDEMethodId;if(!i)throw new m(this.model,"\u7F3A\u5C11\u8FD4\u56DE\u64CD\u4F5C\u5B9E\u4F53\u884C\u4E3A");let r=await this.exec(i,t,e instanceof X?e.getOrigin():e);return r=this.handleResponse(r),r}async updateFormItem(t,e,a={}){let s=await this.exec(t,e,a);return s=this.handleResponse(s),s}async wfStart(t,e,a){var s;const r=((s=this.model.wfstartControlAction)==null?void 0:s.appDEMethodId)||"wfstart";return(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(r,t,e,a instanceof X?a.getOrigin():a)}async wfSubmit(t,e,a){var s;const i=this.model;let r="";return e.type?r=e.type:r=((s=i.wfsubmitControlAction)==null?void 0:s.appDEMethodId)||"wfsubmit",(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(r,t,e,a instanceof X?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];V(this.model,e=>{if(e.detailType==="FORMITEM"||e.detailType==="MDCTRL"){const a=e,s=a.id.toLowerCase(),i=a.fieldName||e.appDEFieldId;let r;i?r=new J(s,i,{isOriginField:!0,dataType:a.dataType}):r=new J(s,s,{isOriginField:t.includes(s)}),this.dataUIMap.set(s,r)}},{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach(a=>{t[a.dataKey]!==void 0&&(e[a.dataKey]=t[a.dataKey])}),e}}),ol=d("EditFormController",class extends li{get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new Ku(this.model),await this.service.init(this.context),this.autoSave=jt(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),s=await this.service.getDraft(e,a)}catch(i){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:i}),i}finally{await this.endLoading()}return this.state.data=s.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=A(this.context),e=A(this.params),s=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(s&&this.params[s]){const r=B(this.model.appDataEntityId);t[r]=this.params[s],delete e[s],delete this.params[s],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(r){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:r}),r}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=K(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Ya(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:s,params:i}=this.handlerAbilityParams(t),r=A(i);let n;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),n=await this.service.get(s,r)}catch(o){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:o}),o}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=n.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=t?.silent===!0;if(this.state.processing)return await zt(500,this.save.bind(this),[t]);if(!await this.validate())throw new f("\u8BF7\u68C0\u67E5\u8868\u5355\u586B\u5199\uFF01");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:s,data:i}=this.handlerAbilityParams(t),r=i[0],n=r.srfuf===0;let o;try{o=n?await this.service.create(s,r):await this.service.update(s,r)}catch(c){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:c}),c}finally{e||await this.endLoading()}const u=t?.noFillBack===!0;return o.data&&(u?(this.data.updatedate=o.data.updatedate,this.data.srfkey=o.data.srfkey):Ut(this.data,o.data),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","\u4FDD\u5B58\u6210\u529F")}),ibiz.mc.command.send(this.data.$origin,n?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let s,i=!1;if(await this.evt.emit("onBeforeRemove",void 0),this.data.srfuf===1){if(i=await ibiz.modal.confirm({title:"\u63D0\u793A",desc:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F"}),!i)return!1;await this.startLoading();try{s=await this.service.remove(e,a)}catch(r){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:r}),r}finally{await this.endLoading()}i=s.ok}return this.state.data=new X,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),i}async goBack(){await this.startLoading();let t;try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&Ut(this.data,t.data),this.data}async updateFormItem(t){var e;const a=(e=this.model.deformItemUpdates)==null?void 0:e.find(c=>c.id===t);if(!a)throw new f("\u6CA1\u627E\u5230".concat(t,"\u8868\u5355\u9879\u66F4\u65B0"));const{appDEMethodId:s,defiupdateDetails:i,customCode:r,scriptCode:n,showBusyIndicator:o}=a,u=i?.map(c=>c.id);try{o&&this.startLoading();let c;if(r&&n)c=O.execScriptFn({...this.getEventArgs(),data:this.data},n,{isAsync:!1});else{const l={...this.params,...this.data.getOrigin()};c=(await this.service.updateFormItem(s,this.context,l)).data}c&&u?.length&&await Promise.all(u.map(l=>this.setDataValue(l,c[l]))),await zt(2e3)}finally{o&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new f("\u8BF7\u68C0\u67E5\u8868\u5355\u586B\u5199\uFF01");await this.startLoading();const{context:a,params:s}=this.handlerAbilityParams(t);try{await this.service.wfStart(a,s,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(i){throw this.actionNotification("WFSTARTERROR",{error:i}),i}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"\u6D41\u7A0B\u542F\u52A8\u6210\u529F"})}async wfSubmit(t){if(!await this.validate())throw new f("\u8BF7\u68C0\u67E5\u8868\u5355\u586B\u5199\uFF01");await this.startLoading();const{context:a,params:s}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(a,s,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(i){throw this.actionNotification("WFSUBMITERROR",{error:i}),i}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"\u6D41\u7A0B\u63D0\u4EA4\u6210\u529F"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(this.model.enableAutoSave)try{await this.save({silent:!0,noFillBack:!0})}catch(t){ibiz.log.error(t)}}setSimpleData(t){const e={...t};this.formItems.forEach(a=>{Object.prototype.hasOwnProperty.call(e,a.name)||(e[a.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)}}),na=d("GridColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1;var a;this.model=t,this.grid=e,this.isAdaptiveColumn=t.widthUnit==="STAR",this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(a=this.deGridDataItem)!=null&&a.customCode&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!!(this.grid.model.enableRowEdit&&this.model.enableRowEdit)}get deGridDataItem(){var t;return(t=this.grid.model.degridDataItems)==null?void 0:t.find(e=>e.id===this.model.id)}get valueFormat(){var t;return(t=this.deGridDataItem)==null?void 0:t.format}get dataType(){var t;return(t=this.deGridDataItem)==null?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if((e=this.deGridDataItem)!=null&&e.scriptCode)return O.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}}),pi=d("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach(a=>{this.errors[a]===void 0&&(this.errors[a]=null)}),Object.values(e.uaColumns).forEach(a=>{a.initActionStates(this)}),Object.values(e.fieldColumns).forEach(a=>{a.initActionStates(this)}),Object.values(e.editColumns).forEach(a=>{this.editColStates[a.fieldName]={disabled:!1,readonly:!1,editable:ibiz.config.grid.editShowMode==="all",required:!1}})}}),fi=d("GridService",class extends rt{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];(t=this.model.degridColumns)==null||t.forEach(a=>{const s=a.id.toLowerCase(),i=a.appDEFieldId;let r;if(i){const n=i.toLowerCase(),o=e.find(u=>u.appDEFieldId===i);if(o)r=new J(s,n,{isOriginField:!0,dataType:o.dataType});else throw new m(a,"\u672A\u627E\u5230\u5BF9\u5E94\u7684\u8868\u683C\u6570\u636E\u9879[".concat(i,"]"))}else r=new J(s,s);this.dataUIMap.set(s,r)})}}async updateGridEditItem(t,e,a={}){let i=await(await this.app.deService.getService(this.model.appDataEntityId)).exec(t,e,a);return i=this.handleResponse(i),i}}),Hu=d("GridController",class extends tt{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="\u5408\u8BA1"}get groupCodeListItems(){var t;return(t=this.groupFieldColumn)==null?void 0:t.codeListItems}get enableAgg(){return this.model.aggMode!=="NONE"}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=this.model.noSort===!0,this.state.size=this.model.pagingSize||20,this.state.singleSelect=this.model.singleSelect===!0,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await super.onCreated(),this.service=new fi(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=ve(this.dataChangeNotify.bind(this),(t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))],200),await this.initGroup()}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:a}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find(r=>r.model.appDEFieldId===t),!this.groupFieldColumn)throw new m(this.model,"\u6CA1\u6709\u914D\u7F6E\u5206\u7EC4\u5C5E\u6027\u7684\u5C5E\u6027\u5217");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new m(this.groupFieldColumn.model,"\u5206\u7EC4\u5C5E\u6027\u7684\u5C5E\u6027\u5217".concat(s,"\u6CA1\u6709\u914D\u7F6E\u4EE3\u7801\u8868"));const i=this.state.columnStates.findIndex(r=>r.key===this.groupFieldColumn.model.codeName);if(i!==-1&&i!==0){if(this.isMultistageHeader)throw new m(this.model,"\u8BF7\u5C06\u5206\u7EC4\u5C5E\u6027\u5217".concat(s,"\u914D\u7F6E\u4E3A\u7B2C\u4E00\u5217"));const r=this.state.columnStates.splice(i,1);this.state.columnStates.unshift(...r)}if(a==="CODELIST"){if(!e)throw new m(this.model,"\u4EE3\u7801\u8868\u5206\u7EC4\u6A21\u5F0F\u9700\u8981\u914D\u7F6E\u4EE3\u7801\u8868");if(this.groupFieldColumn.model.appCodeListId!==e)throw new m(this.model,"\u5206\u7EC4\u4EE3\u7801\u8868\u4E0E\u5C5E\u6027\u5217".concat(s,"\u7684\u4EE3\u7801\u8868\u4E0D\u4E00\u81F4"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await it(Object.values(this.fieldColumns).map(async a=>{await a.loadCodeList()}),!1),this.state.rows=e.map(a=>{const s=new pi(a,this);return this.gridStateNotify(s,"LOAD"),s}),this.state.rows.forEach(a=>{Object.values(a.uaColStates).forEach(s=>{s.update(a.data.getOrigin(),this.model.appDataEntityId)})}),this.state.rows.forEach(a=>{Object.values(a.uiActionGroupStates).forEach(s=>{s.update(a.data.getOrigin(),this.model.appDataEntityId)})}),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const s=new Map,i=a==="CODELIST",r=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach(n=>{s.set(n.value,[])}),t.forEach(n=>{const o=n[r];!i&&!s.has(o)&&s.set(o,[]),s.has(o)&&s.get(o).push(n)}),this.state.groups=[],s.forEach((n,o)=>{const u=this.groupCodeListItems.find(c=>c.value===o);this.state.groups.push({caption:u?.text||"".concat(o),key:o,children:n})})}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:a}=this.model;if(t!=="ALL")return;if(!a||!e)throw new m(this.model,"\u7F3A\u5C11\u914D\u7F6E\u805A\u5408\u5B9E\u4F53\u6216\u805A\u5408\u6570\u636E\u96C6");const s=await this.getFetchParams(),r=await ibiz.hub.getApp(this.context.srfappid).deService.exec(e,a,this.context,void 0,s);r.data.length&&([this.state.remoteAggResult]=r.data)}calcAggResult(t){Object.values(this.fieldColumns).forEach(e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)})}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach(a=>{if(a.children.length){const s=a.children.findIndex(i=>i.srfkey===t.srfkey);s!==-1&&a.children.splice(s,1)}})}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a)){ibiz.log.error("\u4E0D\u652F\u6301\u65B0\u5EFA\u884C");return}if(a==="row"&&this.state.rows.find(c=>c.showRowEdit))throw new f("\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u884C\u7F16\u8F91\u4E2D\u7684\u884C\u7684\u64CD\u4F5C");const s={...this.params},i=this.calcDefaultValue({},!0);Object.assign(s,i);let r;try{r=await this.service.getDraft(this.context,s)}catch(u){throw this.actionNotification("GETDRAFTERROR",{error:u}),u}const n=r.data;Ca(n,i),this.state.items.unshift(n);const o=new pi(n,this);this.state.rows.unshift(o),this.gridStateNotify(o,"DRAFT"),a==="row"&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:n})}async save(t){if(this.state.isSimple)return;const e=t.srfuf===0,a=this.findRowState(t);if(!a)throw new f("\u884C\u6570\u636E\u4E0D\u5B58\u5728");if(!a.modified){ibiz.log.debug("\u503C\u6CA1\u6709\u53D1\u751F\u6539\u53D8");return}if(a.processing){await zt(500,this.save.bind(this),[t]);return}if(!await this.validate(a))throw new f("\u884C\u6570\u636E\u6821\u9A8C\u4E0D\u901A\u8FC7\uFF0C\u4FDD\u5B58\u53D6\u6D88");let i;const r=B(this.model.appDataEntityId),n=this.context.clone();n[r]=t.srfkey;try{i=e?await this.service.create(n,t):await this.service.update(n,t)}catch(u){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:u,data:a.data}),u}const o=this.findRowStateIndex(t);this.state.items.splice(o,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter(e=>e.modified).map(e=>e.data);t.length&&await it(t.map(e=>this.save(e)))}async initColumnsController(t){var e;const a=await re(t);if(!a)return;this.providers[t.codeName]=a;const s=await a.createController(t,this);this.columns[t.codeName]=s,t.columnType==="DEFGRIDCOLUMN"||t.columnType==="DEFTREEGRIDCOLUMN"?(this.fieldColumns[t.codeName]=s,t.enableRowEdit&&(this.editColumns[t.codeName]=s)):t.columnType==="UAGRIDCOLUMN"?this.uaColumns[t.codeName]=s:t.columnType==="GROUPGRIDCOLUMN"&&(this.isMultistageHeader=!0,await Promise.all(((e=t.degridColumns)==null?void 0:e.map(async i=>{await this.initColumnsController(i)}))||[]))}initColumnStates(){V(this.model,t=>{t.columnType!=="GROUPGRIDCOLUMN"&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:t.columnType==="UAGRIDCOLUMN"})},{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter(i=>!i.hidden),e=t.length,{frozenFirstColumn:a,frozenLastColumn:s}=this.model;t.forEach((i,r)=>{i.uaColumn?i.fixed=r+1<=Math.floor(e/2)?"left":"right":a&&r<a?i.fixed="left":s&&r>=e-s&&(i.fixed="right")})}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map(async t=>this.initColumnsController(t)))}async setRowValue(t,e,a){if(!(Object.prototype.hasOwnProperty.call(t.data,e)&&!Je(t.data[e],a))){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this.evt.emit("onGridDataChange",{data:this.state.rows.map(s=>s.data)})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await it(Object.values(this.editColumns).map(async a=>a.dataChangeNotify(t,e)))}gridStateNotify(t,e){Object.values(this.editColumns).forEach(a=>{a.gridStateNotify(t,e)})}async validate(t){return(await Promise.all(Object.values(this.editColumns).map(a=>a.validate(t)))).findIndex(a=>!a)===-1}async toggleRowEdit(){if(!this.model.enableRowNew)throw new f("\u5F53\u524D\u8868\u683C\u4E0D\u652F\u6301\u884C\u7F16\u8F91\uFF0C\u65E0\u6CD5\u5207\u6362\u5F00\u542F\u884C\u7F16\u8F91");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const s=e===void 0?!t.showRowEdit:e;if(t.showRowEdit!==s){if(s===!1)if(a)await this.save(t.data);else{if(t.data.srfuf===0)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(r=>r.showRowEdit))throw new f("\u540C\u65F6\u53EA\u80FD\u6709\u4E00\u884C\u5F00\u542F\u884C\u7F16\u8F91");if(t.data.srfuf===1){t.cacheData=A(t.data);const r=this.calcDefaultValue(t.data,!1);Object.assign(t.data,r)}}t.showRowEdit=s,Object.values(this.editColumns).forEach(i=>{t.editColStates[i.fieldName].editable=s}),this.evt.emit("onRowEditChange",{row:t})}}setSort(t,e){if(t&&e){const a=this.fieldIdNameMap.get(t).toLowerCase();super.setSort(a,e)}else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;if(a&&s){const i=this.fieldIdNameMap.get(a);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(s.toLowerCase())}else this.state.sortQuery=""}}async updateGridEditItem(t,e){var a;const s=(a=this.model.degridEditItemUpdates)==null?void 0:a.find(l=>l.id===e);if(!s)throw new f("\u6CA1\u627E\u5230".concat(e,"\u7F16\u8F91\u5217\u66F4\u65B0"));const{appDEMethodId:i,degeiupdateDetails:r,customCode:n,scriptCode:o}=s,u=r.map(l=>l.id);let c;if(n&&o)c=O.execScriptFn({...this.getEventArgs(),data:t.data},o,{isAsync:!1});else{const l={...this.params,...t.data.getOrigin()};c=(await this.service.updateGridEditItem(i,this.context,l)).data}c&&u?.length&&await Promise.all(u.map(l=>this.setRowValue(t,l,c[l])))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(t?.viewParam);let s;await this.startLoading();try{s=await this.service.fetch(e,a)}finally{await this.endLoading()}return s.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),s=(e=t.dedataExportItems)==null?void 0:e.map(async i=>{const r={...i};return i.codeListId&&(r.codeList=a.codeList.getCodeList(i.codeListId),r.codeListItems=await a.codeList.get(i.codeListId)),r});if(s)return Promise.all(s)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=(e=this.dataEntity.appDEDataExports)==null?void 0:e.find(u=>u.id===this.model.dedataExportId),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=u=>{var c;const l=new Map;this.allExportColumns&&this.allExportColumns.length>0?(c=this.allExportColumns)==null||c.forEach(p=>{p.codeListItems&&l.set(p.appDEFieldId,p.codeListItems)}):Object.keys(this.fieldColumns).forEach(p=>{this.fieldColumns[p].codeList&&l.set(p,this.fieldColumns[p].codeListItems)});const h=A(u.map(p=>p.getOrigin()));return h.forEach(p=>{Object.keys(p).forEach(D=>{var y;l.get(D)&&(p[D]=((y=l.get(D).find(v=>v.value===p[D]))==null?void 0:y.text)||p[D])})}),h},s=async()=>{var u;const c=(u=t.params)==null?void 0:u.type;let l=[];if(c==="activatedPage"&&(l=this.state.rows.map(h=>h.data)),c==="maxRowCount"||c==="customPage"){const{size:h}=this.state,{startPage:p,endPage:E}=t.params,D=c==="customPage"?{page:0,offset:(p-1)*h,size:(E-p+1)*h}:{size:1e3,page:0};l=await this.loadData({viewParam:D})}if(c==="selectedRows"&&(l=this.getData()),l.length===0)throw new f("\u65E0\u5BFC\u51FA\u6570\u636E");return a(l)},i=(u,c)=>c.map(l=>u.map(h=>l[h]));let r=[],n=[];this.allExportColumns&&this.allExportColumns.length>0?(r=this.allExportColumns.map(u=>u.appDEFieldId),n=this.allExportColumns.map(u=>u.caption)):(r=Object.keys(this.fieldColumns).map(u=>this.fieldColumns[u].model.id),n=Object.keys(this.fieldColumns).map(u=>this.fieldColumns[u].model.caption));const o=i(r,await s());await si(n,o,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach(s=>{const{createDV:i,createDVT:r,updateDV:n,updateDVT:o}=s.editItem,u=e?r:o,c=e?i:n,l=pe({name:s.fieldName,valueType:u,defaultValue:c,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});l!==void 0&&(a[s.fieldName]=l)}),a}findRowStateIndex(t){const a=t.srfuf===0?"tempsrfkey":"srfkey";return this.state.rows.findIndex(s=>s.data[a]===t[a])}findRowState(t){const e=this.findRowStateIndex(t);return e!==-1?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),this.state.mdctrlActiveMode===1&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach(a=>{a.capLanguageRes&&a.capLanguageRes.lanResTag&&(a.caption=ibiz.i18n.t(a.capLanguageRes.lanResTag,a.caption)),a.columnType==="GROUPGRIDCOLUMN"&&a.degridColumns&&t(a.degridColumns)})};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}}),Xu=d("GridFieldColumnController",class extends na{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}async onInit(){await super.onInit(),this.loadCodeList=jt(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new pt;e.uiactionGroupDetails.forEach(s=>{const i=s.uiactionId;if(i){const r=new ht(s.id,this.grid.context.srfappid,i);a.addState(s.id,r)}}),t.uiActionGroupStates[this.model.codeName]=a}}clickable(t){const e=t.data[this.model.codeName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:s}=this.model;if(!s)return{context:e,params:a};const{navigateContexts:i,navigateParams:r}=Be(s);let n={};i&&t&&(n=N(i,t,a,e));const o=Object.assign(e.clone(),n);let u={};r&&t&&(u=N(r,t,a,e));const c={...a,...u};return{context:o,params:c}}async openLinkView(t,e){if(!t.data[this.model.codeName])return;const s=this.model.linkValueItem||"srfkey",i=t.data[s];if(i==null)throw new w(this.model,"\u672A\u5728\u884C\u6570\u636E\u4E2D\u53D6\u5230 ".concat(s," \u7684\u503C"));const{linkAppViewId:r}=this.model;if(!r)return;const n=os(t.data),o=Object.assign(this.context.clone(),{srfkey:i,...n}),u=A(this.params),{context:c,params:l}=this.handlePublicParams(t.data,o,u),h=await ibiz.commands.execute(st.TAG,r,c,l,{event:e});h?.ok&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await G.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:i}=this.model;if(a==="NONE")return;const r=e||this.model.id;t=t.filter(u=>!C(u[r]));let n;if(this.grid.model.aggMode==="PAGE")switch(a){case"SUM":n=t.map(u=>u[r]).reduce((u,c)=>Gt(u,c),0);break;case"AVG":n=t.map(u=>u[r]).reduce((u,c)=>Gt(u,c),0)/t.length;break;case"MAX":n=Math.max(...t.map(u=>u[r]));break;case"MIN":n=Math.min(...t.map(u=>u[r]));break;default:throw new w(this.model,"\u6682\u672A\u652F\u6301\u5C5E\u6027\u5217\u805A\u5408\u6A21\u5F0F".concat(a))}else throw this.grid.model.aggMode==="ALL"?new w(this.model,"\u8FDC\u7A0B\u805A\u5408\u6682\u672A\u652F\u6301"):new w(this.grid.model,"\u6682\u672A\u652F\u6301\u805A\u5408\u6A21\u5F0F".concat(this.grid.model.aggMode));let o="".concat(n);if(s)try{o=ibiz.util.text.format("".concat(n),s)}catch{ibiz.log.error("".concat(n," \u503C\u683C\u5F0F\u5316\u9519\u8BEF"))}return o&&i&&(o+=i),o}formatValue(t=""){if(this.model.valueType!=="SIMPLE")return Oo.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(Vt.isDate(this.dataType)){const s=L(e).format(this.valueFormat);return s!=="Invalid Date"?s:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,a){const s=t.uiactionId;await G.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),ul=d("GridUAColumnController",class extends na{initActionStates(t){var e;const{deuiactionGroup:a}=this.model;if(!a)throw new m(this.model,"\u64CD\u4F5C\u5217\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A\u7EC4");if(!((e=a.uiactionGroupDetails)!=null&&e.length)){ibiz.log.debug("\u64CD\u4F5C\u5217\u754C\u9762\u884C\u4E3A\u7EC4\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A");return}const s=new pt;a.uiactionGroupDetails.forEach(i=>{const r=i.uiactionId;if(r){const n=new ht(i.id,this.grid.context.srfappid,r);s.addState(i.id,n)}}),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const s=t.uiactionId;await G.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),cl=d("GridFieldEditColumnController",class extends Xu{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}get fieldName(){return this.model.dataItemName}async onInit(){await super.onInit();const t=Qa(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&this.editItem.editor.editorType!=="HIDDEN"&&(this.editorProvider=await ie(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ke(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Ze(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...ta(this.editItem.editor)),this.rules.length>0&&(this.validator=new Se({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let s=!1;a&&a.length>0&&a.forEach(n=>{e.includes(n)&&(s=!0)}),s&&this.setRowValue(t,null),this.calcColumnDisabled(t);const i=t.editColStates[this.fieldName].required;if(this.calcColumnRequired(t),(i!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName))&&!await this.validate(t))throw new f("".concat(this.editItem.codeName,"\u6821\u9A8C\u62A5\u9519,").concat(t.errors[this.fieldName]));e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});a!==void 0&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=this.editItem.allowEmpty!==!1;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});a!==void 0&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!((e=this.editItem.editor)!=null&&e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=t.data.srfuf===0;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if(ibiz.config.grid.editShowMode!=="cell"&&t.editColStates[e].required&&z(t.data[e]))return t.errors[e]="\u8BF7\u586B\u5199".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:s}=a;return t.errors[e]=s[0].message,!1}return t.errors[e]=null,!0}}),ll=d("GridGroupColumnController",class extends na{}),Yu=d("ListService",class extends rt{initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.delistDataItems)==null||t.forEach(e=>{const a=e.id.toLowerCase(),s=e.appDEFieldId;let i;if(s){const r=s.toLowerCase();i=new J(a,r,{isOriginField:!0,dataType:e.dataType})}else i=new J(a,a);this.dataUIMap.set(a,i)})}}),dl=d("ListController",class extends tt{initState(){super.initState(),this.state.noSort=this.model.noSort===!0}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new Yu(this.model),await this.service.init(this.context)}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;if(a&&s){const i=this.fieldIdNameMap.get(a);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(s.toLowerCase())}else this.state.sortQuery=""}}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}setSelection(t){var e,a;super.setSelection(t);const s=t?.[0];(e=this.batchToolbarController)==null||e.calcButtonState(s,this.model.appDataEntityId),(a=this.quickToolbarController)==null||a.calcButtonState(s,this.model.appDataEntityId)}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&(e==="AUTO"?this.handleAutoGroup():e==="CODELIST"&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach(i=>{const r=a.get(i[t])||[];r.push(i),a.set(i[t],r)});const s=[];a.forEach((i,r)=>{s.push({caption:r,key:r,children:[...i]})}),this.state.groups=s}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,s=[],r=await ibiz.hub.getApp(this.context.srfappid).codeList.get(e,this.context,this.params),n=[];r.forEach(u=>{const c=a.filter(l=>l[t]===u.value);s.push({caption:u.text,key:u.value,children:[...c]}),n.push(u.value)});const o=a.filter(u=>n.indexOf(u[t])===-1);o.length>0&&s.push({caption:"\u5176\u4ED6",key:"\u5176\u4ED6",children:[...o]}),this.state.groups=s}}}),qu=d("PanelController",class extends Y{constructor(t,e,a,s,i){super(t,e,a,s),this.panelItems={},this.providers={},this.container=i}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(),(t=this.scheduler)!=null&&t.hasControlEventTrigger&&this._evt.on("onPanelItemEvent",e=>{this.scheduler.triggerControlEvent(e.panelItemName,e.panelItemEventName,e)})}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),(e=(t=this.data).destroy)==null||e.call(t),Object.values(this.panelItems).forEach(a=>{a.destroy()})}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map(async s=>{var i,r;const n=await Cs(s);if(!n)return;e.providers[s.id]=n;const o=await n.createController(s,e,a);e.panelItems[s.id]=o,(i=s.panelItems)!=null&&i.length&&!o.isDataContainer&&await this.initPanelItemControllers(s.panelItems,e,o),(r=s.panelTabPages)!=null&&r.length&&await this.initPanelItemControllers(s.panelTabPages,e,o)}))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new f("\u672A\u83B7\u53D6\u5230\u9762\u677F\u6570\u636E");const s=this.convertData(a);(e=(t=this.data).destroy)==null||e.call(t),this.state.data=s,this.panelStateNotify("LOAD")}async prepareData(){let t;switch(this.model.dataMode){case 1:this.inputData&&(t=this.inputData);break;default:t=this.inputData||{}}return t}convertData(t){const e=is(this.model),a=e.map(i=>i.id),s=new lo(e,t);return s._evt.on("change",i=>{a.includes(i)&&this.dataChangeNotify([i])}),s}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];V(this.model,a=>{a.controlLogics&&e.push(...a.controlLogics)},{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}}),hl=d("ViewLayoutPanelController",class extends qu{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(t=this.scheduler)!=null&&t.hasControlEventTrigger&&this.evt.on("onControlEvent",e=>{this.scheduler.triggerControlEvent(e.triggerControlName,e.triggerEventName,e.triggerEvent)})}registerToCtx(){}preprocessModel(t){var e;const a=s=>{const i=[];return s.forEach(r=>{r.itemType==="CONTAINER"&&r.predefinedType==="PANELPART"?i.push(...r.panelItems||[]):i.push(r)}),i.forEach(r=>{r.itemType==="CONTAINER"&&this.preprocessModel(r)}),i};t?t.panelItems=a(t.panelItems||[]):(e=this.model.rootPanelItems)!=null&&e.length&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),Qu=d("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var s;return((s=this.parent)==null?void 0:s.visible)!==!1&&e},set(s){return e=s,!0}});let a;Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return a!==void 0?a:this.parent?this.parent.keepAlive:!1},set(s){return a=s,!0}})}}),pl=d("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:s,height:i}=qt(t);this.state.layout.width="".concat(s),this.state.layout.height="".concat(i)}e?.cssName&&this.state.class.container.push(e.cssName),a?.cssName&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new Qu((t=this.parent)==null?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(e!==!0&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(e!==!1&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});a!==void 0&&(e=a)}e!==void 0&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(e!==!0&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});a!==void 0&&(e=!a)}e!==void 0&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||(a=this.model.panelItemGroupLogics)==null||a.forEach(s=>{const i=s.relatedItemNames||[];if(e||kt(i,t))try{const r=ee(this.data,s);switch(s.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!r;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!r;break;case"PANELVISIBLE":this.dynaLogicResult.visible=r;break;default:}}catch(r){ibiz.log.error(r)}})}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=At(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=At(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),fl=d("PickupViewPanelController",class extends Y{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),s={...this.params};t&&Object.assign(a,N(t,this.params,this.context)),e&&Object.assign(s,N(e,this.params,this.context)),this.state.context=a,this.state.params=s}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",e=>{this.evt.emit("onSelectionChange",e)}),this.embedView.evt.on("onDataActive",e=>{this.evt.emit("onDataActive",{data:e.data})})}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),$u=class{constructor(t,e){this.model=t,this.searchBar=e;var a;let s;t.appDEFieldId&&(s=yt(e.appDataEntity,t.appDEFieldId)),this.fieldName=s?s.codeName.toLowerCase():t.id,this.label=t.caption||s?.logicName||t.id,this.valueOP=(a=t.defsearchMode)==null?void 0:a.valueOP}get context(){return this.searchBar.context}get params(){return this.searchBar.params}async init(){if(!this.model.editor)throw new m(this.model,"\u7F3A\u5C11\u7F16\u8F91\u5668\u6A21\u578B");this.editorProvider=await ie(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}},ml=d("SearchBarController",class extends Y{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[]}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.model.enableFilter),this.model.enableFilter&&this.resetFilter()}async onCreated(){await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),await this.initSearchBarFilters()}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter(e=>e.enableQuickSearch);if(t.length){const e=[];t.forEach(a=>{a.lnlanguageRes&&a.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(a.lnlanguageRes.lanResTag,a.logicName)):a.logicName&&e.push(a.logicName)}),e.length>0&&(this.placeHolder=e.join("\u3001"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(t=this.state.selectedGroupItem)!=null&&t.data){const s=O.execSingleLine(this.state.selectedGroupItem.data),i=N(s,this.params,this.context);Object.assign(e,i)}const a=this.calcFilters();return a&&(e.searchconds=a),e}resetFilter(){this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;(t=this.model.searchBarFilters)!=null&&t.length&&(this.model.searchBarFilters.forEach(e=>{const a=new $u(e,this);this.filterControllers.push(a)}),await Promise.all(this.filterControllers.map(e=>e.init())))}calcFilters(){if(!this.model.enableFilter)return;let t=!1,e=!1;if(V(this.state.filterNodes[0],a=>{a.leaf&&(a.field&&a.valueOP&&!C(a.value)?t=!0:e=!0)}),t&&!e)return[this.formatFilters(this.state.filterNodes[0])]}formatFilters(t){return t.leaf?{condtype:"DEFIELD",fieldname:t.field,condop:t.valueOP,value:t.value}:{condtype:"GROUP",condop:t.logicType,bnotmode:!1,searchconds:t.children.map(e=>this.formatFilters(e))}}}),El=d("TabExpPanelController",class extends Y{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return this.controlParams.expcache==="CACHE"?!0:this.controlParams.expcache==="NO_CACHE"?!1:ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach(a=>{e.push({caption:a.caption,tabTag:a.id,class:a.sysCss?[a.sysCss.cssName]:[],sysImage:a.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;break}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find(e=>e.tabTag===this.state.defaultTabName);if(t){this.state.activeName=t.tabTag,this.changeToTab(this.activeTabViewPanelModel,this.routeDepth!==void 0&&$e(this.routeDepth));return}}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);e===!0&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find(a=>a.id===t)}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:s,navigateParams:i,appDataEntityId:r}=t,n={deName:B(r),navFilter:a,pickupDEFName:e?.pickupDEFName,navContexts:s,navParams:i},o={context:this.context,params:this.params,data:{}},{resultContext:u,resultParams:c}=Yt(n,o),l=Object.assign(this.context.clone(),u,{currentSrfNav:this.state.activeName}),h={...c};return{context:l,params:h}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}}),oa=d("TreeService",class extends rt{async fetchChildNodes(t,e){const{hasQuery:a}=e;let s=[];if(t){const i=Ft(this.model,{parentId:t?.nodeId,hasQuery:a});if(i.length===0)return;(await it(i.map(async n=>{const o=Jt(this.model,n.childDETreeNodeId);return this.fetchNodeDatasByType(o,n,t,e)}),!1)).forEach(n=>{s.push(...n)})}else{const i=$t(this.model);s=await this.fetchNodeDatasByType(i,void 0,void 0,e)}return s}async fetchNodeDatasByType(t,e,a,s){const i=Ft(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length===0,r={...s,leaf:i};let n=[];switch(t.treeNodeType){case"STATIC":n=[await this.getStaticNodeData(t,e,a,r)];break;case"DE":n=await this.getDENodeDatas(t,e,a,r);break;case"CODELIST":n=await this.getCodeListNodeDatas(t,e,a,r);break;default:throw new w(t,"".concat(t.treeNodeType,"\u8282\u70B9\u7C7B\u578B\u672A\u652F\u6301"))}const{expandFirstOnly:o,expanded:u,rootNode:c}=t,l=c&&!this.model.rootVisible;return i||await Promise.all(n.map(async(h,p)=>{var E;if(u&&(!o||o&&p===0)||(E=s.defaultExpandedKeys)!=null&&E.length&&s.defaultExpandedKeys.includes(h.id)||l){const D=await this.fetchChildNodes(h,s);h.children=D}})),n}async getStaticNodeData(t,e,a,s){return new $s(t,a,{parentValueLevel:e?.parentValueLevel,leaf:!!s.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:s,navigateContexts:i,navigateParams:r,parentFilter:n,parentDER1N:o}=t,u=o?.pickupDEFName,c={...a.params},l={...a.context,...e?.context||{}};let h={},p;if(e){p=e;for(let b=1;b<s;b++)p=p?.parent}let E,D;if(p){h=p.deData||{};const b=Jt(this.model,p.nodeId);b.appDataEntityId&&(D=B(b.appDataEntityId)),E=p.value}const{resultContext:y,resultParams:v}=Yt({deName:D,navFilter:n?"n_".concat(n.toLowerCase(),"_eq"):void 0,pickupDEFName:u,navParams:r,navContexts:i},{derValue:E,context:l,params:c,data:h});return Object.assign(l,y),Object.assign(c,v),{context:l,params:c,navContext:y,navParams:v}}async getDENodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:r}=t,{context:n,params:o,navContext:u,navParams:c}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}};o.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(o,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(r,i,n,o);return l.data.length?l.data.map(p=>new qe(t,a,{data:p,leaf:!!s.leaf,navContext:u,navParams:c})):[]}async getCodeListNodeDatas(t,e,a,s){const{context:i,params:r,navContext:n,navParams:o}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}},u=await this.app.codeList.get(t.codeListId,i,r);return u.length?u.map(l=>new Qs(t,a,{data:l,leaf:!!s.leaf,navContext:n,navParams:o})):[]}}),gl=d("TreeController",class extends tt{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map}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],(t=this.model.detreeNodes)!=null&&t[0].enableQuickSearch&&(this.enableQuickSearch=!0),this.dataEntity){const a=(e=this.dataEntity.appDEFields)==null?void 0:e.filter(i=>i.enableQuickSearch),s=[];a?.forEach(i=>{i?.lnlanguageRes&&i.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(i.lnlanguageRes.lanResTag,i.logicName)):i?.logicName&&s.push(i.logicName)}),s.length>0&&(this.state.placeHolder=s.join("\u3001"))}this.initDropNodeRss(),this.service=new oa(this.model),await this.service.init(this.context),this.model.detreeNodes.forEach(a=>{var s,i;(i=(s=a.decontextMenu)==null?void 0:s.detoolbarItems)!=null&&i.length&&(this.contextMenus[a.decontextMenu.id]=new ui(a.decontextMenu,this.context,this.params,this.ctx))}),await Promise.all(Object.values(this.contextMenus).map(a=>a.created()))}initDropNodeRss(){var t;(t=this.model.detreeNodes)==null||t.forEach(e=>{if(!e.allowDrop)return;const a=[];Ft(this.model,{parentId:e.id,hasQuery:!1}).forEach(i=>{var r;if((r=i.parentDER1N)!=null&&r.pickupDEFName){const n=this.getNodeModel(i.childDETreeNodeId);n?.treeNodeType==="DE"&&n.appDataEntityId&&a.push({minorEntityId:n.appDataEntityId,pickupDEFName:i.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:i.childDETreeNodeId})}}),a.length>0&&this.dropNodeRss.set(e.id,a)})}async load(t={}){const e=t.isInitialLoad===!0;e&&await this.startLoading();let a;try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;this.state.isLoading=!0;let s;try{s=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t.children=s:this.state.rootNodes=s,this.state.items=[],V({children:this.state.rootNodes},i=>{this.state.items.push(i)}),this.state.expandedKeys=this.calcExpandedKeys(s),s}async onTreeNodeClick(t){if(this.state.navigational){const e=this.getNodeModel(t.nodeId);if(!e?.navAppViewId)return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter(s=>s.id!==t.id);a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}this.state.mdctrlActiveMode===1&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t.id);if(e&&!a)this.state.expandedKeys.push(t.id);else if(!e&&a){const s=this.state.expandedKeys.indexOf(t.id);s!==-1&&this.state.expandedKeys.splice(s,1)}}async onDbTreeNodeClick(t){this.state.mdctrlActiveMode===2&&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(s=>s.id),a=this.state.items.filter(s=>e.includes(s.id));super.setSelection(a)}getNodeModel(t){var e;return(e=this.model.detreeNodes)==null?void 0:e.find(a=>a.id===t)}async doUIAction(t,e,a,s){const i=this.getEventArgs(),r=this.parseTreeNodeData(e),n=await G.exec(t,{...i,...r,event:a},s);if(n.closeView)this.view.closeView();else if(n.refresh)switch(n.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh();break}}parseTreeNodeData(t){return{data:[{...t,...t.deData||{}}],context:Object.assign(this.context.clone(),t.context||{}),params:{...this.params,...t.params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return V({children:t},a=>{var s;(s=a.children)!=null&&s.length&&e.push(a.id)}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"id",s=this.state.items.find(n=>n[a]===t[a]);if(!s){ibiz.log.error("\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u6811\u8282\u70B9\u6570\u636E",t);return}if(e){const{parent:n}=s;if(!n||!this.model.rootVisible&&this.state.rootNodes.includes(n)){this.refresh();return}}const i=e?s.parent:s,r=await this.loadNodes(i);this.evt.emit("onAfterRefreshParent",{parentNode:i,children:r})}async expandNodeByKey(t){const e=t.filter(s=>!this.state.expandedKeys.includes(s));if(e.length===0)return;const a=this.state.items.filter(s=>e.includes(s.id));this.state.expandedKeys.push(...e),a.length!==0&&await Promise.all(a.map(s=>this.loadNodes(s)))}calcAllowDrag(t){const e=this.getNodeModel(t.nodeId);return e?.allowDrag===!0}calcAllowDrop(t,e,a){var s,i;const r=this.getNodeModel(t.nodeId);if(a==="inner")return!!this.findDropNodeRS(e.nodeId,r.appDataEntityId);if(((s=t.parent)==null?void 0:s.id)!==((i=e.parent)==null?void 0:i.id))return!!this.findDropNodeRS(e.parent.nodeId,r.appDataEntityId);const n=this.getNodeModel(e.nodeId);return n?.allowOrder===!0}findDropNodeRS(t,e){const a=this.dropNodeRss.get(t);return a?.find(s=>s.minorEntityId===e)}async onNodeDrop(t,e,a){var s,i,r,n;a==="inner"&&!e.leaf&&e.children===void 0&&await this.expandNodeByKey([e.id]);const o=[],u=this.getNodeModel(t.nodeId),c=a==="inner"?e:e.parent,l=((s=e.parent)==null?void 0:s.id)!==((i=t.parent)==null?void 0:i.id);let h=this.getNodeModel(e.nodeId);if(a==="inner"||((r=e.parent)==null?void 0:r.id)!==((n=t.parent)==null?void 0:n.id)){const v=this.findDropNodeRS(c.nodeId,u.appDataEntityId);v&&(t.deData[v.pickupDEFName]=c.value,o.push(t),h=this.getNodeModel(v.childDETreeNodeId))}const p=t.parent.children;if(p.splice(p.indexOf(t),1),a==="inner")e.children||(e.children=[],e.leaf=!0,this.state.expandedKeys.push(e.id)),e.children.push(t);else{let v=c.children.indexOf(e);a==="next"&&(v+=1),c.children.splice(v,0,t)}(a==="inner"||l)&&(t.parent=c,t.nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([c]));const{sortAppDEFieldId:E,sortDir:D,allowOrder:y}=h;if(y===!0){if(!E)throw new m(h,"\u7F3A\u5C11\u914D\u7F6E\u6392\u5E8F\u5C5E\u6027");const v=E.toLowerCase(),b=D==="ASC",F=[...c.children];b||F.reverse();const I=T=>T+(100-T%100),S=T=>T[v]||0;let R;F.forEach((T,P)=>{const j=T.deData;R===void 0?T===t&&(P===0?R=100:R=I(S(F[P-1].deData)),j[v]=R,o.indexOf(T)===-1&&o.push(T)):(R>=S(j)&&(j[v]=I(R),o.push(T)),R=S(j))})}await this.updateDeNodeData(o),this.evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map(async a=>{const s=this.getNodeModel(a.nodeId),i=a.deData,r=B(s.appDataEntityId),n=this.context.clone();n[r]=i.srfkey;const o=await e.deService.exec(s.appDataEntityId,"update",n,i);o.data&&(a.deData=o.data)}))}async modifyNodeText(t,e){const a=this.getNodeModel(t.nodeId);if(!a.allowEditText)throw new m(a,"\u6811\u8282\u70B9\u6CA1\u6709\u914D\u7F6E\u7F16\u8F91\u6A21\u5F0F\uFF1A\u540D\u79F0");if(!t.deData)throw new f("\u4E0D\u662F\u5B9E\u4F53\u6811\u8282\u70B9\u6570\u636E");t.text=e,t.deData[a.textAppDEFieldId]=e,await this.updateDeNodeData([t])}}),Ju=d("WizardPanelService",class extends ce{async initialize(t,e={},a={}){var s;const i=(s=this.model.initControlAction)==null?void 0:s.appDEMethodId;let r=await this.exec(i,t,e,a);return r=this.handleResponse(r),r}async finish(t,e={},a={}){var s;const i=(s=this.model.finishControlAction)==null?void 0:s.appDEMethodId;let r=await this.exec(i,t,e,a);return r=this.handleResponse(r),r}}),Dl=d("WizardPanelController",class extends Y{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach(s=>{var i,r,n;s.firstForm&&(this.firstForm=s);const o="".concat(this.model.name,"_form_").concat((i=s.formTag)==null?void 0:i.toLowerCase()),u=(n=(r=this.model.dewizard)==null?void 0:r.dewizardSteps)==null?void 0:n.find(l=>l.id===s.dewizardStepId),c=u?.stepTag;this.stepTags[o]=c}),(e=(t=this.model.dewizard)==null?void 0:t.dewizardSteps)==null||e.forEach(s=>{this.steps.push(s.stepTag)}),this.service=new Ju(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map(async s=>{const{formTag:i}=s.dewizardForm;if(i){const r=await Et(s);r&&(this.providers[i]=r)}}))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find(a=>a.formTag===t);return e||ibiz.log.debug("\u627E\u4E0D\u5230".concat(t,"\u7684\u5411\u5BFC\u8868\u5355")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new f("\u627E\u4E0D\u5230".concat(t,"\u7684\u8868\u5355\u63A7\u5236\u5668"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const s=await a.load();Object.assign(this.formData,s)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=B(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!((e=this.model.dewizard)!=null&&e.dewizardForms))throw new f("\u6CA1\u6709\u914D\u7F6E\u5411\u5BFC\u8868\u5355\u96C6\u5408");const a=this.model.dewizard.dewizardForms.find(s=>s.formTag===t);if(!a)throw new f("\u627E\u4E0D\u5230\u6807\u8BC6\u4E3A".concat(t,"\u7684\u5411\u5BFC\u8868\u5355"));return a}async initialize(){var t;if((t=this.model.initControlAction)==null?void 0:t.appDEMethodId){const a=await this.service.initialize(this.context,{},this.params),s=B(this.model.appDataEntityId);if(a.data&&a.data.srfkey&&(this.formData=a.data,this.context[s]=a.data.srfkey),a.data&&this.model.stateAppDEFieldId&&a.data[this.model.stateAppDEFieldId]){const i=this.getWizardFormByTag(a.data[this.model.stateAppDEFieldId]);i&&(this.state.activeFormTag=i.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t;this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack());let e;if(this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]?this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId]):(this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1]),!e)throw new f("\u6CA1\u6709\u4E0A\u4E00\u4E2A\u8868\u5355");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform)this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e));else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId])this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId]);else{const a=this.model.dewizard.dewizardSteps,s=this.model.dewizard.dewizardForms;if(a&&s){const i=a.findIndex(o=>o.id===this.activeWizardForm.dewizardStepId),r=a[i+1];if(!r)throw new f("\u627E\u4E0D\u5230\u4E0B\u4E00\u4E2A\u5411\u5BFC\u6B65\u9AA4");const n=this.getWizardFormByTag(r.stepTag);n&&n.formTag&&(e=n.formTag)}}if(!e)throw new f("\u627E\u4E0D\u5230\u4E0B\u4E00\u4E2A\u5411\u5BFC\u8868\u5355");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),Zu=d("MDCtrlService",class extends rt{initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.delistDataItems)==null||t.forEach(e=>{const a=e.id.toLowerCase(),s=e.appDEFieldId;let i;if(s){const r=s.toLowerCase();i=new J(a,r,{isOriginField:!0,dataType:e.dataType})}else i=new J(a,a);this.dataUIMap.set(a,i)})}}),Ee=d("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),wl=d("MDCtrlController",class extends tt{initState(){super.initState(),this.state.rows=[],this.state.noSort=this.model.noSort===!0,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new Zu(this.model),await this.service.init(this.context),this.setSort()}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:a,minorSortDir:s}=this.model;a&&s?this.state.sortQuery="".concat(a.toLowerCase(),",").concat(s.toLowerCase()):this.state.sortQuery=""}}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map(a=>{const s=new Ee(a,this);return this.initActionStates(s),s})),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map(a=>new Ee(a,this));this.state.rows=e}getAllData(){return this.state.rows.map(t=>t.data)}async onActionClick(t,e,a){const s=t.uiactionId;await G.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(a=e.uiactionGroupDetails)!=null&&a.length||ibiz.log.debug("\u64CD\u4F5C\u5217\u754C\u9762\u884C\u4E3A\u7EC4\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A");const s=new pt;(e.uiactionGroupDetails||[]).forEach(r=>{const n=r.uiactionId;if(n){const o=new ht(r.id,this.context.srfappid,n);s.addState(r.id,o)}}),s.update(t.data.getOrigin()),t.uaColStates[e.id]=s}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new m(this.model,"\u5206\u7EC4\u5C5E\u6027\u6CA1\u6709\u914D\u7F6E");e==="AUTO"?this.handleAutoGroup():e==="CODELIST"&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach(i=>{const r=i[t];C(r)||(a.has(r)||a.set(r,[]),a.get(r).push(new Ee(i,this)))});const s=[];a.forEach((i,r)=>{s.push({caption:r,key:r,children:[...i]})}),this.state.groups=s}}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 m(this.model,"\u5206\u7EC4\u4EE3\u7801\u8868\u6CA1\u6709\u914D\u7F6E");const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach(r=>{s.set(r.value,[])}),a.forEach(r=>{const n=r[t],o=s.get(n);o&&o.push(new Ee(r,this))});const i=[];s.forEach((r,n)=>{const o=this.groupCodeListItems.find(u=>u.value===n);i.push({caption:o.text,key:o.value,children:r})}),this.state.groups=i}}),tc=d("KanbanService",class extends ci{async updateGroup(t,e){var a;const s=((a=this.model.updateGroupControlAction)==null?void 0:a.appDEMethodId)||"update";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}}),Cl=d("KanbanController",class extends Tu{get enableEditOrder(){return this.model.enableCardEditOrder===!0}get enableEditGroup(){return this.model.enableCardEditGroup===!0}async initControlService(){this.service=new tc(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:a}=this.model;if(!e)throw new m(this.model,"\u6392\u5E8F\u5C5E\u6027\u6CA1\u914D\u7F6E");if(!a)throw new m(this.model,"\u6392\u5E8F\u65B9\u5411\u6CA1\u914D\u7F6E");const s=a==="ASC";t.forEach(i=>{const r=i[e];if(C(r))i[e]=0;else{const n=Number(r);if(Number.isNaN(n))throw new f("".concat(i.srfmajortext,"\u7684\u6392\u5E8F\u5C5E\u6027\u65E0\u6CD5\u8F6C\u6362\u6210\u6570\u503C"))}}),t.sort((i,r)=>s?i[e]-r[e]:r[e]-i[e])}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}handleDataGroup(){if(!this.model.enableGroup||this.model.groupMode==="NONE")throw new f("\u770B\u677F\u90E8\u4EF6\u5FC5\u987B\u5F00\u542F\u5206\u7EC4");return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach(i=>{const r=i[t];C(r)||(a.has(r)||a.set(r,[]),a.get(r).push(i))});const s=[];a.forEach((i,r)=>{const n=this.groupCodeListItems.find(o=>o.value===r);s.push({caption:n.text,color:n.color,key:n.value,children:[...i]})}),this.state.groups=s}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new m(this.model,"\u5206\u7EC4\u4EE3\u7801\u8868\u6CA1\u6709\u914D\u7F6E");const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach(r=>{s.set(r.value,[])}),a.forEach(r=>{const n=r[t],o=s.get(n);o&&o.push(r)});const i=[];s.forEach((r,n)=>{const o=this.groupCodeListItems.find(u=>u.value===n);i.push({caption:o.text,color:o.color,key:o.value,children:r})}),this.state.groups=i}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to){ibiz.message.warning("\u5F53\u524D\u770B\u677F\u4E0D\u5141\u8BB8\u8C03\u6574\u5206\u7EC4\uFF01");return}const e=this.model.minorSortDir==="ASC",{from:a,to:s,fromIndex:i,toIndex:r}=t,n=this.model.groupAppDEFieldId,o=this.model.minorSortAppDEFieldId,u=[],c=this.state.groups.find(I=>I.key===a),l=this.state.groups.find(I=>I.key===s);if(!this.enableEditOrder){if(t.from===t.to){ibiz.message.warning("\u5F53\u524D\u770B\u677F\u4E0D\u5141\u8BB8\u8C03\u6574\u6B21\u5E8F");return}const I=c.children[i];return I[n]=t.to,this.updateChangedItems([I])}const h=I=>I+(100-I%100),p=[...l.children],E=[...l.children],D=c.children[i];t.from!==t.to?(D[n]=t.to,E.splice(r,0,D)):(E.splice(i,1),E.splice(r,0,D));const y=c.children.splice(i,1);l.children.splice(r,0,...y),e||(p.reverse(),E.reverse());let v,b=[],F;E.forEach((I,S)=>{v===void 0?I!==p[S]&&(p[S]?v=p[S][o]||100:v=S===0?100:h(p[S-1][o]),I[o]=v,u.push(I)):(v>=I[o]?(b.length>0&&(b.forEach(R=>{R[o]=h(F),u.push(R),F=R[o]}),v=F,F=0,b=[]),I[o]=h(v),u.push(I)):(b.length===0&&(F=v),b.push(I)),v=I[o])}),this.updateChangedItems(u)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map(async e=>{const a=B(this.model.appDataEntityId),s=this.context.clone();s[a]=e.srfkey;const i=await this.service.updateGroup(s,e);if(i.data){const r=this.state.items.findIndex(n=>n.srfkey===e.srfkey);this.state.items.splice(r,1,i.data)}}))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}}),ec=d("TreeGridExService",class extends oa{constructor(){super(...arguments),this.multipleUiMap=new Map}initUIDataMap(){var t;super.initUIDataMap(),(t=this.model.detreeNodes)==null||t.forEach(e=>{var a;const s=new Map;(a=e.detreeNodeDataItems)==null||a.forEach(i=>{const r=i.id.toLowerCase(),o=i.appDEFieldId.toLowerCase(),u=new J(r,o,{isOriginField:!0,dataType:i.dataType});s.set(r,u)}),this.multipleUiMap.set(e.id,s)})}async getDENodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:r}=t,{context:n,params:o,navContext:u,navParams:c}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}};o.size=t.maxSize||1e3,t.sortAppDEFieldId&&t.sortDir&&Object.assign(o,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir.toLowerCase())});const l=await this.app.deService.exec(r,i,n,o);if(l.data.length){const{data:h}=this.handleResponseForMultiple(l,t.id);return h.map(E=>new qe(t,a,{data:E,leaf:!!s.leaf,navContext:u,navParams:c}))}return[]}handleResponseForMultiple(t,e){const a=super.handleResponse(t);return a.headers&&(a.headers["x-page"]&&(a.page=Number(a.headers["x-page"])),a.headers["x-per-page"]&&(a.size=Number(a.headers["x-per-page"])),a.headers["x-total"]&&(a.total=Number(a.headers["x-total"]))),a.ok&&(Kt(a.data)?a.data=a.data.map(s=>this.toUIDataForMultiple(s,e)):a.data=this.toUIDataForMultiple(a.data,e)),a}toUIDataForMultiple(t,e){const a=this.multipleUiMap.get(e);return new X(t,a)}}),vl=d("TreeGridExController",class extends tt{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}initState(){super.initState(),this.state.size=0,this.state.columnStates=[],this.state.defaultExpandedKeys=[]}async onCreated(){await super.onCreated(),this.service=new ec(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns()}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map(async t=>this.initColumnsController(t)))}async initColumnsController(t){const e=await re(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,t.columnType==="DEFGRIDCOLUMN"?this.fieldColumns[t.codeName]=a:t.columnType==="UAGRIDCOLUMN"&&(this.uaColumns[t.codeName]=a)}initColumnStates(){V(this.model,t=>{t.columnType!=="GROUPGRIDCOLUMN"&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:t.columnType==="UAGRIDCOLUMN"})},{childrenFields:["detreeColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter(a=>!a.hidden),e=t.length;t.forEach((a,s)=>{a.uaColumn?a.fixed=s+1<=Math.floor(e/2)?"left":"right":a.fixed="right"})}async load(t={}){const e=t.isInitialLoad===!0,a=await this.loadNodes();return this.state.expandedKeys=this.calcExpandedKeys(a),await this.afterLoad(t,a),this.state.isLoaded=!0,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query,s=t?void 0:this.state.defaultExpandedKeys;await this.startLoading();let i;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:s})||[]}finally{await this.endLoading()}return t?t.children=i:this.state.rootNodes=i,this.state.items=[],V({children:this.state.rootNodes},r=>{this.state.items.push(r)}),i}calcExpandedKeys(t){let e=[];return V({children:t},a=>{var s;(s=a.children)!=null&&s.length&&e.push(a.id)}),this.state.defaultExpandedKeys.length&&(e.push(...this.state.defaultExpandedKeys),e=Array.from(new Set(e))),e}}),Il=d("TreeGridController",class extends Hu{}),Al=d("TreeGridService",class extends fi{}),ac=d("MEditViewPanelService",class extends rt{}),yl=d("MEditViewPanelController",class extends tt{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new ac(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const s=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);a&&s?this.parameters=[{parameterName:(t=s.keyAppDEFieldId)==null?void 0:t.toLowerCase(),pathName:(e=s.codeName)==null?void 0:e.toLowerCase()}]:this.parameters=[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter(s=>s.id.startsWith("mockId:"));return this.state.panelUiItems=[],this.doItems(e,a),this.model.panelStyle==="TAB_TOP"&&this.state.panelUiItems.length>0&&a.length===0&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,s={id:t[e]?t[e]:"mockId:".concat(K()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach(i=>{const{parameterName:r,pathName:n}=i;t[r]&&!Object.is(t[r],"")&&Object.assign(s.context,{[n]:t[r]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(s,{srfmajortext:t.srfmajortext}):t.srfuf===0&&Object.assign(s,{srfmajortext:"\u8349\u7A3F--\u65B0\u5EFA"})}),s}doItems(t,e){t.forEach(a=>{const s=this.handlePanelItemParams(a);this.state.panelUiItems.push(s)}),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),this.model.panelStyle==="TAB_TOP"&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,t.data.srfuf===0){const e=this.state.panelUiItems.findIndex(a=>a===t);this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex(a=>a.data.srfkey===t.srfkey);e!==-1&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){t.eventName==="onSaveSuccess"&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex(i=>i.id===e);if(a<0)throw new f("\u7F16\u8F91\u89C6\u56FE\u9762\u677F\u90E8\u4EF6UI\u6570\u636E\u4E0D\u5B58\u5728");const s=this.state.panelUiItems[a];s.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):s.srfmajortext=t.srfmajortext,this.model.panelStyle==="TAB_TOP"&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),sc=d("MapService",class extends rt{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const s=[];if((a=this.model.sysMapItems)!=null&&a.length){const i=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map(async r=>{const{appDataEntityId:n,appDEDataSetId:o,customCond:u}=r,c=t.clone(),l={...e};if(u){const p=O.execSingleLine(u);if(p){const{navigateContexts:E,navigateParams:D}=Be(p);E&&Object.assign(c,N(E,e,t)),D&&Object.assign(l,N(E,e,t))}}const h=await i.deService.exec(n,o,c,l);h.data&&s.push(...h.data.map(p=>new uo(p,r)))}))}return new U(s,200)}}),Fl=d("MapController",class extends tt{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new sc(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=t.isInitialLoad===!0,{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(t?.viewParam);a.srfareacode=this.state.areaCode;const i=await this.service.fetchAll(a,s);this.state.items=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(e){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:e}),e}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),s=[],i=[];return a.forEach(r=>{r._itemStyle==="REGION"?s.push(r):r._itemStyle==="POINT"&&i.push(r)}),this.state.pointData=i,this.state.areaData=s,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,(t=this.model.controlParam)!=null&&t.ctrlParams){const{ctrlParams:e}=this.model.controlParam;Object.keys(e).forEach(a=>{const s=e[a];switch(a.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=s;break;case"strareacode":this.state.strAreaCode=s==="true";break;case"jsonbaseurl":this.state.jsonBaseUrl=s;break}})}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]})}}),ic=d("ReportPanelService",class extends ce{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const s="".concat((a=this.dataEntity.codeName2)==null?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let i=await ibiz.net.request(s,{method:"post",data:e});return i=this.handleResponse(i),i}}),mi=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},rc=class extends mi{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},nc=class extends mi{},oc=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("\u62A5\u8868\u9762\u677F\u751F\u6210\u5668\u5DE5\u5382\u53C2\u6570\u9519\u8BEF\uFF0C\u62A5\u8868\u9762\u677F\u672A\u6307\u5B9A\u62A5\u8868\u7C7B\u578B");switch(t.appDEReport.reportType){case"USER":return new rc(t);case"USER2":return new nc(t);default:throw new Error("\u6307\u5B9A\u62A5\u8868".concat(t.appDEReport.reportType,"\u7C7B\u578B\u62A5\u8868\u9762\u677F\u751F\u6210\u5668\u6682\u672A\u5B9E\u73B0"))}}},Pl=d("ReportPanelController",class extends Y{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=oc.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new ic(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(t?.viewParam),s=await this.service.fetch(e,a);this.state.data=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(e){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:e}),e}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),uc=d("GanttService",class extends oa{async fetchGanttChildNodes(t,e){const{hasQuery:a}=e;let s=[];if(t){const i=Ft(this.model,{parentId:t.nodeId,hasQuery:a});if(i.length===0)return;(await it(i.map(async n=>{const o=Jt(this.model,n.childDETreeNodeId);return this.fetchGanttNodeDatasByType(o,n,t,e)}),!1)).forEach(n=>{s.push(...n)})}else{const i=$t(this.model);s=await this.fetchGanttNodeDatasByType(i,void 0,void 0,e)}return s}async fetchGanttNodeDatasByType(t,e,a,s){const i=Ft(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length===0,r={...s,leaf:i};let n=[];switch(t.treeNodeType){case"STATIC":n=[await this.getStaticGanttNodeData(t,e,a,r)];break;case"DE":n=await this.getDEGanttNodeDatas(t,e,a,r);break;case"CODELIST":n=await this.getCodeListGanttNodeDatas(t,e,a,r);break;default:throw new w(t,"".concat(t.treeNodeType,"\u8282\u70B9\u7C7B\u578B\u672A\u652F\u6301"))}const{expandFirstOnly:o,expanded:u,rootNode:c}=t,l=c&&!this.model.rootVisible;return i||await Promise.all(n.map(async(h,p)=>{if(u&&(!o||o&&p===0)||l){const E=await this.fetchGanttChildNodes(h,s);h.children=E}})),n}async getStaticGanttNodeData(t,e,a,s){return new mo(this.model,t,a,{parentValueLevel:e?.parentValueLevel,leaf:!!s.leaf})}async getDEGanttNodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:r}=t,{context:n,params:o,navContext:u,navParams:c}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}};o.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(o,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(r,i,n,o);return l.data.length?l.data.map(p=>new Eo(this.model,t,a,{data:p,leaf:!!s.leaf,navContext:u,navParams:c})):[]}async getCodeListGanttNodeDatas(t,e,a,s){const{context:i,params:r,navContext:n,navParams:o}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}},u=await this.app.codeList.get(t.codeListId,i,r);return u.length?u.map(l=>new go(this.model,t,a,{data:l,leaf:!!s.leaf,navContext:n,navParams:o})):[]}}),bl=d("GanttController",class extends tt{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={},this.contextMenus={},this.enableQuickSearch=!1}initState(){super.initState(),this.state.size=0,this.state.query="",this.state.columnStates=[],this.state.rootNodes=[]}async onCreated(){var t,e;if(await super.onCreated(),await this.initGridColumns(),this.initColumnStates(),(t=this.model.detreeNodes)!=null&&t[0].enableQuickSearch&&(this.enableQuickSearch=!0),this.dataEntity){const a=(e=this.dataEntity.appDEFields)==null?void 0:e.filter(i=>i.enableQuickSearch),s=[];a?.forEach(i=>{i?.lnlanguageRes&&i.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(i.lnlanguageRes.lanResTag,i.logicName)):i?.logicName&&s.push(i.logicName)}),s.length>0&&(this.state.placeHolder=s.join("\u3001"))}this.service=new uc(this.model),await this.service.init(this.context),this.model.detreeNodes.forEach(a=>{var s,i;(i=(s=a.decontextMenu)==null?void 0:s.detoolbarItems)!=null&&i.length&&(this.contextMenus[a.decontextMenu.id]=new ui(a.decontextMenu,this.context,this.params,this.ctx))}),await Promise.all(Object.values(this.contextMenus).map(a=>a.created()))}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map(async t=>this.initColumnsController(t)))}async initColumnsController(t){const e=await re(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,t.columnType==="DEFGRIDCOLUMN"?this.fieldColumns[t.codeName]=a:t.columnType==="UAGRIDCOLUMN"&&(this.uaColumns[t.codeName]=a)}initColumnStates(){V(this.model,t=>{t.columnType!=="GROUPGRIDCOLUMN"&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:t.columnType==="UAGRIDCOLUMN"})},{childrenFields:["detreeColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter(a=>!a.hidden),e=t.length;t.forEach((a,s)=>{a.uaColumn?a.fixed=s+1<=Math.floor(e/2)?"left":"right":a.fixed="right"})}async load(t={}){const e=t.isInitialLoad===!0;e&&await this.startLoading();let a;try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),a}getNodeModel(t){var e;return(e=this.model.detreeNodes)==null?void 0:e.find(a=>a.id===t)}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;this.state.isLoading=!0;let s;try{s=await this.service.fetchGanttChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:[]})||[]}finally{this.state.isLoading=!1}return t?t.children=s:this.state.rootNodes=s,this.state.items=[],V({children:this.state.rootNodes},i=>{this.state.items.push(i)}),s}async onGanttNodeClick(t){if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter(s=>s.id!==t.id);a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}this.state.mdctrlActiveMode===1&&await this.setActive(t)}async onDbGanttNodeClick(t){this.state.mdctrlActiveMode===2&&await this.setActive(t)}setActive(t){const e=this.parseGanttNodeData(t);return this.evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map(s=>s.id),a=this.state.items.filter(s=>e.includes(s.id));super.setSelection(a)}async doUIAction(t,e,a,s){const i=this.getEventArgs(),r=this.parseGanttNodeData(e),n=await G.exec(t,{...i,...r,event:a},s);if(n.closeView)this.view.closeView();else if(n.refresh)switch(n.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh();break}}parseGanttNodeData(t){return{data:[{...t,...t.deData||{}}],context:Object.assign(this.context.clone(),t.context||{}),params:{...this.params,...t.params||{}}}}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"id",s=this.state.items.find(n=>n[a]===t[a]);if(!s){ibiz.log.error("\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u6811\u8282\u70B9\u6570\u636E",t);return}if(e){const{parent:n}=s;if(!n||!this.model.rootVisible&&this.state.rootNodes.includes(n)){this.refresh();return}}const i=e?s.parent:s,r=await this.loadNodes(i);this.evt.emit("onAfterRefreshParent",{parentNode:i,children:r})}}),cc=d("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}logout(){return ibiz.auth.logout()}}),lc=class{constructor(){this.convert=new Io,this.controller=new cc,this.appMap=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new yo,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(t.indexOf(".")!==-1){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName,t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map),this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId){const a=this.calcAppViewId(t);this.view2appMap.set(a,e)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const s=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(s),s}throw new f("\u89C6\u56FE[".concat(e,"]\u4E0D\u5B58\u5728"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return t.indexOf(".")!==-1?a=await this.modelLoaderProvider.getAppDataEntity(e,t):a=await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new f("\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new f("\u8BF7\u5148\u6CE8\u518C\u6A21\u578B\u52A0\u8F7D\u9002\u914D\u5668");const e=await this.modelLoaderProvider.getApp(t),a=new Co(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Bt(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return t?t instanceof Object?e=t.id:e=t:e=ibiz.env.appId,this.appMap.get(e)}},dc=d("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:s}=t,i="".concat(s,"_").concat(a),r=this.viewEngines.get(i);if(r)return r(...e);ibiz.log.error("\u6CA1\u6709".concat(i,"\u5BF9\u5E94\u7684\u5F15\u64CE"),t)}}),hc=d("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:s}=this.view;if(ibiz.log.debug("".concat(a.id,"\u7684\u5B50\u7EC4\u4EF6\uFF1A").concat(s.join(";"),"\u90FD\u5DF2mounted")),!this.calcViewHeaderVisible()){const r=(t=this.viewLayoutPanel)==null?void 0:t.panelItems.view_header;r&&(r.state.visible=!1)}if(ibiz.env.isMob&&!this.calcViewFooterVisible()){const n=(e=this.viewLayoutPanel)==null?void 0:e.panelItems.view_footer;n&&(n.state.visible=!1)}}async onDestroyed(){}async call(t,e){if(t==="GetData")return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,s;let i=!1;const{model:r}=this.view;if(r.showCaptionBar===!1){const n=(t=this.viewLayoutPanel)==null?void 0:t.panelItems.view_captionbar;n&&(n.state.visible=!1)}else i=!0;if(ibiz.env.isMob){if(this.leftToolbar)i=!0;else{const n=(e=this.viewLayoutPanel)==null?void 0:e.panelItems.lefttoolbar;n&&(n.state.visible=!1)}if(this.rightToolbar)i=!0;else{const n=(a=this.viewLayoutPanel)==null?void 0:a.panelItems.righttoolbar;n&&(n.state.visible=!1)}}else if(this.toolbar)i=!0;else{const n=(s=this.viewLayoutPanel)==null?void 0:s.panelItems.view_toolbar;n&&(n.state.visible=!1)}return i}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:s}=this.view;if(!t)throw new f("\u8BE5\u89C6\u56FE\u6CA1\u6709\u5B9E\u4F53\uFF0C\u65E0\u6CD5\u52A0\u8F7D\u5B9E\u4F53\u6570\u636E");const r=await ibiz.hub.getApp(a.srfappid).deService.exec(t,"get",a,s),{data:n}=r;n&&(this.view.state.srfactiveviewdata=n,e.emit("onDataChange",{actionType:"LOAD",data:[n]}),n.srfkey&&e.emit("onViewInfoChange",{dataInfo:n.srfmajortext||""}))}}),Nl=d("MDViewEngine",class extends hc{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",async a=>{var s;(s=this.toolbar)==null||s.calcButtonState(a.data[0],this.xdataControl.model.appDataEntityId)}),this.xdataControl.evt.on("onBeforeLoad",()=>{this.xdataControl.state.searchParams=this.getSearchParams()}),this.xdataControl.evt.on("onLoadSuccess",a=>{this.view.evt.emit("onDataChange",{...a,actionType:"LOAD"})}),this.xdataControl.evt.on("onRemoveSuccess",a=>{this.view.evt.emit("onDataChange",{...a,actionType:"REMOVE"})}),this.xdataControl.evt.on("onSaveSuccess",a=>{this.view.evt.emit("onDataChange",{...a,actionType:"SAVE"})});const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",()=>{this.reLoad()}),this.searchBar&&this.searchBar.evt.on("onSearch",()=>{this.reLoad()}),!this.view.state.noLoadDefault&&t.loadDefault&&this.load()}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return t==="ToggleFilter"?(this.toggleFilter(),null):t==="Edit"||t==="View"?this.openData(e):t==="New"?this.newData(e):t==="Remove"?(await this.remove(e),null):t==="Import"?(await this.importData(),null):t==="Refresh"?(await this.refresh(),null):t==="ExportExcel"?(await this.exportData(e),null):t==="Search"?(await this.searchForm.search(),null):t==="Reset"?(await this.searchForm.reset(),null):t==="Copy"?(this.copy(e),null):t==="Load"?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:s,event:i}=t,r=(t.context||this.view.context).clone(),n=t.params||this.view.params,o=((e=s[0].srfdecodename)==null?void 0:e.toLowerCase())||B(this.xdataControl.model.appDataEntityId);r[o.toLowerCase()]=s[0].srfkey;const u=await((a=this.view.scheduler)==null?void 0:a.triggerCustom("opendata",{context:r,params:n,data:s,event:i,view:this.view}));if(u===-1)throw new m(this.view.model,"\u7F3A\u5C11newdata\u7684\u89C6\u56FE\u903B\u8F91");return{cancel:!u.ok}}async newData(t){var e,a,s;const{data:i,event:r,copyMode:n}=t;if(!((a=(e=this.view.model.viewLayoutPanel)==null?void 0:e.appViewLogics)==null?void 0:a.find(l=>l.id==="newdata")))throw new m(this.view.model,"\u7F3A\u5C11newdata\u7684\u89C6\u56FE\u903B\u8F91");const u=A(this.view.params);n&&(u.srfcopymode=n);const c=await((s=this.view.scheduler)==null?void 0:s.triggerCustom("newdata",{context:this.view.context,params:u,data:i,event:r,view:this.view}));if(c===-1)throw new m(this.view.model,"\u7F3A\u5C11newdata\u7684\u89C6\u56FE\u903B\u8F91");return{cancel:!c.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){let t=super.calcViewHeaderVisible();if(!this.searchBar||!this.searchBar.state.visible){const e=this.viewLayoutPanel.panelItems.view_searchbar;e&&(e.state.visible=!1)}else t=!0;return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),pc=class{handle(t){return t instanceof m||t instanceof w?ibiz.message.error(t.message,10,!0):t instanceof ut?t.status===401?ibiz.message.error("\u6CA1\u6709\u6CE8\u518C\u65E0\u6743\u9650\u9519\u8BEF\u5904\u7406\u5668"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof we?ibiz.message.error(t.message,t.duration,t.duration===0):t instanceof f&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}},fc=class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find(a=>!!a.handle(t))||ibiz.log.error("\u6CA1\u6709\u627E\u5230\u80FD\u5904\u7406\u8BE5\u9519\u8BEF\u7684\u5904\u7406\u5668",t)}handle(t){t instanceof Array?t.forEach(e=>{this.handleSingle(e)}):this.handleSingle(t)}},mc=class{constructor(){this.layoutPanel=new Tr,this.theme=new Gr,this.text=new zr,this.hbs=new ir,this.rawValue=new jr,this.action=G,this.error=new fc,this.error.register(new pc)}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)}},ge=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new f("Method not implemented.")}destroy(){}},Ec=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new w(t,"\u903B\u8F91\u7C7B\u578B ".concat(t.logicType," \u6682\u672A\u652F\u6301\uFF01"));return a(t,e)}},gc=class extends ge{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const s=this.logic.scriptCode;this.scriptFn=O.createScriptFn(t,s,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Ei=class extends ge{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new m(this.logic,"\u6CA1\u6709\u914D\u7F6E\u5B9E\u4F53\u754C\u9762\u903B\u8F91");me(e,a,t)}},gi=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach(e=>{try{const a=this.createExecutor(e);this.executors.set(e.id,a);const s=this.createTrigger(e);this.triggers.set(e.id,s),s.bindExecutor(a)}catch(a){ibiz.log.error(a.message)}})}destroy(){this.triggers.forEach(t=>t.destroy()),this.executors.forEach(t=>t.destroy())}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),be(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0;break}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach(a=>{a.match(t)&&e.push(a)}),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const s=this.getExecuteParams(e);return a.map(r=>r.execute(s))}}triggerItemDynaLogic(t,e,a){const s={itemName:t,triggerType:e},i=this.triggerAndExecute(s,a);if(i?.length)return i.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(e=>e.start())}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const s=this.getExecuteParams(e);return a.execute(s)}triggerControlEvent(t,e,a){const s={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(s,a)}},Dc=class extends gi{constructor(t){const e=t.filter(a=>a.triggerType!=="APPVIEWENGINE");e.forEach(a=>{a.triggerType==="CTRLEVENT"&&(a.ctrlName=a.itemName||a.logicTag)}),super(e)}},wc=class extends gi{constructor(t){t.forEach(e=>{e.triggerType=e.logicTrigger}),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Cc=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new w(t,"\u89E6\u53D1\u5668\u7C7B\u578B ".concat(t.triggerType," \u6682\u672A\u652F\u6301\uFF01"));return a(t,e)}},vc=class{constructor(){this.executorFactory=new Ec,this.triggerFactory=new Cc}createViewScheduler(t){return new wc(t)}createControlScheduler(t){return new Dc(t)}},Mt=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,this.executor.type==="SCRIPT"&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],e=>e,{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new f("".concat(this.logic.id,"\u6CA1\u6709\u7ED1\u5B9Aexecutor"))}destroy(){this.executor=void 0}},Ic=class extends Mt{},ua=class extends Mt{bindExecutor(t){if(super.bindExecutor(t),this.executor.type!=="SCRIPT")throw new f("\u9884\u5B9A\u4E49\u903B\u8F91\u7C7B\u578B".concat(this.type,"\u7684\u89E6\u53D1\u5668\u7C7B\u578B\u53EA\u80FD\u662F\u811A\u672C"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],e=>{const{context:a,params:s,data:i}=e;return{context:a,params:s,data:i?.[0]||{},env:ibiz.env}},{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&((e=t.itemName)==null?void 0:e.toLowerCase())===((a=this.logic.itemName)==null?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},Ac=class extends Mt{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new m(this.logic,"\u5B9A\u65F6\u5668\u7F3A\u5C11\u5B9A\u65F6\u95F4\u9694");this.timer=setInterval(()=>{if(!this.scheduler.defaultParamsCb)throw new f("\u5B9A\u65F6\u5668\u7F3A\u5C11\u9ED8\u8BA4\u53C2\u6570\u56DE\u8C03");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)},this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},yc=class extends ge{async execute(t){let e;try{this.logic.builtinAppUILogic&&this.logic.builtinAppUILogic.viewLogicType==="APP_OPENDATA"?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&this.logic.builtinAppUILogic.viewLogicType==="APP_NEWDATA"&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(a){ibiz.log.error(a)}return e}async executeOpenDataAppUILogic(t,e){const{context:a,params:s,...i}=e,{data:r}=e;if(!r?.[0])throw new f("opendata\u6CA1\u6709\u53EF\u64CD\u4F5C\u6570\u636E\uFF01");const n=t.openDataAppViews;let o;if(n)o=await this.calcOpenViewRef(t,e);else if(o=t.openDataAppView,!o)throw new m(t,"opendata\u89C6\u56FE\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u9ED8\u8BA4\u6253\u5F00\u89C6\u56FE");const u=o.refAppViewId;if(!u)throw new m(t,"opendata\u89C6\u56FE\u903B\u8F91\u7684\u9ED8\u8BA4\u6253\u5F00\u89C6\u56FE\u6CA1\u6709\u5B9E\u9645\u5F15\u7528\u89C6\u56FE");const c=o.navigateContexts||[],l=Object.assign(a,N(c,r[0],s,a));let h={};const p=o.navigateParams;return k(p)&&(h=N(p,r[0],s,a)),ibiz.commands.execute(st.TAG,u,l,h,i)}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 m(t,"".concat(a.codeName,"[\u591A\u8868\u5355\u5B9E\u4F53] or [\u7D22\u5F15\u5B9E\u4F53]\u7F3A\u5C11\u7C7B\u578B\u5C5E\u6027\u914D\u7F6E"));const{data:i}=e,r=i[0][s];if(!r)throw new m(t,"\u6570\u636E\u6E90\u65E0\u8868\u5355\u7C7B\u578B\u5E94\u7528\u5B9E\u4F53\u5C5E\u6027\u503C");const n=t.openDataAppViews,o=n?.find(u=>u.refMode===r);if(!o)throw new f("\u6CA1\u6709\u627E\u5230\u4E0E\u8868\u5355\u7C7B\u578B".concat(r,"\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE"));return o}async executeNewDataAppUILogic(t,e){const{context:a,params:s,...i}=e,{data:r,view:n}=e,{enableWizardAdd:o,enableBatchAdd:u,batchAddOnly:c,newDataAppView:l}=t;let h;if(o){if(h=await this.getWizardNewViewRef(t,e),!h)return{ok:!1}}else if(u){const F=B(n.parentView.model.appDataEntityId),I=t.batchAddAppViews;if(h=I?.find(S=>S.refMode.toLowerCase()!==F),!h)throw new m(t,"\u6CA1\u6709\u627E\u5230\u6279\u6DFB\u52A0\u9700\u8981\u6253\u5F00\u7684\u9009\u62E9\u89C6\u56FE")}else{if(c)throw new w(t,"batchAddOnly\u6682\u672A\u652F\u6301");if(h=l,!h||!h.refAppViewId)throw new m(t,"newdata\u89C6\u56FE\u903B\u8F91\u6CA1\u6709\u914D\u7F6E\u9ED8\u8BA4\u65B0\u5EFA\u6570\u636E\u89C6\u56FE")}let p={},E={};const D=r?.[0]||{},y=h.navigateContexts;k(y)&&(p=N(y,D,s,a)),p=Object.assign(a,p);const v=h.navigateParams;if(k(v)&&(E=N(v,D,s,a)),s.srfcopymode){const I=(await ibiz.hub.getAppDataEntity(n.model.appDataEntityId,n.model.appId)).keyAppDEFieldId;I&&D&&(E[I]=D.srfkey,E.srfcopymode=!0)}E.srfuf=0;const b=await ibiz.commands.execute(st.TAG,h.refAppViewId,p,E,i);return u&&b.data&&await this.doBatchAdd(t,b.data,a,h),b}async getWizardNewViewRef(t,e){var a;const{wizardAppView:s,newDataAppViews:i}=t,{context:r,params:n,...o}=e;if(!s||!s.refAppViewId)throw new m(t,"\u7F3A\u5C11\u9ED8\u8BA4\u7D22\u5F15\u5B9E\u4F53\u9009\u62E9\u89C6\u56FE");const u=await ibiz.commands.execute(st.TAG,s.refAppViewId,r,n,{...o,openMode:"POPUPMODAL"});if(!u.ok)return;const c=(a=u.data)==null?void 0:a[0];if(!c)throw new f("\u8BF7\u9009\u4E2D\u4E00\u6761\u6570\u636E");const l=c.srfkey,h=i?.find(p=>{var E;return((E=p.refMode)==null?void 0:E.toUpperCase())===l.toUpperCase()});if(!h)throw new f("\u6CA1\u6709\u627E\u5230\u4E0E\u7D22\u5F15\u7C7B\u578B".concat(l,"\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE"));return h}async doBatchAdd(t,e,a,s){var i;if(e?.length){const r=await ibiz.hub.getAppDataEntity(t.appDataEntityId,a.srfappid),n=r.minorAppDERSs,o=s.refMode.toLowerCase();if(!n)throw new m(r,"\u5B9E\u4F53\u6CA1\u6709\u4ECE\u5173\u7CFB\u96C6\u5408\uFF01");let u;n?.forEach(p=>{const E=B(p.majorAppDataEntityId);o===E&&(u=p.parentAppDEFieldId)});const c=(i=s.navigateParams)==null?void 0:i.find(p=>p.key==="keymapping");let l=[];if(c){const p=c.value.split(";"),E={};for(const D of p){const[y,v]=D.split(":");y&&v&&(E[y]=v)}l=e.map(D=>{const y={[u]:D.srfkey};for(const v in E)if(Object.prototype.hasOwnProperty.call(E,v)){const b=E[v];Object.prototype.hasOwnProperty.call(D,v)&&(y[b]=D[v])}return y})}else l=e.map(p=>({[u]:p.srfkey}));await ibiz.hub.getApp(a.srfappid).deService.exec(r.id,"Create",a,l)}}},Fc=class extends Mt{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map(s=>Ve[s]||s)}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Pc=class extends Mt{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map(s=>H[s]||s)}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},bc=class extends ge{execute(t){if(!this.logic.appDEUIActionId)throw new m(this.logic,"\u903B\u8F91\u4E2D\u7F3A\u5C11\u89E6\u53D1\u5E94\u7528\u5B9E\u4F53\u754C\u9762\u884C\u4E3Aid");G.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};function Nc(){ibiz.scheduler=new vc,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",(t,e)=>new ua(t,e)),ibiz.scheduler.triggerFactory.register("ITEMENABLE",(t,e)=>new ua(t,e)),ibiz.scheduler.triggerFactory.register("ITEMBLANK",(t,e)=>new ua(t,e)),ibiz.scheduler.triggerFactory.register("TIMER",(t,e)=>new Ac(t,e)),ibiz.scheduler.triggerFactory.register("CUSTOM",(t,e)=>new Ic(t,e)),ibiz.scheduler.triggerFactory.register("VIEWEVENT",(t,e)=>new Fc(t,e)),ibiz.scheduler.triggerFactory.register("CTRLEVENT",(t,e)=>new Pc(t,e)),ibiz.scheduler.executorFactory.register("SCRIPT",(t,e)=>new gc(t,e)),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",(t,e)=>new Ei(t,e)),ibiz.scheduler.executorFactory.register("DEUILOGIC",(t,e)=>new Ei(t,e)),ibiz.scheduler.executorFactory.register("APPUILOGIC",(t,e)=>new yc(t,e)),ibiz.scheduler.executorFactory.register("APPDEUIACTION",(t,e)=>new bc(t,e))}function Sc(){const{ibiz:t}=window;t.util=new mc,t.hub=new lc,t.register=new xi,t.config=new Mi,t.auth=new Tn,t.asyncAction=new Bn,t.engine=new dc,ti(),oi(),qs(),Vs(),Nc(),ln(),t.platform=Os()}var Sl=d("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Le.dirname(this.url.pathname)}dir(t){return this.url.origin+Le.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map(a=>{const s=this.dir(a);return this.styleElementMap.has(s)?!1:(this.styleElementMap.set(s,null),new Promise((i,r)=>{const n=document.createElement("link");n.setAttribute("type","text/css"),n.setAttribute("rel","stylesheet"),n.setAttribute("href",s),n.onload=i,n.onerror=r,document.head.appendChild(n)}))});try{await Promise.all(e)}catch(a){ibiz.log.error(a)}}}),Ll=d("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}});