@ibiz-template/runtime 0.1.12-dev.0 → 0.1.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 (160) hide show
  1. package/dist/index.esm.js +6294 -371
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  5. package/out/controller/common/control/md-control.controller.js +9 -0
  6. package/out/controller/common/editor/editor.controller.d.ts +1 -1
  7. package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
  8. package/out/controller/common/editor/editor.controller.js +2 -4
  9. package/out/controller/control/app-menu/app-menu.controller.d.ts +1 -1
  10. package/out/controller/control/app-menu/app-menu.controller.d.ts.map +1 -1
  11. package/out/controller/control/app-menu/app-menu.controller.js +2 -2
  12. package/out/controller/control/caption-bar/caption-bar.controller.d.ts.map +1 -1
  13. package/out/controller/control/caption-bar/caption-bar.controller.js +1 -2
  14. package/out/controller/control/chart/chart.controller.js +1 -1
  15. package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
  16. package/out/controller/control/chart/generator/base-series-generator.js +5 -4
  17. package/out/controller/control/chart/generator/chart-options-generator.d.ts +25 -1
  18. package/out/controller/control/chart/generator/chart-options-generator.d.ts.map +1 -1
  19. package/out/controller/control/chart/generator/chart-options-generator.js +29 -1
  20. package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
  21. package/out/controller/control/exp-bar/exp-bar.controller.js +19 -0
  22. package/out/controller/control/form/edit-form/edit-form.controller.d.ts +7 -0
  23. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  24. package/out/controller/control/form/edit-form/edit-form.controller.js +54 -19
  25. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-item.controller.d.ts +4 -2
  26. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-item.controller.d.ts.map +1 -1
  27. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-item.controller.js +22 -2
  28. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.controller.d.ts +3 -62
  29. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.controller.d.ts.map +1 -1
  30. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.controller.js +7 -97
  31. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.controller.d.ts +2 -48
  32. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.controller.d.ts.map +1 -1
  33. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.controller.js +2 -94
  34. package/out/controller/control/form/search-form/search-form.controller.js +1 -0
  35. package/out/controller/control/form/search-form/search-form.service.d.ts +1 -1
  36. package/out/controller/control/form/search-form/search-form.service.d.ts.map +1 -1
  37. package/out/controller/control/form/search-form/search-form.service.js +2 -3
  38. package/out/controller/control/grid/grid/grid-column.controller.d.ts +16 -0
  39. package/out/controller/control/grid/grid/grid-column.controller.d.ts.map +1 -1
  40. package/out/controller/control/grid/grid/grid-column.controller.js +22 -0
  41. package/out/controller/control/grid/grid/grid.controller.d.ts +8 -0
  42. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  43. package/out/controller/control/grid/grid/grid.controller.js +20 -8
  44. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +8 -0
  45. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
  46. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +20 -1
  47. package/out/controller/control/index.d.ts +1 -0
  48. package/out/controller/control/index.d.ts.map +1 -1
  49. package/out/controller/control/index.js +1 -0
  50. package/out/controller/control/md-ctrl/index.d.ts +4 -0
  51. package/out/controller/control/md-ctrl/index.d.ts.map +1 -0
  52. package/out/controller/control/md-ctrl/index.js +3 -0
  53. package/out/controller/control/md-ctrl/md-ctrl-row.state.d.ts +34 -0
  54. package/out/controller/control/md-ctrl/md-ctrl-row.state.d.ts.map +1 -0
  55. package/out/controller/control/md-ctrl/md-ctrl-row.state.js +31 -0
  56. package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts +77 -0
  57. package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts.map +1 -0
  58. package/out/controller/control/md-ctrl/md-ctrl.controller.js +160 -0
  59. package/out/controller/control/md-ctrl/md-ctrl.service.d.ts +21 -0
  60. package/out/controller/control/md-ctrl/md-ctrl.service.d.ts.map +1 -0
  61. package/out/controller/control/md-ctrl/md-ctrl.service.js +40 -0
  62. package/out/controller/control/panel/panel/panel-item.controller.js +1 -1
  63. package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
  64. package/out/controller/control/panel/panel/panel.controller.js +4 -2
  65. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  66. package/out/controller/control/search-bar/search-bar.controller.js +15 -6
  67. package/out/engine/md-view.engine.d.ts.map +1 -1
  68. package/out/engine/md-view.engine.js +9 -3
  69. package/out/global/global-util/global-util.d.ts +8 -1
  70. package/out/global/global-util/global-util.d.ts.map +1 -1
  71. package/out/global/global-util/global-util.js +8 -1
  72. package/out/hub/config/app-view-config-service.d.ts.map +1 -1
  73. package/out/hub/config/app-view-config-service.js +1 -0
  74. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts +4 -0
  75. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts.map +1 -1
  76. package/out/interface/controller/event/control/i-edit-form.event.d.ts +48 -3
  77. package/out/interface/controller/event/control/i-edit-form.event.d.ts.map +1 -1
  78. package/out/interface/controller/event/control/i-form.event.d.ts +27 -0
  79. package/out/interface/controller/event/control/i-form.event.d.ts.map +1 -1
  80. package/out/interface/controller/event/control/i-md-control.event.d.ts +57 -14
  81. package/out/interface/controller/event/control/i-md-control.event.d.ts.map +1 -1
  82. package/out/interface/controller/state/control/i-exp-bar-control.state.d.ts +7 -0
  83. package/out/interface/controller/state/control/i-exp-bar-control.state.d.ts.map +1 -1
  84. package/out/interface/controller/state/control/i-search-bar.state.d.ts +7 -0
  85. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  86. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts +3 -3
  87. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts.map +1 -1
  88. package/out/logic-scheduler/executor/app-ui-logic-executor.js +3 -3
  89. package/out/service/service/code-list/code-list.service.d.ts.map +1 -1
  90. package/out/service/service/code-list/code-list.service.js +1 -1
  91. package/out/service/service/entity/method/method.d.ts.map +1 -1
  92. package/out/service/service/entity/method/method.js +4 -4
  93. package/out/service/utils/dynamic-code-list/dynamic-code-list.js +1 -1
  94. package/out/service/utils/index.d.ts +0 -1
  95. package/out/service/utils/index.d.ts.map +1 -1
  96. package/out/service/utils/index.js +0 -1
  97. package/out/ui-action/provider/backend-ui-action-provider.d.ts.map +1 -1
  98. package/out/ui-action/provider/backend-ui-action-provider.js +2 -3
  99. package/out/ui-action/uiaction-util.js +1 -1
  100. package/out/utils/handlebars/handlebars.d.ts +50 -0
  101. package/out/utils/handlebars/handlebars.d.ts.map +1 -0
  102. package/out/utils/handlebars/handlebars.js +64 -0
  103. package/out/utils/index.d.ts +1 -0
  104. package/out/utils/index.d.ts.map +1 -1
  105. package/out/utils/index.js +1 -0
  106. package/out/utils/script/script-function.d.ts.map +1 -1
  107. package/out/utils/script/script-function.js +3 -0
  108. package/out/utils/text-util/text-util.d.ts +9 -0
  109. package/out/utils/text-util/text-util.d.ts.map +1 -1
  110. package/out/utils/text-util/text-util.js +11 -0
  111. package/package.json +5 -3
  112. package/src/controller/common/control/md-control.controller.ts +7 -0
  113. package/src/controller/common/editor/editor.controller.ts +3 -6
  114. package/src/controller/control/app-menu/app-menu.controller.ts +6 -3
  115. package/src/controller/control/caption-bar/caption-bar.controller.ts +1 -2
  116. package/src/controller/control/chart/chart.controller.ts +1 -1
  117. package/src/controller/control/chart/generator/base-series-generator.ts +5 -3
  118. package/src/controller/control/chart/generator/chart-options-generator.ts +39 -1
  119. package/src/controller/control/exp-bar/exp-bar.controller.ts +25 -0
  120. package/src/controller/control/form/edit-form/edit-form.controller.ts +55 -24
  121. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-item.controller.ts +41 -4
  122. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.controller.ts +11 -159
  123. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.controller.ts +2 -140
  124. package/src/controller/control/form/search-form/search-form.controller.ts +1 -1
  125. package/src/controller/control/form/search-form/search-form.service.ts +2 -3
  126. package/src/controller/control/grid/grid/grid-column.controller.ts +22 -0
  127. package/src/controller/control/grid/grid/grid.controller.ts +25 -7
  128. package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +21 -1
  129. package/src/controller/control/index.ts +1 -0
  130. package/src/controller/control/md-ctrl/index.ts +3 -0
  131. package/src/controller/control/md-ctrl/md-ctrl-row.state.ts +40 -0
  132. package/src/controller/control/md-ctrl/md-ctrl.controller.ts +199 -0
  133. package/src/controller/control/md-ctrl/md-ctrl.service.ts +40 -0
  134. package/src/controller/control/panel/panel/panel-item.controller.ts +1 -1
  135. package/src/controller/control/panel/panel/panel.controller.ts +6 -2
  136. package/src/controller/control/search-bar/search-bar.controller.ts +21 -8
  137. package/src/engine/md-view.engine.ts +7 -3
  138. package/src/global/global-util/global-util.ts +9 -1
  139. package/src/hub/config/app-view-config-service.ts +1 -0
  140. package/src/interface/common/i-app-view-config-service/i-app-view-config-service.ts +4 -0
  141. package/src/interface/controller/event/control/i-edit-form.event.ts +53 -3
  142. package/src/interface/controller/event/control/i-form.event.ts +30 -0
  143. package/src/interface/controller/event/control/i-md-control.event.ts +63 -15
  144. package/src/interface/controller/state/control/i-exp-bar-control.state.ts +8 -0
  145. package/src/interface/controller/state/control/i-search-bar.state.ts +8 -0
  146. package/src/logic-scheduler/executor/app-ui-logic-executor.ts +5 -5
  147. package/src/service/service/code-list/code-list.service.ts +1 -4
  148. package/src/service/service/entity/method/method.ts +4 -8
  149. package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +1 -1
  150. package/src/service/utils/index.ts +0 -1
  151. package/src/ui-action/provider/backend-ui-action-provider.ts +2 -3
  152. package/src/ui-action/uiaction-util.ts +1 -1
  153. package/src/utils/handlebars/handlebars.ts +70 -0
  154. package/src/utils/index.ts +1 -0
  155. package/src/utils/script/script-function.ts +3 -0
  156. package/src/utils/text-util/text-util.ts +12 -0
  157. package/out/service/utils/route-context/route-context.d.ts +0 -20
  158. package/out/service/utils/route-context/route-context.d.ts.map +0 -1
  159. package/out/service/utils/route-context/route-context.js +0 -71
  160. package/src/service/utils/route-context/route-context.ts +0 -75
@@ -1,2 +1,2 @@
1
- System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","dayjs/plugin/minMax","dayjs/plugin/isSameOrBefore","dayjs/plugin/quarterOfYear","dayjs/plugin/weekOfYear","dayjs/plugin/isoWeek","async-validator"],(function(t){"use strict";var e,a,s,i,n,o,r,c,l,d,h,u,p,m,g,f,E,w,I,v,D,y,C,A,P,b,T,x,N,L,R,V,O,M,S,_,F,W,k,B,U,z,G,j,X,Y,K,H,q,Q,$;return{setters:[function(t){e=t.RuntimeError,a=t.RuntimeModelError,s=t.ModelError,i=t.IBizContext,n=t.HttpResponse,o=t.HttpError,r=t.CoreConst,c=t.Net,l=t.NOOP,d=t.isElementSame,h=t.findRecursiveChild,u=t.StringUtil,p=t.recursiveIterate,m=t.debounceAndAsyncMerge,g=t.mergeDefaultInLeft,f=t.isOverlap,E=t.mergeInLeft,w=t.awaitTimeout,I=t.toNumberOrNil},function(t){v=t.isEmpty,D=t.debounce,y=t.isArray,C=t.isFunction},function(t){A=t.notNilEmpty,P=t.isNilOrEmpty,b=t.AsyncSeriesHook,T=t.QXEvent,x=t.createUUID,N=t.isArray,L=t.setCookie,R=t.clearCookie,V=t.clearAll,O=t.ascSort,M=t.descSort},function(t){S=t.default},function(t){_=t.isNotNil,F=t.isNil,W=t.mergeRight,k=t.isEmpty,B=t.clone,U=t.equals,z=t.where,G=t.mergeDeepRight,j=t.mergeLeft},function(t){X=t.default},function(t){Y=t.default},function(t){K=t.default},function(t){H=t.default},function(t){q=t.default},function(t){Q=t.default},function(t){$=t.default}],execute:function(){t({calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t,s={};if(e||a){switch(Object.assign(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"})}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"})}}return s},calcDeCodeNameById:Dt,calcDynaClass:wt,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:s,colSM:i,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:l}=t,d=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:d(a,s),sm:d(i,n),md:d(o,r),lg:d(c,l)}},calcLayoutHeightWidth:Et,calcMainStateOPPrivsStrs:vt,calcNavParams:mt,calcResPath:na,calcRouteContext:function(t){let e=[];e=e.sort(((t,e)=>e.length-t.length));const[a]=e;if(a){const t={};return a.forEach((([e,a])=>{t[e]=a})),t}return{}},compare:Wt,compareNumber:kt,contains:Bt,convertNavData:lt,convertNavDataByArray:dt,convertNavDataByObject:ht,convertObjectToNavParams:ut,execDELogic:Oa,execDELogicAction:Ma,execDELogicById:async function(t,a,s,i,n){const o=await async function(t,e,a){const s=await ibiz.hub.getAppDataEntity(e,a);return Ct(t,s)}(t,a,s.srfappid);if(!o)throw new e("".concat(a,"找不到实体逻辑").concat(t));return Oa(o,s,i,n)},execFieldLogics:Sa,execUILogic:Ys,filterFieldLogics:At,filterValueRules:ne,findChildFormDetails:Rt,findDELogic:Ct,findEditItem:Lt,findFieldById:Pt,findModelChild:gt,formatMultiData:pt,generateRules:ps,getAppCounterProvider:He,getAppViewRef:function(t,e){var a,s;let i=t.appViewRefs||[];(null==(s=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:s.length)&&(i=i.concat(t.viewLayoutPanel.appViewRefs));return i.find((t=>t.name===e||t.id===e))},getChildNodeRSs:Nt,getControl:function(t,e){var a,s;let i=t.controls||[];(null==(s=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:s.length)&&(i=i.concat(t.viewLayoutPanel.controls));return i.find((t=>t.name===e||t.codeName===e||t.id===e))},getControlProvider:Ce,getControlsByView:Vt,getDeACMode:async function(t,e,a){var s;const i=await ibiz.hub.getAppDataEntity(e,a);return null==(s=i.appDEACModes)?void 0:s.find((e=>e.id===t))},getEditorProvider:be,getFormDetailProvider:Ne,getGridColumnProvider:Ve,getMatchResPath:ia,getOriginData:us,getPanelItemProvider:Se,getPortletProvider:je,getRootNode:Tt,getTreeNode:xt,getUIActionById:bt,getUIActionProvider:ke,getViewEngines:Mt,getViewLogics:Ot,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ve(i,n);if(t&&(e=Ue(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(s&&"DEFAULT"!==s){if(e=Ue("".concat(a,"_").concat(s)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(s,"]对应的适配器"),t)}e||(e=Ue(a));e||(e=Ue("DEFAULT"));return e},getWFContext:Qt,getWFSubmitViewId:function(t,e){var a;const{type:s,sequenceflowview:i,sequenceflowmobview:n}=e,o=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=s?"WFUTILACTION@".concat(s.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:i),c=o.find((t=>t.name===r));return null==c?void 0:c.refAppViewId},hasDeCodeName:yt,install:function(){const{ibiz:t}=window;t.util=new Xi,t.hub=new zi,t.register=new ct,t.config=new rt,t.auth=new ja,t.engine=new Gi,he(),Zs(),Je(),ibiz.scheduler=new Ji,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new en(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new en(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new en(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new an(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new tn(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new nn(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new on(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Ki(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Hi(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Hi(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new sn(t,e)))},installCommand:he,isValueChange:hs,matchMainState:It,openRedirectView:St,parseUserParams:ft,presetAppCounterProvider:Je,presetUIActionProvider:Zs,registerAppCounterProvider:Ye,registerControlProvider:function(t,e){ibiz.register.register("".concat(De,"_").concat(t),e)},registerEditorProvider:function(t,e){ibiz.register.register("".concat(Ae,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Te,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(Le,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Oe,"_").concat(t.toUpperCase()),e)},registerPortletProvider:function(t,e){ibiz.register.register("".concat(ze,"_").concat(t),e)},registerUIActionProvider:Fe,registerViewProvider:function(t,e){ibiz.register.register("".concat(Be,"_").concat(t),e)},strContain:Ut,testCond:Ft,toLocalOpenWFRedirectView:_t,verifyDeRules:Xt,verifyFormGroupLogic:Kt,verifyPanelGroupLogic:Ht});var J,Z,tt=Object.create,et=Object.defineProperty,at=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyNames,it=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,ot=(J={"../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"(t,e){function a(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function s(t,e){for(var a,s="",i=0,n=-1,o=0,r=0;r<=t.length;++r){if(r<t.length)a=t.charCodeAt(r);else{if(47===a)break;a=47}if(47===a){if(n===r-1||1===o);else if(n!==r-1&&2===o){if(s.length<2||2!==i||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2))if(s.length>2){var c=s.lastIndexOf("/");if(c!==s.length-1){-1===c?(s="",i=0):i=(s=s.slice(0,c)).length-1-s.lastIndexOf("/"),n=r,o=0;continue}}else if(2===s.length||1===s.length){s="",i=0,n=r,o=0;continue}e&&(s.length>0?s+="/..":s="..",i=2)}else s.length>0?s+="/"+t.slice(n+1,r):s=t.slice(n+1,r),i=r-n-1;n=r,o=0}else 46===a&&-1!==o?++o:o=-1}return s}var i={resolve:function(){for(var t,e="",i=!1,n=arguments.length-1;n>=-1&&!i;n--){var o;n>=0?o=arguments[n]:(void 0===t&&(t=process.cwd()),o=t),a(o),0!==o.length&&(e=o+"/"+e,i=47===o.charCodeAt(0))}return e=s(e,!i),i?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(a(t),0===t.length)return".";var e=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=s(t,!e)).length||e||(t="."),t.length>0&&i&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return a(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var s=arguments[e];a(s),s.length>0&&(void 0===t?t=s:t+="/"+s)}return void 0===t?".":i.normalize(t)},relative:function(t,e){if(a(t),a(e),t===e)return"";if((t=i.resolve(t))===(e=i.resolve(e)))return"";for(var s=1;s<t.length&&47===t.charCodeAt(s);++s);for(var n=t.length,o=n-s,r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var c=e.length-r,l=o<c?o:c,d=-1,h=0;h<=l;++h){if(h===l){if(c>l){if(47===e.charCodeAt(r+h))return e.slice(r+h+1);if(0===h)return e.slice(r+h)}else o>l&&(47===t.charCodeAt(s+h)?d=h:0===h&&(d=0));break}var u=t.charCodeAt(s+h);if(u!==e.charCodeAt(r+h))break;47===u&&(d=h)}var p="";for(h=s+d+1;h<=n;++h)h!==n&&47!==t.charCodeAt(h)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(r+d):(r+=d,47===e.charCodeAt(r)&&++r,e.slice(r))},_makeLong:function(t){return t},dirname:function(t){if(a(t),0===t.length)return".";for(var e=t.charCodeAt(0),s=47===e,i=-1,n=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!n){i=o;break}}else n=!1;return-1===i?s?"/":".":s&&1===i?"//":t.slice(0,i)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');a(t);var s,i=0,n=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var r=e.length-1,c=-1;for(s=t.length-1;s>=0;--s){var l=t.charCodeAt(s);if(47===l){if(!o){i=s+1;break}}else-1===c&&(o=!1,c=s+1),r>=0&&(l===e.charCodeAt(r)?-1==--r&&(n=s):(r=-1,n=c))}return i===n?n=c:-1===n&&(n=t.length),t.slice(i,n)}for(s=t.length-1;s>=0;--s)if(47===t.charCodeAt(s)){if(!o){i=s+1;break}}else-1===n&&(o=!1,n=s+1);return-1===n?"":t.slice(i,n)},extname:function(t){a(t);for(var e=-1,s=0,i=-1,n=!0,o=0,r=t.length-1;r>=0;--r){var c=t.charCodeAt(r);if(47!==c)-1===i&&(n=!1,i=r+1),46===c?-1===e?e=r:1!==o&&(o=1):-1!==e&&(o=-1);else if(!n){s=r+1;break}}return-1===e||-1===i||0===o||1===o&&e===i-1&&e===s+1?"":t.slice(e,i)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var a=e.dir||e.root,s=e.base||(e.name||"")+(e.ext||"");return a?a===e.root?a+s:a+t+s:s}("/",t)},parse:function(t){a(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var s,i=t.charCodeAt(0),n=47===i;n?(e.root="/",s=1):s=0;for(var o=-1,r=0,c=-1,l=!0,d=t.length-1,h=0;d>=s;--d)if(47!==(i=t.charCodeAt(d)))-1===c&&(l=!1,c=d+1),46===i?-1===o?o=d:1!==h&&(h=1):-1!==o&&(h=-1);else if(!l){r=d+1;break}return-1===o||-1===c||0===h||1===h&&o===c-1&&o===r+1?-1!==c&&(e.base=e.name=0===r&&n?t.slice(1,c):t.slice(r,c)):(0===r&&n?(e.name=t.slice(1,o),e.base=t.slice(1,c)):(e.name=t.slice(r,o),e.base=t.slice(r,c)),e.ext=t.slice(o,c)),r>0?e.dir=t.slice(0,r-1):n&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,e.exports=i}},function(){return Z||(0,J[st(J)[0]])((Z={exports:{}}).exports,Z),Z.exports}),rt=class{constructor(){this.view={enableDataInfoBar:!0},this.grid={editShowMode:"row",editSaveMode:"cell-blur"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5}}},ct=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}});function lt(t,...e){return!t||v(t)?{}:"[object Array]"===Object.prototype.toString.call(t)?dt(t,...e):"[object Object]"===Object.prototype.toString.call(t)?ht(t,...e):{}}function dt(t,...e){const a={};for(const s of t)if(A(s.value)&&!s.rawValue){const t=e.find((t=>!P(t)&&(t[s.value]||Object.prototype.hasOwnProperty.call(t,s.value))));t&&(a[s.key.toLowerCase()]=t[s.value])}else a[s.key.toLowerCase()]=s.value||null;return a}function ht(t,...e){const a={},s=/^%(.+)%$/;for(const i in t)if(A(t[i])&&s.test(t[i])){const s=t[i].substring(1,t[i].length-1),n=e.find((t=>Object.prototype.hasOwnProperty.call(t,s)));n&&(a[i.toLowerCase()]=n[s])}else a[i.toLowerCase()]=t[i]||null;return a}function ut(t){const e=[],a=/^%(.+)%$/;for(const s in t){let i=!0,n=t[s];A(t[s])&&a.test(t[s])&&(i=!1,n=t[s].substring(1,t[s].length-1)),e.push({key:s.toLowerCase(),rawValue:i,value:n})}return e}function pt(t,e){const a={};if(!t)return a;const s=Array.isArray(t)?t:ut(t),i=e[0];return s.forEach((t=>{const{rawValue:s,value:n}=t;!s&&n&&Object.prototype.hasOwnProperty.call(i,n)&&(a[n]=e.map((t=>t[n])).join(";"))})),a}function mt(t,e){const{deName:a,navFilter:s,pickupDEFName:i,navContexts:n,navParams:o}=t,{context:r,params:c,data:l,derValue:d}=e,h={},u={},p=d||l.srfkey;p&&(a&&(h[a]=p),s&&(u[s]=p),i&&(u["n_".concat(i.toLowerCase(),"_eq")]=p));const m=lt(n,r,c,l),g=lt(o,r,c,l);return Object.assign(h,m),Object.assign(u,g),{resultContext:h,resultParams:u}}function gt(t,e){if(t){const a=t.find((t=>t.id===e));if(a)return a}return null}function ft(t){const e={},a={},s={};for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i];if(-1!==i.indexOf(".")){const t=i.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(e,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(a,{[t[1]]:n});break;default:Object.assign(s,{key:n})}}}return{navigateContexts:e,navigateParams:a,other:s}}function Et(t){const{width:e,height:a,widthMode:s,heightMode:i}=t,n={width:"",height:""};return"FULL"===s?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===s?"%":"px")),"FULL"===i?n.height="100%":a&&a>0&&(n.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===i?"%":"px")),n}function wt(t,e){return jt.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1})}function It(t,e){const{mainStateAppDEFieldIds:a,demainStates:s}=t;if(a&&s){const t=[];return a.forEach((a=>{t.push(e[a])})),s.find((e=>{const{stateValue:a,state2Value:s,state3Value:i}=e;let n=!0;const o=[a,s,i];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function vt(t,e){const a=ibiz.hub.getApp().model,{demainStateOPPrivs:s,opprivAllowMode:i}=t,n=(null==s?void 0:s.map((t=>t.name)))||[];let o=[];if(i)o=n;else{o=[...a.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function Dt(t){return t.split(".").pop()}function yt(t,e){const a=Dt(e);return _(t[a])}function Ct(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function At(t,e){var a,s;const i=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?i.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?i.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&i.push(t.defaultValueAppDEFLogicId)})),(null==(s=t.appDELogics)?void 0:s.filter((t=>i.includes(t.id))))||[]}function Pt(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function bt(t){const[,,e]=t.split("@");return ibiz.hub.getApp(e).getUIAction(t)}function Tt(t){return t.detreeNodes.find((t=>t.rootNode))}function xt(t,e){return t.detreeNodes.find((t=>t.id===e))}function Nt(t,e){const a=e.parentId||Tt(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(s=t.searchMode,i=e.hasQuery,3===s||(i?1===s:2===s));var s,i}))}function Lt(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function Rt(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Vt(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function Ot(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function Mt(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a}async function St(t,e,s={},i={}){return async function(t,e,s={},i={}){var n;const o=t.appViewNavContexts||[],r=lt(o,e,s);e=Object.assign(e.clone(),r);const c=t.appViewNavParams||[],l=lt(c,e,s);Object.assign(s,l);const d=t.appDataEntityId,h=Dt(d);let u=(null==(n=i.data)?void 0:n[0])||{};e[h]=u[h]||e[h]||s[h];const p=t.getDataAppDEActionId,m=ibiz.hub.getApp(t.appId),g=await m.deService.getService(d);ibiz.loading.showRedirect();try{const t=await g.exec(p||"get",e,s);if(t.ok){u=t.data;let a=u.linkurl;if(a)return e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://")?new Promise((t=>{const e=window.open(a,"_blank");e&&(e.callback=()=>{t({ok:!0,data:[]})})})):a.startsWith("appredirectview?")?(await _t(e,a,i),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(d,t.appId),E=await async function(t,e,a,s){let i="";const n=e.typeAppDEFieldId;if(n){const{codeName:a}=Pt(t,n),i=s[a.toLowerCase()];if(A(i))return"".concat(i);ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(n,"]值为空"),s)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(A(r))return A(a.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=Pt(t,t.indexTypeAppDEFieldId);c=s[e.toLowerCase()]}if(P(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Pt(t,t.formTypeAppDEFieldId);c=s[e.toLowerCase()]}i=A(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return i}(f,t,s,u),w=E.split(":"),I=2===w.length?E:w.slice(0,2).join(":"),v="".concat(f.name.toUpperCase(),":").concat(E),D=t.redirectAppViewRefs,y=null==D?void 0:D.find((t=>{const e=t.name||t.id;return e===v||e===E||e===I}));if(!y)throw ibiz.log.error("重定向视图引用有:",null==D?void 0:D.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(E,"]或[").concat(v,"]或工作流[").concat(I,"]对应视图"));{const t=y.refAppViewId;if(!t)throw new a(y,"未配置实际引用视图");{const a=await ibiz.commands.execute(ce.TAG,t,e,s,{...i,data:[u]});if(a)return a}}return{ok:!0,data:[]}}(t,e,s,i)}async function _t(t,a,s={}){const i=a.lastIndexOf("?"),n=decodeURIComponent(a.substring(i+1,a.length)),o=S.parse(n,{delimiter:";"}),r=o.srfdename||"";if(!r)throw new e("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new e("未找到指定实体的codeName: ".concat(r));o[c.toLowerCase()]=o[r.toLowerCase()];const l="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),d=await ibiz.hub.getAppView(l);if(delete o.srfdename,"undo"!==o.srfwf){const t=o.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));o.wf=e,o.wfVersion=a}o.srfprocessinstanceid&&(t.srfprocessinstanceid=o.srfprocessinstanceid,delete o.srfprocessinstanceid),await ibiz.commands.execute(ce.TAG,d.id,t,o,s)}function Ft(t,a,s){if(Object.is(a,"IN"))return Bt(t,s);if(Object.is(a,"NOTIN"))return!Bt(t,s);switch(a){case"EQ":return"".concat(t)==="".concat(s);case"NOTEQ":return"".concat(t)!=="".concat(s);case"LT":return Wt(t,s)<0;case"LTANDEQ":return Wt(t,s)<=0;case"GT":return Wt(t,s)>0;case"GTANDEQ":return Wt(t,s)>=0;case"ISNULL":return P(t);case"ISNOTNULL":return A(t);case"TESTNULL":return F(t);case"IN":return Bt(t,s);case"NOTIN":return!Bt(t,s);case"LIKE":return Ut(t,s);case"LEFTLIKE":return Ut(t,s,"start");case"RIGHTLIKE":return Ut(t,s,"end");default:throw new e("值操作:".concat(a,",暂未支持"))}}function Wt(t,a){const s=Number(t),i=Number(a);if(!Number.isNaN(s)&&!Number.isNaN(i))return kt(s,i);const n=new Date(t).getTime(),o=new Date(a).getTime();if(!Number.isNaN(n)&&!Number.isNaN(o))return kt(n,o);throw new e("".concat(t," 和 ").concat(a," 无法比较大小"))}function kt(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Bt(t,a){if(!a||"string"!=typeof a)throw new e("范围比较的条件值不存或者不是字符串");if(t){return a.split(",").includes("".concat(t))}return!1}function Ut(t,e,a){if(!t||!e)return!1;const s="".concat(t).toUpperCase(),i="".concat(e).toUpperCase(),n=s.indexOf(i);switch(a){case"start":return 0===n;case"end":return n+i.length===s.length;default:return-1!==n}}var zt={singleRowReturn:!1,isAsync:!0},Gt=t("ScriptFunction",class{constructor(t,e,a=zt){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(...t){return i.apply({},t)}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?W(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const s=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),s.push(a[t])})),s}fillDefaultParams(t,e){const a=e.view;switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"parent":e.parent=null==a?void 0:a.parentView;break;case"topView":e.topView=null==a?void 0:a.getTopView();break;case"parentView":e.parentView=null==a?void 0:a.parentView;break;case"topViewSession":e.topViewSession=null==a?void 0:a.getTopView().session;break;case"viewSession":e.viewSession=null==a?void 0:a.session;break;case"appSession":e.appSession=ibiz.hub.controller.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),jt=t("ScriptFactory",class{static createScriptFn(t,e,a){return new Gt(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}});function Xt(t,a,s){const i={isPast:!0,infoMessage:s.ruleInfo};if(function(t){return"GROUP"===t.condType}(s)){const e=s.conds;e&&e.length>0&&(i.isPast=function(t,e,a="AND",s=!1){if(!((null==t?void 0:t.length)>0))return!1;let i="AND"===a;for(let s=0,n=t.length;s<n;s++){const n=e(t[s],s);if("AND"===a){if(!n){i=!1;break}}else if("OR"===a&&n){i=!0;break}}return s?!i:i}(e,(e=>{const{isPast:s,infoMessage:n}=Xt(t,a,e);return i.infoMessage=n,s}),s.condOp,!!s.notMode),!i.isPast&&("AND"===s.condOp&&s.notMode||"OR"===s.condOp&&!s.notMode)&&(i.infoMessage=s.ruleInfo))}else{t=null==s?void 0:s.defname.toLowerCase();try{if(function(t){return"SIMPLE"===t.condType}(s))i.isPast=!function(t,a,s,i,n,o,r){Object.is(n,"CURTIME")&&(s="".concat(new Date));if(Object.is(n,"ENTITYFIELD")){s=o[s=s?s.toLowerCase():""]?o[s]:s}(F(i)||k(i))&&(i="内容必须符合值规则");const c=Ft(t,a,s);if(!c&&r)throw new e(i);return!c}(a[t],s.condOp,s.paramValue,s.ruleInfo,s.paramType,a,s.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(s))i.isPast=!function(t,a,s,i,n,o,r){P(o)&&(o="值必须符合值范围规则");if(P(t)){if(r)throw new e("值为空");return o="值为空",!0}if(Yt(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==a)if(s){if(c<a){if(r)throw new e(o);return!0}}else if(c<=a){if(r)throw new e(o);return!0}if(null!=i)if(n){if(c>i){if(r)throw new e(o);return!0}}else if(c>=i){if(r)throw new e(o);return!0}return o="",!1}(a[t],s.minValue,s.includeMinValue,s.maxValue,s.includeMaxValue,s.ruleInfo,s.keyCond);else if(function(t){return"REGEX"===t.condType}(s))i.isPast=!Yt(a[t],s.regExCode,s.ruleInfo,s.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(s))i.isPast=!function(t,a,s,i,n,o,r){P(o)&&(o="内容长度必须符合范围规则");if(P(t)){if(r)throw new e("值为空");return o="值为空",!0}const c=t.length;if(null!==a)if(s){if(c<a){if(r)throw new e(o);return!0}}else if(c<=a){if(r)throw new e(o);return!0}if(null!==i)if(n){if(c>i){if(r)throw new e(o);return!0}}else if(c>=i){if(r)throw new e(o);return!0}return o="",!1}(a[t],s.minValue,s.includeMinValue,s.maxValue,s.includeMaxValue,s.ruleInfo,s.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(s)&&(null==s?void 0:s.sysValueRule)){const{ruleType:n,regExCode:o,scriptCode:r,ruleInfo:c}=s.sysValueRule;if(i.infoMessage=s.ruleInfo||c,"REG"===n)i.isPast=!Yt(a[t],o,i.infoMessage,s.keyCond);else if("SCRIPT"===n){const{isPast:n,infoMessage:o}=function(t,a,s,i,n){P(i)&&(i="值必须符合脚本规则");const o=a;let r="",c=!0;const l=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=jt.execScriptFn({value:t,data:o},s,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),l(t)}if(i="",!c&&n)throw new e(i);return{isPast:c,infoMessage:r||i}}(a[t],a,r,i.infoMessage,s.keyCond);i.isPast=n,i.infoMessage=o||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=s.notMode?!i.isPast:i.isPast}return i}function Yt(t,a,s,i){P(s)&&(s="值必须符合正则规则");if(P(t)){if(i)throw new e("值为空");return s="值为空",!0}if(!new RegExp(a).test(t)){if(i)throw new e(s);return!0}return s="",!1}function Kt(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const s=e.defdlogics;if(!s||0===s.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let i=!0;if("AND"===e.groupOP){i=void 0===s.find((e=>!Kt(t,e)))}else if("OR"===e.groupOP){i=void 0!==e.defdlogics.find((e=>Kt(t,e)))}return e.notMode?!i:i}if(function(t){return"SINGLE"===t.logicType}(e))return Ft(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new s(e,"未支持的逻辑类型".concat(e.logicType))}function Ht(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const s=e.panelItemLogics;if(!s||0===s.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let i=!0;if("AND"===e.groupOP){i=void 0===s.find((e=>!Ht(t,e)))}else if("OR"===e.groupOP){i=void 0!==e.panelItemLogics.find((e=>Ht(t,e)))}return e.notMode?!i:i}if(function(t){return"SINGLE"===t.logicType}(e))return Ft(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new s(e,"未支持的逻辑类型".concat(e.logicType))}var qt=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=B(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:s,mainMenuAlign:i}=t;let n="";return s?n="BLANK_MODE":i&&(n=i.toUpperCase()),""!==n?"".concat(e,"_").concat(a,"_").concat(n):"".concat(e,"_").concat(a)}});function Qt(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var $t=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t))($t||{})),Jt=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t))(Jt||{})),Zt=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Zt||{})),te=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.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))(te||{})),ee=t("StudioViewEvents",class{});ee.onViewMounted="onMounted",ee.onViewDestroyed="onDestroyed";var ae=t("StudioPanelEvents",class{});ae.onClick="onClick",ae.onChange="onChange",ae.onEnter="onEnter",ae.onLeave="onLeave";var se=t("StudioControlEvents",class{});se.onBeforeLoad="onBeforeLoad",se.onLoadSuccess="onLoadSuccess",se.onLoadError="onLoadError",se.onBeforeLoadDraft="onBeforeLoadDraft",se.onLoadDraftSuccess="onLoadDraftSuccess",se.onLoadDraftError="onLoadDraftError",se.onBeforeSave="onBeforeSave",se.onSaveSuccess="onSaveSuccess",se.onSaveError="onSaveError",se.onBeforeRemove="onBeforeRemove",se.onRemoveSuccess="onRemoveSuccess",se.onRemoveError="onRemoveError",se.CLICK="onClick";var ie=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.hooks={shouldDismiss:new b,beforeDismiss:new b},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function ne(t,e){return t.filter((t=>{const{checkMode:a}=t,s=t.deformItemName||t.degridEditItemName;return 2!==a&&s===e}))}var oe=t("TextUtil",class{format(t,e){return t}}),re=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,a,i={},n={}){const o=await ibiz.hub.config.view.get(t);if(!o)throw new e("应用视图[".concat(t,"]不存在"));if(a.srfkey&&o.appDataEntityId){a[Dt(o.appDataEntityId)]=a.srfkey,a.srfkey=void 0}if(o.redirectView){return St(await ibiz.hub.getAppView(t),a,i,n)}const{openMode:r="INDEXVIEWTAB"}=o;switch(n.openMode||r){case"INDEXVIEWTAB":return n.noWaitRoute?void this.openIndexViewTab(o,a,i):this.openIndexViewTab(o,a,i);case"POPUP":throw new s(o,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(o,a,i);case"POPUPAPP":throw new s(o,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(o,n.event,a,i);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(o,a,i);case"USER":return this.openUserCustom(o,a,i);default:return this.openIndexViewTab(o,a,i)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,a,s,i={}){if(!a)throw new e("气泡打开缺少event");return ibiz.openView.popover(t.id,a,s,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};re.TAG="ibiz.app-view.open";var ce=t("OpenAppViewCommand",re),le=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,a,i={},n={}){const o=ibiz.hub.getApp(a.srfappid).getAppFunc(t);if(!o)throw new e("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:l}=o,d=a.clone();Object.assign(d,lt(r,a,i));const h=lt(c,a,i);switch(l){case"APPVIEW":return this.openAppView(o,d,h,n);case"OPENHTMLPAGE":return this.openHtmlPage(o);case"PDTAPPFUNC":return this.openPdAppFunc(o,d,h);case"JAVASCRIPT":return this.executeJavaScript(o,d,h);case"CUSTOM":return this.custom(o,d,h);default:throw new s(o,"未支持的应用功能类型: ".concat(l))}}async openAppView(t,a,s,i){if(!t.appViewId)throw new e("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(ce.TAG,t.appViewId,a,s,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,a,s){throw ibiz.log.warn("openPdAppFunc",t,a,s),new e("未实现")}executeJavaScript(t,a,s){throw ibiz.log.warn("executeJavaScript",t,a,s),new e("未实现")}custom(t,a,s){throw ibiz.log.warn("custom",t,a,s),new e("未实现")}};le.TAG="ibiz.app-func.exec";var de=t("AppFuncCommand",le);function he(){new de,new ce}var ue=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){let s=-1;if(e==a?s=0:e>a&&(s=1),"EQ"===t||"ABSEQ"===t)return 0===s;if("GT"===t)return s>0;if("GTANDEQ"===t)return s>=0;if("LT"===t)return s<0;if("LTANDEQ"===t)return s<=0;if("NOTEQ"===t)return 0!==s}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},pe=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},me=class extends pe{parse(t){const e=t.length;let a=!0,s=!1,i=!1;for(let n=0;n<e;n++)if(a){const e=t[n];this.setCondOp(e),a=!1,s=!0}else if(s){const e=t[n];this.setParam(e),s=!1,i=!0}else if(i){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},ge=class t extends pe{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(a){const s=a.length;let i=!0,n=!0,o=!1;for(let r=0;r<s;r++){if(i&&n){if("!"===a[r]){this.setNotMode(!0),i=!1;continue}}if(n){const t=a[r];this.setCondOp(t),n=!1,i=!1,o=!0}else if(o){const s=a[r];if(!(s instanceof Array))throw new e("值必须为数组");s.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new me;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},fe=class extends ge{},Ee=class extends me{},we=class t extends ue{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,s){if(e instanceof ge){const t=e.getChildPSModelCondBases();if(null==t||k(t))return!e.isNotMode();const i="AND"===e.getCondOp();let n=i;for(let e=0;e<t.length;e++){const o=t[e];if(this.testCond(o,a,s)){if(!i){n=!0;break}}else if(i){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof me){k(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const i=a[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||k(o)?n=e.getValue():(k(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===o?n=s.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=s.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),i,n)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Ee}createPSModelGroupCond(){return new fe}};we.PARAMTYPE_DATACONTEXT="DATACONTEXT",we.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Ie=t("PSDEDQCondEngine",we);async function ve(t,e){var a;const s=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(s)return await ibiz.plugin.loadPlugin(s),"".concat(s.pluginType,"_").concat(s.pluginCode);ibiz.log.error("找不到".concat(t,"的插件模型"))}var De=t("CONTROL_PROVIDER_PREFIX","CONTROL");function ye(t){return ibiz.register.get("".concat(De,"_").concat(t))}async function Ce(t){let e;const{controlType:a,controlStyle:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ve(i,n);if(t&&(e=ye(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(s&&"DEFAULT"!==s){if(e=ye("".concat(a,"_").concat(s)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(s,"]对应的适配器"),t)}if(e=ye(a),e)return e;ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var Ae=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Pe(t){return ibiz.register.get("".concat(Ae,"_").concat(t))}async function be(t){let e;const{editorType:a,editorStyle:s,predefinedType:i,sysPFPluginId:n,appId:o}=t;if(n){const t=await ve(n,o);if(t&&(e=Pe(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(s&&"DEFAULT"!==s){if(e=Pe("".concat(a,"_").concat(s)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(s,"]对应的适配器"),t)}if(i){let n="".concat(i,"_").concat(a);if(s&&"DEFAULT"!==s&&(n+="_".concat(s)),e=Pe(n),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(i,"]对应的适配器"),t)}if(e=Pe(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var Te=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function xe(t){return ibiz.register.get("".concat(Te,"_").concat(t))}async function Ne(t){let e;const{detailType:a,sysPFPluginId:s,appId:i}=t;if(s){const t=await ve(s,i);if(t&&(e=xe(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=xe(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var Le=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Re(t){return ibiz.register.get("".concat(Le,"_").concat(t))}async function Ve(t){let e;const{columnType:a,enableRowEdit:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ve(i,n);if(t&&(e=Re(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const o=s?"".concat(a,"_EDIT"):a;if(e=Re(o),e)return e;ibiz.log.error("找不到表格列类型".concat(o,"对应的适配器"))}var Oe=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Me(t){return ibiz.register.get("".concat(Oe,"_").concat(t.toUpperCase()))}async function Se(t){var e;let a;const{itemType:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ve(i,n);if(t&&(a=Me(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if("CONTAINER"===s){const e=t.predefinedType||"DEFAULT";if(a=Me("CONTAINER_".concat(e)),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器"))}if("RAWITEM"===s){const s=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT";if(a=Me("RAWITEM_".concat(s)),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(s,"的适配器"))}if(a=Me(s),a)return a;ibiz.log.error("找不到面板成员类型".concat(s,"对应的适配器"))}var _e=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Fe(t,e){ibiz.register.register("".concat(_e,"_").concat(t),e)}function We(t){return ibiz.register.get("".concat(_e,"_").concat(t))}async function ke(t){let a;const{uiactionMode:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ve(i,n);if(t&&(a=We(t)),a)return a;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(a=We(s),a)return a;throw new e("找不界面行为模式".concat(s,"对应的适配器"))}var Be=t("VIEW_PROVIDER_PREFIX","VIEW");function Ue(t){return ibiz.register.get("".concat(Be,"_").concat(t))}var ze=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Ge(t){return ibiz.register.get("".concat(ze,"_").concat(t))}async function je(t){let e;const{portletType:a,sysPFPluginId:s,appId:i}=t;if(s){const t=await ve(s,i);if(t&&(e=Ge(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=Ge(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var Xe=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Ye(t,e){ibiz.register.register("".concat(Xe,"_").concat(t),e)}function Ke(t){return ibiz.register.get("".concat(Xe,"_").concat(t))}async function He(t){let a;const{codeName:s,counterType:i,sysPFPluginId:n,appId:o}=t;if(n){const t=await ve(n,o);if(t&&(a=Ke(t)),a)return a;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(a=Ke(s),a)return a;throw new e("找不到自定义系统计数器".concat(s,"对应的适配器"))}if(a=Ke(i),a)return a;throw new e("找不系统计数器类型".concat(i,"对应的适配器"))}var qe=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=i.create(),this.params={},this.evt=new T,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=B(t)),e&&(this.params=B(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 e("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&A(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()}}),Qe=t("AppDECounter",class extends qe{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const s=this.model.getAppDEActionId;if(!s)throw new a(this.model,"未找到获取计数器行为!");this.action=s,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),$e=t("AppDECounterProvider",class{createCounter(t){return new Qe(t)}});function Je(){Ye("DEDR",(()=>new $e))}t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Ie;return a.parse(["OR",this.calcCond(e)]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const s=e.dedqconditions;if(s){const t=this.calcCond(s);a.push(t)}}else{if("SINGLE"!==t.condType)throw new s(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.fieldName),e.condValue||a.push("")}}e.push(a)})),e}}).map=new WeakMap;var Ze=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(t))throw new s(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:s}=this.codeList,i=a?t[a]:t.srfkey;return e.id=i,e.value=i,e.text=s?t[s]:t.srfmajortext,Object.freeze(e)}async load(t={},e={}){const s=ibiz.hub.getApp(t.srfappid);if(this.isPredefined){e.size||(e.size=1e4);const t=await s.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),e);return Object.freeze(t.data.items)}const{appDataEntityId:i,appDEDataSetId:n}=this.codeList;if(!i)throw new a(this.codeList,"未配置应用实体");if(!n)throw new a(this.codeList,"未配置数据集");const o=await s.deService.exec(i,n,t,{},e);let r=[];return o.data.length&&(r=o.data.map((t=>this.convertData(t)))),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 t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const s=this.load(t,e),{cacheTimeout:i}=this.codeList,n=-1===i||F(i)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:s};this.cache.set(a,o);const r=await s;return o.items=r,delete o.promise,r}});function ta(t,a){if(null!=a){const{srfkey:t}=a;if(!F(t)&&!k(t))return!0}throw new e("执行「".concat(t,"」不存在「srfkey」无法处理"))}function ea(t,a){const{srfsessionid:s}=a;if(!F(s)&&!k(s))return!0;throw new e("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var aa=t("DECache",class{constructor(){this.cacheMap=new Map}forceAdd(t,e){const a=this.getCacheByTag(t).get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.getCacheByTag(t).set(e.srfkey,B(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.getCacheByTag(t).delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){try{ea("add",t),(F(e.srfkey)||k(e.srfkey))&&(e.srfkey=x()),e.srftempdate=(new Date).getTime();return this.getCacheByTag(t).set(e.srfkey,B(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{ea("get",t);const a=this.getCacheByTag(t).get(e);return ibiz.log.warn("get",e,a),B(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){try{ea("update",t),ta("update",e),e.srftempdate=(new Date).getTime();const a=this.getCacheByTag(t),s=a.get(e.srfkey);if(s)return s.assign(e),a.set(e.srfkey,s),ibiz.log.warn("update",e.srfkey,e),B(s);throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{ea("delete",t);const a=this.getCacheByTag(t),s=e;if(a.has(s)){const t=a.get(s);return t.srftempdate=(new Date).getTime(),a.delete(s),ibiz.log.warn("delete",s),t}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{ea("add",t);const a=this.getCacheByTag(t);for(let t=0;t<e.length;t++){const s=e[t];(F(s.srfkey)||k(s.srfkey))&&(s.srfkey=x()),s.srftempdate=(new Date).getTime();const i=B(s);a.set(s.srfkey,i),e[t]=i,ibiz.log.warn("add",s.srfkey,s)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{ea("update",t);const a=this.getCacheByTag(t);for(let t=0;t<e.length;t++){const s=e[t];ta("update",s),s.srftempdate=(new Date).getTime();const i=a.get(s.srfkey);if(!i)throw new Error("数据[".concat(s.srfdename,"-").concat(s.srfmajortext,"(").concat(s.srfkey,")]不存在,无法更新!"));i.assign(s),a.set(s.srfkey,i),ibiz.log.warn("update",s.srfkey,s),e[t]=B(i)}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{ea("delete",t)}catch(t){return ibiz.log.error(t),e}const a=this.getCacheByTag(t),s=[];for(let t=0;t<e.length;t++){const i=e[t];a.has(i)||s.push(i)}if(s.length>0)throw new Error("未找到以下数据「".concat(s.join("、"),"」,无法删除!"));for(let t=0;t<e.length;t++){const s=e[t];a.delete(s),ibiz.log.warn("delete",s)}return[]}checkData(t,e){return-1!==this.getList(t).findIndex((t=>t.srfkey===e))}getList(t){try{ea("getList",t);const e=this.getCacheByTag(t);if(!e)return[];const a=e.values();return Array.from(a)}catch(t){return ibiz.log.error(t),[]}}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=U(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const s=t[a];e[a]=U(s)}return z(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)}}),sa=new RegExp("(?<=\\$\\{)(.*?)(?=\\})","g");function ia(t,e){const a=(e.requestPaths||[]).map((t=>({path:t,keys:t.match(sa)||[]}))).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,s)=>s===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function na(t,e){const a=ia(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((s,i)=>{e=i===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(s,"\\}")),""):e.replace("${".concat(s,"}"),t[s])})),e}return a.path}return""}var oa=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(F(e.page)||k(e.page)||(this.page=e.page),F(e.size)||k(e.size)||(this.size=e.size),F(e.query)||k(e.query)||(this.query=e.query),!F(e.sort)&&!k(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}F(e.srfparentkey)||k(e.srfparentkey)||(this.srfparentkey=e.srfparentkey),F(e.srfparentdename)||k(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]}}),ra=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let s=[];return(null==a?void 0: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((t=>{var a;let s=t.text;t.textLanguageRes&&(s=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.textLanguageRes.defaultContent));const i={text:s,value:e?Number(t.value):t.value,color:t.color,id:t.codeName};return(null==(a=t.codeItems)?void 0:a.length)&&(i.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(i)}))}async getDynamicCodeList(t,e={},a={}){let s;const i=t.codeName;return this.cache.has(i)?s=this.cache.get(i):(s=new Ze(t),this.cache.set(i,s),await s.init()),s.get(e,a)}async get(t,a,s){const i=this.allCodeLists.get(t);if(!i)throw new e("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,a,s):[]}}),ca=t("CounterService",class{static async getCounter(t,e,a){const s=t.id;if(this.counterMap.has(s)){const t=this.counterMap.get(s);if(!1===t.isDestroyed)return t;this.counterMap.delete(s)}const i=(await He(t)).createCounter(t);return await i.init(e,a),this.counterMap.set(s,i),i}static async getCounterByRef(t,e,s){const{appCounter:i}=t;if(!i)throw new a(t,"未配置应用计数器!");return this.getCounter(i,e,s)}});ca.counterMap=new Map;var la=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}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/alls/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/alls/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 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,a,s={},i={}){switch(t){case"wfstart":return this.wfStart(a,s,i);case"wfsubmit":return this.wfSubmit(a,s,i);case"reassign":return this.wfReassign(a,s,i);case"addstepbefore":return this.wfAddStepBefore(a,s,i);case"sendback":return this.wfSendBack(a,s,i);case"sendcopy":return this.wfSendCopy(a,s,i);default:throw new e("「".concat(t,"」未实现"))}}}),da=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(da||{})),ha=t("AppDataEntity",class t{get srfuf(){return this.srfkey?1:0}constructor(e,a){let s;Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:B(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=gt(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfile",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(t){s=t},get(){return this._data[t]||s}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const n=gt(e.appDEFields||[],e.majorAppDEFieldId);if(n){const t=n.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfile",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));this.defineProperties()}defineProperties(){var t;const{_data:e}=this,a={},s=Object.keys(e);s.forEach((t=>{a[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const i=t.codeName.toLowerCase();s.includes(i)||(a[i]={enumerable:!0,set(t){e[i]=t},get:()=>e[i]})})),Object.defineProperties(this,a)}clone(){return new t(this._entity,this._data)}assign(e){return e instanceof t?Object.assign(this._data,e._data):Object.assign(this._data,e),this}}),ua=t("MethodDto",class t{constructor(t,e){this.entity=t,this.dto=e,this.dtoMap=new Map,e?(this.app=ibiz.hub.getApp(t.appId),this.fields=e.appDEMethodDTOFields||[]):this.fields=[]}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async get(t,e){const a={};for(let e=0;e<this.fields.length;e++){const i=this.fields[e],n=i.codeName.toLowerCase();switch(i.type){case"SIMPLE":break;case"DTOS":{if(!i.refAppDataEntityId)break;const e=await this.getFieldDto(i),s=(await this.app.deService.getService(i.refAppDataEntityId)).local.getList(t);if(s){const i=[];for(let a=0;a<s.length;a++)i.push(await e.get(t,s[a]));a[n]=i}break}default:throw new s(i,"未支持的应用实体方法输入属性类型: ".concat(i.type))}}return{...e,...a}}async sets(t,e){const a=await this.app.deService.getService(this.entity.id);return a.local.clear(t),Promise.all(e.map((async e=>{const s=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{if(!a.refAppDataEntityId)return;const s=a.codeName.toLowerCase(),i=await this.getFieldDto(a),n=e[s];n&&await i.sets(t,n)}));for(let t=0;t<s.length;t++)await s[t];const i=new ha(this.entity,e);return this.isLocalMode&&await a.local.add(t,i),i})))}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=gt(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),i=new t(a,s);return this.dtoMap.set(e.codeName,i),i}}),pa=class{constructor(t,e){this.entity=t,this.method=e,this.app=ibiz.hub.getApp(t.appId),this.input=new class{constructor(t,e){if(this.entity=t,this.input=e,e){const a=gt(t.appDEMethodDTOs||[],e.appDEMethodDTOId);a&&(this.dto=new ua(t,a))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}(t,e.appDEMethodInput),this.result=new class{constructor(t,e){if(this.entity=t,this.output=e,e){const a=gt(t.appDEMethodDTOs||[],e.appDEMethodDTOId);a&&(this.dto=new ua(t,a))}}async handle(t,e){return this.dto?(await this.dto.sets(t,[e]))[0]:new ha(this.entity,e)}}(t,e.appDEMethodReturn)}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async request(t,e,s,i){const{actionType:n,requestMethod:o}=this.method;if("REMOTE"===n){const e=this.method.codeName.toLowerCase();let n=null;switch(o){case"POST":n=await this.app.net.post("".concat(t,"/").concat(e),s,i);break;case"GET":n=await this.app.net.get("".concat(t,"/").concat(e),s,i);break;case"PUT":n=await this.app.net.put("".concat(t,"/").concat(e),s,i);break;case"DELETE":n=await this.app.net.delete("".concat(t,"/").concat(e),s,i);break;default:throw new a(this.method,o?"未支持的请求方式: ".concat(o):"未配置请求方式")}return n}throw new a(this.method,"未支持的行为类型[".concat(n,"]"))}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return na(t,this.entity)+e}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(t){return new ha(this.entity,t)}},ma=class{},ga=class extends ma{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,i){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=i[this.value]?i[this.value]:e[this.value];return Ft(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return Ft(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new s(this.model,"暂未支持条件值类型为[当前时间]");default:return Ft(n[this.dstField],this.op,this.value)}}},fa=class t extends ma{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new ga(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,s){let i=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,s);if("AND"===this.op&&!1===n){i=!1;break}if("OR"===this.op&&!0===n){i=!0;break}}return this.notMode?!i:i}},Ea=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new fa(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data||{})}}(t)))}},wa=class extends Ea{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:s,dstDELogicParamId:i,retDELogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!s)throw new a(this.model,"未指定实体行为");const o=t.params[i],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,s,t.context,o,t.viewParams);c.ok&&(t.params[n]=c.data)}},Ia=class extends Ea{async exec(t){}},va=class extends Ea{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:i}=this.model;switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=i;break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new s(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function Da(t,e){const{srcDELogicParamId:a,srcValueType:i,srcFieldName:n,srcValue:o}=e;let r;switch(e.srcValueType||(e.srcValueType="SRCDLPARAM"),i){case"SRCDLPARAM":r=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return o;case"VIEWPARAM":r=t.viewParams;break;case"APPDATA":r=t.context;break;case"ENVPARAM":r=B(ibiz.env);break;default:throw new s(e,"暂未支持源值类型".concat(i))}const c=null==n?void 0:n.toLowerCase();return r&&c&&(r=r[c]),r}var ya=class extends Ea{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new s(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,s=Da(e,t);e.params[a]=B(s)}bindParam(t,e){const a=Da(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:s}=t,i=null==a?void 0:a.toLowerCase(),n=Da(e,t);i?e.params[s][i]=n:e.params[s]=n}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:s,srcIndex:i,srcSize:n}=t,o=Da(e,t),r=s||0,c=i||0,l=n||o.length;e.params[a].splice(r,0,...o.slice(c,l))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:s,dstSortDir:i}=t,n=s.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},Ca=class extends Ea{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:s,retDELogicParamId:i}=this.model,n=t.params[s],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(a,e,t.context,n,t.viewParams);r.ok&&(t.params[i]=r.data)}},Aa=class extends Ea{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const i=Da(t,this.model);t.params[e]=i}},Pa=class extends Ea{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},ba=class extends Ea{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Ta=class extends Ea{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const i=Da(t,this.model);t.params[e]=B(i)}},xa=class extends Ea{async exec(t){const{dstDELogicParamId:e,dstSortDir:s,dstFieldName:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=i.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Na=class extends Ea{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:s,dstIndex:i,srcIndex:n,srcSize:o}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Da(t,this.model),c=i||0,l=n||0,d=o||r.length;t.params[e].splice(c,0,...r.slice(l,d))}},La=class extends Ea{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new o({response:{status:e,statusText:a}})}},Ra=class{constructor(t){var e,i;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Ia(t);break;case"END":a=new va(t);break;case"DEACTION":a=new wa(t);break;case"PREPAREPARAM":a=new ya(t);break;case"DEDATASET":a=new Ca(t);break;case"THROWEXCEPTION":a=new La(t);break;case"BINDPARAM":a=new Aa(t);break;case"RESETPARAM":a=new Pa(t);break;case"COPYPARAM":a=new Ta(t);break;case"RENEWPARAM":a=new ba(t);break;case"APPENDPARAM":a=new Na(t);break;case"SORTPARAM":a=new xa(t);break;default:throw new s(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(i=t.delogicParams)||i.forEach((t=>{this.params.set(t.id,new class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)t.params[e]=t.data||{};else if(a.appGlobalParam)t.params[e]=B(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new s(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else{if(a.lastReturnParam)throw new s(a,"未支持的逻辑参数类型: 上次调用返回");if(a.appContextParam)t.params[e]=t.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=B(t.data||{});else{if(a.envParam)throw new s(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new s(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new s(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new s(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new s(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new s(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new s(a,"未支持的逻辑参数类型: 操作会话变量")}}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new s(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}}(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,s){const i=new class{constructor(t,e,a,s){this.deLogicParams=t,this.context=e,this.data=a,this.viewParams=s,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}}(this.params,t,e,s);this.initLogicParams(i);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(n);await this.deepExec(t,i)}return i.isEndNode?i.result:i.params[i.defaultParamName]?i.params[i.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),!1===t.model.parallelOutput))break}}},Va=new Map;async function Oa(t,e,a,s){Va.has(t)||Va.set(t,new Ra(t));return Va.get(t).exec(e,a,s)}async function Ma(t,e,a,s){try{const i=await Oa(t,e,a,s);return new n(i)}catch(t){if(t instanceof o)return new n(t,500);throw t}}async function Sa(t,e,a,s,i){const n=At(t,e);if(n.length){(await Promise.all(n.map((t=>Oa(t,a,s,i))))).forEach((t=>{Object.assign(s,t)}))}}var _a=class extends pa{async exec(t,e,s){if("DELOGIC"===this.method.actionType){const i=Ct(this.method.appDELogicId,this.entity);if(!i)throw new a(this.method,"缺少实体处理逻辑");return Ma(i,t,e,s)}let i;switch(this.isLocalMode||(e=await this.input.handle(t,e)),["READ","GETDRAFT"].includes(this.method.actionMode)||await Sa(this.entity,"change",t,e,s),this.method.codeName){case"Create":i=await this.create(t,e,s);break;case"Get":i=await this.get(t,s);break;case"GetDraft":i=await this.getDraft(t,s);break;case"Remove":i=await this.remove(t,s);break;case"Update":i=await this.update(t,e,s);break;case"CreateTemp":i=await this.createTemp(t,e);break;case"GetTemp":i=await this.getTemp(t,e);break;case"GetDraftTemp":i=await this.getDraftTemp(t,s);break;case"RemoveTemp":i=await this.removeTemp(t,e);break;case"UpdateTemp":i=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);this.method.needResourceKey&&(a="".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]||e[this.entity.keyAppDEFieldId]));const n=await this.request(a,t,e,s);n.data=await this.result.handle(t,n.data),i=n}}return await Sa(this.entity,"compute",t,i.data,s),i}async create(t,e,a){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(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=await a.local.add(t,this.createEntity(e));return new n(s)}catch(t){return new n(t,500)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new n(t):new n(t,500)}catch(t){return new n(t,500)}}async removeTemp(t,e){try{let e=null;!e&&t&&(e=t[this.entity.codeName.toLowerCase()]);const a=(await this.getService()).local.delete(t,e);return a?new n(a):new n(a,500)}catch(t){return new n(t,500)}}async updateTemp(t,e){try{const a=(await this.getService()).local.update(t,this.createEntity(e));return a?new n(a):new n(a,500)}catch(t){return new n(t,500)}}async getTemp(t,e){try{let e=null;!e&&t&&(e=t[this.entity.codeName.toLowerCase()]);const a=(await this.getService()).local.get(t,e);return a?new n(a):new n(a,500)}catch(t){return new n(t,500)}}async removeBatchTemp(t,e){return new n(!0)}},Fa=class extends pa{async exec(t,e,a){if(this.isLocalMode){const a=await this.searchLocal(null,new oa(t,e));return new n(a,200)}let i;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":i=await this.fetchCodeListSet(t,a);break;case"REMOTE":{const s=this.calcPath(t);i=await this.request(s,t,e,a)}break;default:throw new s(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const o=i.data||[];return i.data=o.map((t=>this.createEntity(t))),i.data.length&&await Promise.all(i.data.map((e=>Sa(this.entity,"compute",t,e,a)))),i}async selectLocal(t,e={}){let a=(await this.getService()).local.getList(t);a=O(a,"srfordervalue");const s={},i={},n={},o={};e.srfkey&&(s.srfkey=U(e.srfkey),delete e.srfkey);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];null==a?(i[t]=U(null),n[t]=U(void 0),o[t]=U("")):s[t]=U(a)}if(!k(s)){const t=z(s),e=z(i),r=z(n),c=z(o);a=a.filter((a=>{if(k(i)){if(t(a))return!0}else if(t(a)&&(e(a)||r(a)||c(a)))return!0;return!1}))}return a.map((t=>t.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((a=>t.test(a,e))))):(i=await this.selectLocal(e.context),i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const s=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const i=t[a[e]];if(s.test(i))return!0}return!1})))),F(e.sortField)||k(e.sortField)||(i="DESC"===e.sortMode?M(i,e.sortField):O(i,e.sortField));const{page:n,size:o}=e,r=n*o,c=(n+1)*o-1;return i.slice(r,c).map((t=>B(t)))}async fetchCodeListSet(t,e){const{appCodeListId:s}=this.method;if(!s)throw new a(this.method,"没有指定数据来源代码表");const i=await this.app.codeList.get(s,t,e),{keyAppDEFieldId:o,majorAppDEFieldId:r}=this.entity,c=i.map((t=>({[o]:t.value,[r]:t.text})));return new n(c,200)}},Wa=t("DEService",class{constructor(t){this.model=t,this.methodMap=new Map,this.local=new aa,this.wf=new la(t),this.file=new class{constructor(t){this.model=t}exportData(t,e,a,s){const i=na(a,this.model),n="".concat(i,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:s,responseType:"blob"})}}(t)}getMethod(t){if(this.methodMap.has(t))return this.methodMap.get(t);const e=gt(this.model.appDEMethods,t);let a=null;switch(e.methodType){case"DEACTION":a=new _a(this.model,e);break;case"FETCH":case"FETCHTEMP":a=new Fa(this.model,e);break;default:throw new s(e,"未支持的服务方法类型: ".concat(e.methodType))}return this.methodMap.set(t,a),a}exec(t,a,s={},i={}){const n=this.getMethod(t);if(n)return n.exec(a,s,i);throw new e("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}}),ka=t("ControlVO",class t{get srfuf(){return F(this.$origin.srfuf)?this.srfkey?1:0:this.$origin.srfuf}get srfkey(){return this.$origin.srfkey}get srfmajortext(){return this.$origin.srfmajortext}get srfdeid(){return this.$origin.srfdeid}get srfdecodename(){return this.$origin.srfdecodename}get srfkeyfile(){return this.$origin.srfkeyfile}get srfmajorfile(){return this.$origin.srfmajorfile}constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t.isOriginField)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a=!0){"srfuf"!==t&&(a||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=B(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),Ba=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(null==t?void 0:t.srfappid),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 t}toUIData(t){return new ka(t,this.dataUIMap)}}),Ua=t("MDControlService",class extends Ba{async fetch(t,e={}){var a;const s=(null==(a=this.model.fetchControlAction)?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=(null==(a=this.model.getControlAction)?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=(null==(a=this.model.getDraftControlAction)?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=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(s,t,void 0,e)}async create(t,e){var a;const s=(null==(a=this.model.createControlAction)?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=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}async exportData(t,a,s={}){throw new e("未实现")}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&&(N(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),za=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const s=this.entityModel;if(!s.enableDEMainState)return ibiz.log.debug("".concat(s.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,s);const i=It(s,e);if(i){ibiz.log.debug("匹配主状态",i);const e=vt(i,s);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),Ga=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const a=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!a)throw new e("未找到应用实体[".concat(t,"]"));const s=this.constructorCache.get(t);let i;i=s?await s(a):new za(a),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){if(!t)throw new e("没有appData数据");t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0)}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),s=await e.getOPPriv(t,a);if(this.enablePermission&&(null==s?void 0:s.mapSysUniResCode)&&!this.calcByResCode(s.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),ja=t("V7AuthService",class{async login(t,e){try{const a=await ibiz.net.post("/v7/login",{loginname:t,password:e}),{data:s}=a;if(s&&s.token){L(r.TOKEN,s.token,0,!0);const t=(new Date).getTime()+1e3*(s.expirein||7199);L(r.TOKEN_EXPIRES,"".concat(t),0,!0)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),R(r.TOKEN),R(r.TOKEN_EXPIRES),!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}}),Xa=t("TreeNodeData",class{constructor(t,e,a){this.leaf=!1,this.leaf=!0===a.leaf,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}}),Ya=t("TreeCodeListNodeData",class extends Xa{constructor(t,e,a){super(t,e,a);const{data:s}=a;if(this.deData=s,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 e=Dt(t.appDataEntityId);this.context=Object.assign(this.context||{},{[e]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text,this.icon=this.calcIcon(t)}}),Ka=t("TreeDataSetNodeData",class extends Xa{constructor(t,e,a){super(t,e,a);const{data:s}=a;if(this.deData=s,this.text=s.srfmajortext,this.value=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 e=Dt(t.appDataEntityId);this.context=Object.assign(this.context||{},{[e]:s.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext,this.icon=this.calcIcon(t),this.textHtml=this.calcTextHtml(t)}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=null==s?void 0:s.find((t=>"icon"===t.id));return i&&(e.htmlStr=this.calcDataItemScript(i)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return jt.execScriptFn({data:this.deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,s=null==a?void 0:a.find((t=>"text"===t.id));return s&&(e=this.calcDataItemScript(s)),e}}),Ha=t("TreeStaticNodeData",class extends Xa{constructor(t,e,a){var s,i;super(t,e,a);const n="root"===t.nodeValue?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=n,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t.parent;(null==t?void 0:t.deData)&&(this.deData=t.deData),this.value=n||(null==t?void 0:t.value)}this.srfkey=(null==(s=this.deData)?void 0:s.srfkey)||this.value,this.srfmajortext=(null==(i=this.deData)?void 0:i.srfmajortext)||this.text,this.icon=this.calcIcon(t)}}),qa=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,F(a.isOriginField)||(this.isOriginField=a.isOriginField)}}),Qa=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}}),$a=t("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 a=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!a)throw new e("未找到应用实体[".concat(t,"]"));const s=this.constructorCache.get(t);let i;i=s?await s(a):new Wa(a),this.cache.set(t,i)}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)}}),Ja=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new c({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.deService=new $a(t),this.codeList=new ra(t),this.authority=new Ga(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle()}async loadAppModelStyle(){await this.net.get("".concat(ibiz.env.remoteModelUrl,"/PSSYSAPP.json.css")).then((t=>{const e=document.createElement("style");if(e.setAttribute("type","text/css"),t.request&&t.request.responseURL){const a=new URL(t.request.responseURL);e.id=a.pathname}e.innerHTML=t.data,document.head.appendChild(e)})).catch((t=>{ibiz.log.error("应用[".concat(this.appId,"]模型全局样式加载失败:").concat(t.message))}))}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,s;let i=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!i&&e){i=null==(s=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:s.find((e=>e.name===t))}return i}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}}),Za=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Za||{})),ts=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(ts||{})),es=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(es||{})),as=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new e("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),ss=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new as(l)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),is=t("CTXState",class{}),ns=t("CTX",class{constructor(t){this.parent=t,this.evt=new T(3e3),this.controllersMap=new Map,this.state=new is}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),os=t("ActivityCounter",class extends as{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),rs=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await bt(this.uiActionId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:s,uiactionMode:i,uiactionTag:n}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(s&&"NONE"!==s||"SYS"===i&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&!t):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),cs=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),ls=t("QXEventEx",class extends T{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((a=>a(t,...e))),i=Promise.all(s),n=await a,o=await i;return n.concat(...o)}reset(){super.reset(),V(this.anyEventFns)}}),ds=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.evt=new ls}async emit(t,e){await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.evt.on(t,e)}onAll(t){this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset()}});function hs(t,e){return(!F(t)&&""!==t||!F(e)&&""!==e)&&t!==e}function us(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof ka&&(e=e.getOrigin()),e}function ps(t,a,s){const i=[];return t.forEach((t=>{const{valueRuleType:n}=t,o=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===n&&o)"REG"===o.ruleType?i.push({pattern:new RegExp(o.regExCode),message:o.ruleInfo,trigger:"change blur"}):"SCRIPT"===o.ruleType&&i.push({validator:(t,e,a,s)=>{if(!e)return!0;try{jt.execScriptFn({rule:t,value:e,callback:a,source:s},o.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===n&&r){const t=s||a;i.push({validator:(a,s,i,n)=>{if(P(n[t]))return!0;const{isPast:o,infoMessage:c}=Xt(t,n,r.groupCond);return o||i(new e(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}var ms="__self",gs=t("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 ds(this.getEventArgs.bind(this)),this.mountCounter=new os(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}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(ms),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(ms)||this.mountCounter.attend(ms)}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(),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)}}),fs=t("ViewController",class extends gs{constructor(t,e,a,s){super(ibiz.util.layoutPanel.fill(t),i.create({},e),a||{},new ns(s)),this.session={},this.modal=new ie({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new ss,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 null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this._isActive}onActivated(){this._isActive=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this._isActive=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=Mt(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e&&this.engines.push(e)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await ca.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await Ce(t);this.providers[t.name]=e;const a=Vt(this.model);a&&await Promise.all(a.map((async t=>{const e=await Ce(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const s=Ot(this.model);s.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(s),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){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("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){this.context.srfappid=this.model.appId,(F(this.context.srfsessionid)||k(this.context.srfsessionid))&&(this.context.srfsessionid=x());const t=this.model.appViewNavContexts;let e={};A(t)&&(e=lt(t,this.context,this.params)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let s={};A(a)&&(s=lt(a,this.context,this.params)),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),void 0!==a)break;return a}async callUIAction(t,a){const s=this.call(t,a);if(void 0===s)throw new e("没有引擎支持预置界面行为".concat(t));return s}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEvent)}))}}),Es=(t("MobViewController",class extends fs{}),t("EditorController",class{constructor(t,e){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(){this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t.toLowerCase()]=this.model.editorParams[t]}))}handlePublicParams(t,e,a){const{navigateContexts:s,navigateParams:i}=this.model;let n={};s&&t&&(n=lt(s,e,a,t));const o=Object.assign(e.clone(),n);let r={};i&&t&&(r=lt(i,e,a,t));return{context:o,params:{...a,...r}}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}})),ws=(t("CodeListEditorController",class extends Es{async loadCodeList(t){const{context:e,params:s}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,s),a}throw new a(this.model,"请配置代码表")}}),t("ControlController",class extends gs{constructor(t,e,a,s){super(t,e,a,s),this.providers={},this.registerToCtx();const i=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));i&&(this.controlPanel=i)}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(){if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await Ce(this.controlPanel);this.providers[this.controlPanel.name]=t}this.initControlScheduler(this.model.controlLogics)}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy()}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){return{context:this.context.clone(),params:{...this.params},data:(null==t?void 0:t.data)||this.getData()||[]}}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)}))}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}})),Is=t("MDControlController",class extends ws{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(){await super.onCreated(),this.setSort()}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,n={...this.params};return a&&(n.page=e-1,n.size=a),!i&&s&&(n.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:s}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.params),n=await this.service.fetch(s,i);"number"==typeof n.total&&(this.state.total=n.total),a?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}finally{await this.endLoading()}return this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:a,params:s,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new e("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this.startLoading();let n=!1;try{const e=Dt(this.model.appDataEntityId);await Promise.allSettled(i.map((async t=>{if(0!==t.srfuf){const i=a.clone();i[e]=t.srfkey,await this.service.remove(i,s),n=!0}this.afterRemove(i)}))),!0!==(null==t?void 0:t.silent)&&ibiz.notification.success({desc:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),n&&this.refresh()}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));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;d(e,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}))}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){}async exportData(t){}}),vs=t("AppMenuController",class extends ws{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),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async onClickMenuItem(t,s){const i=h(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new e("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:s}),!i.appFuncId)throw new a(i,"没有配置应用功能");const n=this.context.clone();this.routeDepth&&Object.assign(n,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(de.TAG,i.appFuncId,n,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(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));i=i&&e.includes(!0)}a.permitted=s,a.visible=i}return this.state.menuItemsState[t.id]=a,a}getAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};return e(this.model.appMenuItems),t}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}}),Ds=(t("AppMenuIconViewController",class extends vs{async onClickMenuItem(t,s){const i=h(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new e("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:s}),!i.appFuncId)throw new a(i,"没有配置应用功能");const n=this.context.clone();1===this.routeDepth&&Object.assign(n,{toRouteDepth:1}),await ibiz.commands.execute(de.TAG,i.appFuncId,n,this.params)}}),t("CalendarService",class extends Ua{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const s=a.map((async a=>{const s=a.appDEDataSetId||"fetchdefault";return this.exec2(s,t,e,void 0,a.appDataEntityId)}));return(await Promise.all(s)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,a){const{sysCalendarItems:s}=this.model;if(!s)throw new e("未找到日历项模型");const i=s[a];if(!i)throw new e("未找到日历项模型");return t.map((t=>new Qa(i,t)))}async exec2(t,e,a={},s={},i=this.model.appDataEntityId){return await this.app.deService.exec(i,t,e,a,s)}}));t("CalendarController",class extends Is{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Ds(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.params);let i;await this.startLoading();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,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),i}getCurSelectDate(t){const{selectedDate:e}=this.state,{start:a,end:s}=t;if(!a||!s){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{start:X(t).format("YYYY-MM-DD HH:mm:ss"),end:X(a).format("YYYY-MM-DD HH:mm:ss")}}return{start:a,end:s}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:s,noSort:i}=this.state,n={...this.params};!i&&s&&(n.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),a&&(n.page=e-1,n.size=a),t&&Object.assign(n,t);const o=this.getCurSelectDate(n);return Object.assign(n,o),n}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});X.extend(Y),X.extend(K),X.extend(H),X.extend(q),X.extend(Q);var ys="$default_group",Cs=class{constructor(t,e){var s;this.model=t,this.chartGenerator=e,this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:i,caption:n,id:o,userParam:r}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=t.catalogField.toLowerCase(),this.valueField=t.valueField.toLowerCase(),this.groupField=null==(s=t.seriesField)?void 0:s.toLowerCase();const{chartXAxisId:c,chartYAxisId:l}=i||{};this.xAxisIndex=I(c),this.yAxisIndex=I(l),this.seriesName=n||o,this.staticOptions=this.calcStaticOptions(),r&&(this.seriesUserParam=Ls(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(F(e))return;if(F(t))return e;const s=this.chartGenerator.codeListMap.get(t);if(null==s?void 0:s.length){const t=s.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}calcGroupData(t){this.groupData={};const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:s}=this.model;return t.forEach((t=>{let i=ys;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(F(e))return;i=e}if(!e[i]&&(e[i]=new Map,s&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(s).forEach((t=>{e[i].set(t.text,{value:0})}))}const n=this.translateVal(s,t[this.catalogField],!0);n&&(e[i].get(n)||e[i].set(n,{value:0}),e[i].get(n).value+=t[this.valueField],e[i].get(n).deData=t)})),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!==ys&&(i.name=e),this.seriesUserParam&&(i=G(i,this.seriesUserParam)),i}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{var s;e.push([a,t.value,null==(s=t.deData)?void 0:s.srfkey])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getSrfkeyByParams(t){return t.value[2]}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(B(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=X(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(X(t[this.catalogField]).format("YYYY"),"-").concat(X(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(X(t[this.catalogField]).format("YYYY"),"-").concat(X(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const s=t[a];let i=[];"DAY"===e||"YEAR"===e||"MONTH"===e?i=Array.from(s.keys()).sort(((t,e)=>X(t).diff(X(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(i=Array.from(s.keys()).sort(((t,e)=>{const[a,s]=t.split("-"),[i,n]=e.split("-");return a!==i?parseInt(a,10)-parseInt(i,10):parseInt(s,10)-parseInt(n,10)})));const n=new Map;i.forEach((t=>{n.set(t,s.get(t))})),t[a]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(X(e))}))}));const s=X.max(a),i=X.min(a);if("DAY"===e){let e=i;const a=s;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=i.year();const a=s.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=i.clone().startOf("month");const a=s.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),s=e.reduce(((t,e)=>e>t?e:t),e[0]),[i]=a.split("-"),[n]=s.split("-");for(let e=parseInt(i,10);e<=parseInt(n,10);e++)for(let a=1;a<=4;a++){const s="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(s)||t[e].set(s,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),s=e.reduce(((t,e)=>e>t?e:t),e[0]),[i]=a.split("-"),[n]=s.split("-");for(let e=parseInt(i,10);e<=parseInt(n,10);e++){const a=X("".concat(e,"-12-31")).isoWeek();for(let s=1;s<=a;s++){const a="".concat(e,"-").concat(s);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},As=class extends Cs{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:s}=this.model;return s&&(t.step="middle"),t}},Ps=class extends Cs{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},bs=class extends Cs{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%({c})",t.label.position="outer",t}calcSeriesData(t){return Object.keys(t).map((e=>{var a;const s=t.get(e);return{name:e,value:[s.value,null==(a=s.deData)?void 0:a.srfkey]}}))}getSrfkeyByParams(t){return t.value[1]}},Ts=class extends Cs{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%({c})",t.label.position="outside",t}calcSeriesData(t){return Object.keys(t).map((e=>{var a;const s=t.get(e);return{name:e,value:[s.value,null==(a=s.deData)?void 0:a.srfkey]}}))}getSrfkeyByParams(t){return t.value[1]}},xs=class extends Cs{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},Ns=class extends Cs{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}}(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{Object.keys(t).forEach((e=>{a.updateIndicator(e,t.get(e).value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),s=Object.keys(e).map((t=>{const s=e[t],i=a.indicatorKeys.map((t=>s.has(t)?s.get(t):0));return{name:t===ys?this.seriesName:t,value:i}}));let i={...this.staticOptions,data:s};return this.seriesUserParam&&(i=G(i,this.seriesUserParam)),i}getSrfkeyByParams(t){return t.value[1]}};function Ls(t){const e={};return t&&Object.keys(t).forEach((a=>{const s=a.indexOf(".");if(-1===s)return;const i=a.slice(s+1);if(i)try{e[i]=JSON.parse(t[a])}catch(s){e[i]=t[a]}})),e}var Rs=t("ChartService",class extends Ua{}),Vs=(t("ChartController",class extends Is{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Rs(this.model),await this.service.init(this.context),this.generator=new class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.initSeriesGenerators();const{dechartTitle:e,dechartLegend:a,chartXAxises:s,chartYAxises:i,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==s?void 0:s.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(s)),(null==i?void 0:i.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(i)),n&&(this.chartUserParam=Ls(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new As(t,this);break;case"bar":e=new Ps(t,this);break;case"scatter":e=new xs(t,this);break;case"pie":e=new Ts(t,this);break;case"funnel":e=new bs(t,this);break;case"radar":e=new Ns(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:s,titlePos:i}=t,n={show:e,text:a,subtext:s,left:"center"},o=null==i?void 0:i.toLowerCase();return"left"===o||"right"===o?n.left=o:"bottom"!==o&&"top"!==o||(n.top=o),n}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,s={};s.show=e;const i=null==a?void 0:a.toLowerCase();return"left"===i||"right"===i?(s.left=i,s.top="middle",s.orient="vertical"):"bottom"===i&&(s.top=i),s}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:s,userParam:i}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>1===s?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===s&&t.length>4?"".concat(t.slice(0,4),"..."):t,rotate:3===s?45:0}};i&&(n=G(n,Ls(i))),e.push(n)})),e}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const s=ibiz.hub.getApp(t.srfappid),i=async a=>{if(!a||this.codeListMap.has(a))return;const i=await s.codeList.get(a,t,e);this.codeListMap.set(a,i)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await i(e),await i(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s)})),this.options.series=e,this.options=G(this.staticOptions,this.options),this.chartUserParam&&(this.options=G(this.options,this.chartUserParam)),this.options}getSrfkeyByParams(t){const a=this.seriesGenerators[t.seriesIndex];if(!a)throw new e("找不到".concat(t.seriesIndex,"序列的generator!"));return a.getSrfkeyByParams(t)}}(this.model),await this.generator.loadCodeList(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getSrfkeyByParams(t),a=this.state.items.find((t=>t.srfkey===e));console.log("实体数据",a)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new e("chart对象没有正确初始化");if(!this.options)throw new e("options还没计算");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(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends ws{initState(){super.initState(),this.view.model.capLanguageRes?this.state.caption=ibiz.i18n.t(this.view.model.capLanguageRes.lanResTag,this.view.model.capLanguageRes.defaultContent||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.state.caption).concat(e?"-".concat(e):"")}))}}),class{}),Os=class extends Vs{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,i){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=i[this.value]?i[this.value]:e[this.value];return Ft(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return Ft(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new s(this.model,"暂未支持条件值类型为[当前时间]");default:return Ft(n[this.dstField],this.op,this.value)}}},Ms=class t extends Vs{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Os(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,s){let i=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,s);if("AND"===this.op&&!1===n){i=!1;break}if("OR"===this.op&&!0===n){i=!0;break}}return this.notMode?!i:i}},Ss=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===e&&a&&(this.groupCond=new Ms(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:i}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,i&&i.length>0?i[0]:{});case 1:return!0;case 2:throw new s(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new s(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new s(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new s(this.model,"未支持的逻辑连接类型:".concat(e))}}}(t)))}},_s=class extends Ss{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:s,dstDEUILogicParamId:i,retDEUILogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!s)throw new a(this.model,"未指定实体行为");const o=t.params[i],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,s,t.context,o,t.viewParams);c.ok&&(t.params[n]=c.data)}},Fs=class extends Ss{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:s}=this.model,{data:i,parameters:n}=t;if(!e)throw new a(this.model,"未配置界面行为");let o=[i];if(s){const e=t.params[s];o=e instanceof Array?e:[e]}await Ks.execAndResolved(e,{...n,data:o})}},Ws=class extends Ss{async exec(t){}},ks=class extends Ss{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:i}=this.model;switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=a;break;case"LOGICPARAM":t.result=t.params[i];break;default:throw new s(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}};function Bs(t,e){const{srcDEUILogicParamId:a,srcFieldName:i,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM";let r;switch(o){case"SRCDLPARAM":r=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return n;case"VIEWPARAM":r=t.viewParams;break;case"APPDATA":r=t.context;break;case"ENVPARAM":r=B(ibiz.env);break;default:throw new s(e,"暂未支持源值类型".concat(o))}const c=null==i?void 0:i.toLowerCase();return r&&c&&(r=r[c]),r}var Us=class extends Ss{async exec(t){const e=this.model.deuilogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{if("SETPARAMVALUE"===e.paramAction)return this.setParamValue(e,t);throw new s(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))})))}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:s}=t,i=null==a?void 0:a.toLowerCase(),n=Bs(e,t);i?e.params[s][i]=n:e.params[s]=n}},zs=class extends Ss{async exec(t){t.isEndNode=!0;const{invokeMethod:s,invokeCtrlId:i,invokeParamId:n}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!n)throw new a(this.model,"没有配置操作参数");if(!s)throw new a(this.model,"没有配置调用方法");const o=t.params[n];if(!o)throw new e("没有找到操作参数".concat(n));const r=t.params[i];if(!r)throw new e("没有找到界面对象".concat(i));if(!r[s]||!C(r[s]))throw new e("没有找到调用方法".concat(s));await r[s](o)}},Gs=class extends Ss{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const i=Bs(t,this.model);t.params[e]=i}},js=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Ws(t);break;case"END":a=new ks(t);break;case"DEACTION":a=new _s(t);break;case"DEUIACTION":a=new Fs(t);break;case"PREPAREJSPARAM":a=new Us(t);break;case"BINDPARAM":a=new Gs(t);break;case"VIEWCTRLINVOKE":a=new zs(t);break;default:throw new s(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model,{context:n,viewParams:o,data:r,parameters:c}=t,l=ibiz.hub.getApp(n.srfappid);if(i.default)t.params[e]=r&&r.length>0?r[0]:{};else if(i.activeContainerParam)t.params[e]=c.ctrl||c.view;else if(i.activeCtrlParam)t.params[e]=c.ctrl;else if(i.ctrlParam){const s=c.view.getController(i.codeName.toLowerCase());if(!s)throw new a(this.model,"视图逻辑初始化参数,未找到".concat(i.codeName,"指定部件对象"));t.params[e]=s}else if(i.activeViewParam)t.params[e]=c.view;else if(i.appGlobalParam)t.params[e]=ibiz.env;else if(i.applicationParam)t.params[e]=l;else if(i.entityListParam)t.params[e]=[];else{if(i.entityPageParam)throw new s(i,"未支持的逻辑参数类型: 分页查询结果");if(i.entityParam)t.params[e]={};else{if(i.lastReturnParam)throw new s(i,"未支持的逻辑参数类型: 上次调用返回");if(i.navContextParam)t.params[e]=n;else{if(i.navViewParamParam)throw new s(i,"未支持的逻辑参数类型: 视图路由参数");if(i.routeViewSessionParam)throw new s(i,"未支持的逻辑参数类型: 路由视图会话");if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.viewNavDataParam)t.params[e]=o;else if(i.viewSessionParam)throw new s(i,"未支持的逻辑参数类型: 当前视图会话")}}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new s(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}}(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get context(){return this.parameters.context}get data(){return this.parameters.data}get viewParams(){return this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}}(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:s}=this.model;if(!s||!this.nodes.has(s))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(s);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let s=0;s<a.length;s++){const i=a[s];if(await i.exec(e)&&i.dstNode&&(await this.deepExec(i.dstNode,e),!1===t.model.parallelOutput))break}}},Xs=new Map;async function Ys(t,a,s){const i=ibiz.hub.getApp(s.context.srfappid),n=await i.getDEUILogic(t,a);if(!n)throw new e("找不到实体".concat(a,"的界面逻辑").concat(t));Xs.has(n)||Xs.set(n,new js(n));const o=Xs.get(n);return await o.exec(s),null}var Ks=t("UIActionUtil",class{static async exec(t,a){const s=await bt(t);if(!s)throw new e("没找到".concat(t,"的界面行为模型"));return(await ke(s)).exec(s,a)}static async execAndResolved(t,e){var a,s;const i=await this.exec(t,e);if(i.closeView)e.view.closeView();else if(i.refresh)switch(i.refreshMode){case 1:await e.view.callUIAction("Refresh");break;case 2:await(null==(a=e.view.parentView)?void 0:a.callUIAction("Refresh"));break;case 3:await(null==(s=e.view.getTopView())?void 0:s.callUIAction("Refresh"))}}}),Hs=class{async exec(t,e){const{context:s,params:i,data:n}=e,o={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:r,appDataEntityId:c,uilogicAttachMode:l}=t;if("REPLACE"===l){if(!r)throw new a(t,"没有配置实体界面逻辑");return await Ys(r,c,e),o}if(!await this.isConfirm(t))return this.returnError(o);const d=await this.execAction(t,e);if(Object.assign(o,d),!0===o.cancel)return this.returnError(o);const h=await this.doNextAction(t,{...e,context:o.nextContext||s,data:o.data||n,params:o.nextParams||i});if(h&&(Object.assign(o,h),!0===h.cancel))return this.returnError(o);if("AFTER"===t.uilogicAttachMode){if(!r)throw new a(t,"没有配置实体界面逻辑");await Ys(r,c,e)}return o}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t){return!t.enableConfirm||!t.confirmMsg||ibiz.modal.confirm({title:t.confirmMsg})}async doNextAction(t,e){const a=t.nextId;if(a)return Ks.exec(a,e)}async handleParams(t,e,a,s){let i=[];const n=Dt(t.appDataEntityId);switch(t.actionTarget){case"NONE":i=[];break;case"SINGLEDATA":i=[a[0]];break;case"MULTIDATA":i=a;break;case"MULTIKEY":i=n&&a.length>0?a.map((t=>({[n]:t.srfkey||t[n]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};i=n?[{[n]:t.srfkey||t[n]}]:[{}]}}const o=e.clone(),r=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,s=a||n,i=e||"srfkey";r.unshift({key:s,value:i,rawValue:!1})}const c=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,l=lt(r,e,s,c?pt(r,a):a[0]||{});Object.assign(o,l);const d=t.navigateParams;return{resultContext:o,resultData:i,resultParams:lt(d,o,s,c?pt(d,a):a[0]||{})}}},qs=t("BackendUIActionProvider",class extends Hs{async execAction(t,e){const{context:s,params:i,data:n,event:o}=e,r={},c=t.appDataEntityId,l=t.appDEMethodId;if(!c||!l)throw new a(t,"未配置实体或实体行为");const{resultContext:d,resultParams:h,resultData:u}=await this.handleParams(t,s,n,i),p={...i,...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(ce.TAG,m,d,h,{event:o});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;(null==t?void 0:t.ok)&&t.data&&(0===u.length&&u.push({}),u.forEach((e=>{e.srfactionparam=t.data})))}const g=ibiz.hub.getApp(null==s?void 0:s.srfappid),f=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})),E=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),w=await g.deService.exec(c,l,d,E?f:f[0],p);return w.ok&&t.successMsg&&ibiz.message.success(t.successMsg),Object.assign(r,{data:N(w.data)?w.data:[w.data],nextContext:d,nextParams:p}),r}}),Qs=t("SysUIActionProvider",class extends Hs{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"]])}async execAction(t,e){const{view:a}=e,s=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===s)return{closeView:!0};return await a.callUIAction(s,e)||{}}}),$s=t("FrontUIActionProvider",class extends Hs{async execAction(t,e){const{context:i,params:n,data:o,event:r,noWaitRoute:c}=e;let l={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=u.fill(t.htmlPageUrl,i,null==o?void 0:o[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:s,resultParams:d}=await this.handleParams(t,i,o,n),h=await ibiz.commands.execute(ce.TAG,e,s,d,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(l.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(l.data=h.data,l.nextContext=s,l.nextParams={...n,...d});break}case"OTHER":l=this.doOther(t,e);break;default:throw new s(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return l}doOther(t,e){const{scriptCode:s}=t,{context:i,params:n,data:o,event:r}=e;if(s){return jt.execScriptFn({context:i,params:n,data:o,el:null==r?void 0:r.target},s)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}}),Js=t("WFWithdrawUIActionProvider",class extends Hs{async execAction(t,e){const{view:a}=e;let s=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),s=!0),{refresh:!1,closeView:s}}});function Zs(){const t=new $s;Fe("FRONT",(()=>t));const e=new qs;Fe("BACKEND",(()=>e));const a=new Qs;Fe("SYS",(()=>a));const s=new Js;Fe("DEUIACTION_WFWithdraw",(()=>s))}var ti=t("ToolbarController",class extends ws{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new cs,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const s=t.uiactionId,i=await this.ctx.view.call("GetData")||[],n=this.getEventArgs();n.params=Object.assign(a,n.params),await Ks.execAndResolved(s,{...n,data:i,event:e})}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,p(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new rs(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.state.buttonsState.update()}async onItemClick(t,e,a){this.state.buttonsState.setLoading(t.id);const s="extra"===t.buttonType;try{await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:s?"extra":"deuiaction"}),s||await this.doUIAction(t,e,a)}finally{this.state.buttonsState.setLoading("")}}async calcButtonState(t,e){let a=t;t&&t instanceof ka&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler&&a&&p(this.model,(t=>{const e=this.state.buttonsState[t.id];if(e.visible){const s=this.scheduler.triggerItemVisible(t.id,{data:[a]});void 0!==s&&(e.visible=s)}if(!e.disabled){const s=this.scheduler.triggerItemEnable(t.id,{data:[a]});void 0!==s&&(e.disabled=!s)}}),{childrenFields:["detoolbarItems"]})}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];p(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}}),ei=t("ContextMenuController",class extends ti{}),ai=(t("DashboardController",class extends ws{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=us(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){(null==t?void 0:t.length)&&await Promise.all(t.map((async t=>{var a;const s=await je(t);if(s){this.providers[t.id]=s;const i=await s.createController(t,this,e);this.portlets[t.id]=i,(null==(a=t.controls)?void 0:a.length)&&await this.initPortlets(t.controls,i)}})))}async dataChangeNotify(t){const a=await Promise.allSettled(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))));if(a.find((t=>"rejected"===t.status)))throw ibiz.log.error("dataChangeNotify报错",a),new e("数据变更后有错误")}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),si=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=Et(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new ai}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new cs;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const s=new rs(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,s)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:s}=this.dashboard.view.model;s&&this.dashboard.view.evt.on("onDataChange",(t=>{let e=t.data[0];e&&e instanceof ka&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,s)}))}async onActionClick(t,e,a=[]){const s=t.uiactionId;await Ks.execAndResolved(s,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e})}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=wt(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}}),ii=(t("ContainerPortletController",class extends si{}),t("ViewPortletController",class extends si{}),t("DataViewControlService",class extends Ua{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let s;if(a){const t=a.toLowerCase();s=new qa(e,t,{isOriginField:!0})}else s=new qa(e,e);this.dataUIMap.set(e,s)}))}})),ni=(t("DataViewControlController",class extends Is{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new ii(this.model),await this.service.init(this.context)}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const s=new cs,i=this.getOptItemModel();if(i){if(!i.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=i.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),s;i.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rs(t.id,this.context.srfappid,e);s.addState(t.id,a)}})),s.update(t.getOrigin())}return s}async onActionClick(t,e,a){const s=t.uiactionId;await Ks.execAndResolved(s,{context:this.context,params:this.params,data:[e],view:this.view,event:a})}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const s=a.get(e[t])||[];s.push(e),a.set(e[t],s)}));const s=[];a.forEach(((t,e)=>{s.push({caption:e,children:[...t]})})),this.state.groups=s}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,s=[],i=ibiz.hub.getApp(this.context.srfappid),n=await i.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const i=a.filter((a=>a[t]===e.value));s.push({caption:e.text,children:[...i]}),o.push(e.value)}));const r=a.filter((e=>-1===o.indexOf(e[t])));r.length>0&&s.push({caption:"其他",children:[...r]}),this.state.groups=s}}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.model;this.state.sortQuery=t&&e?"".concat(t.toLowerCase(),",").concat(e.toLowerCase()):""}}}),t("ExpBarControlController",class extends ws{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}async onCreated(){await super.onCreated(),this.childNames.push(this.model.xdataControlName)}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("onBeforeLoad",(()=>{const t={};this.state.query&&(t.query=this.state.query),this.xDataController.state.searchParams=t}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)}))}xDataLoadSuccess(t){t.isInitialLoad&&(this.state.srfnav&&this.routeDepth?this.defaultNavBySrfnav():this.defaultNavByFirstItem())}defaultNavBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));e&&this.xDataController.setSelection([e]),this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav},context:this.context})}defaultNavByFirstItem(){const t=this.xDataController.state.items[0];t&&(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:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,l={deName:c?Dt(c):void 0,navFilter:n,pickupDEFName:null==i?void 0:i.pickupDEFName,navContexts:o,navParams:r},d={context:a,params:s,data:e},{resultContext:h,resultParams:u}=mt(l,d);return{context:Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]}),params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new e("多节点视图由子类实现")}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}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}})),oi=(t("CalendarExpBarController",class extends ni{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}defaultNavBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.defaultNavBySrfnav(),!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,{key:t.navId,context:a,params:s,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends ni{constructor(){super(...arguments),this.navKeyName="id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,a,s){const i=t.id,n=t.deData||t,o=this.getNodeModel(t.nodeId);if(!o)throw new e("找不到".concat(t.nodeId,"的节点模型"));const r=this.prepareParams(o,n,a,s);return r.context.currentSrfNav=i,{key:i,viewId:o.navAppViewId,...r}}defaultNavByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t.nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;if(null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav){const t=[];this.state.srfnav.split(":").forEach(((e,a)=>{0===a?t.push(e):t.push("".concat(t[a-1],":").concat(e))})),t.pop(),this.defaultExpandedKeys=t}}}),t("FormController",class extends ws{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new ka,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){const a=await Promise.allSettled(Object.values(this.details).map((async e=>e.dataChangeNotify(t))));if(a.find((t=>"rejected"===t.status)))throw ibiz.log.error("dataChangeNotify报错",a),new e("数据变更后有错误")}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=m(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200)}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 t=>{const s=await Ne(t);if(!s)return;e.providers[t.id]=s;const i=await s.createController(t,e,a);e.details[t.id]=i,"FORMITEM"!==t.detailType&&"MDCTRL"!==t.detailType||e.formItems.push(i);const n=Rt(t);n.length&&await this.initDetailControllers(n,e,i)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||hs(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 validate(){return-1===(await Promise.all(this.formItems.map((t=>t.validate())))).findIndex((t=>!t))}})),ri=t("SearchFormService",class extends Ba{async getDraft(t,e={}){let a={ok:!0,status:200,data:{}};return a=this.handleResponse(a),a}initUIDataMap(){p(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new qa(e,e))}}),{childrenFields:["deformPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}}),ci=(t("SearchFormController",class extends oi{async onCreated(){await super.onCreated(),this.service=new ri(this.model),await this.service.init(this.context),await this.load()}async load(){const t={...this.params},e=await this.getDraftParams();Object.assign(t,e);const a=await this.service.getDraft(this.context,t);return this.state.data=a.data,g(this.data,e),this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.data}getParams(){return{...this.data.getOrigin()}}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),li=t("FormDetailController",class{get data(){return this.form.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}constructor(t,e,a){this.model=t,this.form=e,this.parent=a,this.state=this.createState()}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:e,height:a}=Et(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}createState(){var t;return new ci(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],t),this.calcDynaClass(this.data)}calcDynamicLogic(t,e){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const s=a.relatedDetailNames||[];if(e||f(s,t))try{const t=Kt(this.form.data,a);switch(a.logicCat){case"ITEMBLANK":this.state.required=!t;break;case"ITEMENABLE":this.state.disabled=!t;break;case"PANELVISIBLE":this.state.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=wt(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=wt(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}}),di=t("FormButtonState",class extends ci{constructor(){super(...arguments),this.loading=!1}}),hi=(t("FormButtonController",class extends li{createState(){var t;return new di(null==(t=this.parent)?void 0:t.state)}get data(){return this.form.data}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}}async doUIAction(t){const e=this.model.uiactionId;await Ks.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0})}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends ci{constructor(){super(...arguments),this.showMask=!1}})),ui=(t("FormDRUIPartController",class extends li{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new hi(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),f(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,this.state.showMask=this.isNewData,this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;A(e)&&(t=Object.assign(t,lt(e,this.form.context,this.form.params,this.form.data)));const a=lt(this.model.navigateParams,this.form.params,this.form.context,this.form.data);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=x(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.callUIAction("Refresh")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends ci{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),pi=t("FormGroupPanelController",class extends li{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new ui(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){super.calcDynamicLogic([],t),this.state.actionGroupState&&this.state.actionGroupState.update(this.form.data.getOrigin())}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new cs;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const s=new rs(t.id,this.form.context.srfappid,e);a.addState(t.id,s)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await Ks.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e})}}),mi=t("FormItemState",class extends ci{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),gi=(t("FormItemController",class extends li{constructor(t,e,a){super(t,e,a),this.rules=[],this.context=e.context,this.params=e.params}createState(){var t;return new mi(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.fieldName||this.model.id}get value(){return this.form.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty,this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await be(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){const t=ne(this.form.model.deformItemVRs||[],this.name);t&&(this.rules=ps(t,this.name,this.valueItemName),this.validator=new $({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;t?(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0):this.state.enableCondDisabled=!0}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond(),"LOAD"===t&&this.setDefaultValue(!1)}calcDynamicLogic(t,e){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&P(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t)}setDefaultValue(t,a=this.data){var i;const{createDVT:n,createDV:o,updateDVT:r,updateDV:c}=this.model,l=t?n:r,d=t?o:c;if("RESET"!==l){if(!(this.value||P(l)&&P(d)))if(l||!d)switch(l){case"APPDATA":Object.prototype.hasOwnProperty.call(this.params,d)&&(a[this.name]=this.params[d]),Object.prototype.hasOwnProperty.call(this.context,d)&&(a[this.name]=this.context[d]);break;case"OPERATORNAME":a[this.name]=this.context.srfusername;break;case"OPERATOR":a[this.name]=this.context.srfuserid;break;case"CURTIME":a[this.name]=X().format(this.model.valueFormat);break;case"PARAM":a[this.name]=this.data[d];break;case"SESSION":case"APPLICATION":if(!(null==(i=ibiz.appData)?void 0:i.context))throw new e("appdata.context不存在");a[this.name]=ibiz.appData.context[d];break;case"CONTEXT":a[this.name]=this.params[d];break;case"UNIQUEID":a[this.name]=x();break;default:throw new s(this.model,"默认值类型[".concat(l,"]未支持"))}else a[this.name]=d}else a[this.name]=null}}),t("FormMDCtrlContentTypeController",class{constructor(t){this.parent=t,this.model=this.parent.model}get data(){return this.parent.state.contentCtrlData}async onInit(){}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}onDataItemChange(t,e){this.parent.state.contentCtrlData[e]=t,this.parent.setFormDataValue()}onDataRemove(t){t<0||(this.parent.state.contentCtrlData.splice(t,1),this.parent.setFormDataValue())}onDataInsert(t){this.parent.state.contentCtrlData.push(t||{}),this.parent.setFormDataValue()}async initData(){const t=this.model.appDEFieldId||this.model.fieldName||this.model.id;t&&("REPEATER"===this.model.contentType&&"STYLE3"===this.model.detailStyle?this.parent.state.contentCtrlData=this.parent.data[t]||{}:this.parent.state.contentCtrlData=this.parent.data[t]||[])}async validate(){return!0}})),fi=t("FormMDCtrlControlController",class extends gi{async onInit(){const{model:t}=this.parent,{contentControl:a}=t;if(!a)throw new e("表单多数据部件未配置嵌入部件");this.controlModel=a;const s=await Ce(this.controlModel);s&&(this.provider=s)}}),Ei=t("FormMDCtrlDataViewController",class extends fi{constructor(){super(...arguments),this.selectData=[],this.state={isSelect:!1}}onDataViewMounted(t){this.dataViewController=t.ctrl}onSelectionChange(t){this.state.isSelect=t.data.length>0}onDataRemove(){this.dataViewController.remove(),this.parent.state.contentCtrlData=this.dataViewController.state.items,this.parent.setFormDataValue()}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}async initData(){this.dataViewController.load()}async onDataInsert(){}}),wi=t("EditFormService",class extends Ba{async get(t,e={}){var a;let s=await this.exec((null==(a=this.model.getControlAction)?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((null==(a=this.model.getDraftControlAction)?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((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;let s=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,e instanceof ka?e.getOrigin():e);return s=this.handleResponse(s),s}async update(t,e){var a;let s=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,e instanceof ka?e.getOrigin():e);return s=this.handleResponse(s),s}async goBack(t,e){var s;const i=null==(s=this.model.goBackControlAction)?void 0:s.appDEMethodId;if(!i)throw new a(this.model,"缺少返回操作实体行为");let n=await this.exec(i,t,e instanceof ka?e.getOrigin():e);return n=this.handleResponse(n),n}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 i=(null==(s=this.model.wfstartControlAction)?void 0:s.appDEMethodId)||"wfstart";return(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(i,t,e,a instanceof ka?a.getOrigin():a)}async wfSubmit(t,e,a){var s;const i=this.model;let n="";n=e.type?e.type:(null==(s=i.wfsubmitControlAction)?void 0:s.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(n,t,e,a instanceof ka?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];p(this.model,(e=>{if("FORMITEM"===e.detailType){const a=e,s=a.fieldName||a.id.toLowerCase(),i=a.fieldName||e.appDEFieldId;let n;n=i?new qa(s,i,{isOriginField:!0}):new qa(s,s,{isOriginField:t.includes(s)}),this.dataUIMap.set(s,n)}if("MDCTRL"===e.detailType){const t=e,a=t.fieldName||t.id.toLowerCase(),s=t.fieldName||e.appDEFieldId;let i;i=new qa(a,s||a,{isOriginField:!0}),this.dataUIMap.set(a,i)}}),{childrenFields:["deformPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}}),Ii=t("EditFormController",class extends oi{async onCreated(){await super.onCreated(),this.service=new wi(this.model),await this.service.init(this.context),this.autoSave=D(this.autoSave.bind(this),500,{trailing:!0})}async load(){const t=!yt(this.context,this.model.appDataEntityId),e={...this.params};let a,s={};t&&(s=await this.getDraftParams(),Object.assign(e,s)),await this.startLoading();try{a=t?await this.service.getDraft(this.context,e):await this.service.get(this.context,e)}finally{await this.endLoading()}return t?E(this.data,a.data):this.state.data=a.data,this.state.modified=!1,this.state.data=a.data,g(this.data,s),this.formStateNotify(t?"DRAFT":"LOAD"),await this.evt.emit(t?"onLoadDraftSuccess":"onLoadSuccess",void 0),this.state.isLoaded=!0,this.data}async save(){if(this.state.processing){return await w(500,this.save.bind(this))}if(!await this.validate())throw new e("请检查表单填写!");let t;await this.startLoading();try{t=0===this.data.srfuf?await this.service.create(this.context,this.data):await this.service.update(this.context,this.data)}finally{await this.endLoading()}return t.data&&E(this.data,t.data),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),ibiz.message.success("".concat(this.data.srfmajortext||"","保存成功")),this.data}async remove(){let t,e=!1;if(1===this.data.srfuf){if(e=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!e)return!1;await this.startLoading();try{t=await this.service.remove(this.context,this.params)}finally{await this.endLoading()}e=t.ok}return this.state.data=new ka,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),e}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}t.data&&E(this.data,t.data)}async updateFormItem(t){var a;const s=null==(a=this.model.deformItemUpdates)?void 0:a.find((e=>e.id===t));if(!s)throw new e("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:n}=s,o=n.map((t=>t.id)),r={...this.params,...this.data.getOrigin()},c=(await this.service.updateFormItem(i,this.context,r)).data;c&&(null==o?void 0:o.length)&&await Promise.all(o.map((t=>this.setDataValue(t,c[t]))))}async wfStart(t={}){if(!await this.validate())throw new e("请检查表单填写!");await this.startLoading();try{await this.service.wfStart(this.context,{...this.params,...t},this.data)}finally{await this.endLoading()}ibiz.message.success("流程启动成功")}async wfSubmit(t={}){if(!await this.validate())throw new e("请检查表单填写!");await this.startLoading();try{await this.service.wfSubmit(this.context,{...this.params,...t},this.data)}finally{await this.endLoading()}ibiz.message.success("流程提交成功")}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(this.model.enableAutoSave)try{await this.save()}catch(t){ibiz.log.error(t)}}}),vi=t("FormMDCtrlFormController",class extends fi{constructor(){super(...arguments),this.controlControllerArray=[],this.state={data:[]}}onControlMounted(t,e){const a=t.ctrl;this.controlControllerArray[e]=a,a.load()}async onInit(){super.onInit(),this.service=new wi(this.model.contentControl),await this.service.init(this.parent.form.context)}async fetch(t,e={}){let a=await this.service.exec("fetchdefault",t,e);return a=this.handleResponse(a),a}handleResponse(t){const e=t;return e.ok&&(y(e.data)?e.data=e.data.map((t=>this.service.toUIData(t))):e.data=this.service.toUIData(e.data)),e}async initData(){const t=await this.fetch(this.parent.form.context,this.parent.form.params);this.state.data=t.data}onDataRemove(t){const e=this.controlControllerArray[t];e&&e.remove()}onFormChange(t,e){const a=this.controlControllerArray[e];a&&(a.save(),this.state.data[e]&&E(this.state.data[e],t[0]),this.parent.state.contentCtrlData=this.state.data,this.parent.setFormDataValue())}onFormRemoveSuccess(t){this.state.data.splice(t,1),this.controlControllerArray.splice(t,1),this.parent.state.contentCtrlData=this.state.data,this.parent.setFormDataValue()}async onDataInsert(){const t=await this.service.getDraft(this.parent.form.context,this.parent.form.params);if(t.data){const e=await this.service.create(this.parent.form.context,t.data);this.state.data.push(e.data),this.parent.state.contentCtrlData=this.state.data,this.parent.setFormDataValue()}}async validate(){return-1===(await Promise.all(this.controlControllerArray.map((t=>t.validate())))).findIndex((t=>!t))}}),Di=t("FormMDCtrlGridController",class extends fi{constructor(){super(...arguments),this.selectData=[],this.state={isSelect:!1}}onGridMounted(t){this.gridController=t.ctrl}onSelectionChange(t){this.state.isSelect=t.data.length>0}onDataRemove(){this.gridController.remove(),this.parent.state.contentCtrlData=this.gridController.state.items,this.parent.setFormDataValue()}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}async initData(){this.gridController.load()}async onDataInsert(){await this.gridController.newRow(),this.parent.state.contentCtrlData=this.gridController.state.items,this.parent.setFormDataValue()}async onInit(){const{model:t}=this.parent,{contentControl:a}=t;if(!a)throw new e("表单多数据部件未配置嵌入部件");E(a,{enableRowEdit:!0,enableRowNew:!0}),this.controlModel=a;const s=await Ce(this.controlModel);s&&(this.provider=s)}async validate(){const{rows:t}=this.gridController.state;return-1===(await Promise.all(t.map((t=>this.gridController.validate(t))))).findIndex((t=>!t))}}),yi=t("FormMDCtrlListController",class extends fi{constructor(){super(...arguments),this.selectData=[],this.state={isSelect:!1}}onListMounted(t){this.listController=t.ctrl}onSelectionChange(t){this.state.isSelect=t.data.length>0}onDataRemove(){this.listController.remove(),this.parent.state.contentCtrlData=this.listController.state.items,this.parent.setFormDataValue()}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}async initData(){this.listController.load()}async onDataInsert(){}}),Ci=t("FormMDCtrlItemController",class extends Ii{constructor(t,e,a,s,i){super(t,e,a,s),this.state.data=i,this.state.isSimple=!0}async onInit(){await this.initDetailControllers(this.model.deformDetails)}}),Ai=t("FormMDCtrlRepeaterFormOneController",class extends gi{constructor(){super(...arguments),this.formDetail=[],this.state={isInit:!1}}get data(){return this.parent.state.contentCtrlData}async initFormMDCtrlItemControllers(t,e=this.parent.form,a={},s=void 0){const i=a,n=new Ci(this.model,this.parent.form.context,this.parent.form.params,this.formCtx,i);return await n.onInit(),n.evt.on("onFormDataChange",(t=>{t.data.length>0&&this.onDataItemChange(t.data[0])})),n.state.isLoaded=!0,await Promise.all(t.map((async t=>{const i=await Ne(t);if(!i)return;e.providers[t.id]=i;const o=await i.createController(t,n,s);this.formDetail||(this.formDetail=[]),this.formDetail.push({name:t.id,detailType:t.detailType,c:o});const r=Rt(t);r.length&&await this.initFormMDCtrlItemControllers(r,n,a,o)}))),a}useFormMdCtrlCtx(){}async initData(){super.initData(),await this.initFormMDCtrlItemControllers(this.model.deformDetails,this.parent.form,this.data),this.state.isInit=!0}onDataItemChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}async validate(){const t=[];this.formDetail.forEach((e=>{if("FORMITEM"===e.detailType){const a=e.c;t.push(a.validate())}}));return-1===(await Promise.all(t)).findIndex((t=>!t))}}),Pi=t("FormMDCtrlRepeaterFormController",class extends gi{constructor(){super(...arguments),this.formDetails=[],this.state={isInit:!1}}async initFormMDCtrlItemControllers(t,e,a=this.parent.form,s={},i=void 0){const n=s,o=new Ci(this.model,this.parent.form.context,this.parent.form.params,this.formCtx,n);return await o.onInit(),o.evt.on("onFormDataChange",(t=>{t.data.length>0&&this.onDataItemChange(t.data[0],e)})),o.state.isLoaded=!0,await Promise.all(t.map((async t=>{const n=await Ne(t);if(!n)return;a.providers[t.id]=n;const r=await n.createController(t,o,i);this.formDetails[e]||(this.formDetails[e]=[]),this.formDetails[e].push({name:t.id,detailType:t.detailType,c:r});const c=Rt(t);c.length&&await this.initFormMDCtrlItemControllers(c,e,o,s,r)}))),s}async onDataInsert(){const t=await this.initFormMDCtrlItemControllers(this.model.deformDetails,this.data.length);super.onDataInsert(t)}onDataRemove(t){t<0||(super.onDataRemove(t),this.formDetails.splice(t,1))}useFormMdCtrlCtx(){}async initData(){super.initData(),await Promise.all(this.data.map((async(t,e)=>{await this.initFormMDCtrlItemControllers(this.model.deformDetails,e,this.parent.form,t)}))),this.state.isInit=!0}async validate(){const t=[];this.formDetails.forEach((e=>{e.forEach((e=>{if("FORMITEM"===e.detailType){const a=e.c;t.push(a.validate())}}))}));return-1===(await Promise.all(t)).findIndex((t=>!t))}}),bi=t("FormMDCtrlRepeaterGridController",class extends gi{constructor(){super(...arguments),this.columns=[],this.editorMap={}}async onInit(){this.initColumns(this.model.deformDetails||[])}initColumns(t){t.forEach((async t=>{if("FORMITEM"===t.detailType){const{editor:e}=t,a=await be(e);if(a){const s=await a.createController(e,{unitName:e.unitName,valueFormat:e.valueFormat,context:this.parent.form.context,params:this.parent.form.params});this.editorMap[t.codeName]={provider:a,controller:s}}this.columns.push({codeName:t.codeName,caption:t.caption})}const e=Rt(t);e.length&&this.initColumns(e)}))}rowDataChange(t,e,a){const s=this.data[a];Object.prototype.hasOwnProperty.call(s,e)&&!hs(s[e],t)||(s[e]=t,this.onDataItemChange(s,a))}}),Ti=t("FormMDCtrlState",class extends ci{constructor(){super(...arguments),this.contentCtrlData=[]}}),xi=(t("FormMDCtrlController",class extends li{createState(){var t;return new Ti(null==(t=this.parent)?void 0:t.state)}async onInit(){switch(await super.onInit(),this.model.contentType){case"FORM":this.mdCtrlContentController=new vi(this);break;case"GRID":this.mdCtrlContentController=new Di(this);break;case"LIST":this.mdCtrlContentController=new yi(this);break;case"DATAVIEW":this.mdCtrlContentController=new Ei(this);break;case"REPEATER":"DEFAULT"===this.model.detailStyle&&(this.mdCtrlContentController=new Pi(this)),"STYLE3"===this.model.detailStyle&&(this.mdCtrlContentController=new Ai(this)),"STYLE2"===this.model.detailStyle&&(this.mdCtrlContentController=new bi(this))}this.mdCtrlContentController&&await this.mdCtrlContentController.onInit()}setFormDataValue(){const t=this.model.appDEFieldId||this.model.fieldName||this.model.id;t&&this.form.setDataValue(t,this.state.contentCtrlData)}async loadData(){await this.mdCtrlContentController.initData()}async validate(){return this.mdCtrlContentController.validate()}setDefaultValue(){}}),t("FormPageState",class extends ui{})),Ni=(t("FormPageController",class extends pi{createState(){var t;return new xi(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends ci{})),Li=(t("FormRawItemController",class extends li{createState(){var t;return new Ni(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends ci{})),Ri=(t("FormTabPageController",class extends li{createState(){var t;return new Li(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPanelState",class extends ci{})),Vi=(t("FormTabPanelController",class extends li{createState(){var t;return new Ri(null==(t=this.parent)?void 0:t.state)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return jt.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),Oi=t("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((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),Mi=t("GridService",class extends Ua{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.degridDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let s;if(a){const t=a.toLowerCase();s=new qa(e,t,{isOriginField:!0})}else s=new qa(e,e);this.dataUIMap.set(e,s)}))}async updateGridEditItem(t,e,a={}){let s=await this.entityService.exec(t,e,a);return s=this.handleResponse(s),s}}),Si=(t("GridController",class extends Is{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await super.onCreated(),this.service=new Mi(this.model),await this.service.init(this.context),await this.initGridColumns(),this.dataChangeNotify=m(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:s}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const i=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(i,"没有配置代码表"));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(i,"配置为第一列"));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===s){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(i,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await Promise.allSettled(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()}))),this.state.rows=e.map((t=>{const e=new Oi(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,s="CODELIST"===a,i=this.groupFieldColumn.model.id;s&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[i];s||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:s}=this.model;if("ALL"!==t)return;if(!s||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const i=await this.getFetchParams(),n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,s,this.context,void 0,i);o.data.length&&([this.state.remoteAggResult]=o.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.state.rows.findIndex((e=>e.data.srfkey===t.srfkey));this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:a}=this.model;if(!t||!a||"row"!==ibiz.config.grid.editShowMode)return void ibiz.log.error("不支持新建行");if(this.state.rows.find((t=>t.showRowEdit)))throw new e("请先完成当前行编辑中的行的操作");const s=await this.service.getDraft(this.context,this.params);this.state.items.unshift(s.data);const i=new Oi(s.data,this);this.state.rows.unshift(i),this.gridStateNotify(i,"DRAFT"),this.switchRowEdit(this.state.rows[0],!0)}async save(t){if(this.state.isSimple)return;const a=this.state.rows.find((e=>e.data.srfkey===t.srfkey));if(!a)throw new e("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await w(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new e("行数据校验不通过,保存取消");let s;await this.startLoading();const i=0===t.srfuf,n=Dt(this.model.appDataEntityId),o=this.context.clone();o[n]=t.srfkey;try{s=i?await this.service.create(o,t):await this.service.update(o,t)}finally{await this.endLoading()}const r=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(r,1,s.data),a.data=s.data,a.modified=!1,ibiz.message.success("".concat(s.data.srfmajortext||"","保存成功")),this.gridStateNotify(a,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&Promise.allSettled(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await Ve(t);if(!a)return;this.providers[t.codeName]=a;const s=await a.createController(t,this);this.columns[t.codeName]=s,"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault}),"DEFGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=s,t.enableRowEdit&&(this.editColumns[t.codeName]=s)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=s:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}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)||hs(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this.evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,a){const s=await Promise.allSettled(Object.values(this.editColumns).map((async e=>e.dataChangeNotify(t,a))));if(s.find((t=>"rejected"===t.status)))throw ibiz.log.error("dataChangeNotify报错",s),new e("数据变更后有错误")}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new e("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,a,s=!0){if(!this.allowRowEdit)return;const i=void 0===a?!t.showRowEdit:a;if(t.showRowEdit!==i){if(!1===i)if(s)await this.save(t.data);else if(0===t.data.srfuf)return t.showRowEdit=!1,this.evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});if(!0===i){if(this.state.rows.find((t=>t.showRowEdit)))throw new e("同时只能有一行开启行编辑")}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this.evt.emit("onRowEditChange",{row:t})}}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.model;this.state.sortQuery=t&&e?"".concat(t.toLowerCase(),",").concat(e.toLowerCase()):""}}async updateGridEditItem(t,a){var s;const i=null==(s=this.model.degridEditItemUpdates)?void 0:s.find((t=>t.id===a));if(!i)throw new e("没找到".concat(a,"编辑列更新"));const{appDEMethodId:n,degeiupdateDetails:o}=i,r=o.map((t=>t.id)),c={...this.params,...t.data.getOrigin()},l=(await this.service.updateGridEditItem(n,this.context,c)).data;l&&(null==r?void 0:r.length)&&await Promise.all(r.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.params);let s;await this.startLoading();try{s=await this.service.fetch(e,a)}finally{await this.endLoading()}return s.data}async exportData(t){const a=this.fieldColumns,s=Object.keys(a).map((t=>a[t].model.id)),i=Object.keys(a).map((t=>a[t].model.caption)),n=(o=s,(await(async()=>{var s;const i=null==(s=t.params)?void 0:s.type;let n=[];if("activatedPage"===i&&(n=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:s}=t.params,o="customPage"===i?{page:0,offset:(a-1)*e,size:(s-a+1)*e}:{size:1e3,page:0};n=await this.loadData({params:o})}if("selectedRows"===i&&(n=this.getData()),0===n.length)throw new e("无导出数据");return(t=>{const e=new Map;Object.keys(a).forEach((t=>{a[t].codeList&&e.set(t,a[t].codeListItems)}));const s=B(t.map((t=>t.getOrigin())));return s.forEach((t=>{Object.keys(t).forEach((a=>{var s;e.get(a)&&(t[a]=(null==(s=e.get(a).find((e=>e.value===t[a])))?void 0:s.text)||t[a])}))})),s})(n)})()).map((t=>o.map((e=>t[e])))));var o;if(!ibiz.util.getExportExcel)throw new e("ibiz.util.getExportExcel不存在");const r=await ibiz.util.getExportExcel();if(!r)throw new e("导出模块加载错误");r.exportJsonToExcel({header:i,data:n,filename:this.model.logicName,autoWidth:!0})}}),t("GridFieldColumnController",class extends Vi{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}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:n}=ft(s);let o={};i&&t&&(o=lt(i,e,a,t));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=lt(n,e,a,t));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.model.codeName])return;const a=this.model.linkValueItem||"srfkey",i=t.data[a];if(null==i)throw new s(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:n}=this.model;if(!n)return;const o=Qt(t.data),r=Object.assign(this.context.clone(),{srfkey:i,...o}),c=B(this.params),{context:l,params:d}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(ce.TAG,n,l,d,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){}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:i}=this.model;if("NONE"===a)return;const n=e||this.model.id;let o;if("PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new s(this.model,"远程聚合暂未支持"):new s(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":o=t.map((t=>t[n])).reduce(((t,e)=>t+e),0);break;case"AVG":o=t.map((t=>t[n])).reduce(((t,e)=>t+e),0)/t.length;break;case"MAX":o=Math.max(...t.map((t=>t[n])));break;case"MIN":o=Math.min(...t.map((t=>t[n])));break;default:throw new s(this.model,"暂未支持属性列聚合模式".concat(a))}if(!i)return"".concat(o);throw new s(this.model,"暂未支持".concat(i,"的聚合值格式化"))}})),_i=(t("GridUAColumnController",class extends Vi{initActionStates(t){var e;const{deuiactionGroup:s}=this.model;if(!s)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=s.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new cs;s.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new rs(t.id,this.grid.context.srfappid,e);i.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=i}async onActionClick(t,e,a){const s=t.uiactionId;await Ks.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a})}}),t("GridFieldEditColumnController",class extends Si{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=Lt(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await be(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){const t=ne(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&(this.rules=ps(t,this.fieldName,this.valueItemName),this.validator=new $({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,a){this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||a.includes(this.fieldName)||a.includes(this.valueItemName)){if(!await this.validate(t))throw new e("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}a.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&P(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:s}=a;return t.errors[e]=s[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends Vi{}),t("ListService",class extends Ua{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let s;if(a){const t=a.toLowerCase();s=new qa(e,t,{isOriginField:!0})}else s=new qa(e,e);this.dataUIMap.set(e,s)}))}})),Fi=(t("ListController",class extends Is{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.service=new _i(this.model),await this.service.init(this.context)}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.model;this.state.sortQuery=t&&e?"".concat(t.toLowerCase(),",").concat(e.toLowerCase()):""}}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=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const s=a.get(e[t])||[];s.push(e),a.set(e[t],s)}));const s=[];a.forEach(((t,e)=>{s.push({caption:e,children:[...t]})})),this.state.groups=s}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,s=[],i=ibiz.hub.getApp(this.context.srfappid),n=await i.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const i=a.filter((a=>a[t]===e.value));s.push({caption:e.text,children:[...i]}),o.push(e.value)}));const r=a.filter((e=>-1===o.indexOf(e[t])));r.length>0&&s.push({caption:"其他",children:[...r]}),this.state.groups=s}}}),t("PanelController",class extends ws{constructor(){super(...arguments),this.panelItems={},this.providers={}}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}async onCreated(){await super.onCreated(),await this.initPanelItemControllers()}async onMounted(){this.load()}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var s,i;const n=await Se(t);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,a);e.panelItems[t.id]=o,(null==(s=t.panelItems)?void 0:s.length)&&await this.initPanelItemControllers(t.panelItems,e,o),(null==(i=t.panelTabPages)?void 0:i.length)&&await this.initPanelItemControllers(t.panelTabPages,e,o)})))}async load(){const t=await this.prepareData();if(!t)throw new e("未获取到面板数据");const a=this.convertData(t);this.state.data=a,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){return t}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,this.dataChangeNotify([t]))}})),Wi=(t("ViewLayoutPanelController",class extends Fi{async onCreated(){this.preprocessModel(),await super.onCreated()}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),ki=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=Et(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}createState(){var t;return new Wi(null==(t=this.parent)?void 0:t.state)}dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDynaClass(this.data)}panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const s=a.relatedItemNames||[];if(e||f(s,t))try{const t=Ht(this.panel.data,a);switch(a.logicCat){case"ITEMBLANK":this.state.required=!t;break;case"ITEMENABLE":this.state.disabled=!t;break;case"PANELVISIBLE":this.state.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=wt(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=wt(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}}),t("PickupViewPanelController",class extends ws{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),s={...this.params};t&&Object.assign(a,lt(t,this.context,this.params)),e&&Object.assign(s,lt(e,this.context,this.params)),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",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),t("SearchBarController",class extends ws{constructor(){super(...arguments),this.placeHolder=""}initState(){super.initState(),this.state.query=""}async onCreated(){var t;await super.onCreated();const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.find((t=>t.enableQuickSearch));(null==a?void 0:a.lnlanguageRes)&&a.lnlanguageRes.lanResTag?this.placeHolder=ibiz.i18n.t(a.lnlanguageRes.lanResTag,a.lnlanguageRes.defaultContent):(null==a?void 0:a.logicName)&&(this.placeHolder=a.logicName)}}handleInput(t){this.state.query=t}handleSearch(){this.evt.emit("onSearch",void 0)}}),t("TabExpPanelController",class extends ws{initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[]})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initDefaultPage(){const t=()=>{this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()};if(this.state.defaultTabName){const e=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));e?(this.state.activeName=e.tabTag,this.changeToTab()):t()}else t()}changeToTab(t=this.activeTabViewPanelModel){const e=this.getNavViewMsg(t);this.evt.emit("onNavViewChange",{navViewMsg:e})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:s,navigateParams:i,appDataEntityId:n}=t,o={deName:Dt(n),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:s,navParams:i},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:l}=mt(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...this.params,...l}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId}}}),t("TreeService",class extends Ua{async fetchChildNodes(t,e){const{hasQuery:a}=e;let s=[];if(t){const i=Nt(this.model,{parentId:null==t?void 0:t.nodeId,hasQuery:a});if(0===i.length)return;(await Promise.allSettled(i.map((async a=>{const s=xt(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(s,a,t,e)})))).forEach((t=>{"fulfilled"===t.status&&t.value?s.push(...t.value):"rejected"===t.status&&ibiz.log.error(t.reason)}))}else{const t=Tt(this.model);s=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return s}async fetchNodeDatasByType(t,e,a,i){const n=0===Nt(this.model,{parentId:t.id,hasQuery:i.hasQuery}).length,o={...i,leaf:n};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,o)];break;case"DE":r=await this.getDENodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,o);break;default:throw new s(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:d}=t,h=d&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{var a;if(l&&(!c||c&&0===e)||(null==(a=i.defaultExpandedKeys)?void 0:a.length)&&i.defaultExpandedKeys.includes(t.id)||h){const e=await this.fetchChildNodes(t,i);t.children=e}}))),r}async getStaticNodeData(t,e,a,s){return new Ha(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!s.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:s,navigateContexts:i,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,l={...a.params},d={...a.context,...(null==e?void 0:e.context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<s;t++)h=null==h?void 0:h.parent}if(h){m=h.deData||{};const t=xt(this.model,h.nodeId);t.appDataEntityId&&(p=Dt(t.appDataEntityId)),u=h.value}const{resultContext:g,resultParams:f}=mt({deName:p,navFilter:o?"n_".concat(o,"_eq"):void 0,pickupDEFName:c,navParams:n,navContexts:i},{derValue:u,context:d,params:l,data:m});return Object.assign(d,g),Object.assign(l,f),{context:d,params:l,navContext:g,navParams:f}}async getDENodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:l}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&t.sortDir&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir.toLowerCase())});const d=await this.app.deService.exec(n,i,o,r);if(d.data.length){return d.data.map((e=>new Ka(t,a,{data:e,leaf:!!s.leaf,navContext:c,navParams:l})))}return[]}async getCodeListNodeDatas(t,e,a,s){const{context:i,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,i,n);if(c.length){return c.map((e=>new Ya(t,a,{data:e,leaf:!!s.leaf,navContext:o,navParams:r})))}return[]}})),Bi=(t("TreeController",class extends Is{constructor(){super(...arguments),this.contextMenus={}}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.size=0}async onCreated(){await super.onCreated(),this.service=new ki(this.model),await this.service.init(this.context),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new ei(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async load(t={}){const e=!0===t.isInitialLoad,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;let i;await this.startLoading();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=[],p({children:this.state.rootNodes},(t=>{this.state.items.push(t)})),i}async onTreeNodeClick(t){if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e.id!==t.id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this.evt.emit("onActive",{...e,nodeData:t})}setSelection(t){super.setSelection(t)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}async doUIAction(t,e,a){const s=this.getEventArgs(),i=this.parseTreeNodeData(e),n=await Ks.exec(t,{...s,...i,event:a});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()}}parseTreeNodeData(t){return{data:[{...t,...t.deData||{}}],context:Object.assign(this.context.clone(),t.context||{}),params:{...this.params,...t.params||{}}}}calcExpandedKeys(t){let e=[];return p({children:t},(t=>{var a;(null==(a=t.children)?void 0:a.length)&&e.push(t.id)})),this.state.defaultExpandedKeys.length&&(e.push(...this.state.defaultExpandedKeys),e=Array.from(new Set(e))),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"id",s=this.state.items.find((e=>e[a]===t[a]));if(!s)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{parent:t}=s;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void this.refresh()}const i=e?s.parent:s,n=await this.loadNodes(i);this.evt.emit("onAfterRefreshParent",{parentNode:i,children:n})}}),t("WizardPanelService",class extends Ba{async initialize(t,e={},a={}){var s;const i=null==(s=this.model.initControlAction)?void 0:s.appDEMethodId;let n=await this.exec(i,t,e,a);return n=this.handleResponse(n),n}async finish(t,e={},a={}){var s;const i=null==(s=this.model.finishControlAction)?void 0:s.appDEMethodId;let n=await this.exec(i,t,e,a);return n=this.handleResponse(n),n}})),Ui=(t("WizardPanelController",class extends ws{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,s;t.firstForm&&(this.firstForm=t);const i="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),n=null==(s=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:s.find((e=>e.id===t.dewizardStepId)),o=null==n?void 0:n.stepTag;this.stepTags[i]=o})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Bi(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await Ce(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,a=this.formControllers.get(t);if(!a)throw new e("找不到".concat(t,"的表单控制器"));return a}onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a),a.load()}onFormSaved(t){const e=t.data[0],a=Dt(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,this.params),e=Dt(this.model.appDataEntityId);t.data&&t.data.srfkey&&(this.context[e]=t.data.srfkey)}this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){await this.activeFormController.goBack(),this.tagHistory.pop();const t=this.tagHistory[this.tagHistory.length-1];if(!t)throw new e("没有上一个表单");this.state.activeFormTag=t}async onNextClick(){const t=await this.activeFormController.save();let a;if(t.srfnextform){if(!this.model.dewizard.dewizardForms.find((e=>e.formTag===t.srfnextform)))throw new e("找不到标识为".concat(t.srfnextform,"的向导表单"));a=t.srfnextform}else{const{formTag:t}=this.activeWizardForm,s=this.model.dewizard.dewizardSteps;if(s&&t){const i=s.findIndex((e=>e.stepTag===t)),n=s[i+1];if(!n)throw new e("找不到下一个向导步骤");const o=this.model.dewizard.dewizardForms.find((t=>t.formTag===n.stepTag));o&&(a=o.formTag)}}if(!a)throw new e("找不到下一个向导表单");this.state.activeFormTag=a,this.tagHistory.push(a)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}logout(){return ibiz.auth.logout()}})),zi=class{constructor(){this.convert=new class{constructor(){this.appMenu=new class{parse(t){return t}}}},this.controller=new Ui,this.appMap=new Map,this.apps=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new class{constructor(){this.view=new class{constructor(){this.viewConfigs=new Map}set(t,e){this.viewConfigs.set(t,e)}async get(t){if(!this.viewConfigs.has(t)){const a=await ibiz.hub.getAppView(t);if(!a)throw new e("视图[".concat(t,"]不存在"));this.set(a.id,{id:a.id,codeName:a.codeName,openMode:a.openMode,width:a.width,height:a.height,appDataEntityId:a.appDataEntityId,redirectView:a.redirectView})}return this.viewConfigs.get(t)}}}},this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerApp(t){this.apps.set(t.codeName,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 getAppView(t){const a=this.calcAppViewId(t),s=this.view2appMap.get(a)||ibiz.env.appId;if(this.appMap.has(s)||await this.createApp(s),this.views.has(a))return this.views.get(a);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(s,a);return this.registerAppView(t),t}throw new e("视图[".concat(a,"]不存在"))}async getAppDataEntity(t,a=ibiz.env.appId){if(this.dataEntities.has(a)){const e=this.dataEntities.get(a);if(e.has(t))return e.get(t)}if(this.modelLoaderProvider){let e;return e=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(a,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(a,t),this.registerAppDataEntity(e,a),e}throw new e("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);let a;if(this.apps.has(t))a=this.apps.get(t);else{if(!this.modelLoaderProvider)throw new e("未找到应用[".concat(t,"]模型"));a=await this.modelLoaderProvider.getApp(t),this.registerApp(a)}const s=new Ja(a);return this.appMap.set(t,s),await s.init(),s}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}},Gi=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:s}=t,i="".concat(s,"_").concat(a),n=this.viewEngines.get(i);if(n)return n(...e);ibiz.log.error("没有".concat(i,"对应的引擎"),t)}}),ji=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:s}=this.view;ibiz.log.debug("".concat(a.id,"的子组件:").concat(s.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_header;e&&(e.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_footer;t&&(t.state.visible=!1)}}}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,s;let i=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_captionbar;e&&(e.state.visible=!1)}else i=!0;if(ibiz.env.isMob){if(this.leftToolbar)i=!0;else{const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.lefttoolbar;t&&(t.state.visible=!1)}if(this.rightToolbar)i=!0;else{const t=null==(a=this.viewLayoutPanel)?void 0:a.panelItems.righttoolbar;t&&(t.state.visible=!1)}}else if(this.toolbar)i=!0;else{const t=null==(s=this.viewLayoutPanel)?void 0:s.panelItems.view_toolbar;t&&(t.state.visible=!1)}return i}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:a,context:s,params:i}=this.view;if(!t)throw new e("该视图没有实体,无法加载实体数据");const n=ibiz.hub.getApp(s.srfappid),o=await n.deService.exec(t,"get",s,i),{data:r}=o;r&&(this.view.state.srfactiveviewdata=r,a.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&a.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),Xi=(t("MDViewEngine",class extends ji{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")}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",(async t=>{await this.openData(t)})),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.refresh()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.refresh()})),!this.view.state.noLoadDefault&&t.loadDefault&&this.load()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?(await this.openData(e),null):"New"===t?(await this.newData(e),null):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Copy"===t?(this.copy(e),null):"load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:s,event:i}=t,n=(t.context||this.view.context).clone(),o=t.params||this.view.params;n[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||Dt(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;-1===await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("opendata",{context:n,params:o,data:s,event:i,view:this.view}))&&ibiz.log.warn("视图[".concat(this.view.model.codeName,"],未配置编辑打开视图"))}async newData(t){var e,s,i;const{data:n,event:o,copyMode:r}=t;if(!(null==(s=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:s.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=this.view.context.clone();r&&(c.srfcopymode=!0);if(-1===await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("newdata",{context:c,params:this.view.params,data:n,event:o,view:this.view})))throw new a(this.view.model,"缺少newdata的视图逻辑")}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}getSearchParams(){const t={};if(this.searchForm){const e=this.searchForm.getData()[0],a=Object.entries(e).reduce(((t,[e,a])=>(null!=a&&""!==a&&(t[e]=a),t)),{});Object.assign(t,a)}if(this.searchBar&&this.searchBar.state.query){const e={query:this.searchBar.state.query};Object.assign(t,e)}return 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)t=!0;else{const t=this.viewLayoutPanel.panelItems.view_searchbar;t&&(t.state.visible=!1)}return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),class{constructor(){this.layoutPanel=new qt,this.text=new oe}}),Yi=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new e("Method not implemented.")}destroy(){}},Ki=class extends Yi{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const s=this.logic.scriptCode;this.scriptFn=jt.createScriptFn(t,s,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Hi=class extends Yi{execute(t){const{appDEUILogicId:e,appDataEntityId:s}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Ys(e,s,t)}},qi=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),j(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const s={itemName:t,triggerType:e},i=this.triggerAndExecute(s,a);if(null==i?void 0: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((t=>t.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){const a={ctrlName:t,eventName:e.eventName,triggerType:"CTRLEVENT"};this.triggerAndExecute(a,e)}},Qi=class extends qi{constructor(t){super(t.filter((t=>"APPVIEWENGINE"!==t.triggerType)))}},$i=class extends qi{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Ji=class{constructor(){this.executorFactory=new 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 s(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},this.triggerFactory=new 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 s(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}}}createViewScheduler(t){return new $i(t)}createControlScheduler(t){return new Qi(t)}},Zi=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new e("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},tn=class extends Zi{},en=class extends Zi{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new e("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:s}=t;return{context:e,params:a,data:(null==s?void 0:s[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){return super.match(t)&&t.itemName===this.logic.itemName}execute(t){const a=this.executor.execute(t);if("boolean"==typeof a)return a;throw new e("".concat(this.logic.id,"逻辑返回值不是布尔值"))}},an=class extends Zi{constructor(){super(...arguments),this.timer=null}start(){this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new e("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},sn=class extends Yi{execute(t){return"opendata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):"newdata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t):void 0}async executeOpenDataAppUILogic(t,s){const{context:i,params:n,...o}=s,{data:r}=s;if(!(null==r?void 0:r[0]))throw new e("opendata没有可操作数据!");const c=t.openDataAppView;if(!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const d=c.navigateContexts||[],h=Object.assign(i,lt(d,i,n,r[0]));let u={};const p=c.navigateParams;A(p)&&(u=lt(p,n,i,r[0])),await ibiz.commands.execute(ce.TAG,l,h,u,o)}async executeNewDataAppUILogic(t,e){const{context:i,params:n,...o}=e,{data:r}=e,{enableWizardAdd:c,enableBatchAdd:l,batchAddOnly:d,newDataAppView:h}=t;let u;if(c){if(u=await this.getWizardNewViewRef(t,e),!u)return}else{if(l)throw new s(t,"enableBatchAdd暂未支持");if(d)throw new s(t,"batchAddOnly暂未支持");if(u=h,!u||!u.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let p={},m={};const g=(null==r?void 0:r[0])||{},f=u.navigateContexts;A(f)&&(p=lt(f,i,n,g)),p=Object.assign(i,p);const E=u.navigateParams;A(E)&&(m=lt(E,n,i,g)),i.srfcopymode&&(g.srfkey=void 0,m=Object.assign(m,g.$origin)),await ibiz.commands.execute(ce.TAG,u.refAppViewId,p,m,o)}async getWizardNewViewRef(t,s){var i;const{wizardAppView:n,newDataAppViews:o}=t,{context:r,params:c,...l}=s;if(!n||!n.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const d=await ibiz.commands.execute(ce.TAG,n.refAppViewId,r,c,{...l,openMode:"POPUPMODAL"});if(!d.ok)return;const h=null==(i=d.data)?void 0:i[0];if(!h)throw new e("请选中一条数据");const u=h.srfkey,p=null==o?void 0:o.find((t=>t.refMode===u));if(!p)throw new e("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}},nn=class extends Zi{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(",");this.listenEventNames=a.map((t=>ee[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},on=class extends Zi{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(",");this.listenEventNames=a.map((t=>se[t]||t))}match(t){return super.match(t)&&t.ctrlName===this.logic.ctrlName&&this.listenEventNames.includes(t.eventName)}};var rn=((t,e,a)=>(a=null!=t?tt(it(t)):{},((t,e,a,s)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of st(e))nt.call(t,i)||i===a||et(t,i,{get:()=>e[i],enumerable:!(s=at(e,i))||s.enumerable});return t})(!e&&t&&t.__esModule?a:et(a,"default",{value:t,enumerable:!0}),t)))(ot(),1);t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t);const e=rn.default.dirname(this.url.pathname);this.baseDir=e}dir(t){return rn.default.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const s=document.createElement("link");s.setAttribute("type","text/css"),s.setAttribute("rel","stylesheet"),s.setAttribute("href",e),s.onload=t,s.onerror=a,document.head.appendChild(s)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));
1
+ System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","dayjs/plugin/minMax","dayjs/plugin/isSameOrBefore","dayjs/plugin/quarterOfYear","dayjs/plugin/weekOfYear","dayjs/plugin/isoWeek","async-validator"],(function(t){"use strict";var e,a,s,i,n,r,o,c,l,h,d,u,p,m,f,g,w,E,v,y,I,D,C,b,P,A,_,S,x,T,L,O,M,N,R,V,k,F,W,B,U,j,z,G,H,X,K,Y,$,q,Q,J;return{setters:[function(t){e=t.RuntimeError,a=t.RuntimeModelError,s=t.ModelError,i=t.IBizContext,n=t.HttpResponse,r=t.HttpError,o=t.CoreConst,c=t.Net,l=t.NOOP,h=t.isElementSame,d=t.findRecursiveChild,u=t.StringUtil,p=t.recursiveIterate,m=t.debounceAndAsyncMerge,f=t.mergeDefaultInLeft,g=t.isOverlap,w=t.awaitTimeout,E=t.mergeInLeft,v=t.DataTypes,y=t.toNumberOrNil},function(t){I=t.isEmpty,D=t.debounce,C=t.isArray,b=t.isFunction},function(t){P=t.notNilEmpty,A=t.isNilOrEmpty,_=t.AsyncSeriesHook,S=t.QXEvent,x=t.createUUID,T=t.isArray,L=t.setCookie,O=t.clearCookie,M=t.clearAll,N=t.ascSort,R=t.descSort},function(t){V=t.default},function(t){k=t.isNotNil,F=t.isNil,W=t.mergeRight,B=t.isEmpty,U=t.clone,j=t.equals,z=t.where,G=t.mergeDeepRight,H=t.mergeLeft},function(t){X=t.default},function(t){K=t.default},function(t){Y=t.default},function(t){$=t.default},function(t){q=t.default},function(t){Q=t.default},function(t){J=t.default}],execute:function(){t({calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t,s={};if(e||a){switch(Object.assign(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"})}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"})}}return s},calcDeCodeNameById:de,calcDynaClass:ce,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:s,colSM:i,colSMOffset:n,colMD:r,colMDOffset:o,colLG:c,colLGOffset:l}=t,h=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:h(a,s),sm:h(i,n),md:h(r,o),lg:h(c,l)}},calcLayoutHeightWidth:oe,calcMainStateOPPrivsStrs:he,calcNavParams:ie,calcResPath:$a,compare:Se,compareNumber:xe,contains:Te,convertNavData:Zt,convertNavDataByArray:te,convertNavDataByObject:ee,convertObjectToNavParams:ae,execDELogic:Cs,execDELogicAction:bs,execDELogicById:async function(t,a,s,i,n){const r=await async function(t,e,a){const s=await ibiz.hub.getAppDataEntity(e,a);return pe(t,s)}(t,a,s.srfappid);if(!r)throw new e("".concat(a,"找不到实体逻辑").concat(t));return Cs(r,s,i,n)},execFieldLogics:Ps,execUILogic:Vi,filterFieldLogics:me,filterValueRules:$e,findChildFormDetails:Ie,findDELogic:pe,findEditItem:ye,findFieldById:fe,findModelChild:ne,formatMultiData:se,generateRules:si,getAppCounterProvider:Fa,getAppViewRef:function(t,e){var a,s;let i=t.appViewRefs||[];(null==(s=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:s.length)&&(i=i.concat(t.viewLayoutPanel.appViewRefs));return i.find((t=>t.name===e||t.id===e))},getChildNodeRSs:ve,getControl:function(t,e){var a,s;let i=t.controls||[];(null==(s=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:s.length)&&(i=i.concat(t.viewLayoutPanel.controls));return i.find((t=>t.name===e||t.codeName===e||t.id===e))},getControlProvider:pa,getControlsByView:De,getDeACMode:async function(t,e,a){var s;const i=await ibiz.hub.getAppDataEntity(e,a);return null==(s=i.appDEACModes)?void 0:s.find((e=>e.id===t))},getEditorProvider:ga,getFormDetailProvider:va,getGridColumnProvider:Da,getMatchResPath:Ya,getOriginData:ai,getPanelItemProvider:Pa,getPortletProvider:Na,getRootNode:we,getTreeNode:Ee,getUIActionById:ge,getUIActionProvider:xa,getViewEngines:be,getViewLogics:Ce,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ha(i,n);if(t&&(e=La(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(s&&"DEFAULT"!==s){if(e=La("".concat(a,"_").concat(s)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(s,"]对应的适配器"),t)}e||(e=La(a));e||(e=La("DEFAULT"));return e},getWFContext:Be,getWFSubmitViewId:function(t,e){var a;const{type:s,sequenceflowview:i,sequenceflowmobview:n}=e,r=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,o=s?"WFUTILACTION@".concat(s.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:i),c=r.find((t=>t.name===o));return null==c?void 0:c.refAppViewId},hasDeCodeName:ue,install:function(){const{ibiz:t}=window;t.util=new kn,t.hub=new Nn,t.register=new Qt,t.config=new qt,t.auth=new Ns,t.engine=new Rn,ea(),zi(),ja(),ibiz.scheduler=new Gn,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Kn(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Kn(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Kn(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Yn(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Xn(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new qn(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Qn(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Wn(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Bn(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Bn(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new $n(t,e)))},installCommand:ea,isValueChange:ei,matchMainState:le,openRedirectView:Pe,parseUserParams:re,presetAppCounterProvider:ja,presetUIActionProvider:zi,registerAppCounterProvider:Va,registerControlProvider:function(t,e){ibiz.register.register("".concat(da,"_").concat(t),e)},registerEditorProvider:function(t,e){ibiz.register.register("".concat(ma,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(wa,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(ya,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Ca,"_").concat(t.toUpperCase()),e)},registerPortletProvider:function(t,e){ibiz.register.register("".concat(Oa,"_").concat(t),e)},registerUIActionProvider:_a,registerViewProvider:function(t,e){ibiz.register.register("".concat(Ta,"_").concat(t),e)},strContain:Le,testCond:_e,toLocalOpenWFRedirectView:Ae,verifyDeRules:Re,verifyFormGroupLogic:ke,verifyPanelGroupLogic:Fe});var Z=Object.create,tt=Object.defineProperty,et=Object.getOwnPropertyDescriptor,at=Object.getOwnPropertyNames,st=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty,nt=(t,e)=>function(){return e||(0,t[at(t)[0]])((e={exports:{}}).exports,e),e.exports},rt=(t,e,a)=>(a=null!=t?Z(st(t)):{},((t,e,a,s)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of at(e))it.call(t,i)||i===a||tt(t,i,{get:()=>e[i],enumerable:!(s=et(e,i))||s.enumerable});return t})(!e&&t&&t.__esModule?a:tt(a,"default",{value:t,enumerable:!0}),t)),ot=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/utils.js"(t){t.__esModule=!0,t.extend=n,t.indexOf=function(t,e){for(var a=0,s=t.length;a<s;a++)if(t[a]===e)return a;return-1},t.escapeExpression=function(t){if("string"!=typeof t){if(t&&t.toHTML)return t.toHTML();if(null==t)return"";if(!t)return t+"";t=""+t}if(!s.test(t))return t;return t.replace(a,i)},t.isEmpty=function(t){return!t&&0!==t||!(!c(t)||0!==t.length)},t.createFrame=function(t){var e=n({},t);return e._parent=t,e},t.blockParams=function(t,e){return t.path=e,t},t.appendContextPath=function(t,e){return(t?t+".":"")+e};var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},a=/[&<>"'`=]/g,s=/[&<>"'`=]/;function i(t){return e[t]}function n(t){for(var e=1;e<arguments.length;e++)for(var a in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],a)&&(t[a]=arguments[e][a]);return t}var r=Object.prototype.toString;t.toString=r;var o=function(t){return"function"==typeof t};o(/x/)&&(t.isFunction=o=function(t){return"function"==typeof t&&"[object Function]"===r.call(t)}),t.isFunction=o;var c=Array.isArray||function(t){return!(!t||"object"!=typeof t)&&"[object Array]"===r.call(t)};t.isArray=c}}),ct=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/exception.js"(t,e){t.__esModule=!0;var a=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function s(t,e){var i=e&&e.loc,n=void 0,r=void 0,o=void 0,c=void 0;i&&(n=i.start.line,r=i.end.line,o=i.start.column,c=i.end.column,t+=" - "+n+":"+o);for(var l=Error.prototype.constructor.call(this,t),h=0;h<a.length;h++)this[a[h]]=l[a[h]];Error.captureStackTrace&&Error.captureStackTrace(this,s);try{i&&(this.lineNumber=n,this.endLineNumber=r,Object.defineProperty?(Object.defineProperty(this,"column",{value:o,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:c,enumerable:!0})):(this.column=o,this.endColumn=c))}catch(t){}}s.prototype=new Error,t.default=s,e.exports=t.default}}),lt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js"(t,e){t.__esModule=!0;var a=ot();t.default=function(t){t.registerHelper("blockHelperMissing",(function(e,s){var i=s.inverse,n=s.fn;if(!0===e)return n(this);if(!1===e||null==e)return i(this);if(a.isArray(e))return e.length>0?(s.ids&&(s.ids=[s.name]),t.helpers.each(e,s)):i(this);if(s.data&&s.ids){var r=a.createFrame(s.data);r.contextPath=a.appendContextPath(s.data.contextPath,s.name),s={data:r}}return n(e,s)}))},e.exports=t.default}}),ht=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js"(t,e){t.__esModule=!0;var a,s=ot(),i=ct(),n=(a=i)&&a.__esModule?a:{default:a};t.default=function(t){t.registerHelper("each",(function(t,e){if(!e)throw new n.default("Must pass iterator to #each");var a,i=e.fn,r=e.inverse,o=0,c="",l=void 0,h=void 0;function d(e,a,n){l&&(l.key=e,l.index=a,l.first=0===a,l.last=!!n,h&&(l.contextPath=h+e)),c+=i(t[e],{data:l,blockParams:s.blockParams([t[e],e],[h+e,null])})}if(e.data&&e.ids&&(h=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),s.isFunction(t)&&(t=t.call(this)),e.data&&(l=s.createFrame(e.data)),t&&"object"==typeof t)if(s.isArray(t))for(var u=t.length;o<u;o++)o in t&&d(o,o,o===t.length-1);else if("function"==typeof Symbol&&t[Symbol.iterator]){for(var p=[],m=t[Symbol.iterator](),f=m.next();!f.done;f=m.next())p.push(f.value);for(u=(t=p).length;o<u;o++)d(o,o,o===t.length-1)}else a=void 0,Object.keys(t).forEach((function(t){void 0!==a&&d(a,o-1),a=t,o++})),void 0!==a&&d(a,o-1,!0);return 0===o&&(c=r(this)),c}))},e.exports=t.default}}),dt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js"(t,e){t.__esModule=!0;var a,s=ct(),i=(a=s)&&a.__esModule?a:{default:a};t.default=function(t){t.registerHelper("helperMissing",(function(){if(1!==arguments.length)throw new i.default('Missing helper: "'+arguments[arguments.length-1].name+'"')}))},e.exports=t.default}}),ut=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers/if.js"(t,e){t.__esModule=!0;var a,s=ot(),i=ct(),n=(a=i)&&a.__esModule?a:{default:a};t.default=function(t){t.registerHelper("if",(function(t,e){if(2!=arguments.length)throw new n.default("#if requires exactly one argument");return s.isFunction(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||s.isEmpty(t)?e.inverse(this):e.fn(this)})),t.registerHelper("unless",(function(e,a){if(2!=arguments.length)throw new n.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:a.inverse,inverse:a.fn,hash:a.hash})}))},e.exports=t.default}}),pt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers/log.js"(t,e){t.__esModule=!0,t.default=function(t){t.registerHelper("log",(function(){for(var e=[void 0],a=arguments[arguments.length-1],s=0;s<arguments.length-1;s++)e.push(arguments[s]);var i=1;null!=a.hash.level?i=a.hash.level:a.data&&null!=a.data.level&&(i=a.data.level),e[0]=i,t.log.apply(t,e)}))},e.exports=t.default}}),mt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js"(t,e){t.__esModule=!0,t.default=function(t){t.registerHelper("lookup",(function(t,e,a){return t?a.lookupProperty(t,e):t}))},e.exports=t.default}}),ft=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers/with.js"(t,e){t.__esModule=!0;var a,s=ot(),i=ct(),n=(a=i)&&a.__esModule?a:{default:a};t.default=function(t){t.registerHelper("with",(function(t,e){if(2!=arguments.length)throw new n.default("#with requires exactly one argument");s.isFunction(t)&&(t=t.call(this));var a=e.fn;if(s.isEmpty(t))return e.inverse(this);var i=e.data;return e.data&&e.ids&&((i=s.createFrame(e.data)).contextPath=s.appendContextPath(e.data.contextPath,e.ids[0])),a(t,{data:i,blockParams:s.blockParams([t],[i&&i.contextPath])})}))},e.exports=t.default}}),gt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/helpers.js"(t){function e(t){return t&&t.__esModule?t:{default:t}}t.__esModule=!0,t.registerDefaultHelpers=function(t){a.default(t),s.default(t),i.default(t),n.default(t),r.default(t),o.default(t),c.default(t)},t.moveHelperToHooks=function(t,e,a){t.helpers[e]&&(t.hooks[e]=t.helpers[e],a||delete t.helpers[e])};var a=e(lt()),s=e(ht()),i=e(dt()),n=e(ut()),r=e(pt()),o=e(mt()),c=e(ft())}}),wt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js"(t,e){t.__esModule=!0;var a=ot();t.default=function(t){t.registerDecorator("inline",(function(t,e,s,i){var n=t;return e.partials||(e.partials={},n=function(i,n){var r=s.partials;s.partials=a.extend({},r,e.partials);var o=t(i,n);return s.partials=r,o}),e.partials[i.args[0]]=i.fn,n}))},e.exports=t.default}}),Et=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/decorators.js"(t){t.__esModule=!0,t.registerDefaultDecorators=function(t){s.default(t)};var e,a=wt(),s=(e=a)&&e.__esModule?e:{default:e}}}),vt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/logger.js"(t,e){t.__esModule=!0;var a=ot(),s={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(t){if("string"==typeof t){var e=a.indexOf(s.methodMap,t.toLowerCase());t=e>=0?e:parseInt(t,10)}return t},log:function(t){if(t=s.lookupLevel(t),"undefined"!=typeof console&&s.lookupLevel(s.level)<=t){var e=s.methodMap[t];console[e]||(e="log");for(var a=arguments.length,i=Array(a>1?a-1:0),n=1;n<a;n++)i[n-1]=arguments[n];console[e].apply(console,i)}}};t.default=s,e.exports=t.default}}),yt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js"(t){t.__esModule=!0,t.createNewLookupObject=function(){for(var t=arguments.length,a=Array(t),s=0;s<t;s++)a[s]=arguments[s];return e.extend.apply(void 0,[Object.create(null)].concat(a))};var e=ot()}}),It=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js"(t){t.__esModule=!0,t.createProtoAccessControl=function(t){var e=Object.create(null);e.constructor=!1,e.__defineGetter__=!1,e.__defineSetter__=!1,e.__lookupGetter__=!1;var s=Object.create(null);return s.__proto__=!1,{properties:{whitelist:a.createNewLookupObject(s,t.allowedProtoProperties),defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:a.createNewLookupObject(e,t.allowedProtoMethods),defaultValue:t.allowProtoMethodsByDefault}}},t.resultIsAllowed=function(t,e,a){return r("function"==typeof t?e.methods:e.properties,a)},t.resetLoggedProperties=function(){Object.keys(n).forEach((function(t){delete n[t]}))};var e,a=yt(),s=vt(),i=(e=s)&&e.__esModule?e:{default:e},n=Object.create(null);function r(t,e){return void 0!==t.whitelist[e]?!0===t.whitelist[e]:void 0!==t.defaultValue?t.defaultValue:(function(t){!0!==n[t]&&(n[t]=!0,i.default.log("error",'Handlebars: Access has been denied to resolve the property "'+t+'" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'))}(e),!1)}}}),Dt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/base.js"(t){function e(t){return t&&t.__esModule?t:{default:t}}t.__esModule=!0,t.HandlebarsEnvironment=l;var a=ot(),s=e(ct()),i=gt(),n=Et(),r=e(vt()),o=It();t.VERSION="4.7.8";t.COMPILER_REVISION=8;t.LAST_COMPATIBLE_COMPILER_REVISION=7;t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var c="[object Object]";function l(t,e,a){this.helpers=t||{},this.partials=e||{},this.decorators=a||{},i.registerDefaultHelpers(this),n.registerDefaultDecorators(this)}l.prototype={constructor:l,logger:r.default,log:r.default.log,registerHelper:function(t,e){if(a.toString.call(t)===c){if(e)throw new s.default("Arg not supported with multiple helpers");a.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(a.toString.call(t)===c)a.extend(this.partials,t);else{if(void 0===e)throw new s.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(a.toString.call(t)===c){if(e)throw new s.default("Arg not supported with multiple decorators");a.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){o.resetLoggedProperties()}};var h=r.default.log;t.log=h,t.createFrame=a.createFrame,t.logger=r.default}}),Ct=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/safe-string.js"(t,e){function a(t){this.string=t}t.__esModule=!0,a.prototype.toString=a.prototype.toHTML=function(){return""+this.string},t.default=a,e.exports=t.default}}),bt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js"(t){t.__esModule=!0,t.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}}}}),Pt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/runtime.js"(t){t.__esModule=!0,t.checkRevision=function(t){var e=t&&t[0]||1,a=n.COMPILER_REVISION;if(e>=n.LAST_COMPATIBLE_COMPILER_REVISION&&e<=n.COMPILER_REVISION)return;if(e<n.LAST_COMPATIBLE_COMPILER_REVISION){var s=n.REVISION_CHANGES[a],r=n.REVISION_CHANGES[e];throw new i.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+s+") or downgrade your runtime to an older version ("+r+").")}throw new i.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")},t.template=function(t,e){if(!e)throw new i.default("No environment passed to template");if(!t||!t.main)throw new i.default("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var s=t.compiler&&7===t.compiler[0];var h={strict:function(t,e,a){if(!t||!(e in t))throw new i.default('"'+e+'" not defined in '+t,{loc:a});return h.lookupProperty(t,e)},lookupProperty:function(t,e){var a=t[e];return null==a||Object.prototype.hasOwnProperty.call(t,e)||c.resultIsAllowed(a,h.protoAccessControl,e)?a:void 0},lookup:function(t,e){for(var a=t.length,s=0;s<a;s++){if(null!=(t[s]&&h.lookupProperty(t[s],e)))return t[s][e]}},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:a.escapeExpression,invokePartial:function(s,n,r){r.hash&&(n=a.extend({},n,r.hash),r.ids&&(r.ids[0]=!0)),s=e.VM.resolvePartial.call(this,s,n,r);var o=a.extend({},r,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),c=e.VM.invokePartial.call(this,s,n,o);if(null==c&&e.compile&&(r.partials[r.name]=e.compile(s,t.compilerOptions,e),c=r.partials[r.name](n,o)),null!=c){if(r.indent){for(var l=c.split("\n"),h=0,d=l.length;h<d&&(l[h]||h+1!==d);h++)l[h]=r.indent+l[h];c=l.join("\n")}return c}throw new i.default("The partial "+r.name+" could not be compiled when running in runtime-only mode")},fn:function(e){var a=t[e];return a.decorator=t[e+"_d"],a},programs:[],program:function(t,e,a,s,i){var n=this.programs[t],r=this.fn(t);return e||i||s||a?n=l(this,t,r,e,a,s,i):n||(n=this.programs[t]=l(this,t,r)),n},data:function(t,e){for(;t&&e--;)t=t._parent;return t},mergeIfNeeded:function(t,e){var s=t||e;return t&&e&&t!==e&&(s=a.extend({},e,t)),s},nullContext:Object.seal({}),noop:e.VM.noop,compilerInfo:t.compiler};function u(e){var a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=a.data;u._setup(a),!a.partial&&t.useData&&(s=function(t,e){e&&"root"in e||((e=e?n.createFrame(e):{}).root=t);return e}(e,s));var i=void 0,r=t.useBlockParams?[]:void 0;function o(e){return""+t.main(h,e,h.helpers,h.partials,s,r,i)}return t.useDepths&&(i=a.depths?e!=a.depths[0]?[e].concat(a.depths):a.depths:[e]),(o=d(t.main,o,h,a.depths||[],s,r))(e,a)}return u.isTop=!0,u._setup=function(i){if(i.partial)h.protoAccessControl=i.protoAccessControl,h.helpers=i.helpers,h.partials=i.partials,h.decorators=i.decorators,h.hooks=i.hooks;else{var n=a.extend({},e.helpers,i.helpers);!function(t,e){Object.keys(t).forEach((function(s){var i=t[s];t[s]=function(t,e){var s=e.lookupProperty;return o.wrapHelper(t,(function(t){return a.extend({lookupProperty:s},t)}))}(i,e)}))}(n,h),h.helpers=n,t.usePartial&&(h.partials=h.mergeIfNeeded(i.partials,e.partials)),(t.usePartial||t.useDecorators)&&(h.decorators=a.extend({},e.decorators,i.decorators)),h.hooks={},h.protoAccessControl=c.createProtoAccessControl(i);var l=i.allowCallsToHelperMissing||s;r.moveHelperToHooks(h,"helperMissing",l),r.moveHelperToHooks(h,"blockHelperMissing",l)}},u._child=function(e,a,s,n){if(t.useBlockParams&&!s)throw new i.default("must pass block params");if(t.useDepths&&!n)throw new i.default("must pass parent depths");return l(h,e,t[e],a,0,s,n)},u},t.wrapProgram=l,t.resolvePartial=function(t,e,a){t?t.call||a.name||(a.name=t,t=a.partials[t]):t="@partial-block"===a.name?a.data["partial-block"]:a.partials[a.name];return t},t.invokePartial=function(t,e,s){var r=s.data&&s.data["partial-block"];s.partial=!0,s.ids&&(s.data.contextPath=s.ids[0]||s.data.contextPath);var o=void 0;s.fn&&s.fn!==h&&function(){s.data=n.createFrame(s.data);var t=s.fn;o=s.data["partial-block"]=function(e){var a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return a.data=n.createFrame(a.data),a.data["partial-block"]=r,t(e,a)},t.partials&&(s.partials=a.extend({},s.partials,t.partials))}();void 0===t&&o&&(t=o);if(void 0===t)throw new i.default("The partial "+s.name+" could not be found");if(t instanceof Function)return t(e,s)},t.noop=h;var e,a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e.default=t,e}(ot()),s=ct(),i=(e=s)&&e.__esModule?e:{default:e},n=Dt(),r=gt(),o=bt(),c=It();function l(t,e,a,s,i,n,r){function o(e){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=r;return!r||e==r[0]||e===t.nullContext&&null===r[0]||(o=[e].concat(r)),a(t,e,t.helpers,t.partials,i.data||s,n&&[i.blockParams].concat(n),o)}return(o=d(a,o,t,r,s,n)).program=e,o.depth=r?r.length:0,o.blockParams=i||0,o}function h(){return""}function d(t,e,s,i,n,r){if(t.decorator){var o={};e=t.decorator(e,o,s,i&&i[0],n,r,i),a.extend(e,o)}return e}}}),At=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/no-conflict.js"(t,e){t.__esModule=!0,t.default=function(t){"object"!=typeof globalThis&&(Object.prototype.__defineGetter__("__magic__",(function(){return this})),__magic__.globalThis=__magic__,delete Object.prototype.__magic__);var e=globalThis.Handlebars;t.noConflict=function(){return globalThis.Handlebars===t&&(globalThis.Handlebars=e),t}},e.exports=t.default}}),_t=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars.runtime.js"(t,e){function a(t){return t&&t.__esModule?t:{default:t}}function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e.default=t,e}t.__esModule=!0;var i=s(Dt()),n=a(Ct()),r=a(ct()),o=s(ot()),c=s(Pt()),l=a(At());function h(){var t=new i.HandlebarsEnvironment;return o.extend(t,i),t.SafeString=n.default,t.Exception=r.default,t.Utils=o,t.escapeExpression=o.escapeExpression,t.VM=c,t.template=function(e){return c.template(e,t)},t}var d=h();d.create=h,l.default(d),d.default=d,t.default=d,e.exports=t.default}}),St=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js"(t,e){t.__esModule=!0;var a={helpers:{helperExpression:function(t){return"SubExpression"===t.type||("MustacheStatement"===t.type||"BlockStatement"===t.type)&&!!(t.params&&t.params.length||t.hash)},scopedId:function(t){return/^\.|this\b/.test(t.original)},simpleId:function(t){return 1===t.parts.length&&!a.helpers.scopedId(t)&&!t.depth}}};t.default=a,e.exports=t.default}}),xt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js"(t,e){t.__esModule=!0;var a=function(){var t={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(t,e,a,s,i,n,r){var o=n.length-1;switch(i){case 1:return n[o-1];case 2:this.$=s.prepareProgram(n[o]);break;case 3:case 4:case 5:case 6:case 7:case 8:case 20:case 27:case 28:case 33:case 34:case 40:case 41:this.$=n[o];break;case 9:this.$={type:"CommentStatement",value:s.stripComment(n[o]),strip:s.stripFlags(n[o],n[o]),loc:s.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:n[o],value:n[o],loc:s.locInfo(this._$)};break;case 11:this.$=s.prepareRawBlock(n[o-2],n[o-1],n[o],this._$);break;case 12:this.$={path:n[o-3],params:n[o-2],hash:n[o-1]};break;case 13:this.$=s.prepareBlock(n[o-3],n[o-2],n[o-1],n[o],!1,this._$);break;case 14:this.$=s.prepareBlock(n[o-3],n[o-2],n[o-1],n[o],!0,this._$);break;case 15:this.$={open:n[o-5],path:n[o-4],params:n[o-3],hash:n[o-2],blockParams:n[o-1],strip:s.stripFlags(n[o-5],n[o])};break;case 16:case 17:this.$={path:n[o-4],params:n[o-3],hash:n[o-2],blockParams:n[o-1],strip:s.stripFlags(n[o-5],n[o])};break;case 18:this.$={strip:s.stripFlags(n[o-1],n[o-1]),program:n[o]};break;case 19:var c=s.prepareBlock(n[o-2],n[o-1],n[o],n[o],!1,this._$),l=s.prepareProgram([c],n[o-1].loc);l.chained=!0,this.$={strip:n[o-2].strip,program:l,chain:!0};break;case 21:this.$={path:n[o-1],strip:s.stripFlags(n[o-2],n[o])};break;case 22:case 23:this.$=s.prepareMustache(n[o-3],n[o-2],n[o-1],n[o-4],s.stripFlags(n[o-4],n[o]),this._$);break;case 24:this.$={type:"PartialStatement",name:n[o-3],params:n[o-2],hash:n[o-1],indent:"",strip:s.stripFlags(n[o-4],n[o]),loc:s.locInfo(this._$)};break;case 25:this.$=s.preparePartialBlock(n[o-2],n[o-1],n[o],this._$);break;case 26:this.$={path:n[o-3],params:n[o-2],hash:n[o-1],strip:s.stripFlags(n[o-4],n[o])};break;case 29:this.$={type:"SubExpression",path:n[o-3],params:n[o-2],hash:n[o-1],loc:s.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:n[o],loc:s.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:s.id(n[o-2]),value:n[o],loc:s.locInfo(this._$)};break;case 32:this.$=s.id(n[o-1]);break;case 35:this.$={type:"StringLiteral",value:n[o],original:n[o],loc:s.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(n[o]),original:Number(n[o]),loc:s.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===n[o],original:"true"===n[o],loc:s.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:s.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:s.locInfo(this._$)};break;case 42:this.$=s.preparePath(!0,n[o],this._$);break;case 43:this.$=s.preparePath(!1,n[o],this._$);break;case 44:n[o-2].push({part:s.id(n[o]),original:n[o],separator:n[o-1]}),this.$=n[o-2];break;case 45:this.$=[{part:s.id(n[o]),original:n[o]}];break;case 46:case 48:case 50:case 58:case 64:case 70:case 78:case 82:case 86:case 90:case 94:this.$=[];break;case 47:case 49:case 51:case 59:case 65:case 71:case 79:case 83:case 87:case 91:case 95:case 99:case 101:n[o-1].push(n[o]);break;case 98:case 100:this.$=[n[o]]}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,a=[0],s=[null],i=[],n=this.table,r="",o=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;i.push(l);var h=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var d,u,p,m,f,g,w,E,v,y={};;){if(u=a[a.length-1],this.defaultActions[u]?p=this.defaultActions[u]:(null==d&&(v=void 0,"number"!=typeof(v=e.lexer.lex()||1)&&(v=e.symbols_[v]||v),d=v),p=n[u]&&n[u][d]),void 0===p||!p.length||!p[0]){var I="";for(f in E=[],n[u])this.terminals_[f]&&f>2&&E.push("'"+this.terminals_[f]+"'");I=this.lexer.showPosition?"Parse error on line "+(o+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[d]||d)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==d?"end of input":"'"+(this.terminals_[d]||d)+"'"),this.parseError(I,{text:this.lexer.match,token:this.terminals_[d]||d,line:this.lexer.yylineno,loc:l,expected:E})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+u+", token: "+d);switch(p[0]){case 1:a.push(d),s.push(this.lexer.yytext),i.push(this.lexer.yylloc),a.push(p[1]),d=null,c=this.lexer.yyleng,r=this.lexer.yytext,o=this.lexer.yylineno,l=this.lexer.yylloc;break;case 2:if(g=this.productions_[p[1]][1],y.$=s[s.length-g],y._$={first_line:i[i.length-(g||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(g||1)].first_column,last_column:i[i.length-1].last_column},h&&(y._$.range=[i[i.length-(g||1)].range[0],i[i.length-1].range[1]]),void 0!==(m=this.performAction.call(y,r,c,o,this.yy,p[1],s,i)))return m;g&&(a=a.slice(0,-1*g*2),s=s.slice(0,-1*g),i=i.slice(0,-1*g)),a.push(this.productions_[p[1]][0]),s.push(y.$),i.push(y._$),w=n[a[a.length-2]][a[a.length-1]],a.push(w);break;case 3:return!0}}return!0}},e={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,a=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===s.length?this.yylloc.first_column:0)+s[s.length-a.length].length-a[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,a,s,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;r<n.length&&(!(a=this._input.match(this.rules[n[r]]))||e&&!(a[0].length>e[0].length)||(e=a,s=r,this.options.flex));r++);return e?((i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,n[s],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,a,s){function i(t,a){return e.yytext=e.yytext.substring(t,e.yyleng-a+t)}switch(a){case 0:if("\\\\"===e.yytext.slice(-2)?(i(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(i(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(i(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=i(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=i(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};function a(){this.yy={}}return t.lexer=e,a.prototype=t,t.Parser=a,new a}();t.default=a,e.exports=t.default}}),Tt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js"(t,e){t.__esModule=!0;var a,s=ct(),i=(a=s)&&a.__esModule?a:{default:a};function n(){this.parents=[]}function r(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function o(t){r.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function c(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}n.prototype={constructor:n,mutating:!1,acceptKey:function(t,e){var a=this.accept(t[e]);if(this.mutating){if(a&&!n.prototype[a.type])throw new i.default('Unexpected node type "'+a.type+'" found when accepting '+e+" on "+t.type);t[e]=a}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new i.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,a=t.length;e<a;e++)this.acceptKey(t,e),t[e]||(t.splice(e,1),e--,a--)},accept:function(t){if(t){if(!this[t.type])throw new i.default("Unknown type: "+t.type,t);this.current&&this.parents.unshift(this.current),this.current=t;var e=this[t.type](t);return this.current=this.parents.shift(),!this.mutating||e?e:!1!==e?t:void 0}},Program:function(t){this.acceptArray(t.body)},MustacheStatement:r,Decorator:r,BlockStatement:o,DecoratorBlock:o,PartialStatement:c,PartialBlockStatement:function(t){c.call(this,t),this.acceptKey(t,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:r,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(t){this.acceptArray(t.pairs)},HashPair:function(t){this.acceptRequired(t,"value")}},t.default=n,e.exports=t.default}}),Lt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js"(t,e){t.__esModule=!0;var a,s=Tt(),i=(a=s)&&a.__esModule?a:{default:a};function n(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=t}function r(t,e,a){void 0===e&&(e=t.length);var s=t[e-1],i=t[e-2];return s?"ContentStatement"===s.type?(i||!a?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(s.original):void 0:a}function o(t,e,a){void 0===e&&(e=-1);var s=t[e+1],i=t[e+2];return s?"ContentStatement"===s.type?(i||!a?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(s.original):void 0:a}function c(t,e,a){var s=t[null==e?0:e+1];if(s&&"ContentStatement"===s.type&&(a||!s.rightStripped)){var i=s.value;s.value=s.value.replace(a?/^\s+/:/^[ \t]*\r?\n?/,""),s.rightStripped=s.value!==i}}function l(t,e,a){var s=t[null==e?t.length-1:e-1];if(s&&"ContentStatement"===s.type&&(a||!s.leftStripped)){var i=s.value;return s.value=s.value.replace(a?/\s+$/:/[ \t]+$/,""),s.leftStripped=s.value!==i,s.leftStripped}}n.prototype=new i.default,n.prototype.Program=function(t){var e=!this.options.ignoreStandalone,a=!this.isRootSeen;this.isRootSeen=!0;for(var s=t.body,i=0,n=s.length;i<n;i++){var h=s[i],d=this.accept(h);if(d){var u=r(s,i,a),p=o(s,i,a),m=d.openStandalone&&u,f=d.closeStandalone&&p,g=d.inlineStandalone&&u&&p;d.close&&c(s,i,!0),d.open&&l(s,i,!0),e&&g&&(c(s,i),l(s,i)&&"PartialStatement"===h.type&&(h.indent=/([ \t]+$)/.exec(s[i-1].original)[1])),e&&m&&(c((h.program||h.inverse).body),l(s,i)),e&&f&&(c(s,i),l((h.inverse||h.program).body))}}return t},n.prototype.BlockStatement=n.prototype.DecoratorBlock=n.prototype.PartialBlockStatement=function(t){this.accept(t.program),this.accept(t.inverse);var e=t.program||t.inverse,a=t.program&&t.inverse,s=a,i=a;if(a&&a.chained)for(s=a.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var n={open:t.openStrip.open,close:t.closeStrip.close,openStandalone:o(e.body),closeStandalone:r((s||e).body)};if(t.openStrip.close&&c(e.body,null,!0),a){var h=t.inverseStrip;h.open&&l(e.body,null,!0),h.close&&c(s.body,null,!0),t.closeStrip.open&&l(i.body,null,!0),!this.options.ignoreStandalone&&r(e.body)&&o(s.body)&&(l(e.body),c(s.body))}else t.closeStrip.open&&l(e.body,null,!0);return n},n.prototype.Decorator=n.prototype.MustacheStatement=function(t){return t.strip},n.prototype.PartialStatement=n.prototype.CommentStatement=function(t){var e=t.strip||{};return{inlineStandalone:!0,open:e.open,close:e.close}},t.default=n,e.exports=t.default}}),Ot=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js"(t){t.__esModule=!0,t.SourceLocation=function(t,e){this.source=t,this.start={line:e.first_line,column:e.first_column},this.end={line:e.last_line,column:e.last_column}},t.id=function(t){return/^\[.*\]$/.test(t)?t.substring(1,t.length-1):t},t.stripFlags=function(t,e){return{open:"~"===t.charAt(2),close:"~"===e.charAt(e.length-3)}},t.stripComment=function(t){return t.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")},t.preparePath=function(t,e,a){a=this.locInfo(a);for(var i=t?"@":"",n=[],r=0,o=0,c=e.length;o<c;o++){var l=e[o].part,h=e[o].original!==l;if(i+=(e[o].separator||"")+l,h||".."!==l&&"."!==l&&"this"!==l)n.push(l);else{if(n.length>0)throw new s.default("Invalid path: "+i,{loc:a});".."===l&&r++}}return{type:"PathExpression",data:t,depth:r,parts:n,original:i,loc:a}},t.prepareMustache=function(t,e,a,s,i,n){var r=s.charAt(3)||s.charAt(2),o="{"!==r&&"&"!==r;return{type:/\*/.test(s)?"Decorator":"MustacheStatement",path:t,params:e,hash:a,escaped:o,strip:i,loc:this.locInfo(n)}},t.prepareRawBlock=function(t,e,a,s){i(t,a),s=this.locInfo(s);var n={type:"Program",body:e,strip:{},loc:s};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:n,openStrip:{},inverseStrip:{},closeStrip:{},loc:s}},t.prepareBlock=function(t,e,a,n,r,o){n&&n.path&&i(t,n);var c=/\*/.test(t.open);e.blockParams=t.blockParams;var l=void 0,h=void 0;if(a){if(c)throw new s.default("Unexpected inverse block on decorator",a);a.chain&&(a.program.body[0].closeStrip=n.strip),h=a.strip,l=a.program}r&&(r=l,l=e,e=r);return{type:c?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:l,openStrip:t.strip,inverseStrip:h,closeStrip:n&&n.strip,loc:this.locInfo(o)}},t.prepareProgram=function(t,e){if(!e&&t.length){var a=t[0].loc,s=t[t.length-1].loc;a&&s&&(e={source:a.source,start:{line:a.start.line,column:a.start.column},end:{line:s.end.line,column:s.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},t.preparePartialBlock=function(t,e,a,s){return i(t,a),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:a&&a.strip,loc:this.locInfo(s)}};var e,a=ct(),s=(e=a)&&e.__esModule?e:{default:e};function i(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var a={loc:t.path.loc};throw new s.default(t.path.original+" doesn't match "+e,a)}}}}),Mt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/base.js"(t){function e(t){return t&&t.__esModule?t:{default:t}}t.__esModule=!0,t.parseWithoutProcessing=o,t.parse=function(t,e){var a=o(t,e);return new s.default(e).accept(a)};var a=e(xt()),s=e(Lt()),i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e.default=t,e}(Ot()),n=ot();t.parser=a.default;var r={};function o(t,e){return"Program"===t.type?t:(a.default.yy=r,r.locInfo=function(t){return new r.SourceLocation(e&&e.srcName,t)},a.default.parse(t))}n.extend(r,i)}}),Nt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js"(t){function e(t){return t&&t.__esModule?t:{default:t}}t.__esModule=!0,t.Compiler=r,t.precompile=function(t,e,s){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new a.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var i=s.parse(t,e),n=(new s.Compiler).compile(i,e);return(new s.JavaScriptCompiler).compile(n,e)},t.compile=function(t,e,i){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new a.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=s.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var n=void 0;function r(){var a=i.parse(t,e),s=(new i.Compiler).compile(a,e),n=(new i.JavaScriptCompiler).compile(s,e,void 0,!0);return i.template(n)}function o(t,e){return n||(n=r()),n.call(this,t,e)}return o._setup=function(t){return n||(n=r()),n._setup(t)},o._child=function(t,e,a,s){return n||(n=r()),n._child(t,e,a,s)},o};var a=e(ct()),s=ot(),i=e(St()),n=[].slice;function r(){}function o(t,e){if(t===e)return!0;if(s.isArray(t)&&s.isArray(e)&&t.length===e.length){for(var a=0;a<t.length;a++)if(!o(t[a],e[a]))return!1;return!0}}function c(t){if(!t.path.parts){var e=t.path;t.path={type:"PathExpression",data:!1,depth:0,parts:[e.original+""],original:e.original+"",loc:e.loc}}}r.prototype={compiler:r,equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var a=0;a<e;a++){var s=this.opcodes[a],i=t.opcodes[a];if(s.opcode!==i.opcode||!o(s.args,i.args))return!1}e=this.children.length;for(a=0;a<e;a++)if(!this.children[a].equals(t.children[a]))return!1;return!0},guid:0,compile:function(t,e){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=e,this.stringParams=e.stringParams,this.trackIds=e.trackIds,e.blockParams=e.blockParams||[],e.knownHelpers=s.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},e.knownHelpers),this.accept(t)},compileProgram:function(t){var e=(new this.compiler).compile(t,this.options),a=this.guid++;return this.usePartial=this.usePartial||e.usePartial,this.children[a]=e,this.useDepths=this.useDepths||e.useDepths,a},accept:function(t){if(!this[t.type])throw new a.default("Unknown type: "+t.type,t);this.sourceNode.unshift(t);var e=this[t.type](t);return this.sourceNode.shift(),e},Program:function(t){this.options.blockParams.unshift(t.blockParams);for(var e=t.body,a=e.length,s=0;s<a;s++)this.accept(e[s]);return this.options.blockParams.shift(),this.isSimple=1===a,this.blockParams=t.blockParams?t.blockParams.length:0,this},BlockStatement:function(t){c(t);var e=t.program,a=t.inverse;e=e&&this.compileProgram(e),a=a&&this.compileProgram(a);var s=this.classifySexpr(t);"helper"===s?this.helperSexpr(t,e,a):"simple"===s?(this.simpleSexpr(t),this.opcode("pushProgram",e),this.opcode("pushProgram",a),this.opcode("emptyHash"),this.opcode("blockValue",t.path.original)):(this.ambiguousSexpr(t,e,a),this.opcode("pushProgram",e),this.opcode("pushProgram",a),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(t){var e=t.program&&this.compileProgram(t.program),a=this.setupFullMustacheParams(t,e,void 0),s=t.path;this.useDecorators=!0,this.opcode("registerDecorator",a.length,s.original)},PartialStatement:function(t){this.usePartial=!0;var e=t.program;e&&(e=this.compileProgram(t.program));var s=t.params;if(s.length>1)throw new a.default("Unsupported number of partial arguments: "+s.length,t);s.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):s.push({type:"PathExpression",parts:[],depth:0}));var i=t.name.original,n="SubExpression"===t.name.type;n&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var r=t.indent||"";this.options.preventIndent&&r&&(this.opcode("appendContent",r),r=""),this.opcode("invokePartial",n,i,r),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){c(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,a){var s=t.path,i=s.parts[0],n=null!=e||null!=a;this.opcode("getContext",s.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",a),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",i,n)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,s){var n=this.setupFullMustacheParams(t,e,s),r=t.path,o=r.parts[0];if(this.options.knownHelpers[o])this.opcode("invokeKnownHelper",n.length,o);else{if(this.options.knownHelpersOnly)throw new a.default("You specified knownHelpersOnly, but used the unknown helper "+o,t);r.strict=!0,r.falsy=!0,this.accept(r),this.opcode("invokeHelper",n.length,r.original,i.default.helpers.simpleId(r))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],a=i.default.helpers.scopedId(t),s=!t.depth&&!a&&this.blockParamIndex(e);s?this.opcode("lookupBlockParam",s,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,a):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,a=0,s=e.length;for(this.opcode("pushHash");a<s;a++)this.pushParam(e[a].value);for(;a--;)this.opcode("assignToHash",e[a].key);this.opcode("popHash")},opcode:function(t){this.opcodes.push({opcode:t,args:n.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(t){t&&(this.useDepths=!0)},classifySexpr:function(t){var e=i.default.helpers.simpleId(t.path),a=e&&!!this.blockParamIndex(t.path.parts[0]),s=!a&&i.default.helpers.helperExpression(t),n=!a&&(s||e);if(n&&!s){var r=t.path.parts[0],o=this.options;o.knownHelpers[r]?s=!0:o.knownHelpersOnly&&(n=!1)}return s?"helper":n?"ambiguous":"simple"},pushParams:function(t){for(var e=0,a=t.length;e<a;e++)this.pushParam(t[e])},pushParam:function(t){var e=null!=t.value?t.value:t.original||"";if(this.stringParams)e.replace&&(e=e.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),t.depth&&this.addDepth(t.depth),this.opcode("getContext",t.depth||0),this.opcode("pushStringParam",e,t.type),"SubExpression"===t.type&&this.accept(t);else{if(this.trackIds){var a=void 0;if(!t.parts||i.default.helpers.scopedId(t)||t.depth||(a=this.blockParamIndex(t.parts[0])),a){var s=t.parts.slice(1).join(".");this.opcode("pushId","BlockParam",a,s)}else(e=t.original||e).replace&&(e=e.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",t.type,e)}this.accept(t)}},setupFullMustacheParams:function(t,e,a,s){var i=t.params;return this.pushParams(i),this.opcode("pushProgram",e),this.opcode("pushProgram",a),t.hash?this.accept(t.hash):this.opcode("emptyHash",s),i},blockParamIndex:function(t){for(var e=0,a=this.options.blockParams.length;e<a;e++){var i=this.options.blockParams[e],n=i&&s.indexOf(i,t);if(i&&n>=0)return[e,n]}}}}}),Rt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64.js"(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(t){if(0<=t&&t<e.length)return e[t];throw new TypeError("Must be between 0 and 63: "+t)},t.decode=function(t){return 65<=t&&t<=90?t-65:97<=t&&t<=122?t-97+26:48<=t&&t<=57?t-48+52:43==t?62:47==t?63:-1}}}),Vt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64-vlq.js"(t){var e=Rt();t.encode=function(t){var a,s="",i=function(t){return t<0?1+(-t<<1):0+(t<<1)}(t);do{a=31&i,(i>>>=5)>0&&(a|=32),s+=e.encode(a)}while(i>0);return s},t.decode=function(t,a,s){var i,n,r,o,c=t.length,l=0,h=0;do{if(a>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=e.decode(t.charCodeAt(a++))))throw new Error("Invalid base64 digit: "+t.charAt(a-1));i=!!(32&n),l+=(n&=31)<<h,h+=5}while(i);s.value=(o=(r=l)>>1,1==(1&r)?-o:o),s.rest=a}}}),kt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/util.js"(t){t.getArg=function(t,e,a){if(e in t)return t[e];if(3===arguments.length)return a;throw new Error('"'+e+'" is a required argument.')};var e=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,a=/^data:.+\,.+$/;function s(t){var a=t.match(e);return a?{scheme:a[1],auth:a[2],host:a[3],port:a[4],path:a[5]}:null}function i(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function n(e){var a=e,n=s(e);if(n){if(!n.path)return e;a=n.path}for(var r,o=t.isAbsolute(a),c=a.split(/\/+/),l=0,h=c.length-1;h>=0;h--)"."===(r=c[h])?c.splice(h,1):".."===r?l++:l>0&&(""===r?(c.splice(h+1,l),l=0):(c.splice(h,2),l--));return""===(a=c.join("/"))&&(a=o?"/":"."),n?(n.path=a,i(n)):a}function r(t,e){""===t&&(t="."),""===e&&(e=".");var r=s(e),o=s(t);if(o&&(t=o.path||"/"),r&&!r.scheme)return o&&(r.scheme=o.scheme),i(r);if(r||e.match(a))return e;if(o&&!o.host&&!o.path)return o.host=e,i(o);var c="/"===e.charAt(0)?e:n(t.replace(/\/+$/,"")+"/"+e);return o?(o.path=c,i(o)):c}t.urlParse=s,t.urlGenerate=i,t.normalize=n,t.join=r,t.isAbsolute=function(t){return"/"===t.charAt(0)||e.test(t)},t.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var a=0;0!==e.indexOf(t+"/");){var s=t.lastIndexOf("/");if(s<0)return e;if((t=t.slice(0,s)).match(/^([^\/]+:\/)?\/*$/))return e;++a}return Array(a+1).join("../")+e.substr(t.length+1)};var o=!("__proto__"in Object.create(null));function c(t){return t}function l(t){if(!t)return!1;var e=t.length;if(e<9)return!1;if(95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var a=e-10;a>=0;a--)if(36!==t.charCodeAt(a))return!1;return!0}function h(t,e){return t===e?0:null===t?1:null===e?-1:t>e?1:-1}t.toSetString=o?c:function(t){return l(t)?"$"+t:t},t.fromSetString=o?c:function(t){return l(t)?t.slice(1):t},t.compareByOriginalPositions=function(t,e,a){var s=h(t.source,e.source);return 0!==s||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)||a||0!==(s=t.generatedColumn-e.generatedColumn)||0!==(s=t.generatedLine-e.generatedLine)?s:h(t.name,e.name)},t.compareByGeneratedPositionsDeflated=function(t,e,a){var s=t.generatedLine-e.generatedLine;return 0!==s||0!==(s=t.generatedColumn-e.generatedColumn)||a||0!==(s=h(t.source,e.source))||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)?s:h(t.name,e.name)},t.compareByGeneratedPositionsInflated=function(t,e){var a=t.generatedLine-e.generatedLine;return 0!==a||0!==(a=t.generatedColumn-e.generatedColumn)||0!==(a=h(t.source,e.source))||0!==(a=t.originalLine-e.originalLine)||0!==(a=t.originalColumn-e.originalColumn)?a:h(t.name,e.name)},t.parseSourceMapInput=function(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(t,e,a){if(e=e||"",t&&("/"!==t[t.length-1]&&"/"!==e[0]&&(t+="/"),e=t+e),a){var o=s(a);if(!o)throw new Error("sourceMapURL could not be parsed");if(o.path){var c=o.path.lastIndexOf("/");c>=0&&(o.path=o.path.substring(0,c+1))}e=r(i(o),e)}return n(e)}}}),Ft=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/array-set.js"(t){var e=kt(),a=Object.prototype.hasOwnProperty,s="undefined"!=typeof Map;function i(){this._array=[],this._set=s?new Map:Object.create(null)}i.fromArray=function(t,e){for(var a=new i,s=0,n=t.length;s<n;s++)a.add(t[s],e);return a},i.prototype.size=function(){return s?this._set.size:Object.getOwnPropertyNames(this._set).length},i.prototype.add=function(t,i){var n=s?t:e.toSetString(t),r=s?this.has(t):a.call(this._set,n),o=this._array.length;r&&!i||this._array.push(t),r||(s?this._set.set(t,o):this._set[n]=o)},i.prototype.has=function(t){if(s)return this._set.has(t);var i=e.toSetString(t);return a.call(this._set,i)},i.prototype.indexOf=function(t){if(s){var i=this._set.get(t);if(i>=0)return i}else{var n=e.toSetString(t);if(a.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')},i.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)},i.prototype.toArray=function(){return this._array.slice()},t.ArraySet=i}}),Wt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/mapping-list.js"(t){var e=kt();function a(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}a.prototype.unsortedForEach=function(t,e){this._array.forEach(t,e)},a.prototype.add=function(t){var a,s,i,n,r,o;a=this._last,s=t,i=a.generatedLine,n=s.generatedLine,r=a.generatedColumn,o=s.generatedColumn,n>i||n==i&&o>=r||e.compareByGeneratedPositionsInflated(a,s)<=0?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},a.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},t.MappingList=a}}),Bt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js"(t){var e=Vt(),a=kt(),s=Ft().ArraySet,i=Wt().MappingList;function n(t){t||(t={}),this._file=a.getArg(t,"file",null),this._sourceRoot=a.getArg(t,"sourceRoot",null),this._skipValidation=a.getArg(t,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new i,this._sourcesContents=null}n.prototype._version=3,n.fromSourceMap=function(t){var e=t.sourceRoot,s=new n({file:t.file,sourceRoot:e});return t.eachMapping((function(t){var i={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(i.source=t.source,null!=e&&(i.source=a.relative(e,i.source)),i.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(i.name=t.name)),s.addMapping(i)})),t.sources.forEach((function(i){var n=i;null!==e&&(n=a.relative(e,i)),s._sources.has(n)||s._sources.add(n);var r=t.sourceContentFor(i);null!=r&&s.setSourceContent(i,r)})),s},n.prototype.addMapping=function(t){var e=a.getArg(t,"generated"),s=a.getArg(t,"original",null),i=a.getArg(t,"source",null),n=a.getArg(t,"name",null);this._skipValidation||this._validateMapping(e,s,i,n),null!=i&&(i=String(i),this._sources.has(i)||this._sources.add(i)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:e.line,generatedColumn:e.column,originalLine:null!=s&&s.line,originalColumn:null!=s&&s.column,source:i,name:n})},n.prototype.setSourceContent=function(t,e){var s=t;null!=this._sourceRoot&&(s=a.relative(this._sourceRoot,s)),null!=e?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[a.toSetString(s)]=e):this._sourcesContents&&(delete this._sourcesContents[a.toSetString(s)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},n.prototype.applySourceMap=function(t,e,i){var n=e;if(null==e){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=t.file}var r=this._sourceRoot;null!=r&&(n=a.relative(r,n));var o=new s,c=new s;this._mappings.unsortedForEach((function(e){if(e.source===n&&null!=e.originalLine){var s=t.originalPositionFor({line:e.originalLine,column:e.originalColumn});null!=s.source&&(e.source=s.source,null!=i&&(e.source=a.join(i,e.source)),null!=r&&(e.source=a.relative(r,e.source)),e.originalLine=s.line,e.originalColumn=s.column,null!=s.name&&(e.name=s.name))}var l=e.source;null==l||o.has(l)||o.add(l);var h=e.name;null==h||c.has(h)||c.add(h)}),this),this._sources=o,this._names=c,t.sources.forEach((function(e){var s=t.sourceContentFor(e);null!=s&&(null!=i&&(e=a.join(i,e)),null!=r&&(e=a.relative(r,e)),this.setSourceContent(e,s))}),this)},n.prototype._validateMapping=function(t,e,a,s){if(e&&"number"!=typeof e.line&&"number"!=typeof e.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||a||s)&&!(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&a))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:a,original:e,name:s}))},n.prototype._serializeMappings=function(){for(var t,s,i,n,r=0,o=1,c=0,l=0,h=0,d=0,u="",p=this._mappings.toArray(),m=0,f=p.length;m<f;m++){if(t="",(s=p[m]).generatedLine!==o)for(r=0;s.generatedLine!==o;)t+=";",o++;else if(m>0){if(!a.compareByGeneratedPositionsInflated(s,p[m-1]))continue;t+=","}t+=e.encode(s.generatedColumn-r),r=s.generatedColumn,null!=s.source&&(n=this._sources.indexOf(s.source),t+=e.encode(n-d),d=n,t+=e.encode(s.originalLine-1-l),l=s.originalLine-1,t+=e.encode(s.originalColumn-c),c=s.originalColumn,null!=s.name&&(i=this._names.indexOf(s.name),t+=e.encode(i-h),h=i)),u+=t}return u},n.prototype._generateSourcesContent=function(t,e){return t.map((function(t){if(!this._sourcesContents)return null;null!=e&&(t=a.relative(e,t));var s=a.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null}),this)},n.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.SourceMapGenerator=n}}),Ut=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/binary-search.js"(t){function e(a,s,i,n,r,o){var c=Math.floor((s-a)/2)+a,l=r(i,n[c],!0);return 0===l?c:l>0?s-c>1?e(c,s,i,n,r,o):o==t.LEAST_UPPER_BOUND?s<n.length?s:-1:c:c-a>1?e(a,c,i,n,r,o):o==t.LEAST_UPPER_BOUND?c:a<0?-1:a}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(a,s,i,n){if(0===s.length)return-1;var r=e(-1,s.length,a,s,i,n||t.GREATEST_LOWER_BOUND);if(r<0)return-1;for(;r-1>=0&&0===i(s[r],s[r-1],!0);)--r;return r}}}),jt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/quick-sort.js"(t){function e(t,e,a){var s=t[e];t[e]=t[a],t[a]=s}function a(t,s,i,n){if(i<n){var r=i-1;e(t,(h=i,d=n,Math.round(h+Math.random()*(d-h))),n);for(var o=t[n],c=i;c<n;c++)s(t[c],o)<=0&&e(t,r+=1,c);e(t,r+1,c);var l=r+1;a(t,s,i,l-1),a(t,s,l+1,n)}var h,d}t.quickSort=function(t,e){a(t,e,0,t.length-1)}}}),zt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-consumer.js"(t){var e=kt(),a=Ut(),s=Ft().ArraySet,i=Vt(),n=jt().quickSort;function r(t,a){var s=t;return"string"==typeof t&&(s=e.parseSourceMapInput(t)),null!=s.sections?new l(s,a):new o(s,a)}function o(t,a){var i=t;"string"==typeof t&&(i=e.parseSourceMapInput(t));var n=e.getArg(i,"version"),r=e.getArg(i,"sources"),o=e.getArg(i,"names",[]),c=e.getArg(i,"sourceRoot",null),l=e.getArg(i,"sourcesContent",null),h=e.getArg(i,"mappings"),d=e.getArg(i,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);c&&(c=e.normalize(c)),r=r.map(String).map(e.normalize).map((function(t){return c&&e.isAbsolute(c)&&e.isAbsolute(t)?e.relative(c,t):t})),this._names=s.fromArray(o.map(String),!0),this._sources=s.fromArray(r,!0),this._absoluteSources=this._sources.toArray().map((function(t){return e.computeSourceURL(c,t,a)})),this.sourceRoot=c,this.sourcesContent=l,this._mappings=h,this._sourceMapURL=a,this.file=d}function c(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function l(t,a){var i=t;"string"==typeof t&&(i=e.parseSourceMapInput(t));var n=e.getArg(i,"version"),o=e.getArg(i,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new s,this._names=new s;var c={line:-1,column:0};this._sections=o.map((function(t){if(t.url)throw new Error("Support for url field in sections not implemented.");var s=e.getArg(t,"offset"),i=e.getArg(s,"line"),n=e.getArg(s,"column");if(i<c.line||i===c.line&&n<c.column)throw new Error("Section offsets must be ordered and non-overlapping.");return c=s,{generatedOffset:{generatedLine:i+1,generatedColumn:n+1},consumer:new r(e.getArg(t,"map"),a)}}))}r.fromSourceMap=function(t,e){return o.fromSourceMap(t,e)},r.prototype._version=3,r.prototype.__generatedMappings=null,Object.defineProperty(r.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),r.prototype.__originalMappings=null,Object.defineProperty(r.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),r.prototype._charIsMappingSeparator=function(t,e){var a=t.charAt(e);return";"===a||","===a},r.prototype._parseMappings=function(t,e){throw new Error("Subclasses must implement _parseMappings")},r.GENERATED_ORDER=1,r.ORIGINAL_ORDER=2,r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.prototype.eachMapping=function(t,a,s){var i,n=a||null;switch(s||r.GENERATED_ORDER){case r.GENERATED_ORDER:i=this._generatedMappings;break;case r.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;i.map((function(t){var a=null===t.source?null:this._sources.at(t.source);return{source:a=e.computeSourceURL(o,a,this._sourceMapURL),generatedLine:t.generatedLine,generatedColumn:t.generatedColumn,originalLine:t.originalLine,originalColumn:t.originalColumn,name:null===t.name?null:this._names.at(t.name)}}),this).forEach(t,n)},r.prototype.allGeneratedPositionsFor=function(t){var s=e.getArg(t,"line"),i={source:e.getArg(t,"source"),originalLine:s,originalColumn:e.getArg(t,"column",0)};if(i.source=this._findSourceIndex(i.source),i.source<0)return[];var n=[],r=this._findMapping(i,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,a.LEAST_UPPER_BOUND);if(r>=0){var o=this._originalMappings[r];if(void 0===t.column)for(var c=o.originalLine;o&&o.originalLine===c;)n.push({line:e.getArg(o,"generatedLine",null),column:e.getArg(o,"generatedColumn",null),lastColumn:e.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++r];else for(var l=o.originalColumn;o&&o.originalLine===s&&o.originalColumn==l;)n.push({line:e.getArg(o,"generatedLine",null),column:e.getArg(o,"generatedColumn",null),lastColumn:e.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++r]}return n},t.SourceMapConsumer=r,o.prototype=Object.create(r.prototype),o.prototype.consumer=r,o.prototype._findSourceIndex=function(t){var a,s=t;if(null!=this.sourceRoot&&(s=e.relative(this.sourceRoot,s)),this._sources.has(s))return this._sources.indexOf(s);for(a=0;a<this._absoluteSources.length;++a)if(this._absoluteSources[a]==t)return a;return-1},o.fromSourceMap=function(t,a){var i=Object.create(o.prototype),r=i._names=s.fromArray(t._names.toArray(),!0),l=i._sources=s.fromArray(t._sources.toArray(),!0);i.sourceRoot=t._sourceRoot,i.sourcesContent=t._generateSourcesContent(i._sources.toArray(),i.sourceRoot),i.file=t._file,i._sourceMapURL=a,i._absoluteSources=i._sources.toArray().map((function(t){return e.computeSourceURL(i.sourceRoot,t,a)}));for(var h=t._mappings.toArray().slice(),d=i.__generatedMappings=[],u=i.__originalMappings=[],p=0,m=h.length;p<m;p++){var f=h[p],g=new c;g.generatedLine=f.generatedLine,g.generatedColumn=f.generatedColumn,f.source&&(g.source=l.indexOf(f.source),g.originalLine=f.originalLine,g.originalColumn=f.originalColumn,f.name&&(g.name=r.indexOf(f.name)),u.push(g)),d.push(g)}return n(i.__originalMappings,e.compareByOriginalPositions),i},o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),o.prototype._parseMappings=function(t,a){for(var s,r,o,l,h,d=1,u=0,p=0,m=0,f=0,g=0,w=t.length,E=0,v={},y={},I=[],D=[];E<w;)if(";"===t.charAt(E))d++,E++,u=0;else if(","===t.charAt(E))E++;else{for((s=new c).generatedLine=d,l=E;l<w&&!this._charIsMappingSeparator(t,l);l++);if(o=v[r=t.slice(E,l)])E+=r.length;else{for(o=[];E<l;)i.decode(t,E,y),h=y.value,E=y.rest,o.push(h);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");v[r]=o}s.generatedColumn=u+o[0],u=s.generatedColumn,o.length>1&&(s.source=f+o[1],f+=o[1],s.originalLine=p+o[2],p=s.originalLine,s.originalLine+=1,s.originalColumn=m+o[3],m=s.originalColumn,o.length>4&&(s.name=g+o[4],g+=o[4])),D.push(s),"number"==typeof s.originalLine&&I.push(s)}n(D,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=D,n(I,e.compareByOriginalPositions),this.__originalMappings=I},o.prototype._findMapping=function(t,e,s,i,n,r){if(t[s]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[s]);if(t[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[i]);return a.search(t,e,n,r)},o.prototype.computeColumnSpans=function(){for(var t=0;t<this._generatedMappings.length;++t){var e=this._generatedMappings[t];if(t+1<this._generatedMappings.length){var a=this._generatedMappings[t+1];if(e.generatedLine===a.generatedLine){e.lastGeneratedColumn=a.generatedColumn-1;continue}}e.lastGeneratedColumn=1/0}},o.prototype.originalPositionFor=function(t){var a={generatedLine:e.getArg(t,"line"),generatedColumn:e.getArg(t,"column")},s=this._findMapping(a,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(t,"bias",r.GREATEST_LOWER_BOUND));if(s>=0){var i=this._generatedMappings[s];if(i.generatedLine===a.generatedLine){var n=e.getArg(i,"source",null);null!==n&&(n=this._sources.at(n),n=e.computeSourceURL(this.sourceRoot,n,this._sourceMapURL));var o=e.getArg(i,"name",null);return null!==o&&(o=this._names.at(o)),{source:n,line:e.getArg(i,"originalLine",null),column:e.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(t){return null==t})))},o.prototype.sourceContentFor=function(t,a){if(!this.sourcesContent)return null;var s=this._findSourceIndex(t);if(s>=0)return this.sourcesContent[s];var i,n=t;if(null!=this.sourceRoot&&(n=e.relative(this.sourceRoot,n)),null!=this.sourceRoot&&(i=e.urlParse(this.sourceRoot))){var r=n.replace(/^file:\/\//,"");if("file"==i.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!i.path||"/"==i.path)&&this._sources.has("/"+n))return this.sourcesContent[this._sources.indexOf("/"+n)]}if(a)return null;throw new Error('"'+n+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(t){var a=e.getArg(t,"source");if((a=this._findSourceIndex(a))<0)return{line:null,column:null,lastColumn:null};var s={source:a,originalLine:e.getArg(t,"line"),originalColumn:e.getArg(t,"column")},i=this._findMapping(s,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(t,"bias",r.GREATEST_LOWER_BOUND));if(i>=0){var n=this._originalMappings[i];if(n.source===s.source)return{line:e.getArg(n,"generatedLine",null),column:e.getArg(n,"generatedColumn",null),lastColumn:e.getArg(n,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},t.BasicSourceMapConsumer=o,l.prototype=Object.create(r.prototype),l.prototype.constructor=r,l.prototype._version=3,Object.defineProperty(l.prototype,"sources",{get:function(){for(var t=[],e=0;e<this._sections.length;e++)for(var a=0;a<this._sections[e].consumer.sources.length;a++)t.push(this._sections[e].consumer.sources[a]);return t}}),l.prototype.originalPositionFor=function(t){var s={generatedLine:e.getArg(t,"line"),generatedColumn:e.getArg(t,"column")},i=a.search(s,this._sections,(function(t,e){var a=t.generatedLine-e.generatedOffset.generatedLine;return a||t.generatedColumn-e.generatedOffset.generatedColumn})),n=this._sections[i];return n?n.consumer.originalPositionFor({line:s.generatedLine-(n.generatedOffset.generatedLine-1),column:s.generatedColumn-(n.generatedOffset.generatedLine===s.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(t){return t.consumer.hasContentsOfAllSources()}))},l.prototype.sourceContentFor=function(t,e){for(var a=0;a<this._sections.length;a++){var s=this._sections[a].consumer.sourceContentFor(t,!0);if(s)return s}if(e)return null;throw new Error('"'+t+'" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(t){for(var a=0;a<this._sections.length;a++){var s=this._sections[a];if(-1!==s.consumer._findSourceIndex(e.getArg(t,"source"))){var i=s.consumer.generatedPositionFor(t);if(i)return{line:i.line+(s.generatedOffset.generatedLine-1),column:i.column+(s.generatedOffset.generatedLine===i.line?s.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},l.prototype._parseMappings=function(t,a){this.__generatedMappings=[],this.__originalMappings=[];for(var s=0;s<this._sections.length;s++)for(var i=this._sections[s],r=i.consumer._generatedMappings,o=0;o<r.length;o++){var c=r[o],l=i.consumer._sources.at(c.source);l=e.computeSourceURL(i.consumer.sourceRoot,l,this._sourceMapURL),this._sources.add(l),l=this._sources.indexOf(l);var h=null;c.name&&(h=i.consumer._names.at(c.name),this._names.add(h),h=this._names.indexOf(h));var d={source:l,generatedLine:c.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:c.generatedColumn+(i.generatedOffset.generatedLine===c.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:c.originalLine,originalColumn:c.originalColumn,name:h};this.__generatedMappings.push(d),"number"==typeof d.originalLine&&this.__originalMappings.push(d)}n(this.__generatedMappings,e.compareByGeneratedPositionsDeflated),n(this.__originalMappings,e.compareByOriginalPositions)},t.IndexedSourceMapConsumer=l}}),Gt=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-node.js"(t){var e=Bt().SourceMapGenerator,a=kt(),s=/(\r?\n)/,i="$$$isSourceNode$$$";function n(t,e,a,s,n){this.children=[],this.sourceContents={},this.line=null==t?null:t,this.column=null==e?null:e,this.source=null==a?null:a,this.name=null==n?null:n,this[i]=!0,null!=s&&this.add(s)}n.fromStringWithSourceMap=function(t,e,i){var r=new n,o=t.split(s),c=0,l=function(){return t()+(t()||"");function t(){return c<o.length?o[c++]:void 0}},h=1,d=0,u=null;return e.eachMapping((function(t){if(null!==u){if(!(h<t.generatedLine)){var e=(a=o[c]||"").substr(0,t.generatedColumn-d);return o[c]=a.substr(t.generatedColumn-d),d=t.generatedColumn,p(u,e),void(u=t)}p(u,l()),h++,d=0}for(;h<t.generatedLine;)r.add(l()),h++;if(d<t.generatedColumn){var a=o[c]||"";r.add(a.substr(0,t.generatedColumn)),o[c]=a.substr(t.generatedColumn),d=t.generatedColumn}u=t}),this),c<o.length&&(u&&p(u,l()),r.add(o.splice(c).join(""))),e.sources.forEach((function(t){var s=e.sourceContentFor(t);null!=s&&(null!=i&&(t=a.join(i,t)),r.setSourceContent(t,s))})),r;function p(t,e){if(null===t||void 0===t.source)r.add(e);else{var s=i?a.join(i,t.source):t.source;r.add(new n(t.originalLine,t.originalColumn,s,e,t.name))}}},n.prototype.add=function(t){if(Array.isArray(t))t.forEach((function(t){this.add(t)}),this);else{if(!t[i]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);t&&this.children.push(t)}return this},n.prototype.prepend=function(t){if(Array.isArray(t))for(var e=t.length-1;e>=0;e--)this.prepend(t[e]);else{if(!t[i]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},n.prototype.walk=function(t){for(var e,a=0,s=this.children.length;a<s;a++)(e=this.children[a])[i]?e.walk(t):""!==e&&t(e,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(t){var e,a,s=this.children.length;if(s>0){for(e=[],a=0;a<s-1;a++)e.push(this.children[a]),e.push(t);e.push(this.children[a]),this.children=e}return this},n.prototype.replaceRight=function(t,e){var a=this.children[this.children.length-1];return a[i]?a.replaceRight(t,e):"string"==typeof a?this.children[this.children.length-1]=a.replace(t,e):this.children.push("".replace(t,e)),this},n.prototype.setSourceContent=function(t,e){this.sourceContents[a.toSetString(t)]=e},n.prototype.walkSourceContents=function(t){for(var e=0,s=this.children.length;e<s;e++)this.children[e][i]&&this.children[e].walkSourceContents(t);var n=Object.keys(this.sourceContents);for(e=0,s=n.length;e<s;e++)t(a.fromSetString(n[e]),this.sourceContents[n[e]])},n.prototype.toString=function(){var t="";return this.walk((function(e){t+=e})),t},n.prototype.toStringWithSourceMap=function(t){var a={code:"",line:1,column:0},s=new e(t),i=!1,n=null,r=null,o=null,c=null;return this.walk((function(t,e){a.code+=t,null!==e.source&&null!==e.line&&null!==e.column?(n===e.source&&r===e.line&&o===e.column&&c===e.name||s.addMapping({source:e.source,original:{line:e.line,column:e.column},generated:{line:a.line,column:a.column},name:e.name}),n=e.source,r=e.line,o=e.column,c=e.name,i=!0):i&&(s.addMapping({generated:{line:a.line,column:a.column}}),n=null,i=!1);for(var l=0,h=t.length;l<h;l++)10===t.charCodeAt(l)?(a.line++,a.column=0,l+1===h?(n=null,i=!1):i&&s.addMapping({source:e.source,original:{line:e.line,column:e.column},generated:{line:a.line,column:a.column},name:e.name})):a.column++})),this.walkSourceContents((function(t,e){s.setSourceContent(t,e)})),{code:a.code,map:s}},t.SourceNode=n}}),Ht=nt({"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js"(t){t.SourceMapGenerator=Bt().SourceMapGenerator,t.SourceMapConsumer=zt().SourceMapConsumer,t.SourceNode=Gt().SourceNode}}),Xt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js"(t,e){t.__esModule=!0;var a,s=ot(),i=void 0;try{"function"==typeof define&&define.amd||(a=Ht(),i=a.SourceNode)}catch(t){}function n(t,e,a){if(s.isArray(t)){for(var i=[],n=0,r=t.length;n<r;n++)i.push(e.wrap(t[n],a));return i}return"boolean"==typeof t||"number"==typeof t?t+"":t}function r(t){this.srcFile=t,this.source=[]}i||((i=function(t,e,a,s){this.src="",s&&this.add(s)}).prototype={add:function(t){s.isArray(t)&&(t=t.join("")),this.src+=t},prepend:function(t){s.isArray(t)&&(t=t.join("")),this.src=t+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),r.prototype={isEmpty:function(){return!this.source.length},prepend:function(t,e){this.source.unshift(this.wrap(t,e))},push:function(t,e){this.source.push(this.wrap(t,e))},merge:function(){var t=this.empty();return this.each((function(e){t.add([" ",e,"\n"])})),t},each:function(t){for(var e=0,a=this.source.length;e<a;e++)t(this.source[e])},empty:function(){var t=this.currentLocation||{start:{}};return new i(t.start.line,t.start.column,this.srcFile)},wrap:function(t){var e=arguments.length<=1||void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return t instanceof i?t:(t=n(t,this,e),new i(e.start.line,e.start.column,this.srcFile,t))},functionCall:function(t,e,a){return a=this.generateList(a),this.wrap([t,e?"."+e+"(":"(",a,")"])},quotedString:function(t){return'"'+(t+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(t){var e=this,a=[];Object.keys(t).forEach((function(s){var i=n(t[s],e);"undefined"!==i&&a.push([e.quotedString(s),":",i])}));var s=this.generateList(a);return s.prepend("{"),s.add("}"),s},generateList:function(t){for(var e=this.empty(),a=0,s=t.length;a<s;a++)a&&e.add(","),e.add(n(t[a],this));return e},generateArray:function(t){var e=this.generateList(t);return e.prepend("["),e.add("]"),e}},t.default=r,e.exports=t.default}}),Kt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js"(t,e){function a(t){return t&&t.__esModule?t:{default:t}}t.__esModule=!0;var s=Dt(),i=a(ct()),n=ot(),r=a(Xt());function o(t){this.value=t}function c(){}c.prototype={nameLookup:function(t,e){return this.internalNameLookup(t,e)},depthedLookup:function(t){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(t),")"]},compilerInfo:function(){var t=s.COMPILER_REVISION;return[t,s.REVISION_CHANGES[t]]},appendToBuffer:function(t,e,a){return n.isArray(t)||(t=[t]),t=this.source.wrap(t,e),this.environment.isSimple?["return ",t,";"]:a?["buffer += ",t,";"]:(t.appendToBuffer=!0,t)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(t,e){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",t,",",JSON.stringify(e),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(t,e,a,s){this.environment=t,this.options=e,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!s,this.name=this.environment.name,this.isChild=!!a,this.context=a||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(t,e),this.useDepths=this.useDepths||t.useDepths||t.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||t.useBlockParams;var n=t.opcodes,r=void 0,o=void 0,c=void 0,l=void 0;for(c=0,l=n.length;c<l;c++)r=n[c],this.source.currentLocation=r.loc,o=o||r.loc,this[r.opcode].apply(this,r.args);if(this.source.currentLocation=o,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new i.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),";\n"]),this.decorators.push("return fn;"),s?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend("function(fn, props, container, depth0, data, blockParams, depths) {\n"),this.decorators.push("}\n"),this.decorators=this.decorators.merge()));var h=this.createFunctionContext(s);if(this.isChild)return h;var d={compiler:this.compilerInfo(),main:h};this.decorators&&(d.main_d=this.decorators,d.useDecorators=!0);var u=this.context,p=u.programs,m=u.decorators;for(c=0,l=p.length;c<l;c++)p[c]&&(d[c]=p[c],m[c]&&(d[c+"_d"]=m[c],d.useDecorators=!0));return this.environment.usePartial&&(d.usePartial=!0),this.options.data&&(d.useData=!0),this.useDepths&&(d.useDepths=!0),this.useBlockParams&&(d.useBlockParams=!0),this.options.compat&&(d.compat=!0),s?d.compilerOptions=this.options:(d.compiler=JSON.stringify(d.compiler),this.source.currentLocation={start:{line:1,column:0}},d=this.objectLiteral(d),e.srcName?(d=d.toStringWithSourceMap({file:e.destName})).map=d.map&&d.map.toString():d=d.toString()),d},preamble:function(){this.lastContext=0,this.source=new r.default(this.options.srcName),this.decorators=new r.default(this.options.srcName)},createFunctionContext:function(t){var e=this,a="",s=this.stackVars.concat(this.registers.list);s.length>0&&(a+=", "+s.join(", "));var i=0;Object.keys(this.aliases).forEach((function(t){var s=e.aliases[t];s.children&&s.referenceCount>1&&(a+=", alias"+ ++i+"="+t,s.children[0]="alias"+i)})),this.lookupPropertyFunctionIsUsed&&(a+=", "+this.lookupPropertyFunctionVarDeclaration());var n=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths");var r=this.mergeSource(a);return t?(n.push(r),Function.apply(this,n)):this.source.wrap(["function(",n.join(","),") {\n ",r,"}"])},mergeSource:function(t){var e=this.environment.isSimple,a=!this.forceBuffer,s=void 0,i=void 0,n=void 0,r=void 0;return this.source.each((function(t){t.appendToBuffer?(n?t.prepend(" + "):n=t,r=t):(n&&(i?n.prepend("buffer += "):s=!0,r.add(";"),n=r=void 0),i=!0,e||(a=!1))})),a?n?(n.prepend("return "),r.add(";")):i||this.source.push('return "";'):(t+=", buffer = "+(s?"":this.initializeBuffer()),n?(n.prepend("return buffer + "),r.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(s?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),a=[this.contextName(0)];this.setupHelperArgs(t,0,a);var s=this.popStack();a.splice(1,0,s),this.push(this.source.functionCall(e,"call",a))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var a=this.topStack();e.splice(1,0,a),this.pushSource(["if (!",this.lastHelper,") { ",a," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack((function(t){return[" != null ? ",t,' : ""']})),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,a,s){var i=0;s||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[i++])),this.resolvePath("context",t,i,e,a)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,a){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,a)},resolvePath:function(t,e,a,s,i){var n=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,a,s,i){var n=e.popStack(),r=a.length;t&&r--;for(;s<r;s++)n=e.nameLookup(n,a[s],i);return t?[e.aliasable("container.strict"),"(",n,", ",e.quotedString(a[s]),", ",JSON.stringify(e.source.currentLocation)," )"]:n}(this.options.strict&&i,this,e,a,t));else for(var r=e.length;a<r;a++)this.replaceStack((function(i){var r=n.nameLookup(i,e[a],t);return s?[" && ",r]:[" != null ? ",r," : ",i]}))},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(t,e){this.pushContext(),this.pushString(e),"SubExpression"!==e&&("string"==typeof t?this.pushString(t):this.pushStackLiteral(t))},emptyHash:function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){null!=t?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},registerDecorator:function(t,e){var a=this.nameLookup("decorators",e,"decorator"),s=this.setupHelperArgs(e,t);this.decorators.push(["fn = ",this.decorators.functionCall(a,"",["fn","props","container",s])," || fn;"])},invokeHelper:function(t,e,a){var s=this.popStack(),i=this.setupHelper(t,e),n=[];a&&n.push(i.name),n.push(s),this.options.strict||n.push(this.aliasable("container.hooks.helperMissing"));var r=["(",this.itemsSeparatedBy(n,"||"),")"],o=this.source.functionCall(r,"call",i.callParams);this.push(o)},itemsSeparatedBy:function(t,e){var a=[];a.push(t[0]);for(var s=1;s<t.length;s++)a.push(e,t[s]);return a},invokeKnownHelper:function(t,e){var a=this.setupHelper(t,e);this.push(this.source.functionCall(a.name,"call",a.callParams))},invokeAmbiguous:function(t,e){this.useRegister("helper");var a=this.popStack();this.emptyHash();var s=this.setupHelper(0,t,e),i=["(","(helper = ",this.lastHelper=this.nameLookup("helpers",t,"helper")," || ",a,")"];this.options.strict||(i[0]="(helper = ",i.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",i,s.paramsInit?["),(",s.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",s.callParams)," : helper))"])},invokePartial:function(t,e,a){var s=[],i=this.setupParams(e,1,s);t&&(e=this.popStack(),delete i.name),a&&(i.indent=JSON.stringify(a)),i.helpers="helpers",i.partials="partials",i.decorators="container.decorators",t?s.unshift(e):s.unshift(this.nameLookup("partials",e,"partial")),this.options.compat&&(i.depths="depths"),i=this.objectLiteral(i),s.push(i),this.push(this.source.functionCall("container.invokePartial","",s))},assignToHash:function(t){var e=this.popStack(),a=void 0,s=void 0,i=void 0;this.trackIds&&(i=this.popStack()),this.stringParams&&(s=this.popStack(),a=this.popStack());var n=this.hash;a&&(n.contexts[t]=a),s&&(n.types[t]=s),i&&(n.ids[t]=i),n.values[t]=e},pushId:function(t,e,a){"BlockParam"===t?this.pushStackLiteral("blockParams["+e[0]+"].path["+e[1]+"]"+(a?" + "+JSON.stringify("."+a):"")):"PathExpression"===t?this.pushString(e):"SubExpression"===t?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:c,compileChildren:function(t,e){for(var a=t.children,s=void 0,i=void 0,n=0,r=a.length;n<r;n++){s=a[n],i=new this.compiler;var o=this.matchExistingProgram(s);if(null==o){this.context.programs.push("");var c=this.context.programs.length;s.index=c,s.name="program"+c,this.context.programs[c]=i.compile(s,e,this.context,!this.precompile),this.context.decorators[c]=i.decorators,this.context.environments[c]=s,this.useDepths=this.useDepths||i.useDepths,this.useBlockParams=this.useBlockParams||i.useBlockParams,s.useDepths=this.useDepths,s.useBlockParams=this.useBlockParams}else s.index=o.index,s.name="program"+o.index,this.useDepths=this.useDepths||o.useDepths,this.useBlockParams=this.useBlockParams||o.useBlockParams}},matchExistingProgram:function(t){for(var e=0,a=this.context.environments.length;e<a;e++){var s=this.context.environments[e];if(s&&s.equals(t))return s}},programExpression:function(t){var e=this.environment.children[t],a=[e.index,"data",e.blockParams];return(this.useBlockParams||this.useDepths)&&a.push("blockParams"),this.useDepths&&a.push("depths"),"container.program("+a.join(", ")+")"},useRegister:function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},push:function(t){return t instanceof o||(t=this.source.wrap(t)),this.inlineStack.push(t),t},pushStackLiteral:function(t){this.push(new o(t))},pushSource:function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),t&&this.source.push(t)},replaceStack:function(t){var e=["("],a=void 0,s=void 0,n=void 0;if(!this.isInline())throw new i.default("replaceStack on non-inline");var r=this.popStack(!0);if(r instanceof o)e=["(",a=[r.value]],n=!0;else{s=!0;var c=this.incrStack();e=["((",this.push(c)," = ",r,")"],a=this.topStack()}var l=t.call(this,a);n||this.popStack(),s&&this.stackSlot--,this.push(e.concat(l,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,a=t.length;e<a;e++){var s=t[e];if(s instanceof o)this.compileStack.push(s);else{var i=this.incrStack();this.pushSource([i," = ",s,";"]),this.compileStack.push(i)}}},isInline:function(){return this.inlineStack.length},popStack:function(t){var e=this.isInline(),a=(e?this.inlineStack:this.compileStack).pop();if(!t&&a instanceof o)return a.value;if(!e){if(!this.stackSlot)throw new i.default("Invalid stack pop");this.stackSlot--}return a},topStack:function(){var t=this.isInline()?this.inlineStack:this.compileStack,e=t[t.length-1];return e instanceof o?e.value:e},contextName:function(t){return this.useDepths&&t?"depths["+t+"]":"depth"+t},quotedString:function(t){return this.source.quotedString(t)},objectLiteral:function(t){return this.source.objectLiteral(t)},aliasable:function(t){var e=this.aliases[t];return e?(e.referenceCount++,e):((e=this.aliases[t]=this.source.wrap(t)).aliasable=!0,e.referenceCount=1,e)},setupHelper:function(t,e,a){var s=[];return{params:s,paramsInit:this.setupHelperArgs(e,t,s,a),name:this.nameLookup("helpers",e,"helper"),callParams:[this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})")].concat(s)}},setupParams:function(t,e,a){var s={},i=[],n=[],r=[],o=!a,c=void 0;o&&(a=[]),s.name=this.quotedString(t),s.hash=this.popStack(),this.trackIds&&(s.hashIds=this.popStack()),this.stringParams&&(s.hashTypes=this.popStack(),s.hashContexts=this.popStack());var l=this.popStack(),h=this.popStack();(h||l)&&(s.fn=h||"container.noop",s.inverse=l||"container.noop");for(var d=e;d--;)c=this.popStack(),a[d]=c,this.trackIds&&(r[d]=this.popStack()),this.stringParams&&(n[d]=this.popStack(),i[d]=this.popStack());return o&&(s.args=this.source.generateArray(a)),this.trackIds&&(s.ids=this.source.generateArray(r)),this.stringParams&&(s.types=this.source.generateArray(n),s.contexts=this.source.generateArray(i)),this.options.data&&(s.data="data"),this.useBlockParams&&(s.blockParams="blockParams"),s},setupHelperArgs:function(t,e,a,s){var i=this.setupParams(t,e,a);return i.loc=JSON.stringify(this.source.currentLocation),i=this.objectLiteral(i),s?(this.useRegister("options"),a.push("options"),["options=",i]):a?(a.push(i),""):i}},function(){for(var t="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),e=c.RESERVED_WORDS={},a=0,s=t.length;a<s;a++)e[t[a]]=!0}(),c.isValidJavaScriptVariableName=function(t){return!c.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(t)},t.default=c,e.exports=t.default}}),Yt=nt({"../../node_modules/.pnpm/handlebars@4.7.8/node_modules/handlebars/dist/cjs/handlebars.js"(t,e){function a(t){return t&&t.__esModule?t:{default:t}}t.__esModule=!0;var s=a(_t()),i=a(St()),n=Mt(),r=Nt(),o=a(Kt()),c=a(Tt()),l=a(At()),h=s.default.create;function d(){var t=h();return t.compile=function(e,a){return r.compile(e,a,t)},t.precompile=function(e,a){return r.precompile(e,a,t)},t.AST=i.default,t.Compiler=r.Compiler,t.JavaScriptCompiler=o.default,t.Parser=n.parser,t.parse=n.parse,t.parseWithoutProcessing=n.parseWithoutProcessing,t}var u=d();u.create=d,l.default(u),u.Visitor=c.default,u.default=u,t.default=u,e.exports=t.default}}),$t=nt({"../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"(t,e){function a(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function s(t,e){for(var a,s="",i=0,n=-1,r=0,o=0;o<=t.length;++o){if(o<t.length)a=t.charCodeAt(o);else{if(47===a)break;a=47}if(47===a){if(n===o-1||1===r);else if(n!==o-1&&2===r){if(s.length<2||2!==i||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2))if(s.length>2){var c=s.lastIndexOf("/");if(c!==s.length-1){-1===c?(s="",i=0):i=(s=s.slice(0,c)).length-1-s.lastIndexOf("/"),n=o,r=0;continue}}else if(2===s.length||1===s.length){s="",i=0,n=o,r=0;continue}e&&(s.length>0?s+="/..":s="..",i=2)}else s.length>0?s+="/"+t.slice(n+1,o):s=t.slice(n+1,o),i=o-n-1;n=o,r=0}else 46===a&&-1!==r?++r:r=-1}return s}var i={resolve:function(){for(var t,e="",i=!1,n=arguments.length-1;n>=-1&&!i;n--){var r;n>=0?r=arguments[n]:(void 0===t&&(t=process.cwd()),r=t),a(r),0!==r.length&&(e=r+"/"+e,i=47===r.charCodeAt(0))}return e=s(e,!i),i?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(a(t),0===t.length)return".";var e=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=s(t,!e)).length||e||(t="."),t.length>0&&i&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return a(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var s=arguments[e];a(s),s.length>0&&(void 0===t?t=s:t+="/"+s)}return void 0===t?".":i.normalize(t)},relative:function(t,e){if(a(t),a(e),t===e)return"";if((t=i.resolve(t))===(e=i.resolve(e)))return"";for(var s=1;s<t.length&&47===t.charCodeAt(s);++s);for(var n=t.length,r=n-s,o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var c=e.length-o,l=r<c?r:c,h=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(47===e.charCodeAt(o+d))return e.slice(o+d+1);if(0===d)return e.slice(o+d)}else r>l&&(47===t.charCodeAt(s+d)?h=d:0===d&&(h=0));break}var u=t.charCodeAt(s+d);if(u!==e.charCodeAt(o+d))break;47===u&&(h=d)}var p="";for(d=s+h+1;d<=n;++d)d!==n&&47!==t.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(o+h):(o+=h,47===e.charCodeAt(o)&&++o,e.slice(o))},_makeLong:function(t){return t},dirname:function(t){if(a(t),0===t.length)return".";for(var e=t.charCodeAt(0),s=47===e,i=-1,n=!0,r=t.length-1;r>=1;--r)if(47===(e=t.charCodeAt(r))){if(!n){i=r;break}}else n=!1;return-1===i?s?"/":".":s&&1===i?"//":t.slice(0,i)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');a(t);var s,i=0,n=-1,r=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var o=e.length-1,c=-1;for(s=t.length-1;s>=0;--s){var l=t.charCodeAt(s);if(47===l){if(!r){i=s+1;break}}else-1===c&&(r=!1,c=s+1),o>=0&&(l===e.charCodeAt(o)?-1==--o&&(n=s):(o=-1,n=c))}return i===n?n=c:-1===n&&(n=t.length),t.slice(i,n)}for(s=t.length-1;s>=0;--s)if(47===t.charCodeAt(s)){if(!r){i=s+1;break}}else-1===n&&(r=!1,n=s+1);return-1===n?"":t.slice(i,n)},extname:function(t){a(t);for(var e=-1,s=0,i=-1,n=!0,r=0,o=t.length-1;o>=0;--o){var c=t.charCodeAt(o);if(47!==c)-1===i&&(n=!1,i=o+1),46===c?-1===e?e=o:1!==r&&(r=1):-1!==e&&(r=-1);else if(!n){s=o+1;break}}return-1===e||-1===i||0===r||1===r&&e===i-1&&e===s+1?"":t.slice(e,i)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var a=e.dir||e.root,s=e.base||(e.name||"")+(e.ext||"");return a?a===e.root?a+s:a+t+s:s}("/",t)},parse:function(t){a(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var s,i=t.charCodeAt(0),n=47===i;n?(e.root="/",s=1):s=0;for(var r=-1,o=0,c=-1,l=!0,h=t.length-1,d=0;h>=s;--h)if(47!==(i=t.charCodeAt(h)))-1===c&&(l=!1,c=h+1),46===i?-1===r?r=h:1!==d&&(d=1):-1!==r&&(d=-1);else if(!l){o=h+1;break}return-1===r||-1===c||0===d||1===d&&r===c-1&&r===o+1?-1!==c&&(e.base=e.name=0===o&&n?t.slice(1,c):t.slice(o,c)):(0===o&&n?(e.name=t.slice(1,r),e.base=t.slice(1,c)):(e.name=t.slice(o,r),e.base=t.slice(o,c)),e.ext=t.slice(r,c)),o>0?e.dir=t.slice(0,o-1):n&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,e.exports=i}}),qt=class{constructor(){this.view={enableDataInfoBar:!0},this.grid={editShowMode:"row",editSaveMode:"cell-blur"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5}}},Qt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Jt=t("HandlebarsUtil",class{get isInit(){return!!this.hsb}async init(){this.hsb=await Promise.resolve().then((()=>rt(Yt(),1)))}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function Zt(t,...e){return!t||I(t)?{}:"[object Array]"===Object.prototype.toString.call(t)?te(t,...e):"[object Object]"===Object.prototype.toString.call(t)?ee(t,...e):{}}function te(t,...e){const a={};for(const s of t)if(P(s.value)&&!s.rawValue){const t=e.find((t=>!A(t)&&(t[s.value]||Object.prototype.hasOwnProperty.call(t,s.value))));t&&(a[s.key.toLowerCase()]=t[s.value])}else a[s.key.toLowerCase()]=s.value||null;return a}function ee(t,...e){const a={},s=/^%(.+)%$/;for(const i in t)if(P(t[i])&&s.test(t[i])){const s=t[i].substring(1,t[i].length-1),n=e.find((t=>Object.prototype.hasOwnProperty.call(t,s)));n&&(a[i.toLowerCase()]=n[s])}else a[i.toLowerCase()]=t[i]||null;return a}function ae(t){const e=[],a=/^%(.+)%$/;for(const s in t){let i=!0,n=t[s];P(t[s])&&a.test(t[s])&&(i=!1,n=t[s].substring(1,t[s].length-1)),e.push({key:s.toLowerCase(),rawValue:i,value:n})}return e}function se(t,e){const a={};if(!t)return a;const s=Array.isArray(t)?t:ae(t),i=e[0];return s.forEach((t=>{const{rawValue:s,value:n}=t;!s&&n&&Object.prototype.hasOwnProperty.call(i,n)&&(a[n]=e.map((t=>t[n])).join(";"))})),a}function ie(t,e){const{deName:a,navFilter:s,pickupDEFName:i,navContexts:n,navParams:r}=t,{context:o,params:c,data:l,derValue:h}=e,d={},u={},p=h||l.srfkey;p&&(a&&(d[a]=p),s&&(u[s]=p),i&&(u["n_".concat(i.toLowerCase(),"_eq")]=p));const m=Zt(n,o,c,l),f=Zt(r,o,c,l);return Object.assign(d,m),Object.assign(u,f),{resultContext:d,resultParams:u}}function ne(t,e){if(t){const a=t.find((t=>t.id===e));if(a)return a}return null}function re(t){const e={},a={},s={};for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i];if(-1!==i.indexOf(".")){const t=i.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(e,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(a,{[t[1]]:n});break;default:Object.assign(s,{key:n})}}}return{navigateContexts:e,navigateParams:a,other:s}}function oe(t){const{width:e,height:a,widthMode:s,heightMode:i}=t,n={width:"",height:""};return"FULL"===s?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===s?"%":"px")),"FULL"===i?n.height="100%":a&&a>0&&(n.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===i?"%":"px")),n}function ce(t,e){return Ne.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1})}function le(t,e){const{mainStateAppDEFieldIds:a,demainStates:s}=t;if(a&&s){const t=[];return a.forEach((a=>{t.push(e[a])})),s.find((e=>{const{stateValue:a,state2Value:s,state3Value:i}=e;let n=!0;const r=[a,s,i];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(r[e])){n=!1;break}return n}))}}function he(t,e){const a=ibiz.hub.getApp().model,{demainStateOPPrivs:s,opprivAllowMode:i}=t,n=(null==s?void 0:s.map((t=>t.name)))||[];let r=[];if(i)r=n;else{r=[...a.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return r}function de(t){return t.split(".").pop()}function ue(t,e){const a=de(e);return k(t[a])}function pe(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function me(t,e){var a,s;const i=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?i.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?i.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&i.push(t.defaultValueAppDEFLogicId)})),(null==(s=t.appDELogics)?void 0:s.filter((t=>i.includes(t.id))))||[]}function fe(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function ge(t){const[,,e]=t.split("@");return ibiz.hub.getApp(e).getUIAction(t)}function we(t){return t.detreeNodes.find((t=>t.rootNode))}function Ee(t,e){return t.detreeNodes.find((t=>t.id===e))}function ve(t,e){const a=e.parentId||we(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(s=t.searchMode,i=e.hasQuery,3===s||(i?1===s:2===s));var s,i}))}function ye(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function Ie(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function De(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function Ce(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function be(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a}async function Pe(t,e,s={},i={}){return async function(t,e,s={},i={}){var n;const r=t.appViewNavContexts||[],o=Zt(r,e,s);e=Object.assign(e.clone(),o);const c=t.appViewNavParams||[],l=Zt(c,e,s);Object.assign(s,l);const h=t.appDataEntityId,d=de(h);let u=(null==(n=i.data)?void 0:n[0])||{};e[d]=u[d]||e[d]||s[d];const p=t.getDataAppDEActionId,m=ibiz.hub.getApp(t.appId),f=await m.deService.getService(h);ibiz.loading.showRedirect();try{const t=await f.exec(p||"get",e,s);if(t.ok){u=t.data;let a=u.linkurl;if(a)return e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://")?new Promise((t=>{const e=window.open(a,"_blank");e&&(e.callback=()=>{t({ok:!0,data:[]})})})):a.startsWith("appredirectview?")?(await Ae(e,a,i),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(h,t.appId),w=await async function(t,e,a,s){let i="";const n=e.typeAppDEFieldId;if(n){const{codeName:a}=fe(t,n),i=s[a.toLowerCase()];if(P(i))return"".concat(i);ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(n,"]值为空"),s)}const r="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),o=a.srfwf;if(P(o))return P(a.wf)?"".concat(r,":").concat(o.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(r,":").concat(o.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=fe(t,t.indexTypeAppDEFieldId);c=s[e.toLowerCase()]}if(A(c)&&t.formTypeAppDEFieldId){const{codeName:e}=fe(t,t.formTypeAppDEFieldId);c=s[e.toLowerCase()]}i=P(c)?"".concat(r,":").concat(c.toString().toUpperCase()):"".concat(r);return i}(g,t,s,u),E=w.split(":"),v=2===E.length?w:E.slice(0,2).join(":"),y="".concat(g.name.toUpperCase(),":").concat(w),I=t.redirectAppViewRefs,D=null==I?void 0:I.find((t=>{const e=t.name||t.id;return e===y||e===w||e===v}));if(!D)throw ibiz.log.error("重定向视图引用有:",null==I?void 0:I.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(w,"]或[").concat(y,"]或工作流[").concat(v,"]对应视图"));{const t=D.refAppViewId;if(!t)throw new a(D,"未配置实际引用视图");{const a=await ibiz.commands.execute(Je.TAG,t,e,s,{...i,data:[u]});if(a)return a}}return{ok:!0,data:[]}}(t,e,s,i)}async function Ae(t,a,s={}){const i=a.lastIndexOf("?"),n=decodeURIComponent(a.substring(i+1,a.length)),r=V.parse(n,{delimiter:";"}),o=r.srfdename||"";if(!o)throw new e("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(o.toUpperCase());if(!c)throw new e("未找到指定实体的codeName: ".concat(o));r[c.toLowerCase()]=r[o.toLowerCase()];const l="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),h=await ibiz.hub.getAppView(l);if(delete r.srfdename,"undo"!==r.srfwf){const t=r.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));r.wf=e,r.wfVersion=a}r.srfprocessinstanceid&&(t.srfprocessinstanceid=r.srfprocessinstanceid,delete r.srfprocessinstanceid),await ibiz.commands.execute(Je.TAG,h.id,t,r,s)}function _e(t,a,s){if(Object.is(a,"IN"))return Te(t,s);if(Object.is(a,"NOTIN"))return!Te(t,s);switch(a){case"EQ":return"".concat(t)==="".concat(s);case"NOTEQ":return"".concat(t)!=="".concat(s);case"LT":return Se(t,s)<0;case"LTANDEQ":return Se(t,s)<=0;case"GT":return Se(t,s)>0;case"GTANDEQ":return Se(t,s)>=0;case"ISNULL":return A(t);case"ISNOTNULL":return P(t);case"TESTNULL":return F(t);case"IN":return Te(t,s);case"NOTIN":return!Te(t,s);case"LIKE":return Le(t,s);case"LEFTLIKE":return Le(t,s,"start");case"RIGHTLIKE":return Le(t,s,"end");default:throw new e("值操作:".concat(a,",暂未支持"))}}function Se(t,a){const s=Number(t),i=Number(a);if(!Number.isNaN(s)&&!Number.isNaN(i))return xe(s,i);const n=new Date(t).getTime(),r=new Date(a).getTime();if(!Number.isNaN(n)&&!Number.isNaN(r))return xe(n,r);throw new e("".concat(t," 和 ").concat(a," 无法比较大小"))}function xe(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Te(t,a){if(!a||"string"!=typeof a)throw new e("范围比较的条件值不存或者不是字符串");if(t){return a.split(",").includes("".concat(t))}return!1}function Le(t,e,a){if(!t||!e)return!1;const s="".concat(t).toUpperCase(),i="".concat(e).toUpperCase(),n=s.indexOf(i);switch(a){case"start":return 0===n;case"end":return n+i.length===s.length;default:return-1!==n}}var Oe={singleRowReturn:!1,isAsync:!0},Me=t("ScriptFunction",class{constructor(t,e,a=Oe){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(...t){return i.apply({},t)}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?W(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const s=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),s.push(a[t])})),s}fillDefaultParams(t,e){const a=e.view;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"parent":e.parent=null==a?void 0:a.parentView;break;case"topView":e.topView=null==a?void 0:a.getTopView();break;case"parentView":e.parentView=null==a?void 0:a.parentView;break;case"topViewSession":e.topViewSession=null==a?void 0:a.getTopView().session;break;case"viewSession":e.viewSession=null==a?void 0:a.session;break;case"appSession":e.appSession=ibiz.hub.controller.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),Ne=t("ScriptFactory",class{static createScriptFn(t,e,a){return new Me(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}});function Re(t,a,s){const i={isPast:!0,infoMessage:s.ruleInfo};if(function(t){return"GROUP"===t.condType}(s)){const e=s.conds;e&&e.length>0&&(i.isPast=function(t,e,a="AND",s=!1){if(!((null==t?void 0:t.length)>0))return!1;let i="AND"===a;for(let s=0,n=t.length;s<n;s++){const n=e(t[s],s);if("AND"===a){if(!n){i=!1;break}}else if("OR"===a&&n){i=!0;break}}return s?!i:i}(e,(e=>{const{isPast:s,infoMessage:n}=Re(t,a,e);return i.infoMessage=n,s}),s.condOp,!!s.notMode),!i.isPast&&("AND"===s.condOp&&s.notMode||"OR"===s.condOp&&!s.notMode)&&(i.infoMessage=s.ruleInfo))}else{t=null==s?void 0:s.defname.toLowerCase();try{if(function(t){return"SIMPLE"===t.condType}(s))i.isPast=!function(t,a,s,i,n,r,o){Object.is(n,"CURTIME")&&(s="".concat(new Date));if(Object.is(n,"ENTITYFIELD")){s=r[s=s?s.toLowerCase():""]?r[s]:s}(F(i)||B(i))&&(i="内容必须符合值规则");const c=_e(t,a,s);if(!c&&o)throw new e(i);return!c}(a[t],s.condOp,s.paramValue,s.ruleInfo,s.paramType,a,s.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(s))i.isPast=!function(t,a,s,i,n,r,o){A(r)&&(r="值必须符合值范围规则");if(A(t)){if(o)throw new e("值为空");return r="值为空",!0}if(Ve(t,/^-?\d*\.?\d+$/,"",o))return!0;const c=Number.parseFloat(t);if(null!==a)if(s){if(c<a){if(o)throw new e(r);return!0}}else if(c<=a){if(o)throw new e(r);return!0}if(null!=i)if(n){if(c>i){if(o)throw new e(r);return!0}}else if(c>=i){if(o)throw new e(r);return!0}return r="",!1}(a[t],s.minValue,s.includeMinValue,s.maxValue,s.includeMaxValue,s.ruleInfo,s.keyCond);else if(function(t){return"REGEX"===t.condType}(s))i.isPast=!Ve(a[t],s.regExCode,s.ruleInfo,s.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(s))i.isPast=!function(t,a,s,i,n,r,o){A(r)&&(r="内容长度必须符合范围规则");if(A(t)){if(o)throw new e("值为空");return r="值为空",!0}const c=t.length;if(null!==a)if(s){if(c<a){if(o)throw new e(r);return!0}}else if(c<=a){if(o)throw new e(r);return!0}if(null!==i)if(n){if(c>i){if(o)throw new e(r);return!0}}else if(c>=i){if(o)throw new e(r);return!0}return r="",!1}(a[t],s.minValue,s.includeMinValue,s.maxValue,s.includeMaxValue,s.ruleInfo,s.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(s)&&(null==s?void 0:s.sysValueRule)){const{ruleType:n,regExCode:r,scriptCode:o,ruleInfo:c}=s.sysValueRule;if(i.infoMessage=s.ruleInfo||c,"REG"===n)i.isPast=!Ve(a[t],r,i.infoMessage,s.keyCond);else if("SCRIPT"===n){const{isPast:n,infoMessage:r}=function(t,a,s,i,n){A(i)&&(i="值必须符合脚本规则");const r=a;let o="",c=!0;const l=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(o+=t.message)})):(null==t?void 0:t.message)&&(o=t.message)};try{const e=Ne.execScriptFn({value:t,data:r},s,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),l(t)}if(i="",!c&&n)throw new e(i);return{isPast:c,infoMessage:o||i}}(a[t],a,o,i.infoMessage,s.keyCond);i.isPast=n,i.infoMessage=r||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=s.notMode?!i.isPast:i.isPast}return i}function Ve(t,a,s,i){A(s)&&(s="值必须符合正则规则");if(A(t)){if(i)throw new e("值为空");return s="值为空",!0}if(!new RegExp(a).test(t)){if(i)throw new e(s);return!0}return s="",!1}function ke(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const s=e.defdlogics;if(!s||0===s.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let i=!0;if("AND"===e.groupOP){i=void 0===s.find((e=>!ke(t,e)))}else if("OR"===e.groupOP){i=void 0!==e.defdlogics.find((e=>ke(t,e)))}return e.notMode?!i:i}if(function(t){return"SINGLE"===t.logicType}(e))return _e(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new s(e,"未支持的逻辑类型".concat(e.logicType))}function Fe(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const s=e.panelItemLogics;if(!s||0===s.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let i=!0;if("AND"===e.groupOP){i=void 0===s.find((e=>!Fe(t,e)))}else if("OR"===e.groupOP){i=void 0!==e.panelItemLogics.find((e=>Fe(t,e)))}return e.notMode?!i:i}if(function(t){return"SINGLE"===t.logicType}(e))return _e(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new s(e,"未支持的逻辑类型".concat(e.logicType))}var We=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=U(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:s,mainMenuAlign:i}=t;let n="";return s?n="BLANK_MODE":i&&(n=i.toUpperCase()),""!==n?"".concat(e,"_").concat(a,"_").concat(n):"".concat(e,"_").concat(a)}});function Be(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var Ue=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t))(Ue||{})),je=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t))(je||{})),ze=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(ze||{})),Ge=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.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))(Ge||{})),He=t("StudioViewEvents",class{});He.onViewMounted="onMounted",He.onViewDestroyed="onDestroyed";var Xe=t("StudioPanelEvents",class{});Xe.onClick="onClick",Xe.onChange="onChange",Xe.onEnter="onEnter",Xe.onLeave="onLeave";var Ke=t("StudioControlEvents",class{});Ke.onBeforeLoad="onBeforeLoad",Ke.onLoadSuccess="onLoadSuccess",Ke.onLoadError="onLoadError",Ke.onBeforeLoadDraft="onBeforeLoadDraft",Ke.onLoadDraftSuccess="onLoadDraftSuccess",Ke.onLoadDraftError="onLoadDraftError",Ke.onBeforeSave="onBeforeSave",Ke.onSaveSuccess="onSaveSuccess",Ke.onSaveError="onSaveError",Ke.onBeforeRemove="onBeforeRemove",Ke.onRemoveSuccess="onRemoveSuccess",Ke.onRemoveError="onRemoveError",Ke.CLICK="onClick";var Ye=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.hooks={shouldDismiss:new _,beforeDismiss:new _},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function $e(t,e){return t.filter((t=>{const{checkMode:a}=t,s=t.deformItemName||t.degridEditItemName;return 2!==a&&s===e}))}var qe=t("TextUtil",class{format(t,e){return t}async copy(t){return navigator.clipboard.writeText(t)}}),Qe=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,a,i={},n={}){const r=await ibiz.hub.config.view.get(t);if(!r)throw new e("应用视图[".concat(t,"]不存在"));if(a.srfkey&&r.appDataEntityId){a[de(r.appDataEntityId)]=a.srfkey,a.srfkey=void 0}if(r.redirectView){return Pe(await ibiz.hub.getAppView(t),a,i,n)}const{openMode:o="INDEXVIEWTAB"}=r;switch(n.openMode||o){case"INDEXVIEWTAB":return n.noWaitRoute?void this.openIndexViewTab(r,a,i):this.openIndexViewTab(r,a,i);case"POPUP":throw new s(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,a,i);case"POPUPAPP":throw new s(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,n.event,a,i);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,a,i);case"USER":return this.openUserCustom(r,a,i);default:return this.openIndexViewTab(r,a,i)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,a,s,i={}){if(!a)throw new e("气泡打开缺少event");return ibiz.openView.popover(t.id,a,s,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};Qe.TAG="ibiz.app-view.open";var Je=t("OpenAppViewCommand",Qe),Ze=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,a,i={},n={}){const r=ibiz.hub.getApp(a.srfappid).getAppFunc(t);if(!r)throw new e("找不到叫".concat(t,"的应用功能"));const{navigateContexts:o,navigateParams:c,appFuncType:l}=r,h=a.clone();Object.assign(h,Zt(o,a,i));const d=Zt(c,a,i);switch(l){case"APPVIEW":return this.openAppView(r,h,d,n);case"OPENHTMLPAGE":return this.openHtmlPage(r);case"PDTAPPFUNC":return this.openPdAppFunc(r,h,d);case"JAVASCRIPT":return this.executeJavaScript(r,h,d);case"CUSTOM":return this.custom(r,h,d);default:throw new s(r,"未支持的应用功能类型: ".concat(l))}}async openAppView(t,a,s,i){if(!t.appViewId)throw new e("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(Je.TAG,t.appViewId,a,s,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,a,s){throw ibiz.log.warn("openPdAppFunc",t,a,s),new e("未实现")}executeJavaScript(t,a,s){throw ibiz.log.warn("executeJavaScript",t,a,s),new e("未实现")}custom(t,a,s){throw ibiz.log.warn("custom",t,a,s),new e("未实现")}};Ze.TAG="ibiz.app-func.exec";var ta=t("AppFuncCommand",Ze);function ea(){new ta,new Je}var aa=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){let s=-1;if(e==a?s=0:e>a&&(s=1),"EQ"===t||"ABSEQ"===t)return 0===s;if("GT"===t)return s>0;if("GTANDEQ"===t)return s>=0;if("LT"===t)return s<0;if("LTANDEQ"===t)return s<=0;if("NOTEQ"===t)return 0!==s}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},sa=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},ia=class extends sa{parse(t){const e=t.length;let a=!0,s=!1,i=!1;for(let n=0;n<e;n++)if(a){const e=t[n];this.setCondOp(e),a=!1,s=!0}else if(s){const e=t[n];this.setParam(e),s=!1,i=!0}else if(i){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},na=class t extends sa{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(a){const s=a.length;let i=!0,n=!0,r=!1;for(let o=0;o<s;o++){if(i&&n){if("!"===a[o]){this.setNotMode(!0),i=!1;continue}}if(n){const t=a[o];this.setCondOp(t),n=!1,i=!1,r=!0}else if(r){const s=a[o];if(!(s instanceof Array))throw new e("值必须为数组");s.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new ia;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},ra=class extends na{},oa=class extends ia{},ca=class t extends aa{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,s){if(e instanceof na){const t=e.getChildPSModelCondBases();if(null==t||B(t))return!e.isNotMode();const i="AND"===e.getCondOp();let n=i;for(let e=0;e<t.length;e++){const r=t[e];if(this.testCond(r,a,s)){if(!i){n=!0;break}}else if(i){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof ia){B(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const i=a[e.getParam().toLowerCase()];let n=null;const r=e.getValueType(),o=e.getValue();return null==r||B(r)?n=e.getValue():(B(o)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===r?n=s.data[o.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===r&&(n=s.getValue(o.toLowerCase()))),this.testSingleCond(e.getCondOp(),i,n)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new oa}createPSModelGroupCond(){return new ra}};ca.PARAMTYPE_DATACONTEXT="DATACONTEXT",ca.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var la=t("PSDEDQCondEngine",ca);async function ha(t,e){var a;const s=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(s)return await ibiz.plugin.loadPlugin(s),"".concat(s.pluginType,"_").concat(s.pluginCode);ibiz.log.error("找不到".concat(t,"的插件模型"))}var da=t("CONTROL_PROVIDER_PREFIX","CONTROL");function ua(t){return ibiz.register.get("".concat(da,"_").concat(t))}async function pa(t){let e;const{controlType:a,controlStyle:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ha(i,n);if(t&&(e=ua(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(s&&"DEFAULT"!==s){if(e=ua("".concat(a,"_").concat(s)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(s,"]对应的适配器"),t)}if(e=ua(a),e)return e;ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var ma=t("EDITOR_PROVIDER_PREFIX","EDITOR");function fa(t){return ibiz.register.get("".concat(ma,"_").concat(t))}async function ga(t){let e;const{editorType:a,editorStyle:s,predefinedType:i,sysPFPluginId:n,appId:r}=t;if(n){const t=await ha(n,r);if(t&&(e=fa(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(s&&"DEFAULT"!==s){if(e=fa("".concat(a,"_").concat(s)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(s,"]对应的适配器"),t)}if(i){let n="".concat(i,"_").concat(a);if(s&&"DEFAULT"!==s&&(n+="_".concat(s)),e=fa(n),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(i,"]对应的适配器"),t)}if(e=fa(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var wa=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function Ea(t){return ibiz.register.get("".concat(wa,"_").concat(t))}async function va(t){let e;const{detailType:a,sysPFPluginId:s,appId:i}=t;if(s){const t=await ha(s,i);if(t&&(e=Ea(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=Ea(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var ya=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Ia(t){return ibiz.register.get("".concat(ya,"_").concat(t))}async function Da(t){let e;const{columnType:a,enableRowEdit:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ha(i,n);if(t&&(e=Ia(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const r=s?"".concat(a,"_EDIT"):a;if(e=Ia(r),e)return e;ibiz.log.error("找不到表格列类型".concat(r,"对应的适配器"))}var Ca=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function ba(t){return ibiz.register.get("".concat(Ca,"_").concat(t.toUpperCase()))}async function Pa(t){var e;let a;const{itemType:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ha(i,n);if(t&&(a=ba(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if("CONTAINER"===s){const e=t.predefinedType||"DEFAULT";if(a=ba("CONTAINER_".concat(e)),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器"))}if("RAWITEM"===s){const s=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT";if(a=ba("RAWITEM_".concat(s)),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(s,"的适配器"))}if(a=ba(s),a)return a;ibiz.log.error("找不到面板成员类型".concat(s,"对应的适配器"))}var Aa=t("UIACTION_PROVIDER_PREFIX","UIACTION");function _a(t,e){ibiz.register.register("".concat(Aa,"_").concat(t),e)}function Sa(t){return ibiz.register.get("".concat(Aa,"_").concat(t))}async function xa(t){let a;const{uiactionMode:s,sysPFPluginId:i,appId:n}=t;if(i){const t=await ha(i,n);if(t&&(a=Sa(t)),a)return a;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(a=Sa(s),a)return a;throw new e("找不界面行为模式".concat(s,"对应的适配器"))}var Ta=t("VIEW_PROVIDER_PREFIX","VIEW");function La(t){return ibiz.register.get("".concat(Ta,"_").concat(t))}var Oa=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Ma(t){return ibiz.register.get("".concat(Oa,"_").concat(t))}async function Na(t){let e;const{portletType:a,sysPFPluginId:s,appId:i}=t;if(s){const t=await ha(s,i);if(t&&(e=Ma(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=Ma(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var Ra=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Va(t,e){ibiz.register.register("".concat(Ra,"_").concat(t),e)}function ka(t){return ibiz.register.get("".concat(Ra,"_").concat(t))}async function Fa(t){let a;const{codeName:s,counterType:i,sysPFPluginId:n,appId:r}=t;if(n){const t=await ha(n,r);if(t&&(a=ka(t)),a)return a;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(a=ka(s),a)return a;throw new e("找不到自定义系统计数器".concat(s,"对应的适配器"))}if(a=ka(i),a)return a;throw new e("找不系统计数器类型".concat(i,"对应的适配器"))}var Wa=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=i.create(),this.params={},this.evt=new S,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=U(t)),e&&(this.params=U(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 e("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&P(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()}}),Ba=t("AppDECounter",class extends Wa{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const s=this.model.getAppDEActionId;if(!s)throw new a(this.model,"未找到获取计数器行为!");this.action=s,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),Ua=t("AppDECounterProvider",class{createCounter(t){return new Ba(t)}});function ja(){Va("DEDR",(()=>new Ua))}t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new la;return a.parse(["OR",this.calcCond(e)]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const s=e.dedqconditions;if(s){const t=this.calcCond(s);a.push(t)}}else{if("SINGLE"!==t.condType)throw new s(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.fieldName),e.condValue||a.push("")}}e.push(a)})),e}}).map=new WeakMap;var za=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(t))throw new s(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:s}=this.codeList,i=a?t[a]:t.srfkey;return e.id=i,e.value=i,e.text=s?t[s]:t.srfmajortext,Object.freeze(e)}async load(t={},e={}){const s=ibiz.hub.getApp(t.srfappid);if(this.isPredefined){e.size||(e={...e,size:1e4});const t=await s.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),e);return Object.freeze(t.data.items)}const{appDataEntityId:i,appDEDataSetId:n}=this.codeList;if(!i)throw new a(this.codeList,"未配置应用实体");if(!n)throw new a(this.codeList,"未配置数据集");const r=await s.deService.exec(i,n,t,{},e);let o=[];return r.data.length&&(o=r.data.map((t=>this.convertData(t)))),o}async get(t={},e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const s=this.load(t,e),{cacheTimeout:i}=this.codeList,n=-1===i||F(i)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,r={expirationTime:(new Date).getTime()+n,promise:s};this.cache.set(a,r);const o=await s;return r.items=o,delete r.promise,o}});function Ga(t,a){if(null!=a){const{srfkey:t}=a;if(!F(t)&&!B(t))return!0}throw new e("执行「".concat(t,"」不存在「srfkey」无法处理"))}function Ha(t,a){const{srfsessionid:s}=a;if(!F(s)&&!B(s))return!0;throw new e("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Xa=t("DECache",class{constructor(){this.cacheMap=new Map}forceAdd(t,e){const a=this.getCacheByTag(t).get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.getCacheByTag(t).set(e.srfkey,U(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.getCacheByTag(t).delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){try{Ha("add",t),(F(e.srfkey)||B(e.srfkey))&&(e.srfkey=x()),e.srftempdate=(new Date).getTime();return this.getCacheByTag(t).set(e.srfkey,U(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Ha("get",t);const a=this.getCacheByTag(t).get(e);return ibiz.log.warn("get",e,a),U(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){try{Ha("update",t),Ga("update",e),e.srftempdate=(new Date).getTime();const a=this.getCacheByTag(t),s=a.get(e.srfkey);if(s)return s.assign(e),a.set(e.srfkey,s),ibiz.log.warn("update",e.srfkey,e),U(s);throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Ha("delete",t);const a=this.getCacheByTag(t),s=e;if(a.has(s)){const t=a.get(s);return t.srftempdate=(new Date).getTime(),a.delete(s),ibiz.log.warn("delete",s),t}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Ha("add",t);const a=this.getCacheByTag(t);for(let t=0;t<e.length;t++){const s=e[t];(F(s.srfkey)||B(s.srfkey))&&(s.srfkey=x()),s.srftempdate=(new Date).getTime();const i=U(s);a.set(s.srfkey,i),e[t]=i,ibiz.log.warn("add",s.srfkey,s)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Ha("update",t);const a=this.getCacheByTag(t);for(let t=0;t<e.length;t++){const s=e[t];Ga("update",s),s.srftempdate=(new Date).getTime();const i=a.get(s.srfkey);if(!i)throw new Error("数据[".concat(s.srfdename,"-").concat(s.srfmajortext,"(").concat(s.srfkey,")]不存在,无法更新!"));i.assign(s),a.set(s.srfkey,i),ibiz.log.warn("update",s.srfkey,s),e[t]=U(i)}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Ha("delete",t)}catch(t){return ibiz.log.error(t),e}const a=this.getCacheByTag(t),s=[];for(let t=0;t<e.length;t++){const i=e[t];a.has(i)||s.push(i)}if(s.length>0)throw new Error("未找到以下数据「".concat(s.join("、"),"」,无法删除!"));for(let t=0;t<e.length;t++){const s=e[t];a.delete(s),ibiz.log.warn("delete",s)}return[]}checkData(t,e){return-1!==this.getList(t).findIndex((t=>t.srfkey===e))}getList(t){try{Ha("getList",t);const e=this.getCacheByTag(t);if(!e)return[];const a=e.values();return Array.from(a)}catch(t){return ibiz.log.error(t),[]}}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=j(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const s=t[a];e[a]=j(s)}return z(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)}}),Ka=new RegExp("(?<=\\$\\{)(.*?)(?=\\})","g");function Ya(t,e){const a=(e.requestPaths||[]).map((t=>({path:t,keys:t.match(Ka)||[]}))).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,s)=>s===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function $a(t,e){const a=Ya(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((s,i)=>{e=i===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(s,"\\}")),""):e.replace("${".concat(s,"}"),t[s])})),e}return a.path}return""}var qa=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(F(e.page)||B(e.page)||(this.page=e.page),F(e.size)||B(e.size)||(this.size=e.size),F(e.query)||B(e.query)||(this.query=e.query),!F(e.sort)&&!B(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}F(e.srfparentkey)||B(e.srfparentkey)||(this.srfparentkey=e.srfparentkey),F(e.srfparentdename)||B(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]}}),Qa=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let s=[];return(null==a?void 0: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((t=>{var a;let s=t.text;t.textLanguageRes&&(s=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));const i={text:s,value:e?Number(t.value):t.value,color:t.color,id:t.codeName};return(null==(a=t.codeItems)?void 0:a.length)&&(i.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(i)}))}async getDynamicCodeList(t,e={},a={}){let s;const i=t.codeName;return this.cache.has(i)?s=this.cache.get(i):(s=new za(t),this.cache.set(i,s),await s.init()),s.get(e,a)}async get(t,a,s){const i=this.allCodeLists.get(t);if(!i)throw new e("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,a,s):[]}}),Ja=t("CounterService",class{static async getCounter(t,e,a){const s=t.id;if(this.counterMap.has(s)){const t=this.counterMap.get(s);if(!1===t.isDestroyed)return t;this.counterMap.delete(s)}const i=(await Fa(t)).createCounter(t);return await i.init(e,a),this.counterMap.set(s,i),i}static async getCounterByRef(t,e,s){const{appCounter:i}=t;if(!i)throw new a(t,"未配置应用计数器!");return this.getCounter(i,e,s)}});Ja.counterMap=new Map;var Za=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}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/alls/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/alls/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 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,a,s={},i={}){switch(t){case"wfstart":return this.wfStart(a,s,i);case"wfsubmit":return this.wfSubmit(a,s,i);case"reassign":return this.wfReassign(a,s,i);case"addstepbefore":return this.wfAddStepBefore(a,s,i);case"sendback":return this.wfSendBack(a,s,i);case"sendcopy":return this.wfSendCopy(a,s,i);default:throw new e("「".concat(t,"」未实现"))}}}),ts=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(ts||{})),es=t("AppDataEntity",class t{get srfuf(){return this.srfkey?1:0}constructor(e,a){let s;Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:U(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=ne(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfile",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(t){s=t},get(){return this._data[t]||s}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const n=ne(e.appDEFields||[],e.majorAppDEFieldId);if(n){const t=n.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfile",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));this.defineProperties()}defineProperties(){var t;const{_data:e}=this,a={},s=Object.keys(e);s.forEach((t=>{a[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const i=t.codeName.toLowerCase();s.includes(i)||(a[i]={enumerable:!0,set(t){e[i]=t},get:()=>e[i]})})),Object.defineProperties(this,a)}clone(){return new t(this._entity,this._data)}assign(e){return e instanceof t?Object.assign(this._data,e._data):Object.assign(this._data,e),this}}),as=t("MethodDto",class t{constructor(t,e){this.entity=t,this.dto=e,this.dtoMap=new Map,e?(this.app=ibiz.hub.getApp(t.appId),this.fields=e.appDEMethodDTOFields||[]):this.fields=[]}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async get(t,e){const a={};for(let e=0;e<this.fields.length;e++){const i=this.fields[e],n=i.codeName.toLowerCase();switch(i.type){case"SIMPLE":break;case"DTOS":{if(!i.refAppDataEntityId)break;const e=await this.getFieldDto(i),s=(await this.app.deService.getService(i.refAppDataEntityId)).local.getList(t);if(s){const i=[];for(let a=0;a<s.length;a++)i.push(await e.get(t,s[a]));a[n]=i}break}default:throw new s(i,"未支持的应用实体方法输入属性类型: ".concat(i.type))}}return{...e,...a}}async sets(t,e){const a=await this.app.deService.getService(this.entity.id);return a.local.clear(t),Promise.all(e.map((async e=>{const s=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{if(!a.refAppDataEntityId)return;const s=a.codeName.toLowerCase(),i=await this.getFieldDto(a),n=e[s];n&&await i.sets(t,n)}));for(let t=0;t<s.length;t++)await s[t];const i=new es(this.entity,e);return this.isLocalMode&&await a.local.add(t,i),i})))}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=ne(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),i=new t(a,s);return this.dtoMap.set(e.codeName,i),i}}),ss=class{constructor(t,e){this.entity=t,this.method=e,this.app=ibiz.hub.getApp(t.appId),this.input=new class{constructor(t,e){if(this.entity=t,this.input=e,e){const a=ne(t.appDEMethodDTOs||[],e.appDEMethodDTOId);a&&(this.dto=new as(t,a))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}(t,e.appDEMethodInput),this.result=new class{constructor(t,e){if(this.entity=t,this.output=e,e){const a=ne(t.appDEMethodDTOs||[],e.appDEMethodDTOId);a&&(this.dto=new as(t,a))}}async handle(t,e){return this.dto?(await this.dto.sets(t,[e]))[0]:new es(this.entity,e)}}(t,e.appDEMethodReturn)}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async request(t,e,s,i){const{actionType:n,requestMethod:r}=this.method;if("REMOTE"===n){const e=this.method.codeName.toLowerCase();let n=null;switch(r){case"POST":n=await this.app.net.post("".concat(t,"/").concat(e),s);break;case"GET":n=await this.app.net.get("".concat(t,"/").concat(e),i);break;case"PUT":n=await this.app.net.put("".concat(t,"/").concat(e),s);break;case"DELETE":n=await this.app.net.delete("".concat(t,"/").concat(e),i);break;default:throw new a(this.method,r?"未支持的请求方式: ".concat(r):"未配置请求方式")}return n}throw new a(this.method,"未支持的行为类型[".concat(n,"]"))}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return $a(t,this.entity)+e}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(t){return new es(this.entity,t)}},is=class{},ns=class extends is{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,i){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=i[this.value]?i[this.value]:e[this.value];return _e(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return _e(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new s(this.model,"暂未支持条件值类型为[当前时间]");default:return _e(n[this.dstField],this.op,this.value)}}},rs=class t extends is{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new ns(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,s){let i=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,s);if("AND"===this.op&&!1===n){i=!1;break}if("OR"===this.op&&!0===n){i=!0;break}}return this.notMode?!i:i}},os=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new rs(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data||{})}}(t)))}},cs=class extends os{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:s,dstDELogicParamId:i,retDELogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!s)throw new a(this.model,"未指定实体行为");const r=t.params[i],o=ibiz.hub.getApp(t.context.srfappid),c=await o.deService.exec(e,s,t.context,r,t.viewParams);c.ok&&(t.params[n]=c.data)}},ls=class extends os{async exec(t){}},hs=class extends os{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:i}=this.model;switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=i;break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new s(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function ds(t,e){const{srcDELogicParamId:a,srcValueType:i,srcFieldName:n,srcValue:r}=e;let o;switch(e.srcValueType||(e.srcValueType="SRCDLPARAM"),i){case"SRCDLPARAM":o=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=t.viewParams;break;case"APPDATA":o=t.context;break;case"ENVPARAM":o=U(ibiz.env);break;default:throw new s(e,"暂未支持源值类型".concat(i))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}var us=class extends os{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new s(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,s=ds(e,t);e.params[a]=U(s)}bindParam(t,e){const a=ds(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:s}=t,i=null==a?void 0:a.toLowerCase(),n=ds(e,t);i?e.params[s][i]=n:e.params[s]=n}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:s,srcIndex:i,srcSize:n}=t,r=ds(e,t),o=s||0,c=i||0,l=n||r.length;e.params[a].splice(o,0,...r.slice(c,l))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:s,dstSortDir:i}=t,n=s.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},ps=class extends os{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:s,retDELogicParamId:i}=this.model,n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),o=await r.deService.exec(a,e,t.context,n,t.viewParams);o.ok&&(t.params[i]=o.data)}},ms=class extends os{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const i=ds(t,this.model);t.params[e]=i}},fs=class extends os{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},gs=class extends os{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},ws=class extends os{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const i=ds(t,this.model);t.params[e]=U(i)}},Es=class extends os{async exec(t){const{dstDELogicParamId:e,dstSortDir:s,dstFieldName:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=i.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},vs=class extends os{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:s,dstIndex:i,srcIndex:n,srcSize:r}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const o=ds(t,this.model),c=i||0,l=n||0,h=r||o.length;t.params[e].splice(c,0,...o.slice(l,h))}},ys=class extends os{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new r({response:{status:e,statusText:a}})}},Is=class{constructor(t){var e,i;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new ls(t);break;case"END":a=new hs(t);break;case"DEACTION":a=new cs(t);break;case"PREPAREPARAM":a=new us(t);break;case"DEDATASET":a=new ps(t);break;case"THROWEXCEPTION":a=new ys(t);break;case"BINDPARAM":a=new ms(t);break;case"RESETPARAM":a=new fs(t);break;case"COPYPARAM":a=new ws(t);break;case"RENEWPARAM":a=new gs(t);break;case"APPENDPARAM":a=new vs(t);break;case"SORTPARAM":a=new Es(t);break;default:throw new s(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(i=t.delogicParams)||i.forEach((t=>{this.params.set(t.id,new class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)t.params[e]=t.data||{};else if(a.appGlobalParam)t.params[e]=U(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new s(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else{if(a.lastReturnParam)throw new s(a,"未支持的逻辑参数类型: 上次调用返回");if(a.appContextParam)t.params[e]=t.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=U(t.data||{});else{if(a.envParam)throw new s(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new s(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new s(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new s(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new s(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new s(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new s(a,"未支持的逻辑参数类型: 操作会话变量")}}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new s(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}}(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,s){const i=new class{constructor(t,e,a,s){this.deLogicParams=t,this.context=e,this.data=a,this.viewParams=s,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}}(this.params,t,e,s);this.initLogicParams(i);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(n);await this.deepExec(t,i)}return i.isEndNode?i.result:i.params[i.defaultParamName]?i.params[i.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),!1===t.model.parallelOutput))break}}},Ds=new Map;async function Cs(t,e,a,s){Ds.has(t)||Ds.set(t,new Is(t));return Ds.get(t).exec(e,a,s)}async function bs(t,e,a,s){try{const i=await Cs(t,e,a,s);return new n(i)}catch(t){if(t instanceof r)return new n(t,500);throw t}}async function Ps(t,e,a,s,i){const n=me(t,e);if(n.length){(await Promise.all(n.map((t=>Cs(t,a,s,i))))).forEach((t=>{Object.assign(s,t)}))}}var As=class extends ss{async exec(t,e,s){if("DELOGIC"===this.method.actionType){const i=pe(this.method.appDELogicId,this.entity);if(!i)throw new a(this.method,"缺少实体处理逻辑");return bs(i,t,e,s)}let i;switch(this.isLocalMode||(e=await this.input.handle(t,e)),["READ","GETDRAFT"].includes(this.method.actionMode)||await Ps(this.entity,"change",t,e,s),this.method.codeName){case"Create":i=await this.create(t,e,s);break;case"Get":i=await this.get(t,s);break;case"GetDraft":i=await this.getDraft(t,s);break;case"Remove":i=await this.remove(t,s);break;case"Update":i=await this.update(t,e,s);break;case"CreateTemp":i=await this.createTemp(t,e);break;case"GetTemp":i=await this.getTemp(t,e);break;case"GetDraftTemp":i=await this.getDraftTemp(t,s);break;case"RemoveTemp":i=await this.removeTemp(t,e);break;case"UpdateTemp":i=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);this.method.needResourceKey&&(a="".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]||e[this.entity.keyAppDEFieldId]));const n=await this.request(a,t,e,s);n.data=await this.result.handle(t,n.data),i=n}}return await Ps(this.entity,"compute",t,i.data,s),i}async create(t,e,a){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(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=await a.local.add(t,this.createEntity(e));return new n(s)}catch(t){return new n(t,500)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new n(t):new n(t,500)}catch(t){return new n(t,500)}}async removeTemp(t,e){try{let e=null;!e&&t&&(e=t[this.entity.codeName.toLowerCase()]);const a=(await this.getService()).local.delete(t,e);return a?new n(a):new n(a,500)}catch(t){return new n(t,500)}}async updateTemp(t,e){try{const a=(await this.getService()).local.update(t,this.createEntity(e));return a?new n(a):new n(a,500)}catch(t){return new n(t,500)}}async getTemp(t,e){try{let e=null;!e&&t&&(e=t[this.entity.codeName.toLowerCase()]);const a=(await this.getService()).local.get(t,e);return a?new n(a):new n(a,500)}catch(t){return new n(t,500)}}async removeBatchTemp(t,e){return new n(!0)}},_s=class extends ss{async exec(t,e,a){if(this.isLocalMode){const a=await this.searchLocal(null,new qa(t,e));return new n(a,200)}let i;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":i=await this.fetchCodeListSet(t,a);break;case"REMOTE":{const s=this.calcPath(t);i=await this.request(s,t,e,a)}break;default:throw new s(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const r=i.data||[];return i.data=r.map((t=>this.createEntity(t))),i.data.length&&await Promise.all(i.data.map((e=>Ps(this.entity,"compute",t,e,a)))),i}async selectLocal(t,e={}){let a=(await this.getService()).local.getList(t);a=N(a,"srfordervalue");const s={},i={},n={},r={};e.srfkey&&(s.srfkey=j(e.srfkey),delete e.srfkey);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];null==a?(i[t]=j(null),n[t]=j(void 0),r[t]=j("")):s[t]=j(a)}if(!B(s)){const t=z(s),e=z(i),o=z(n),c=z(r);a=a.filter((a=>{if(B(i)){if(t(a))return!0}else if(t(a)&&(e(a)||o(a)||c(a)))return!0;return!1}))}return a.map((t=>t.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((a=>t.test(a,e))))):(i=await this.selectLocal(e.context),i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const s=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const i=t[a[e]];if(s.test(i))return!0}return!1})))),F(e.sortField)||B(e.sortField)||(i="DESC"===e.sortMode?R(i,e.sortField):N(i,e.sortField));const{page:n,size:r}=e,o=n*r,c=(n+1)*r-1;return i.slice(o,c).map((t=>U(t)))}async fetchCodeListSet(t,e){const{appCodeListId:s}=this.method;if(!s)throw new a(this.method,"没有指定数据来源代码表");const i=await this.app.codeList.get(s,t,e),{keyAppDEFieldId:r,majorAppDEFieldId:o}=this.entity,c=i.map((t=>({[r]:t.value,[o]:t.text})));return new n(c,200)}},Ss=t("DEService",class{constructor(t){this.model=t,this.methodMap=new Map,this.local=new Xa,this.wf=new Za(t),this.file=new class{constructor(t){this.model=t}exportData(t,e,a,s){const i=$a(a,this.model),n="".concat(i,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:s,responseType:"blob"})}}(t)}getMethod(t){if(this.methodMap.has(t))return this.methodMap.get(t);const e=ne(this.model.appDEMethods,t);let a=null;switch(e.methodType){case"DEACTION":a=new As(this.model,e);break;case"FETCH":case"FETCHTEMP":a=new _s(this.model,e);break;default:throw new s(e,"未支持的服务方法类型: ".concat(e.methodType))}return this.methodMap.set(t,a),a}exec(t,a,s={},i={}){const n=this.getMethod(t);if(n)return n.exec(a,s,i);throw new e("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}}),xs=t("ControlVO",class t{get srfuf(){return F(this.$origin.srfuf)?this.srfkey?1:0:this.$origin.srfuf}get srfkey(){return this.$origin.srfkey}get srfmajortext(){return this.$origin.srfmajortext}get srfdeid(){return this.$origin.srfdeid}get srfdecodename(){return this.$origin.srfdecodename}get srfkeyfile(){return this.$origin.srfkeyfile}get srfmajorfile(){return this.$origin.srfmajorfile}constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t.isOriginField)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a=!0){"srfuf"!==t&&(a||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=U(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),Ts=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(null==t?void 0:t.srfappid),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 t}toUIData(t){return new xs(t,this.dataUIMap)}}),Ls=t("MDControlService",class extends Ts{async fetch(t,e={}){var a;const s=(null==(a=this.model.fetchControlAction)?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=(null==(a=this.model.getControlAction)?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=(null==(a=this.model.getDraftControlAction)?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=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(s,t,void 0,e)}async create(t,e){var a;const s=(null==(a=this.model.createControlAction)?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=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let i=await this.exec(s,t,e.getOrigin());return i=this.handleResponse(i),i}async exportData(t,a,s={}){throw new e("未实现")}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&&(T(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),Os=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const s=this.entityModel;if(!s.enableDEMainState)return ibiz.log.debug("".concat(s.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,s);const i=le(s,e);if(i){ibiz.log.debug("匹配主状态",i);const e=he(i,s);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),Ms=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const a=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!a)throw new e("未找到应用实体[".concat(t,"]"));const s=this.constructorCache.get(t);let i;i=s?await s(a):new Os(a),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){if(!t)throw new e("没有appData数据");t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0)}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),s=await e.getOPPriv(t,a);if(this.enablePermission&&(null==s?void 0:s.mapSysUniResCode)&&!this.calcByResCode(s.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),Ns=t("V7AuthService",class{async login(t,e){try{const a=await ibiz.net.post("/v7/login",{loginname:t,password:e}),{data:s}=a;if(s&&s.token){L(o.TOKEN,s.token,0,!0);const t=(new Date).getTime()+1e3*(s.expirein||7199);L(o.TOKEN_EXPIRES,"".concat(t),0,!0)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),O(o.TOKEN),O(o.TOKEN_EXPIRES),!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}}),Rs=t("TreeNodeData",class{constructor(t,e,a){this.leaf=!1,this.leaf=!0===a.leaf,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}}),Vs=t("TreeCodeListNodeData",class extends Rs{constructor(t,e,a){super(t,e,a);const{data:s}=a;if(this.deData=s,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 e=de(t.appDataEntityId);this.context=Object.assign(this.context||{},{[e]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text,this.icon=this.calcIcon(t)}}),ks=t("TreeDataSetNodeData",class extends Rs{constructor(t,e,a){super(t,e,a);const{data:s}=a;if(this.deData=s,this.text=s.srfmajortext,this.value=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 e=de(t.appDataEntityId);this.context=Object.assign(this.context||{},{[e]:s.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext,this.icon=this.calcIcon(t),this.textHtml=this.calcTextHtml(t)}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=null==s?void 0:s.find((t=>"icon"===t.id));return i&&(e.htmlStr=this.calcDataItemScript(i)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return Ne.execScriptFn({data:this.deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,s=null==a?void 0:a.find((t=>"text"===t.id));return s&&(e=this.calcDataItemScript(s)),e}}),Fs=t("TreeStaticNodeData",class extends Rs{constructor(t,e,a){var s,i;super(t,e,a);const n="root"===t.nodeValue?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=n,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t.parent;(null==t?void 0:t.deData)&&(this.deData=t.deData),this.value=n||(null==t?void 0:t.value)}this.srfkey=(null==(s=this.deData)?void 0:s.srfkey)||this.value,this.srfmajortext=(null==(i=this.deData)?void 0:i.srfmajortext)||this.text,this.icon=this.calcIcon(t)}}),Ws=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,F(a.isOriginField)||(this.isOriginField=a.isOriginField)}}),Bs=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}}),Us=t("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 a=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!a)throw new e("未找到应用实体[".concat(t,"]"));const s=this.constructorCache.get(t);let i;i=s?await s(a):new Ss(a),this.cache.set(t,i)}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=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new c({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.deService=new Us(t),this.codeList=new Qa(t),this.authority=new Ms(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle()}async loadAppModelStyle(){await this.net.get("".concat(ibiz.env.remoteModelUrl,"/PSSYSAPP.json.css")).then((t=>{const e=document.createElement("style");if(e.setAttribute("type","text/css"),t.request&&t.request.responseURL){const a=new URL(t.request.responseURL);e.id=a.pathname}e.innerHTML=t.data,document.head.appendChild(e)})).catch((t=>{ibiz.log.error("应用[".concat(this.appId,"]模型全局样式加载失败:").concat(t.message))}))}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,s;let i=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!i&&e){i=null==(s=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:s.find((e=>e.name===t))}return i}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}}),zs=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(zs||{})),Gs=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Gs||{})),Hs=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Hs||{})),Xs=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new e("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Ks=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new Xs(l)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),Ys=t("CTXState",class{}),$s=t("CTX",class{constructor(t){this.parent=t,this.evt=new S(3e3),this.controllersMap=new Map,this.state=new Ys}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),qs=t("ActivityCounter",class extends Xs{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),Qs=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await ge(this.uiActionId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:s,uiactionMode:i,uiactionTag:n}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(s&&"NONE"!==s||"SYS"===i&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&!t):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),Js=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),Zs=t("QXEventEx",class extends S{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((a=>a(t,...e))),i=Promise.all(s),n=await a,r=await i;return n.concat(...r)}reset(){super.reset(),M(this.anyEventFns)}}),ti=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.evt=new Zs}async emit(t,e){await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.evt.on(t,e)}onAll(t){this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset()}});function ei(t,e){return(!F(t)&&""!==t||!F(e)&&""!==e)&&t!==e}function ai(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof xs&&(e=e.getOrigin()),e}function si(t,a,s){const i=[];return t.forEach((t=>{const{valueRuleType:n}=t,r=t.sysValueRule,o=t.defvalueRule;if("SYSVALUERULE"===n&&r)"REG"===r.ruleType?i.push({pattern:new RegExp(r.regExCode),message:r.ruleInfo,trigger:"change blur"}):"SCRIPT"===r.ruleType&&i.push({validator:(t,e,a,s)=>{if(!e)return!0;try{Ne.execScriptFn({rule:t,value:e,callback:a,source:s},r.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===n&&o){const t=s||a;i.push({validator:(a,s,i,n)=>{if(A(n[t]))return!0;const{isPast:r,infoMessage:c}=Re(t,n,o.groupCond);return r||i(new e(c||o.ruleInfo)),!0},trigger:"change blur"})}})),i}var ii="__self",ni=t("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 ti(this.getEventArgs.bind(this)),this.mountCounter=new qs(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}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(ii),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(ii)||this.mountCounter.attend(ii)}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(),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)}}),ri=t("ViewController",class extends ni{constructor(t,e,a,s){super(ibiz.util.layoutPanel.fill(t),i.create({},e),a||{},new $s(s)),this.session={},this.modal=new Ye({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Ks,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 null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this._isActive}onActivated(){this._isActive=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this._isActive=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=be(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e&&this.engines.push(e)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await Ja.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await pa(t);this.providers[t.name]=e;const a=De(this.model);a&&await Promise.all(a.map((async t=>{const e=await pa(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const s=Ce(this.model);s.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(s),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){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("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){this.context.srfappid=this.model.appId,(F(this.context.srfsessionid)||B(this.context.srfsessionid))&&(this.context.srfsessionid=x());const t=this.model.appViewNavContexts;let e={};P(t)&&(e=Zt(t,this.context,this.params)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let s={};P(a)&&(s=Zt(a,this.context,this.params)),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),void 0!==a)break;return a}async callUIAction(t,a){const s=this.call(t,a);if(void 0===s)throw new e("没有引擎支持预置界面行为".concat(t));return s}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEvent)}))}}),oi=(t("MobViewController",class extends ri{}),t("EditorController",class{constructor(t,e){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(){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]}))}handlePublicParams(t,e,a){const{navigateContexts:s,navigateParams:i}=this.model;let n={};s&&t&&(n=Zt(s,e,a,t));let r={};return i&&t&&(r=Zt(i,e,a,t)),{context:n,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}})),ci=(t("CodeListEditorController",class extends oi{async loadCodeList(t){const{context:e,params:s}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,s),a}throw new a(this.model,"请配置代码表")}}),t("ControlController",class extends ni{constructor(t,e,a,s){super(t,e,a,s),this.providers={},this.registerToCtx();const i=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));i&&(this.controlPanel=i)}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(){if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await pa(this.controlPanel);this.providers[this.controlPanel.name]=t}this.initControlScheduler(this.model.controlLogics)}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy()}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){return{context:this.context.clone(),params:{...this.params},data:(null==t?void 0:t.data)||this.getData()||[]}}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)}))}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}})),li=t("MDControlController",class extends ci{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(){await super.onCreated(),this.setSort()}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,n={...this.params};return a&&(n.page=e-1,n.size=a),!i&&s&&(n.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:s}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.params),n=await this.service.fetch(s,i);"number"==typeof n.total&&(this.state.total=n.total),a?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),t}finally{await this.endLoading()}return this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:a,params:s,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new e("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let n=!1;try{const e=de(this.model.appDataEntityId);await Promise.allSettled(i.map((async t=>{if(0!==t.srfuf){const i=a.clone();i[e]=t.srfkey,await this.service.remove(i,s),n=!0}this.afterRemove(i)}))),!0!==(null==t?void 0:t.silent)&&ibiz.notification.success({desc:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),n&&this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),t}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));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;h(e,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}))}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){}async exportData(t){}}),hi=t("AppMenuController",class extends ci{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),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async onClickMenuItem(t,s,i=!0){const n=d(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!n)throw new e("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:s}),!n.appFuncId)throw new a(n,"没有配置应用功能");const r=this.context.clone();this.routeDepth&&i&&Object.assign(r,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(ta.TAG,n.appFuncId,r,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(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));i=i&&e.includes(!0)}a.permitted=s,a.visible=i}return this.state.menuItemsState[t.id]=a,a}getAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};return e(this.model.appMenuItems),t}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}}),di=(t("AppMenuIconViewController",class extends hi{async onClickMenuItem(t,s){const i=d(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new e("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:s}),!i.appFuncId)throw new a(i,"没有配置应用功能");const n=this.context.clone();1===this.routeDepth&&Object.assign(n,{toRouteDepth:1}),await ibiz.commands.execute(ta.TAG,i.appFuncId,n,this.params)}}),t("CalendarService",class extends Ls{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const s=a.map((async a=>{const s=a.appDEDataSetId||"fetchdefault";return this.exec2(s,t,e,void 0,a.appDataEntityId)}));return(await Promise.all(s)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,a){const{sysCalendarItems:s}=this.model;if(!s)throw new e("未找到日历项模型");const i=s[a];if(!i)throw new e("未找到日历项模型");return t.map((t=>new Bs(i,t)))}async exec2(t,e,a={},s={},i=this.model.appDataEntityId){return await this.app.deService.exec(i,t,e,a,s)}}));t("CalendarController",class extends li{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new di(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.params);let i;await this.startLoading();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,await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),i}getCurSelectDate(t){const{selectedDate:e}=this.state,{start:a,end:s}=t;if(!a||!s){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{start:X(t).format("YYYY-MM-DD HH:mm:ss"),end:X(a).format("YYYY-MM-DD HH:mm:ss")}}return{start:a,end:s}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:s,noSort:i}=this.state,n={...this.params};!i&&s&&(n.sort=s),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),a&&(n.page=e-1,n.size=a),t&&Object.assign(n,t);const r=this.getCurSelectDate(n);return Object.assign(n,r),n}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});X.extend(K),X.extend(Y),X.extend($),X.extend(q),X.extend(Q);var ui="$default_group",pi=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:s,caption:i,id:n,userParam:r}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:o,chartYAxisId:c}=s||{};this.xAxisIndex=y(o),this.yAxisIndex=y(c),this.seriesName=i||n,this.staticOptions=this.calcStaticOptions(),r&&(this.seriesUserParam=yi(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(F(e))return;if(F(t))return e;const s=this.chartGenerator.codeListMap.get(t);if(null==s?void 0:s.length){const t=s.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}calcGroupData(t){this.groupData={};const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:s}=this.model;return t.forEach((t=>{let i=ui;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(F(e))return;i=e}if(!e[i]&&(e[i]=new Map,s&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(s).forEach((t=>{e[i].set(t.text,{value:0})}))}const n=this.translateVal(s,t[this.catalogField],!0);n&&(e[i].get(n)||e[i].set(n,{value:0}),e[i].get(n).value+=t[this.valueField],e[i].get(n).deData=t)})),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!==ui&&(i.name=e),this.seriesUserParam&&(i=G(i,this.seriesUserParam)),i}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{var s;e.push([a,t.value,null==(s=t.deData)?void 0:s.srfkey])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getSrfkeyByParams(t){return t.value[2]}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(U(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=X(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(X(t[this.catalogField]).format("YYYY"),"-").concat(X(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(X(t[this.catalogField]).format("YYYY"),"-").concat(X(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const s=t[a];let i=[];"DAY"===e||"YEAR"===e||"MONTH"===e?i=Array.from(s.keys()).sort(((t,e)=>X(t).diff(X(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(i=Array.from(s.keys()).sort(((t,e)=>{const[a,s]=t.split("-"),[i,n]=e.split("-");return a!==i?parseInt(a,10)-parseInt(i,10):parseInt(s,10)-parseInt(n,10)})));const n=new Map;i.forEach((t=>{n.set(t,s.get(t))})),t[a]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(X(e))}))}));const s=X.max(a),i=X.min(a);if("DAY"===e){let e=i;const a=s;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=i.year();const a=s.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=i.clone().startOf("month");const a=s.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),s=e.reduce(((t,e)=>e>t?e:t),e[0]),[i]=a.split("-"),[n]=s.split("-");for(let e=parseInt(i,10);e<=parseInt(n,10);e++)for(let a=1;a<=4;a++){const s="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(s)||t[e].set(s,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),s=e.reduce(((t,e)=>e>t?e:t),e[0]),[i]=a.split("-"),[n]=s.split("-");for(let e=parseInt(i,10);e<=parseInt(n,10);e++){const a=X("".concat(e,"-12-31")).isoWeek();for(let s=1;s<=a;s++){const a="".concat(e,"-").concat(s);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},mi=class extends pi{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:s}=this.model;return s&&(t.step="middle"),t}},fi=class extends pi{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},gi=class extends pi{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%({c})",t.label.position="outer",t}calcSeriesData(t){return Object.keys(t).map((e=>{var a;const s=t.get(e);return{name:e,value:[s.value,null==(a=s.deData)?void 0:a.srfkey]}}))}getSrfkeyByParams(t){return t.value[1]}},wi=class extends pi{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%({c})",t.label.position="outside",t}calcSeriesData(t){return Object.keys(t).map((e=>{var a;const s=t.get(e);return{name:e,value:[s.value,null==(a=s.deData)?void 0:a.srfkey]}}))}getSrfkeyByParams(t){return t.value[1]}},Ei=class extends pi{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},vi=class extends pi{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}}(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{Object.keys(t).forEach((e=>{a.updateIndicator(e,t.get(e).value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),s=Object.keys(e).map((t=>{const s=e[t],i=a.indicatorKeys.map((t=>s.has(t)?s.get(t):0));return{name:t===ui?this.seriesName:t,value:i}}));let i={...this.staticOptions,data:s};return this.seriesUserParam&&(i=G(i,this.seriesUserParam)),i}getSrfkeyByParams(t){return t.value[1]}};function yi(t){const e={};return t&&Object.keys(t).forEach((a=>{const s=a.indexOf(".");if(-1===s)return;const i=a.slice(s+1);if(i)try{e[i]=JSON.parse(t[a])}catch(s){e[i]=t[a]}})),e}var Ii=t("ChartService",class extends Ls{}),Di=(t("ChartController",class extends li{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Ii(this.model),await this.service.init(this.context),this.generator=new class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:s,chartYAxises:i,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==s?void 0:s.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(s)),(null==i?void 0:i.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(i)),n&&(this.chartUserParam=yi(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new mi(t,this);break;case"bar":e=new fi(t,this);break;case"scatter":e=new Ei(t,this);break;case"pie":e=new wi(t,this);break;case"funnel":e=new gi(t,this);break;case"radar":e=new vi(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:s,titlePos:i}=t,n={show:e,text:a,subtext:s,left:"center"},r=null==i?void 0:i.toLowerCase();return"left"===r||"right"===r?n.left=r:"bottom"!==r&&"top"!==r||(n.top=r),n}calcLegendOption(t){var e;const{showLegend:a,legendPos:s}=t,i={};i.show=a,1===(null==(e=this.model.dechartSerieses)?void 0:e.length)&&(i.show=!1);const n=null==s?void 0:s.toLowerCase();return"left"===n||"right"===n?(i.left=n,i.top="middle",i.orient="vertical"):"bottom"===n&&(i.top=n),i}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:s,userParam:i}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>1===s?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===s&&t.length>4?"".concat(t.slice(0,4),"..."):t,rotate:3===s?45:0}};i&&(n=G(n,yi(i))),e.push(n)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const s=ibiz.hub.getApp(t.srfappid),i=async a=>{if(!a||this.codeListMap.has(a))return;const i=await s.codeList.get(a,t,e);this.codeListMap.set(a,i)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await i(e),await i(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s)})),this.options.series=e,this.options=G(this.staticOptions,this.options),this.chartUserParam&&(this.options=G(this.options,this.chartUserParam)),this.options}getSrfkeyByParams(t){const a=this.seriesGenerators[t.seriesIndex];if(!a)throw new e("找不到".concat(t.seriesIndex,"序列的generator!"));return a.getSrfkeyByParams(t)}}(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getSrfkeyByParams(t),a=this.state.items.find((t=>t.srfkey===e));console.log("实体数据",a)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new e("chart对象没有正确初始化");if(!this.options)throw new e("options还没计算");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(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends ci{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.state.caption).concat(e?"-".concat(e):"")}))}}),class{}),Ci=class extends Di{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,i){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=i[this.value]?i[this.value]:e[this.value];return _e(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return _e(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new s(this.model,"暂未支持条件值类型为[当前时间]");default:return _e(n[this.dstField],this.op,this.value)}}},bi=class t extends Di{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Ci(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,s){let i=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,s);if("AND"===this.op&&!1===n){i=!1;break}if("OR"===this.op&&!0===n){i=!0;break}}return this.notMode?!i:i}},Pi=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===e&&a&&(this.groupCond=new bi(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:i}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,i&&i.length>0?i[0]:{});case 1:return!0;case 2:throw new s(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new s(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new s(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new s(this.model,"未支持的逻辑连接类型:".concat(e))}}}(t)))}},Ai=class extends Pi{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:s,dstDEUILogicParamId:i,retDEUILogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!s)throw new a(this.model,"未指定实体行为");const r=t.params[i],o=ibiz.hub.getApp(t.context.srfappid),c=await o.deService.exec(e,s,t.context,r,t.viewParams);c.ok&&(t.params[n]=c.data)}},_i=class extends Pi{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:s}=this.model,{data:i,parameters:n}=t;if(!e)throw new a(this.model,"未配置界面行为");let r=[i];if(s){const e=t.params[s];r=e instanceof Array?e:[e]}await ki.execAndResolved(e,{...n,data:r})}},Si=class extends Pi{async exec(t){}},xi=class extends Pi{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:i}=this.model;switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=a;break;case"LOGICPARAM":t.result=t.params[i];break;default:throw new s(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}};function Ti(t,e){const{srcDEUILogicParamId:a,srcFieldName:i,srcValue:n}=e,r=e.srcValueType||"SRCDLPARAM";let o;switch(r){case"SRCDLPARAM":o=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return n;case"VIEWPARAM":o=t.viewParams;break;case"APPDATA":o=t.context;break;case"ENVPARAM":o=U(ibiz.env);break;default:throw new s(e,"暂未支持源值类型".concat(r))}const c=null==i?void 0:i.toLowerCase();return o&&c&&(o=o[c]),o}var Li=class extends Pi{async exec(t){const e=this.model.deuilogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{if("SETPARAMVALUE"===e.paramAction)return this.setParamValue(e,t);throw new s(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))})))}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:s}=t,i=null==a?void 0:a.toLowerCase(),n=Ti(e,t);i?e.params[s][i]=n:e.params[s]=n}},Oi=class extends Pi{async exec(t){t.isEndNode=!0;const{invokeMethod:s,invokeCtrlId:i,invokeParamId:n}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!n)throw new a(this.model,"没有配置操作参数");if(!s)throw new a(this.model,"没有配置调用方法");const r=t.params[n];if(!r)throw new e("没有找到操作参数".concat(n));const o=t.params[i];if(!o)throw new e("没有找到界面对象".concat(i));if(!o[s]||!b(o[s]))throw new e("没有找到调用方法".concat(s));await o[s](r)}},Mi=class extends Pi{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const i=Ti(t,this.model);t.params[e]=i}},Ni=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Si(t);break;case"END":a=new xi(t);break;case"DEACTION":a=new Ai(t);break;case"DEUIACTION":a=new _i(t);break;case"PREPAREJSPARAM":a=new Li(t);break;case"BINDPARAM":a=new Mi(t);break;case"VIEWCTRLINVOKE":a=new Oi(t);break;default:throw new s(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model,{context:n,viewParams:r,data:o,parameters:c}=t,l=ibiz.hub.getApp(n.srfappid);if(i.default)t.params[e]=o&&o.length>0?o[0]:{};else if(i.activeContainerParam)t.params[e]=c.ctrl||c.view;else if(i.activeCtrlParam)t.params[e]=c.ctrl;else if(i.ctrlParam){const s=c.view.getController(i.codeName.toLowerCase());if(!s)throw new a(this.model,"视图逻辑初始化参数,未找到".concat(i.codeName,"指定部件对象"));t.params[e]=s}else if(i.activeViewParam)t.params[e]=c.view;else if(i.appGlobalParam)t.params[e]=ibiz.env;else if(i.applicationParam)t.params[e]=l;else if(i.entityListParam)t.params[e]=[];else{if(i.entityPageParam)throw new s(i,"未支持的逻辑参数类型: 分页查询结果");if(i.entityParam)t.params[e]={};else{if(i.lastReturnParam)throw new s(i,"未支持的逻辑参数类型: 上次调用返回");if(i.navContextParam)t.params[e]=n;else{if(i.navViewParamParam)throw new s(i,"未支持的逻辑参数类型: 视图路由参数");if(i.routeViewSessionParam)throw new s(i,"未支持的逻辑参数类型: 路由视图会话");if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.viewNavDataParam)t.params[e]=r;else if(i.viewSessionParam)throw new s(i,"未支持的逻辑参数类型: 当前视图会话")}}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new s(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}}(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get context(){return this.parameters.context}get data(){return this.parameters.data}get viewParams(){return this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}}(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:s}=this.model;if(!s||!this.nodes.has(s))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(s);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let s=0;s<a.length;s++){const i=a[s];if(await i.exec(e)&&i.dstNode&&(await this.deepExec(i.dstNode,e),!1===t.model.parallelOutput))break}}},Ri=new Map;async function Vi(t,a,s){const i=ibiz.hub.getApp(s.context.srfappid),n=await i.getDEUILogic(t,a);if(!n)throw new e("找不到实体".concat(a,"的界面逻辑").concat(t));Ri.has(n)||Ri.set(n,new Ni(n));const r=Ri.get(n);return await r.exec(s),null}var ki=t("UIActionUtil",class{static async exec(t,a){const s=await ge(t);if(!s)throw new e("没找到".concat(t,"的界面行为模型"));return(await xa(s)).exec(s,a)}static async execAndResolved(t,e){var a,s;const i=await this.exec(t,e);if(i.closeView)e.view.closeView({ok:!0});else if(i.refresh)switch(i.refreshMode){case 1:await e.view.callUIAction("Refresh");break;case 2:await(null==(a=e.view.parentView)?void 0:a.callUIAction("Refresh"));break;case 3:await(null==(s=e.view.getTopView())?void 0:s.callUIAction("Refresh"))}}}),Fi=class{async exec(t,e){const{context:s,params:i,data:n}=e,r={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:o,appDataEntityId:c,uilogicAttachMode:l}=t;if("REPLACE"===l){if(!o)throw new a(t,"没有配置实体界面逻辑");return await Vi(o,c,e),r}if(!await this.isConfirm(t))return this.returnError(r);const h=await this.execAction(t,e);if(Object.assign(r,h),!0===r.cancel)return this.returnError(r);const d=await this.doNextAction(t,{...e,context:r.nextContext||s,data:r.data||n,params:r.nextParams||i});if(d&&(Object.assign(r,d),!0===d.cancel))return this.returnError(r);if("AFTER"===t.uilogicAttachMode){if(!o)throw new a(t,"没有配置实体界面逻辑");await Vi(o,c,e)}return r}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t){return!t.enableConfirm||!t.confirmMsg||ibiz.modal.confirm({title:t.confirmMsg})}async doNextAction(t,e){const a=t.nextId;if(a)return ki.exec(a,e)}async handleParams(t,e,a,s){let i=[];const n=de(t.appDataEntityId);switch(t.actionTarget){case"NONE":i=[];break;case"SINGLEDATA":i=[a[0]];break;case"MULTIDATA":i=a;break;case"MULTIKEY":i=n&&a.length>0?a.map((t=>({[n]:t.srfkey||t[n]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};i=n?[{[n]:t.srfkey||t[n]}]:[{}]}}const r=e.clone(),o=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,s=a||n,i=e||"srfkey";o.unshift({key:s,value:i,rawValue:!1})}const c=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,l=Zt(o,e,s,c?se(o,a):a[0]||{});Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:i,resultParams:Zt(h,r,s,c?se(h,a):a[0]||{})}}},Wi=t("BackendUIActionProvider",class extends Fi{async execAction(t,e){const{context:s,params:i,data:n,event:r}=e,o={},c=t.appDataEntityId,l=t.appDEMethodId;if(!c||!l)throw new a(t,"未配置实体或实体行为");const{resultContext:h,resultParams:d,resultData:u}=await this.handleParams(t,s,n,i),p=t.frontAppViewId;if(p){const t=await ibiz.commands.execute(Je.TAG,p,h,d,{event:r});if(!(null==t?void 0:t.ok))return o.cancel=!0,o;(null==t?void 0:t.ok)&&t.data&&(0===u.length&&u.push({}),u.forEach((e=>{e.srfactionparam=t.data})))}const m=ibiz.hub.getApp(null==s?void 0:s.srfappid),f=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})),g=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),w=await m.deService.exec(c,l,h,g?f:f[0],d);return w.ok&&t.successMsg&&ibiz.message.success(t.successMsg),Object.assign(o,{data:T(w.data)?w.data:[w.data],nextContext:h,nextParams:d}),o}}),Bi=t("SysUIActionProvider",class extends Fi{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"]])}async execAction(t,e){const{view:a}=e,s=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===s)return{closeView:!0};return await a.callUIAction(s,e)||{}}}),Ui=t("FrontUIActionProvider",class extends Fi{async execAction(t,e){const{context:i,params:n,data:r,event:o,noWaitRoute:c}=e;let l={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=u.fill(t.htmlPageUrl,i,null==r?void 0:r[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:s,resultParams:h}=await this.handleParams(t,i,r,n),d=await ibiz.commands.execute(Je.TAG,e,s,h,{event:o,noWaitRoute:c});(null==d?void 0:d.ok)||(l.cancel=!0),(null==d?void 0:d.ok)&&d.data&&(l.data=d.data,l.nextContext=s,l.nextParams={...n,...h});break}case"OTHER":l=this.doOther(t,e);break;default:throw new s(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return l}doOther(t,e){const{scriptCode:s}=t,{context:i,params:n,data:r,event:o}=e;if(s){return Ne.execScriptFn({context:i,params:n,data:r,el:null==o?void 0:o.target},s)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}}),ji=t("WFWithdrawUIActionProvider",class extends Fi{async execAction(t,e){const{view:a}=e;let s=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),s=!0),{refresh:!1,closeView:s}}});function zi(){const t=new Ui;_a("FRONT",(()=>t));const e=new Wi;_a("BACKEND",(()=>e));const a=new Bi;_a("SYS",(()=>a));const s=new ji;_a("DEUIACTION_WFWithdraw",(()=>s))}var Gi=t("ToolbarController",class extends ci{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new Js,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const s=t.uiactionId,i=await this.ctx.view.call("GetData")||[],n=this.getEventArgs();n.params=Object.assign(a,n.params),await ki.execAndResolved(s,{...n,data:i,event:e})}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,p(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new Qs(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.state.buttonsState.update()}async onItemClick(t,e,a){this.state.buttonsState.setLoading(t.id);const s="extra"===t.buttonType;try{await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:s?"extra":"deuiaction"}),s||await this.doUIAction(t,e,a)}finally{this.state.buttonsState.setLoading("")}}async calcButtonState(t,e){let a=t;t&&t instanceof xs&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler&&a&&p(this.model,(t=>{const e=this.state.buttonsState[t.id];if(e.visible){const s=this.scheduler.triggerItemVisible(t.id,{data:[a]});void 0!==s&&(e.visible=s)}if(!e.disabled){const s=this.scheduler.triggerItemEnable(t.id,{data:[a]});void 0!==s&&(e.disabled=!s)}}),{childrenFields:["detoolbarItems"]})}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];p(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}}),Hi=t("ContextMenuController",class extends Gi{}),Xi=(t("DashboardController",class extends ci{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=ai(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){(null==t?void 0:t.length)&&await Promise.all(t.map((async t=>{var a;const s=await Na(t);if(s){this.providers[t.id]=s;const i=await s.createController(t,this,e);this.portlets[t.id]=i,(null==(a=t.controls)?void 0:a.length)&&await this.initPortlets(t.controls,i)}})))}async dataChangeNotify(t){const a=await Promise.allSettled(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))));if(a.find((t=>"rejected"===t.status)))throw ibiz.log.error("dataChangeNotify报错",a),new e("数据变更后有错误")}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),Ki=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=oe(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new Xi}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Js;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const s=new Qs(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,s)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:s}=this.dashboard.view.model;s&&this.dashboard.view.evt.on("onDataChange",(t=>{let e=t.data[0];e&&e instanceof xs&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,s)}))}async onActionClick(t,e,a=[]){const s=t.uiactionId;await ki.execAndResolved(s,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e})}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=ce(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}}),Yi=(t("ContainerPortletController",class extends Ki{}),t("ViewPortletController",class extends Ki{}),t("DataViewControlService",class extends Ls{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let s;if(a){const t=a.toLowerCase();s=new Ws(e,t,{isOriginField:!0})}else s=new Ws(e,e);this.dataUIMap.set(e,s)}))}})),$i=(t("DataViewControlController",class extends li{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new Yi(this.model),await this.service.init(this.context)}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const s=new Js,i=this.getOptItemModel();if(i){if(!i.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=i.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),s;i.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Qs(t.id,this.context.srfappid,e);s.addState(t.id,a)}})),s.update(t.getOrigin())}return s}async onActionClick(t,e,a){const s=t.uiactionId;await ki.execAndResolved(s,{context:this.context,params:this.params,data:[e],view:this.view,event:a})}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const s=a.get(e[t])||[];s.push(e),a.set(e[t],s)}));const s=[];a.forEach(((t,e)=>{s.push({caption:e,children:[...t]})})),this.state.groups=s}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,s=[],i=ibiz.hub.getApp(this.context.srfappid),n=await i.codeList.get(e,this.context,this.params),r=[];n.forEach((e=>{const i=a.filter((a=>a[t]===e.value));s.push({caption:e.text,children:[...i]}),r.push(e.value)}));const o=a.filter((e=>-1===r.indexOf(e[t])));o.length>0&&s.push({caption:"其他",children:[...o]}),this.state.groups=s}}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.model;this.state.sortQuery=t&&e?"".concat(t.toLowerCase(),",").concat(e.toLowerCase()):""}}}),t("ExpBarControlController",class extends ci{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),s=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&s.push(t.logicName)})),s.length>0&&(this.state.placeHolder=s.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onBeforeLoad",(()=>{const t={};this.state.query&&(t.query=this.state.query),this.xDataController.state.searchParams=t}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)}))}xDataLoadSuccess(t){t.isInitialLoad&&(this.state.srfnav&&this.routeDepth?this.defaultNavBySrfnav():this.defaultNavByFirstItem())}defaultNavBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));e&&this.xDataController.setSelection([e]),this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav},context:this.context})}defaultNavByFirstItem(){const t=this.xDataController.state.items[0];t&&(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:n,navigateContexts:r,navigateParams:o,appDataEntityId:c}=t,l={deName:c?de(c):void 0,navFilter:n,pickupDEFName:null==i?void 0:i.pickupDEFName,navContexts:r,navParams:o},h={context:a,params:s,data:e},{resultContext:d,resultParams:u}=ie(l,h);return{context:Object.assign(a.clone(),d,{currentSrfNav:e[this.navKeyName]}),params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new e("多节点视图由子类实现")}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}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}})),qi=(t("CalendarExpBarController",class extends $i{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}defaultNavBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.defaultNavBySrfnav(),!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,{key:t.navId,context:a,params:s,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends $i{constructor(){super(...arguments),this.navKeyName="id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,a,s){const i=t.id,n=t.deData||t,r=this.getNodeModel(t.nodeId);if(!r)throw new e("找不到".concat(t.nodeId,"的节点模型"));const o=this.prepareParams(r,n,a,s);return o.context.currentSrfNav=i,{key:i,viewId:r.navAppViewId,...o}}defaultNavByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t.nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;if(null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav){const t=[];this.state.srfnav.split(":").forEach(((e,a)=>{0===a?t.push(e):t.push("".concat(t[a-1],":").concat(e))})),t.pop(),this.defaultExpandedKeys=t}}}),t("FormController",class extends ci{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new xs,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){const a=await Promise.allSettled(Object.values(this.details).map((async e=>e.dataChangeNotify(t))));if(a.find((t=>"rejected"===t.status)))throw ibiz.log.error("dataChangeNotify报错",a),new e("数据变更后有错误")}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=m(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200)}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 t=>{const s=await va(t);if(!s)return;e.providers[t.id]=s;const i=await s.createController(t,e,a);e.details[t.id]=i,"FORMITEM"!==t.detailType&&"MDCTRL"!==t.detailType||e.formItems.push(i);const n=Ie(t);n.length&&await this.initDetailControllers(n,e,i)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||ei(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 validate(){return-1===(await Promise.all(this.formItems.map((t=>t.validate())))).findIndex((t=>!t))}})),Qi=t("SearchFormService",class extends Ts{async getDraft(t,e={}){let a={ok:!0,status:200,data:{...e}};return a=this.handleResponse(a),a}initUIDataMap(){p(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new Ws(e,e))}}),{childrenFields:["deformPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}}),Ji=(t("SearchFormController",class extends qi{async onCreated(){await super.onCreated(),this.service=new Qi(this.model),await this.service.init(this.context),await this.load()}async load(){const t={...this.params},e=await this.getDraftParams();Object.assign(t,e),await this.evt.emit("onBeforeLoadDraft",{params:t});const a=await this.service.getDraft(this.context,t);return this.state.data=a.data,f(this.data,e),this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.data}getParams(){return{...this.data.getOrigin()}}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),Zi=t("FormDetailController",class{get data(){return this.form.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}constructor(t,e,a){this.model=t,this.form=e,this.parent=a,this.state=this.createState()}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:e,height:a}=oe(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}createState(){var t;return new Ji(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],t),this.calcDynaClass(this.data)}calcDynamicLogic(t,e){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const s=a.relatedDetailNames||[];if(e||g(s,t))try{const t=ke(this.form.data,a);switch(a.logicCat){case"ITEMBLANK":this.state.required=!t;break;case"ITEMENABLE":this.state.disabled=!t;break;case"PANELVISIBLE":this.state.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=ce(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=ce(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}}),tn=t("FormButtonState",class extends Ji{constructor(){super(...arguments),this.loading=!1}}),en=(t("FormButtonController",class extends Zi{createState(){var t;return new tn(null==(t=this.parent)?void 0:t.state)}get data(){return this.form.data}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}}async doUIAction(t){const e=this.model.uiactionId;await ki.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0})}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends Ji{constructor(){super(...arguments),this.showMask=!1}})),an=(t("FormDRUIPartController",class extends Zi{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new en(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),g(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,this.state.showMask=this.isNewData,this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;P(e)&&(t=Object.assign(t,Zt(e,this.form.context,this.form.params,this.form.data)));const a=Zt(this.model.navigateParams,this.form.params,this.form.context,this.form.data);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=x(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.callUIAction("Refresh")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends Ji{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),sn=t("FormGroupPanelController",class extends Zi{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new an(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){super.calcDynamicLogic([],t),this.state.actionGroupState&&this.state.actionGroupState.update(this.form.data.getOrigin())}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Js;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const s=new Qs(t.id,this.form.context.srfappid,e);a.addState(t.id,s)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await ki.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e})}}),nn=t("FormItemState",class extends Ji{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),rn=(t("FormItemController",class extends Zi{constructor(t,e,a){super(t,e,a),this.rules=[],this.context=e.context,this.params=e.params}createState(){var t;return new nn(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.fieldName||this.model.id}get value(){return this.form.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty,this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await ga(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){const t=$e(this.form.model.deformItemVRs||[],this.name);t&&(this.rules=si(t,this.name,this.valueItemName),this.validator=new J({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;t?(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0):this.state.enableCondDisabled=!0}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond(),"LOAD"===t&&this.setDefaultValue(!1)}calcDynamicLogic(t,e){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&A(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t)}setDefaultValue(t,a=this.data){var i;const{createDVT:n,createDV:r,updateDVT:o,updateDV:c}=this.model,l=t?n:o,h=t?r:c;if("RESET"!==l){if(!(this.value||A(l)&&A(h)))if(l||!h)switch(l){case"APPDATA":Object.prototype.hasOwnProperty.call(this.params,h)&&(a[this.name]=this.params[h]),Object.prototype.hasOwnProperty.call(this.context,h)&&(a[this.name]=this.context[h]);break;case"OPERATORNAME":a[this.name]=this.context.srfusername;break;case"OPERATOR":a[this.name]=this.context.srfuserid;break;case"CURTIME":a[this.name]=X().format(this.model.valueFormat);break;case"PARAM":a[this.name]=this.data[h];break;case"SESSION":case"APPLICATION":if(!(null==(i=ibiz.appData)?void 0:i.context))throw new e("appdata.context不存在");a[this.name]=ibiz.appData.context[h];break;case"CONTEXT":a[this.name]=this.params[h];break;case"UNIQUEID":a[this.name]=x();break;default:throw new s(this.model,"默认值类型[".concat(l,"]未支持"))}else a[this.name]=h}else a[this.name]=null}}),t("FormMDCtrlContentTypeController",class{constructor(t){this.parent=t,this.model=this.parent.model}get data(){return this.parent.state.contentCtrlData}async onInit(){}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}onDataItemChange(t,e){this.parent.state.contentCtrlData[e]=t,this.parent.setFormDataValue()}onDataRemove(t){t<0||(this.parent.state.contentCtrlData.splice(t,1),this.parent.setFormDataValue())}onDataInsert(t){this.parent.state.contentCtrlData.push(t||{}),this.parent.setFormDataValue()}async initData(){const t=this.model.appDEFieldId||this.model.fieldName||this.model.id;t&&("REPEATER"===this.model.contentType&&"STYLE3"===this.model.detailStyle?this.parent.state.contentCtrlData=this.parent.data[t]||{}:this.parent.state.contentCtrlData=this.parent.data[t]||[])}async validate(){return!0}})),on=t("FormMDCtrlControlController",class extends rn{async onInit(){const{model:t}=this.parent,{contentControl:a}=t;if(!a)throw new e("表单多数据部件未配置嵌入部件");this.controlModel=a;const s=await pa(this.controlModel);s&&(this.provider=s)}}),cn=t("FormMDCtrlDataViewController",class extends on{constructor(){super(...arguments),this.selectData=[],this.state={isSelect:!1}}onDataViewMounted(t){this.dataViewController=t.ctrl}onSelectionChange(t){this.state.isSelect=t.data.length>0}onDataRemove(){this.dataViewController.remove(),this.parent.state.contentCtrlData=this.dataViewController.state.items,this.parent.setFormDataValue()}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}async initData(){this.dataViewController.load()}async onDataInsert(){}}),ln=t("EditFormService",class extends Ts{async get(t,e={}){var a;let s=await this.exec((null==(a=this.model.getControlAction)?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((null==(a=this.model.getDraftControlAction)?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((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;let s=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,e instanceof xs?e.getOrigin():e);return s=this.handleResponse(s),s}async update(t,e){var a;let s=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,e instanceof xs?e.getOrigin():e);return s=this.handleResponse(s),s}async goBack(t,e){var s;const i=null==(s=this.model.goBackControlAction)?void 0:s.appDEMethodId;if(!i)throw new a(this.model,"缺少返回操作实体行为");let n=await this.exec(i,t,e instanceof xs?e.getOrigin():e);return n=this.handleResponse(n),n}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 i=(null==(s=this.model.wfstartControlAction)?void 0:s.appDEMethodId)||"wfstart";return(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(i,t,e,a instanceof xs?a.getOrigin():a)}async wfSubmit(t,e,a){var s;const i=this.model;let n="";n=e.type?e.type:(null==(s=i.wfsubmitControlAction)?void 0:s.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(this.model.appDataEntityId)).wf.exec(n,t,e,a instanceof xs?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];p(this.model,(e=>{if("FORMITEM"===e.detailType){const a=e,s=a.fieldName||a.id.toLowerCase(),i=a.fieldName||e.appDEFieldId;let n;n=i?new Ws(s,i,{isOriginField:!0}):new Ws(s,s,{isOriginField:t.includes(s)}),this.dataUIMap.set(s,n)}if("MDCTRL"===e.detailType){const t=e,a=t.fieldName||t.id.toLowerCase(),s=t.fieldName||e.appDEFieldId;let i;i=new Ws(a,s||a,{isOriginField:!0}),this.dataUIMap.set(a,i)}}),{childrenFields:["deformPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}}),hn=t("EditFormController",class extends qi{async onCreated(){await super.onCreated(),this.service=new ln(this.model),await this.service.init(this.context),this.autoSave=D(this.autoSave.bind(this),500,{trailing:!0})}async loadDraft(){const t={...this.params},e=await this.getDraftParams();let a;Object.assign(t,e);try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:t}),a=await this.service.getDraft(this.context,t)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),t}finally{await this.endLoading()}return this.state.data=a.data,f(this.data,e),this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.state.isLoaded=!0,this.data}async load(){if(!ue(this.context,this.model.appDataEntityId))return this.loadDraft();const t={...this.params};let e;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),e=await this.service.get(this.context,t)}catch(t){throw await this.evt.emit("onLoadError",void 0),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=e.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.state.isLoaded=!0,this.data}async save(){if(this.state.processing){return await w(500,this.save.bind(this))}if(!await this.validate())throw new e("请检查表单填写!");let t;await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);try{t=0===this.data.srfuf?await this.service.create(this.context,this.data):await this.service.update(this.context,this.data)}catch(t){throw await this.evt.emit("onSaveError",void 0),t}finally{await this.endLoading()}return t.data&&E(this.data,t.data),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),ibiz.message.success("".concat(this.data.srfmajortext||"","保存成功")),this.data}async remove(){let t,e=!1;if(await this.evt.emit("onBeforeRemove",void 0),1===this.data.srfuf){if(e=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!e)return!1;await this.startLoading();try{t=await this.service.remove(this.context,this.params)}catch(t){throw await this.evt.emit("onRemoveError",void 0),t}finally{await this.endLoading()}e=t.ok}return this.state.data=new xs,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),e}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}t.data&&E(this.data,t.data)}async updateFormItem(t){var a;const s=null==(a=this.model.deformItemUpdates)?void 0:a.find((e=>e.id===t));if(!s)throw new e("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:n}=s,r=n.map((t=>t.id)),o={...this.params,...this.data.getOrigin()},c=(await this.service.updateFormItem(i,this.context,o)).data;c&&(null==r?void 0:r.length)&&await Promise.all(r.map((t=>this.setDataValue(t,c[t]))))}async wfStart(t={}){if(!await this.validate())throw new e("请检查表单填写!");await this.startLoading();try{await this.service.wfStart(this.context,{...this.params,...t},this.data)}finally{await this.endLoading()}ibiz.message.success("流程启动成功")}async wfSubmit(t={}){if(!await this.validate())throw new e("请检查表单填写!");await this.startLoading();try{await this.service.wfSubmit(this.context,{...this.params,...t},this.data)}finally{await this.endLoading()}ibiz.message.success("流程提交成功")}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(this.model.enableAutoSave)try{await this.save()}catch(t){ibiz.log.error(t)}}}),dn=t("FormMDCtrlFormController",class extends on{constructor(){super(...arguments),this.controlControllerArray=[],this.state={data:[]}}onControlMounted(t,e){const a=t.ctrl;this.controlControllerArray[e]=a,a.load()}async onInit(){super.onInit(),this.service=new ln(this.model.contentControl),await this.service.init(this.parent.form.context)}async fetch(t,e={}){let a=await this.service.exec("fetchdefault",t,e);return a=this.handleResponse(a),a}handleResponse(t){const e=t;return e.ok&&(C(e.data)?e.data=e.data.map((t=>this.service.toUIData(t))):e.data=this.service.toUIData(e.data)),e}async initData(){const t=await this.fetch(this.parent.form.context,this.parent.form.params);this.state.data=t.data}onDataRemove(t){const e=this.controlControllerArray[t];e&&e.remove()}onFormChange(t,e){const a=this.controlControllerArray[e];a&&(a.save(),this.state.data[e]&&E(this.state.data[e],t[0]),this.parent.state.contentCtrlData=this.state.data,this.parent.setFormDataValue())}onFormRemoveSuccess(t){this.state.data.splice(t,1),this.controlControllerArray.splice(t,1),this.parent.state.contentCtrlData=this.state.data,this.parent.setFormDataValue()}async onDataInsert(){const t=await this.service.getDraft(this.parent.form.context,this.parent.form.params);if(t.data){const e=await this.service.create(this.parent.form.context,t.data);this.state.data.push(e.data),this.parent.state.contentCtrlData=this.state.data,this.parent.setFormDataValue()}}async validate(){return-1===(await Promise.all(this.controlControllerArray.map((t=>t.validate())))).findIndex((t=>!t))}}),un=t("FormMDCtrlGridController",class extends on{constructor(){super(...arguments),this.selectData=[],this.state={isSelect:!1}}onGridMounted(t){this.gridController=t.ctrl}onSelectionChange(t){this.state.isSelect=t.data.length>0}onDataRemove(){this.gridController.remove(),this.parent.state.contentCtrlData=this.gridController.state.items,this.parent.setFormDataValue()}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}async initData(){this.gridController.load()}async onDataInsert(){await this.gridController.newRow(),this.parent.state.contentCtrlData=this.gridController.state.items,this.parent.setFormDataValue()}async onInit(){const{model:t}=this.parent,{contentControl:a}=t;if(!a)throw new e("表单多数据部件未配置嵌入部件");E(a,{enableRowEdit:!0,enableRowNew:!0}),this.controlModel=a;const s=await pa(this.controlModel);s&&(this.provider=s)}async validate(){const{rows:t}=this.gridController.state;return-1===(await Promise.all(t.map((t=>this.gridController.validate(t))))).findIndex((t=>!t))}}),pn=t("FormMDCtrlListController",class extends on{constructor(){super(...arguments),this.selectData=[],this.state={isSelect:!1}}onListMounted(t){this.listController=t.ctrl}onSelectionChange(t){this.state.isSelect=t.data.length>0}onDataRemove(){this.listController.remove(),this.parent.state.contentCtrlData=this.listController.state.items,this.parent.setFormDataValue()}onDataChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}async initData(){this.listController.load()}async onDataInsert(){}}),mn=t("FormMDCtrlRepeaterFormController",class extends rn{constructor(){super(...arguments),this.formControllerArray=[]}async onDataInsert(){super.onDataInsert({})}onDataRemove(t){t<0||super.onDataRemove(t)}async validate(){const t=this.formControllerArray.map((t=>t.validate()));return-1===(await Promise.all(t)).findIndex((t=>!t))}setFromController(t){this.formControllerArray.push(t)}}),fn=t("FormMDCtrlRepeaterFormOneController",class extends mn{get data(){return this.parent.state.contentCtrlData}onDataItemChange(t){this.parent.state.contentCtrlData=t,this.parent.setFormDataValue()}}),gn=t("FormMDCtrlRepeaterGridController",class extends rn{constructor(){super(...arguments),this.columns=[],this.editorMap={}}async onInit(){this.initColumns(this.model.deformDetails||[])}initColumns(t){t.forEach((async t=>{if("FORMITEM"===t.detailType){const{editor:e}=t,a=await ga(e);if(a){const s=await a.createController(e,{unitName:e.unitName,valueFormat:e.valueFormat,context:this.parent.form.context,params:this.parent.form.params});this.editorMap[t.codeName]={provider:a,controller:s}}this.columns.push({codeName:t.codeName,caption:t.caption})}const e=Ie(t);e.length&&this.initColumns(e)}))}rowDataChange(t,e,a){const s=this.data[a];Object.prototype.hasOwnProperty.call(s,e)&&!ei(s[e],t)||(s[e]=t,this.onDataItemChange(s,a))}}),wn=t("FormMDCtrlState",class extends Ji{constructor(){super(...arguments),this.contentCtrlData=[]}}),En=(t("FormMDCtrlController",class extends Zi{createState(){var t;return new wn(null==(t=this.parent)?void 0:t.state)}async onInit(){switch(await super.onInit(),this.model.contentType){case"FORM":this.mdCtrlContentController=new dn(this);break;case"GRID":this.mdCtrlContentController=new un(this);break;case"LIST":this.mdCtrlContentController=new pn(this);break;case"DATAVIEW":this.mdCtrlContentController=new cn(this);break;case"REPEATER":"DEFAULT"===this.model.detailStyle&&(this.mdCtrlContentController=new mn(this)),"STYLE3"===this.model.detailStyle&&(this.mdCtrlContentController=new fn(this)),"STYLE2"===this.model.detailStyle&&(this.mdCtrlContentController=new gn(this))}this.mdCtrlContentController&&await this.mdCtrlContentController.onInit()}setFormDataValue(){const t=this.model.appDEFieldId||this.model.fieldName||this.model.id;t&&this.form.setDataValue(t,this.state.contentCtrlData)}async loadData(){await this.mdCtrlContentController.initData()}async validate(){return this.mdCtrlContentController.validate()}setDefaultValue(){}}),t("FormMDCtrlItemController",class extends hn{constructor(t,e,a,s,i){super(t,e,a,s),this.state.data=i,this.state.isSimple=!0}async initDetailControllers(t=this.model.deformDetails,e=this,a=void 0){await Promise.all(t.map((async t=>{const s=await va(t);if(!s)return;e.providers[t.id]=s;const i=await s.createController(t,e,a);e.details[t.id]=i,"FORMITEM"!==t.detailType&&"MDCTRL"!==t.detailType||e.formItems.push(i);const n=Ie(t);n.length&&await this.initDetailControllers(n,e,i)})))}}),t("FormPageState",class extends an{})),vn=(t("FormPageController",class extends sn{createState(){var t;return new En(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Ji{})),yn=(t("FormRawItemController",class extends Zi{createState(){var t;return new vn(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Ji{})),In=(t("FormTabPageController",class extends Zi{createState(){var t;return new yn(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPanelState",class extends Ji{})),Dn=(t("FormTabPanelController",class extends Zi{createState(){var t;return new In(null==(t=this.parent)?void 0:t.state)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return Ne.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),Cn=t("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((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),bn=t("GridService",class extends Ls{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.degridDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let s;if(a){const t=a.toLowerCase();s=new Ws(e,t,{isOriginField:!0})}else s=new Ws(e,e);this.dataUIMap.set(e,s)}))}async updateGridEditItem(t,e,a={}){let s=await this.entityService.exec(t,e,a);return s=this.handleResponse(s),s}}),Pn=(t("GridController",class extends li{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await super.onCreated(),this.service=new bn(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=m(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:s}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const i=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(i,"没有配置代码表"));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(i,"配置为第一列"));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===s){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(i,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await Promise.allSettled(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()}))),this.state.rows=e.map((t=>{const e=new Cn(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,s="CODELIST"===a,i=this.groupFieldColumn.model.id;s&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[i];s||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:s}=this.model;if("ALL"!==t)return;if(!s||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const i=await this.getFetchParams(),n=ibiz.hub.getApp(this.context.srfappid),r=await n.deService.exec(e,s,this.context,void 0,i);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.state.rows.findIndex((e=>e.data.srfkey===t.srfkey));this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:a}=this.model;if(!t||!a||"row"!==ibiz.config.grid.editShowMode)return void ibiz.log.error("不支持新建行");if(this.state.rows.find((t=>t.showRowEdit)))throw new e("请先完成当前行编辑中的行的操作");const s=await this.service.getDraft(this.context,this.params);this.state.items.unshift(s.data);const i=new Cn(s.data,this);this.state.rows.unshift(i),this.gridStateNotify(i,"DRAFT"),this.switchRowEdit(this.state.rows[0],!0)}async save(t){if(this.state.isSimple)return;const a=this.state.rows.find((e=>e.data.srfkey===t.srfkey));if(!a)throw new e("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await w(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new e("行数据校验不通过,保存取消");let s;await this.startLoading();const i=0===t.srfuf,n=de(this.model.appDataEntityId),r=this.context.clone();r[n]=t.srfkey;try{s=i?await this.service.create(r,t):await this.service.update(r,t)}finally{await this.endLoading()}const o=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(o,1,s.data),a.data=s.data,a.modified=!1,ibiz.message.success("".concat(s.data.srfmajortext||"","保存成功")),this.gridStateNotify(a,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&Promise.allSettled(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await Da(t);if(!a)return;this.providers[t.codeName]=a;const s=await a.createController(t,this);this.columns[t.codeName]=s,"DEFGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=s,t.enableRowEdit&&(this.editColumns[t.codeName]=s)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=s:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){p(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault})}),{childrenFields:["degridColumns"]})}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)||ei(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this.evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,a){const s=await Promise.allSettled(Object.values(this.editColumns).map((async e=>e.dataChangeNotify(t,a))));if(s.find((t=>"rejected"===t.status)))throw ibiz.log.error("dataChangeNotify报错",s),new e("数据变更后有错误")}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new e("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,a,s=!0){if(!this.allowRowEdit)return;const i=void 0===a?!t.showRowEdit:a;if(t.showRowEdit!==i){if(!1===i)if(s)await this.save(t.data);else if(0===t.data.srfuf)return t.showRowEdit=!1,this.evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});if(!0===i){if(this.state.rows.find((t=>t.showRowEdit)))throw new e("同时只能有一行开启行编辑")}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this.evt.emit("onRowEditChange",{row:t})}}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.model;this.state.sortQuery=t&&e?"".concat(t.toLowerCase(),",").concat(e.toLowerCase()):""}}async updateGridEditItem(t,a){var s;const i=null==(s=this.model.degridEditItemUpdates)?void 0:s.find((t=>t.id===a));if(!i)throw new e("没找到".concat(a,"编辑列更新"));const{appDEMethodId:n,degeiupdateDetails:r}=i,o=r.map((t=>t.id)),c={...this.params,...t.data.getOrigin()},l=(await this.service.updateGridEditItem(n,this.context,c)).data;l&&(null==o?void 0:o.length)&&await Promise.all(o.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.params);let s;await this.startLoading();try{s=await this.service.fetch(e,a)}finally{await this.endLoading()}return s.data}async exportData(t){const a=this.fieldColumns,s=Object.keys(a).map((t=>a[t].model.id)),i=Object.keys(a).map((t=>a[t].model.caption)),n=(r=s,(await(async()=>{var s;const i=null==(s=t.params)?void 0:s.type;let n=[];if("activatedPage"===i&&(n=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:s}=t.params,r="customPage"===i?{page:0,offset:(a-1)*e,size:(s-a+1)*e}:{size:1e3,page:0};n=await this.loadData({params:r})}if("selectedRows"===i&&(n=this.getData()),0===n.length)throw new e("无导出数据");return(t=>{const e=new Map;Object.keys(a).forEach((t=>{a[t].codeList&&e.set(t,a[t].codeListItems)}));const s=U(t.map((t=>t.getOrigin())));return s.forEach((t=>{Object.keys(t).forEach((a=>{var s;e.get(a)&&(t[a]=(null==(s=e.get(a).find((e=>e.value===t[a])))?void 0:s.text)||t[a])}))})),s})(n)})()).map((t=>r.map((e=>t[e])))));var r;if(!ibiz.util.getExportExcel)throw new e("ibiz.util.getExportExcel不存在");const o=await ibiz.util.getExportExcel();if(!o)throw new e("导出模块加载错误");o.exportJsonToExcel({header:i,data:n,filename:this.model.logicName,autoWidth:!0})}}),t("GridFieldColumnController",class extends Dn{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}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:n}=re(s);let r={};i&&t&&(r=Zt(i,e,a,t));const o=Object.assign(e.clone(),r);let c={};n&&t&&(c=Zt(n,e,a,t));return{context:o,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.model.codeName])return;const a=this.model.linkValueItem||"srfkey",i=t.data[a];if(null==i)throw new s(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:n}=this.model;if(!n)return;const r=Be(t.data),o=Object.assign(this.context.clone(),{srfkey:i,...r}),c=U(this.params),{context:l,params:h}=this.handlePublicParams(t.data,o,c),d=await ibiz.commands.execute(Je.TAG,n,l,h,{event:e});(null==d?void 0:d.ok)&&this.grid.load()}async triggerAction(t,e){}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:i}=this.model;if("NONE"===a)return;const n=e||this.model.id;let r;if("PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new s(this.model,"远程聚合暂未支持"):new s(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":r=t.map((t=>t[n])).reduce(((t,e)=>t+e),0);break;case"AVG":r=t.map((t=>t[n])).reduce(((t,e)=>t+e),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[n])));break;case"MIN":r=Math.min(...t.map((t=>t[n])));break;default:throw new s(this.model,"暂未支持属性列聚合模式".concat(a))}if(!i)return"".concat(r);throw new s(this.model,"暂未支持".concat(i,"的聚合值格式化"))}formatValue(t=""){const e="".concat(t);if(!this.valueFormat)return e;return v.isDate(this.dataType)?X(e).format(this.valueFormat):ibiz.util.text.format(e,this.valueFormat)}})),An=(t("GridUAColumnController",class extends Dn{initActionStates(t){var e;const{deuiactionGroup:s}=this.model;if(!s)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=s.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Js;s.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Qs(t.id,this.grid.context.srfappid,e);i.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=i}async onActionClick(t,e,a){const s=t.uiactionId;await ki.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a})}}),t("GridFieldEditColumnController",class extends Pn{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=ye(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await ga(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){const t=$e(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&(this.rules=si(t,this.fieldName,this.valueItemName),this.validator=new J({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,a){this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||a.includes(this.fieldName)||a.includes(this.valueItemName)){if(!await this.validate(t))throw new e("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}a.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&A(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:s}=a;return t.errors[e]=s[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends Dn{}),t("ListService",class extends Ls{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let s;if(a){const t=a.toLowerCase();s=new Ws(e,t,{isOriginField:!0})}else s=new Ws(e,e);this.dataUIMap.set(e,s)}))}})),_n=(t("ListController",class extends li{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.service=new An(this.model),await this.service.init(this.context)}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.model;this.state.sortQuery=t&&e?"".concat(t.toLowerCase(),",").concat(e.toLowerCase()):""}}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=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const s=a.get(e[t])||[];s.push(e),a.set(e[t],s)}));const s=[];a.forEach(((t,e)=>{s.push({caption:e,children:[...t]})})),this.state.groups=s}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,s=[],i=ibiz.hub.getApp(this.context.srfappid),n=await i.codeList.get(e,this.context,this.params),r=[];n.forEach((e=>{const i=a.filter((a=>a[t]===e.value));s.push({caption:e.text,children:[...i]}),r.push(e.value)}));const o=a.filter((e=>-1===r.indexOf(e[t])));o.length>0&&s.push({caption:"其他",children:[...o]}),this.state.groups=s}}}),t("PanelController",class extends ci{constructor(){super(...arguments),this.panelItems={},this.providers={}}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}async onCreated(){await super.onCreated(),await this.initPanelItemControllers()}async onMounted(){this.load()}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var s,i;const n=await Pa(t);if(!n)return;e.providers[t.id]=n;const r=await n.createController(t,e,a);e.panelItems[t.id]=r,(null==(s=t.panelItems)?void 0:s.length)&&!r.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,r),(null==(i=t.panelTabPages)?void 0:i.length)&&await this.initPanelItemControllers(t.panelTabPages,e,r)})))}async load(){const t=await this.prepareData();if(!t)throw new e("未获取到面板数据");const a=this.convertData(t);this.state.data=a,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){return t}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,this.dataChangeNotify([t]))}})),Sn=(t("ViewLayoutPanelController",class extends _n{async onCreated(){this.preprocessModel(),await super.onCreated()}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),xn=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=oe(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}createState(){var t;return new Sn(null==(t=this.parent)?void 0:t.state)}dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDynaClass(this.data)}panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const s=a.relatedItemNames||[];if(e||g(s,t))try{const t=Fe(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.state.required=!t;break;case"ITEMENABLE":this.state.disabled=!t;break;case"PANELVISIBLE":this.state.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=ce(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=ce(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}}),t("PickupViewPanelController",class extends ci{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),s={...this.params};t&&Object.assign(a,Zt(t,this.context,this.params)),e&&Object.assign(s,Zt(e,this.context,this.params)),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",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),t("SearchBarController",class extends ci{constructor(){super(...arguments),this.placeHolder=""}initState(){super.initState(),this.state.query="",this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.model.enableFilter)}async onCreated(){var t;await super.onCreated();const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),s=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?s.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&s.push(t.logicName)})),s.length>0&&(this.placeHolder=s.join("、"))}}handleInput(t){this.state.query=t}handleSearch(){this.evt.emit("onSearch",void 0)}}),t("TabExpPanelController",class extends ci{initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[]})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initDefaultPage(){const t=()=>{this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()};if(this.state.defaultTabName){const e=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));e?(this.state.activeName=e.tabTag,this.changeToTab()):t()}else t()}changeToTab(t=this.activeTabViewPanelModel){const e=this.getNavViewMsg(t);this.evt.emit("onNavViewChange",{navViewMsg:e})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:s,navigateParams:i,appDataEntityId:n}=t,r={deName:de(n),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:s,navParams:i},o={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:l}=ie(r,o);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...this.params,...l}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId}}}),t("TreeService",class extends Ls{async fetchChildNodes(t,e){const{hasQuery:a}=e;let s=[];if(t){const i=ve(this.model,{parentId:null==t?void 0:t.nodeId,hasQuery:a});if(0===i.length)return;(await Promise.allSettled(i.map((async a=>{const s=Ee(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(s,a,t,e)})))).forEach((t=>{"fulfilled"===t.status&&t.value?s.push(...t.value):"rejected"===t.status&&ibiz.log.error(t.reason)}))}else{const t=we(this.model);s=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return s}async fetchNodeDatasByType(t,e,a,i){const n=0===ve(this.model,{parentId:t.id,hasQuery:i.hasQuery}).length,r={...i,leaf:n};let o=[];switch(t.treeNodeType){case"STATIC":o=[await this.getStaticNodeData(t,e,a,r)];break;case"DE":o=await this.getDENodeDatas(t,e,a,r);break;case"CODELIST":o=await this.getCodeListNodeDatas(t,e,a,r);break;default:throw new s(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:h}=t,d=h&&!this.model.rootVisible;return n||await Promise.all(o.map((async(t,e)=>{var a;if(l&&(!c||c&&0===e)||(null==(a=i.defaultExpandedKeys)?void 0:a.length)&&i.defaultExpandedKeys.includes(t.id)||d){const e=await this.fetchChildNodes(t,i);t.children=e}}))),o}async getStaticNodeData(t,e,a,s){return new Fs(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!s.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:s,navigateContexts:i,navigateParams:n,parentFilter:r,parentDER1N:o}=t,c=null==o?void 0:o.pickupDEFName,l={...a.params},h={...a.context,...(null==e?void 0:e.context)||{}};let d,u,p,m={};if(e){d=e;for(let t=1;t<s;t++)d=null==d?void 0:d.parent}if(d){m=d.deData||{};const t=Ee(this.model,d.nodeId);t.appDataEntityId&&(p=de(t.appDataEntityId)),u=d.value}const{resultContext:f,resultParams:g}=ie({deName:p,navFilter:r?"n_".concat(r,"_eq"):void 0,pickupDEFName:c,navParams:n,navContexts:i},{derValue:u,context:h,params:l,data:m});return Object.assign(h,f),Object.assign(l,g),{context:h,params:l,navContext:f,navParams:g}}async getDENodeDatas(t,e,a,s){const{appDEDataSetId:i,appDataEntityId:n}=t,{context:r,params:o,navContext:c,navParams:l}=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 h=await this.app.deService.exec(n,i,r,o);if(h.data.length){return h.data.map((e=>new ks(t,a,{data:e,leaf:!!s.leaf,navContext:c,navParams:l})))}return[]}async getCodeListNodeDatas(t,e,a,s){const{context:i,params:n,navContext:r,navParams:o}=e?this.getNodeRSFilterParams(e,a,s):{context:s.context,params:s.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,i,n);if(c.length){return c.map((e=>new Vs(t,a,{data:e,leaf:!!s.leaf,navContext:r,navParams:o})))}return[]}})),Tn=(t("TreeController",class extends li{constructor(){super(...arguments),this.contextMenus={}}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.size=0}async onCreated(){await super.onCreated(),this.service=new xn(this.model),await this.service.init(this.context),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new Hi(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async load(t={}){const e=!0===t.isInitialLoad,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;let i;await this.startLoading();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=[],p({children:this.state.rootNodes},(t=>{this.state.items.push(t)})),i}async onTreeNodeClick(t){if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e.id!==t.id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this.evt.emit("onActive",{...e,nodeData:t})}setSelection(t){super.setSelection(t)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}async doUIAction(t,e,a){const s=this.getEventArgs(),i=this.parseTreeNodeData(e),n=await ki.exec(t,{...s,...i,event:a});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()}}parseTreeNodeData(t){return{data:[{...t,...t.deData||{}}],context:Object.assign(this.context.clone(),t.context||{}),params:{...this.params,...t.params||{}}}}calcExpandedKeys(t){let e=[];return p({children:t},(t=>{var a;(null==(a=t.children)?void 0:a.length)&&e.push(t.id)})),this.state.defaultExpandedKeys.length&&(e.push(...this.state.defaultExpandedKeys),e=Array.from(new Set(e))),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"id",s=this.state.items.find((e=>e[a]===t[a]));if(!s)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{parent:t}=s;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void this.refresh()}const i=e?s.parent:s,n=await this.loadNodes(i);this.evt.emit("onAfterRefreshParent",{parentNode:i,children:n})}}),t("WizardPanelService",class extends Ts{async initialize(t,e={},a={}){var s;const i=null==(s=this.model.initControlAction)?void 0:s.appDEMethodId;let n=await this.exec(i,t,e,a);return n=this.handleResponse(n),n}async finish(t,e={},a={}){var s;const i=null==(s=this.model.finishControlAction)?void 0:s.appDEMethodId;let n=await this.exec(i,t,e,a);return n=this.handleResponse(n),n}})),Ln=(t("WizardPanelController",class extends ci{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,s;t.firstForm&&(this.firstForm=t);const i="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),n=null==(s=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:s.find((e=>e.id===t.dewizardStepId)),r=null==n?void 0:n.stepTag;this.stepTags[i]=r})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Tn(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await pa(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,a=this.formControllers.get(t);if(!a)throw new e("找不到".concat(t,"的表单控制器"));return a}onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a),a.load()}onFormSaved(t){const e=t.data[0],a=de(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,this.params),e=de(this.model.appDataEntityId);t.data&&t.data.srfkey&&(this.context[e]=t.data.srfkey)}this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){await this.activeFormController.goBack(),this.tagHistory.pop();const t=this.tagHistory[this.tagHistory.length-1];if(!t)throw new e("没有上一个表单");this.state.activeFormTag=t}async onNextClick(){const t=await this.activeFormController.save();let a;if(t.srfnextform){if(!this.model.dewizard.dewizardForms.find((e=>e.formTag===t.srfnextform)))throw new e("找不到标识为".concat(t.srfnextform,"的向导表单"));a=t.srfnextform}else{const{formTag:t}=this.activeWizardForm,s=this.model.dewizard.dewizardSteps;if(s&&t){const i=s.findIndex((e=>e.stepTag===t)),n=s[i+1];if(!n)throw new e("找不到下一个向导步骤");const r=this.model.dewizard.dewizardForms.find((t=>t.formTag===n.stepTag));r&&(a=r.formTag)}}if(!a)throw new e("找不到下一个向导表单");this.state.activeFormTag=a,this.tagHistory.push(a)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends Ls{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let s;if(a){const t=a.toLowerCase();s=new Ws(e,t,{isOriginField:!0})}else s=new Ws(e,e);this.dataUIMap.set(e,s)}))}})),On=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),Mn=(t("MDCtrlController",class extends li{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new Ln(this.model),await this.service.init(this.context),this.setSort()}setSort(t,e){if(t&&e)super.setSort(t,e);else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.model;this.state.sortQuery=t&&e?"".concat(t.toLowerCase(),",").concat(e.toLowerCase()):""}}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0})}async refresh(){await this.load({isInitialLoad:!0})}afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new On(t,this);return this.initActionStates(e),e}))),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new On(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,a){const s=t.uiactionId;await ki.execAndResolved(s,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a})}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(null==(a=e.uiactionGroupDetails)?void 0:a.length)||ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new Js;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new Qs(t.id,this.context.srfappid,e);s.addState(t.id,a)}})),s.update(t.data.getOrigin()),t.uaColStates[e.id]=s}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}logout(){return ibiz.auth.logout()}})),Nn=class{constructor(){this.convert=new class{constructor(){this.appMenu=new class{parse(t){return t}}}},this.controller=new Mn,this.appMap=new Map,this.apps=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new class{constructor(){this.view=new class{constructor(){this.viewConfigs=new Map}set(t,e){this.viewConfigs.set(t,e)}async get(t){if(!this.viewConfigs.has(t)){const a=await ibiz.hub.getAppView(t);if(!a)throw new e("视图[".concat(t,"]不存在"));this.set(a.id,{id:a.id,codeName:a.codeName,openMode:a.openMode,viewType:a.viewType,width:a.width,height:a.height,appDataEntityId:a.appDataEntityId,redirectView:a.redirectView})}return this.viewConfigs.get(t)}}}},this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerApp(t){this.apps.set(t.codeName,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 getAppView(t){const a=this.calcAppViewId(t),s=this.view2appMap.get(a)||ibiz.env.appId;if(this.appMap.has(s)||await this.createApp(s),this.views.has(a))return this.views.get(a);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(s,a);return this.registerAppView(t),t}throw new e("视图[".concat(a,"]不存在"))}async getAppDataEntity(t,a=ibiz.env.appId){if(this.dataEntities.has(a)){const e=this.dataEntities.get(a);if(e.has(t))return e.get(t)}if(this.modelLoaderProvider){let e;return e=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(a,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(a,t),this.registerAppDataEntity(e,a),e}throw new e("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);let a;if(this.apps.has(t))a=this.apps.get(t);else{if(!this.modelLoaderProvider)throw new e("未找到应用[".concat(t,"]模型"));a=await this.modelLoaderProvider.getApp(t),this.registerApp(a)}const s=new js(a);return this.appMap.set(t,s),await s.init(),s}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}},Rn=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:s}=t,i="".concat(s,"_").concat(a),n=this.viewEngines.get(i);if(n)return n(...e);ibiz.log.error("没有".concat(i,"对应的引擎"),t)}}),Vn=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:s}=this.view;ibiz.log.debug("".concat(a.id,"的子组件:").concat(s.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_header;e&&(e.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_footer;t&&(t.state.visible=!1)}}}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,s;let i=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_captionbar;e&&(e.state.visible=!1)}else i=!0;if(ibiz.env.isMob){if(this.leftToolbar)i=!0;else{const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.lefttoolbar;t&&(t.state.visible=!1)}if(this.rightToolbar)i=!0;else{const t=null==(a=this.viewLayoutPanel)?void 0:a.panelItems.righttoolbar;t&&(t.state.visible=!1)}}else if(this.toolbar)i=!0;else{const t=null==(s=this.viewLayoutPanel)?void 0:s.panelItems.view_toolbar;t&&(t.state.visible=!1)}return i}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:a,context:s,params:i}=this.view;if(!t)throw new e("该视图没有实体,无法加载实体数据");const n=ibiz.hub.getApp(s.srfappid),r=await n.deService.exec(t,"get",s,i),{data:o}=r;o&&(this.view.state.srfactiveviewdata=o,a.emit("onDataChange",{actionType:"LOAD",data:[o]}),o.srfkey&&a.emit("onViewInfoChange",{dataInfo:o.srfmajortext||""}))}}),kn=(t("MDViewEngine",class extends Vn{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")}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",(async t=>{await this.openData(t)})),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.refresh()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.refresh()})),!this.view.state.noLoadDefault&&t.loadDefault&&this.load()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?(await this.openData(e),null):"New"===t?(await this.newData(e),null):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Copy"===t?(this.copy(e),null):"load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:s,event:i}=t,n=(t.context||this.view.context).clone(),r=t.params||this.view.params;n[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||de(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const o=await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("opendata",{context:n,params:r,data:s,event:i,view:this.view}));o instanceof Object&&o.ok?this.refresh():-1===o&&ibiz.log.warn("视图[".concat(this.view.model.codeName,"],未配置编辑打开视图"))}async newData(t){var e,s,i;const{data:n,event:r,copyMode:o}=t;if(!(null==(s=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:s.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=this.view.context.clone();o&&(c.srfcopymode=!0);const l=await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("newdata",{context:c,params:this.view.params,data:n,event:r,view:this.view}));if(l instanceof Object&&l.ok)this.refresh();else if(-1===l)throw new a(this.view.model,"缺少newdata的视图逻辑")}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}getSearchParams(){const t={};if(this.searchForm){const e=this.searchForm.getData()[0],a=Object.entries(e).reduce(((t,[e,a])=>(null!=a&&""!==a&&(t[e]=a),t)),{});Object.assign(t,a)}if(this.searchBar&&this.searchBar.state.query){const e={query:this.searchBar.state.query};Object.assign(t,e)}return 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)t=!0;else{const t=this.viewLayoutPanel.panelItems.view_searchbar;t&&(t.state.visible=!1)}return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),class{constructor(){this.layoutPanel=new We,this.text=new qe,this.hbs=new Jt}}),Fn=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new e("Method not implemented.")}destroy(){}},Wn=class extends Fn{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const s=this.logic.scriptCode;this.scriptFn=Ne.createScriptFn(t,s,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Bn=class extends Fn{execute(t){const{appDEUILogicId:e,appDataEntityId:s}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Vi(e,s,t)}},Un=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),H(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const s={itemName:t,triggerType:e},i=this.triggerAndExecute(s,a);if(null==i?void 0: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((t=>t.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){const a={ctrlName:t,eventName:e.eventName,triggerType:"CTRLEVENT"};this.triggerAndExecute(a,e)}},jn=class extends Un{constructor(t){super(t.filter((t=>"APPVIEWENGINE"!==t.triggerType)))}},zn=class extends Un{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Gn=class{constructor(){this.executorFactory=new 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 s(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},this.triggerFactory=new 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 s(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}}}createViewScheduler(t){return new zn(t)}createControlScheduler(t){return new jn(t)}},Hn=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new e("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},Xn=class extends Hn{},Kn=class extends Hn{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new e("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:s}=t;return{context:e,params:a,data:(null==s?void 0:s[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){return super.match(t)&&t.itemName===this.logic.itemName}execute(t){const a=this.executor.execute(t);if("boolean"==typeof a)return a;throw new e("".concat(this.logic.id,"逻辑返回值不是布尔值"))}},Yn=class extends Hn{constructor(){super(...arguments),this.timer=null}start(){this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new e("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},$n=class extends Fn{execute(t){return"opendata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):"newdata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t):void 0}async executeOpenDataAppUILogic(t,s){const{context:i,params:n,...r}=s,{data:o}=s;if(!(null==o?void 0:o[0]))throw new e("opendata没有可操作数据!");const c=t.openDataAppView;if(!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const h=c.navigateContexts||[],d=Object.assign(i,Zt(h,i,n,o[0]));let u={};const p=c.navigateParams;return P(p)&&(u=Zt(p,n,i,o[0])),ibiz.commands.execute(Je.TAG,l,d,u,r)}async executeNewDataAppUILogic(t,e){const{context:i,params:n,...r}=e,{data:o}=e,{enableWizardAdd:c,enableBatchAdd:l,batchAddOnly:h,newDataAppView:d}=t;let u;if(c){if(u=await this.getWizardNewViewRef(t,e),!u)return{ok:!1}}else{if(l)throw new s(t,"enableBatchAdd暂未支持");if(h)throw new s(t,"batchAddOnly暂未支持");if(u=d,!u||!u.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let p={},m={};const f=(null==o?void 0:o[0])||{},g=u.navigateContexts;P(g)&&(p=Zt(g,i,n,f)),p=Object.assign(i,p);const w=u.navigateParams;return P(w)&&(m=Zt(w,n,i,f)),i.srfcopymode&&(f.srfkey=void 0,m=Object.assign(m,f.$origin)),ibiz.commands.execute(Je.TAG,u.refAppViewId,p,m,r)}async getWizardNewViewRef(t,s){var i;const{wizardAppView:n,newDataAppViews:r}=t,{context:o,params:c,...l}=s;if(!n||!n.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const h=await ibiz.commands.execute(Je.TAG,n.refAppViewId,o,c,{...l,openMode:"POPUPMODAL"});if(!h.ok)return;const d=null==(i=h.data)?void 0:i[0];if(!d)throw new e("请选中一条数据");const u=d.srfkey,p=null==r?void 0:r.find((t=>t.refMode===u));if(!p)throw new e("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}},qn=class extends Hn{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(",");this.listenEventNames=a.map((t=>He[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Qn=class extends Hn{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(",");this.listenEventNames=a.map((t=>Ke[t]||t))}match(t){return super.match(t)&&t.ctrlName===this.logic.ctrlName&&this.listenEventNames.includes(t.eventName)}};var Jn=rt($t(),1);t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t);const e=Jn.default.dirname(this.url.pathname);this.baseDir=e}dir(t){return Jn.default.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const s=document.createElement("link");s.setAttribute("type","text/css"),s.setAttribute("rel","stylesheet"),s.setAttribute("href",e),s.onload=t,s.onerror=a,document.head.appendChild(s)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));
2
2
  //# sourceMappingURL=index.system.min.js.map