@nocobase/app 2.1.37 → 2.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-da051635.js → index-68721948.js} +8 -8
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/v/assets/{index-c90a7249.js → index-5460cca0.js} +7 -7
- package/dist/client/v/index.html +1 -1
- package/package.json +7 -7
- /package/dist/client/assets/{index-da051635.js.LICENSE.txt → index-68721948.js.LICENSE.txt} +0 -0
- /package/dist/client/v/assets/{index-c90a7249.js.LICENSE.txt → index-5460cca0.js.LICENSE.txt} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! For license information please see index-
|
|
1
|
+
/*! For license information please see index-68721948.js.LICENSE.txt */
|
|
2
2
|
(globalThis.webpackChunknocobase=globalThis.webpackChunknocobase||[]).push([["8410"],{65359(e,t,l){var n={"./en-nz":["35571","8878"],"./bi.js":["95944","8878"],"./id.js":["87420","8878"],"./km":["36101","8878"],"./he.js":["92010","8878"],"./me":["80623","8878"],"./tk":["62544","8878"],"./ko.js":["88003","8878"],"./tet.js":["18928","8878"],"./es-do":["61219","8878"],"./ku":["16605","8878"],"./hr":["15811","8878"],"./zh-tw.js":["31349","8878"],"./hy-am":["94309","8878"],"./am.js":["4736","8878"],"./en-in":["60912","8878"],"./de-at":["32878","8878"],"./pt-br":["92218","8878"],"./ar-iq.js":["13309","8878"],"./en-sg":["12673","8878"],"./zh":["56007","8878"],"./en-il.js":["97690","8878"],"./lo":["73860","8878"],"./tlh":["60321","8878"],"./mi.js":["32739","8878"],"./el":["54072","8878"],"./ur.js":["51750","8878"],"./sq":["95977","8878"],"./pa-in.js":["39252","8878"],"./ar-kw.js":["79865","8878"],"./fr-ca.js":["86290","8878"],"./de-ch.js":["13672","8878"],"./ru":["62796","8878"],"./eo.js":["33713","8878"],"./nb":["7205","8878"],"./br":["72745","8878"],"./fo":["17674","8878"],"./zh.js":["56007","8878"],"./vi":["96098","8878"],"./fr-ch.js":["73433","8878"],"./ms-my":["26400","8878"],"./es-pr":["3532","8878"],"./bo.js":["59294","8878"],"./ht.js":["8809","8878"],"./lo.js":["73860","8878"],"./my.js":["46803","8878"],"./et":["4288","8878"],"./br.js":["72745","8878"],"./gu":["57409","8878"],"./it-ch":["19286","8878"],"./sv-fi":["9160","8878"],"./ne.js":["40880","8878"],"./zh-cn.js":["16033"],"./gom-latn.js":["78660","8878"],"./bg.js":["39990","8878"],"./mr.js":["46462","8878"],"./cv.js":["4780","8878"],"./lt.js":["34485","8878"],"./pt":["72369","8878"],"./th.js":["47081","8878"],"./cs.js":["9751","8878"],"./es.js":["47317","8878"],"./bn.js":["92509","8878"],"./ar-tn":["54405","8878"],"./mi":["32739","8878"],"./sr.js":["45616","8878"],"./tr":["4895","8878"],"./bn-bd":["64608","8878"],"./fa.js":["90292","8878"],"./it":["33900","8878"],"./nl":["69423","8878"],"./zh-hk":["87741","8878"],"./fo.js":["17674","8878"],"./bs.js":["25530","8878"],"./ja.js":["50952","8878"],"./my":["46803","8878"],"./es-do.js":["61219","8878"],"./gl":["33562","8878"],"./nl-be.js":["60465","8878"],"./en-ca.js":["21995","8878"],"./tzm-latn.js":["58804","8878"],"./types.d.ts":["69224","8878"],"./ru.js":["62796","8878"],"./sq.js":["95977","8878"],"./cv":["4780","8878"],"./km.js":["36101","8878"],"./fa":["90292","8878"],"./cs":["9751","8878"],"./ms":["79677","8878"],"./types.d":["69224","8878"],"./ca":["25993","8878"],"./tr.js":["4895","8878"],"./x-pseudo":["5760","8878"],"./tzm-latn":["58804","8878"],"./kn":["6364","8878"],"./jv":["77741","8878"],"./ms-my.js":["26400","8878"],"./ht":["8809","8878"],"./be":["51532","8878"],"./gd":["68418","8878"],"./en-au":["59881","8878"],"./ka":["46481","8878"],"./ka.js":["46481","8878"],"./ur":["51750","8878"],"./sv.js":["21340","8878"],"./zh-cn":["16033"],"./pl.js":["63225","8878"],"./hi":["52830","8878"],"./ug-cn":["79911","8878"],"./ar-kw":["79865","8878"],"./dv.js":["82187","8878"],"./id":["87420","8878"],"./dv":["82187","8878"],"./vi.js":["96098","8878"],"./de-ch":["13672","8878"],"./en-in.js":["60912","8878"],"./es-pr.js":["3532","8878"],"./es-us.js":["32498","8878"],"./ar-iq":["13309","8878"],"./fi.js":["89964","8878"],"./ca.js":["25993","8878"],"./ms.js":["79677","8878"],"./zh-tw":["31349","8878"],"./bs":["25530","8878"],"./rw.js":["35414","8878"],"./fy":["59836","8878"],"./uz-latn":["80950","8878"],"./mt.js":["99464","8878"],"./fr.js":["813","8878"],"./hu":["38298","8878"],"./lv.js":["76467","8878"],"./sr-cyrl.js":["27439","8878"],"./tzl":["3187","8878"],"./mn":["12698","8878"],"./pa-in":["39252","8878"],"./nl-be":["60465","8878"],"./kk":["11335","8878"],"./en-tt":["2619","8878"],"./ar-ly.js":["85592","8878"],"./hr.js":["15811","8878"],"./kk.js":["11335","8878"],"./ar":["2338","8878"],"./ar-dz.js":["48361","8878"],"./ar-sa":["40539","8878"],"./nl.js":["69423","8878"],"./cy":["95681","8878"],"./en-ie":["17329","8878"],"./lb.js":["88615","8878"],"./ar-ly":["85592","8878"],"./de.js":["50494","8878"],"./am":["4736","8878"],"./lv":["76467","8878"],"./tg":["15012","8878"],"./de-at.js":["32878","8878"],"./sl":["39998","8878"],"./tg.js":["15012","8878"],"./ky.js":["34457","8878"],"./kn.js":["6364","8878"],"./bo":["59294","8878"],"./da":["42706","8878"],"./ss.js":["52487","8878"],"./uz":["54734","8878"],"./fr-ch":["73433","8878"],"./sk":["46847","8878"],"./hu.js":["38298","8878"],"./sr":["45616","8878"],"./he":["92010","8878"],"./uk.js":["34173","8878"],"./es-mx":["64719","8878"],"./se.js":["55285","8878"],"./oc-lnc":["70225","8878"],"./pt-br.js":["92218","8878"],"./rw":["35414","8878"],"./ar-sa.js":["40539","8878"],"./nb.js":["7205","8878"],"./fr-ca":["86290","8878"],"./hi.js":["52830","8878"],"./gl.js":["33562","8878"],"./en-ie.js":["17329","8878"],"./me.js":["80623","8878"],"./fy.js":["59836","8878"],"./ar.js":["2338","8878"],"./az":["51130","8878"],"./lt":["34485","8878"],"./en":["65826","8878"],"./ro.js":["24334","8878"],"./sw":["2979","8878"],"./te.js":["87406","8878"],"./tl-ph.js":["78142","8878"],"./es-mx.js":["64719","8878"],"./ky":["34457","8878"],"./it.js":["33900","8878"],"./zh-hk.js":["87741","8878"],"./da.js":["42706","8878"],"./te":["87406","8878"],"./mt":["99464","8878"],"./lb":["88615","8878"],"./uz-latn.js":["80950","8878"],"./ml.js":["75376","8878"],"./en-sg.js":["12673","8878"],"./uz.js":["54734","8878"],"./tzm.js":["95084","8878"],"./tet":["18928","8878"],"./oc-lnc.js":["70225","8878"],"./az.js":["51130","8878"],"./en-au.js":["59881","8878"],"./fr":["813","8878"],"./gd.js":["68418","8878"],"./yo.js":["87933","8878"],"./nn":["23473","8878"],"./bm":["71092","8878"],"./index.d.ts":["41213","8878"],"./sw.js":["2979","8878"],"./af":["65662","8878"],"./en-il":["97690","8878"],"./eu":["94007","8878"],"./et.js":["4288","8878"],"./rn":["34509","8878"],"./se":["55285","8878"],"./sv-fi.js":["9160","8878"],"./gu.js":["57409","8878"],"./gom-latn":["78660","8878"],"./pl":["63225","8878"],"./ar-dz":["48361","8878"],"./ar-ma":["81289","8878"],"./eu.js":["94007","8878"],"./ss":["52487","8878"],"./tk.js":["62544","8878"],"./es-us":["32498","8878"],"./bi":["95944","8878"],"./ug-cn.js":["79911","8878"],"./mn.js":["12698","8878"],"./pt.js":["72369","8878"],"./cy.js":["95681","8878"],"./mr":["46462","8878"],"./ga.js":["54061","8878"],"./ko":["88003","8878"],"./ku.js":["16605","8878"],"./af.js":["65662","8878"],"./hy-am.js":["94309","8878"],"./es":["47317","8878"],"./ml":["75376","8878"],"./en-ca":["21995","8878"],"./bn":["92509","8878"],"./ga":["54061","8878"],"./is.js":["15513","8878"],"./sd.js":["63222","8878"],"./sl.js":["39998","8878"],"./tlh.js":["60321","8878"],"./tl-ph":["78142","8878"],"./uk":["34173","8878"],"./x-pseudo.js":["5760","8878"],"./is":["15513","8878"],"./jv.js":["77741","8878"],"./el.js":["54072","8878"],"./fi":["89964","8878"],"./bn-bd.js":["64608","8878"],"./en-gb":["72026","8878"],"./en-gb.js":["72026","8878"],"./mk":["75877","8878"],"./ne":["40880","8878"],"./ro":["24334","8878"],"./mk.js":["75877","8878"],"./si":["65665","8878"],"./tzm":["95084","8878"],"./be.js":["51532","8878"],"./de":["50494","8878"],"./rn.js":["34509","8878"],"./si.js":["65665","8878"],"./yo":["87933","8878"],"./bg":["39990","8878"],"./en.js":["65826","8878"],"./sv":["21340","8878"],"./th":["47081","8878"],"./bm.js":["71092","8878"],"./nn.js":["23473","8878"],"./ar-ma.js":["81289","8878"],"./index.d":["41213","8878"],"./ja":["50952","8878"],"./ta.js":["77250","8878"],"./ar-tn.js":["54405","8878"],"./sd":["63222","8878"],"./sk.js":["46847","8878"],"./tzl.js":["3187","8878"],"./en-nz.js":["35571","8878"],"./eo":["33713","8878"],"./ta":["77250","8878"],"./en-tt.js":["2619","8878"],"./it-ch.js":["19286","8878"],"./sr-cyrl":["27439","8878"]};function o(e){if(!l.o(n,e))return Promise.resolve().then(function(){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=n[e],o=t[0];return Promise.all(t.slice(1).map(l.e)).then(function(){return l.t(o,23)})}o.keys=()=>Object.keys(n),o.id=65359,e.exports=o},35358(e,t,l){var n={"./af":"25177","./af.js":"25177","./ar":"61509","./ar-dz":"41488","./ar-dz.js":"41488","./ar-kw":"58676","./ar-kw.js":"58676","./ar-ly":"42353","./ar-ly.js":"42353","./ar-ma":"24496","./ar-ma.js":"24496","./ar-sa":"82682","./ar-sa.js":"82682","./ar-tn":"89756","./ar-tn.js":"89756","./ar.js":"61509","./az":"95533","./az.js":"95533","./be":"28959","./be.js":"28959","./bg":"47777","./bg.js":"47777","./bm":"54903","./bm.js":"54903","./bn":"61290","./bn-bd":"17357","./bn-bd.js":"17357","./bn.js":"61290","./bo":"31545","./bo.js":"31545","./br":"11470","./br.js":"11470","./bs":"44429","./bs.js":"44429","./ca":"7306","./ca.js":"7306","./cs":"56464","./cs.js":"56464","./cv":"73635","./cv.js":"73635","./cy":"64226","./cy.js":"64226","./da":"93601","./da.js":"93601","./de":"77853","./de-at":"26111","./de-at.js":"26111","./de-ch":"54697","./de-ch.js":"54697","./de.js":"77853","./dv":"60708","./dv.js":"60708","./el":"54691","./el.js":"54691","./en-au":"53872","./en-au.js":"53872","./en-ca":"28298","./en-ca.js":"28298","./en-gb":"56195","./en-gb.js":"56195","./en-ie":"66584","./en-ie.js":"66584","./en-il":"65543","./en-il.js":"65543","./en-in":"9033","./en-in.js":"9033","./en-nz":"79402","./en-nz.js":"79402","./en-sg":"43004","./en-sg.js":"43004","./eo":"32934","./eo.js":"32934","./es":"97650","./es-do":"20838","./es-do.js":"20838","./es-mx":"17730","./es-mx.js":"17730","./es-us":"56575","./es-us.js":"56575","./es.js":"97650","./et":"3035","./et.js":"3035","./eu":"3508","./eu.js":"3508","./fa":"119","./fa.js":"119","./fi":"90527","./fi.js":"90527","./fil":"95995","./fil.js":"95995","./fo":"52477","./fo.js":"52477","./fr":"85498","./fr-ca":"26435","./fr-ca.js":"26435","./fr-ch":"37892","./fr-ch.js":"37892","./fr.js":"85498","./fy":"37071","./fy.js":"37071","./ga":"41734","./ga.js":"41734","./gd":"70217","./gd.js":"70217","./gl":"77329","./gl.js":"77329","./gom-deva":"32124","./gom-deva.js":"32124","./gom-latn":"93383","./gom-latn.js":"93383","./gu":"95050","./gu.js":"95050","./he":"11713","./he.js":"11713","./hi":"43861","./hi.js":"43861","./hr":"26308","./hr.js":"26308","./hu":"90609","./hu.js":"90609","./hy-am":"17160","./hy-am.js":"17160","./id":"74063","./id.js":"74063","./is":"89374","./is.js":"89374","./it":"88383","./it-ch":"21827","./it-ch.js":"21827","./it.js":"88383","./ja":"23827","./ja.js":"23827","./jv":"89722","./jv.js":"89722","./ka":"41794","./ka.js":"41794","./kk":"27088","./kk.js":"27088","./km":"96870","./km.js":"96870","./kn":"84451","./kn.js":"84451","./ko":"63164","./ko.js":"63164","./ku":"98174","./ku.js":"98174","./ky":"78474","./ky.js":"78474","./lb":"79680","./lb.js":"79680","./lo":"15867","./lo.js":"15867","./lt":"45766","./lt.js":"45766","./lv":"69532","./lv.js":"69532","./me":"58076","./me.js":"58076","./mi":"41848","./mi.js":"41848","./mk":"30306","./mk.js":"30306","./ml":"73739","./ml.js":"73739","./mn":"99053","./mn.js":"99053","./mr":"86169","./mr.js":"86169","./ms":"73386","./ms-my":"92297","./ms-my.js":"92297","./ms.js":"73386","./mt":"77075","./mt.js":"77075","./my":"72264","./my.js":"72264","./nb":"22274","./nb.js":"22274","./ne":"8235","./ne.js":"8235","./nl":"92572","./nl-be":"43784","./nl-be.js":"43784","./nl.js":"92572","./nn":"54566","./nn.js":"54566","./oc-lnc":"69330","./oc-lnc.js":"69330","./pa-in":"29849","./pa-in.js":"29849","./pl":"94418","./pl.js":"94418","./pt":"79834","./pt-br":"48303","./pt-br.js":"48303","./pt.js":"79834","./ro":"24457","./ro.js":"24457","./ru":"82271","./ru.js":"82271","./sd":"1221","./sd.js":"1221","./se":"33478","./se.js":"33478","./si":"17538","./si.js":"17538","./sk":"5784","./sk.js":"5784","./sl":"46637","./sl.js":"46637","./sq":"86794","./sq.js":"86794","./sr":"45719","./sr-cyrl":"3322","./sr-cyrl.js":"3322","./sr.js":"45719","./ss":"56000","./ss.js":"56000","./sv":"41011","./sv.js":"41011","./sw":"40748","./sw.js":"40748","./ta":"11025","./ta.js":"11025","./te":"11885","./te.js":"11885","./tet":"28861","./tet.js":"28861","./tg":"86571","./tg.js":"86571","./th":"55802","./th.js":"55802","./tk":"59527","./tk.js":"59527","./tl-ph":"29231","./tl-ph.js":"29231","./tlh":"31052","./tlh.js":"31052","./tr":"85096","./tr.js":"85096","./tzl":"79846","./tzl.js":"79846","./tzm":"81765","./tzm-latn":"97711","./tzm-latn.js":"97711","./tzm.js":"81765","./ug-cn":"48414","./ug-cn.js":"48414","./uk":"16618","./uk.js":"16618","./ur":"57777","./ur.js":"57777","./uz":"57609","./uz-latn":"72475","./uz-latn.js":"72475","./uz.js":"57609","./vi":"21135","./vi.js":"21135","./x-pseudo":"64051","./x-pseudo.js":"64051","./yo":"82218","./yo.js":"82218","./zh-cn":"52648","./zh-cn.js":"52648","./zh-hk":"1632","./zh-hk.js":"1632","./zh-mo":"31541","./zh-mo.js":"31541","./zh-tw":"50304","./zh-tw.js":"50304"};function o(e){return l(r(e))}function r(e){if(!l.o(n,e)){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n[e]}o.keys=function(){return Object.keys(n)},o.resolve=r,e.exports=o,o.id=35358},87696(e,t,l){"use strict";let n,o;var r={};l.r(r),l.d(r,{default:()=>rV,evaluators:()=>rL,getOptions:()=>r_});var i={};l.r(i),l.d(i,{array:()=>it,bigField:()=>ip,boolean:()=>id,collection:()=>ic,datetime:()=>io,enumType:()=>ia,id:()=>ii,number:()=>ir,object:()=>il,string:()=>ie,tableoid:()=>iu,time:()=>is});var a={};l.r(a),l.d(a,{connectFields:()=>mq,customizeFilterRender:()=>mY,defaultOperator:()=>mU,operatorComponentProps:()=>mX});var s={};l.r(s),l.d(s,{ASSIGN_FIELD_VALUES_STEP_KEY:()=>uu.zL,ActionGroupModel:()=>sL,ActionModel:()=>sz.S0,ActionSceneEnum:()=>sz.s5,ActionWithoutPermission:()=>sz._T,AddChildActionModel:()=>uL,AddNewActionModel:()=>dJ,AssignFormGridModel:()=>uW,AssignFormItemModel:()=>ci,AssignFormModel:()=>uz,AssociateActionModel:()=>d3,AssociationFieldGroupModel:()=>sK,AssociationFieldModel:()=>cS,BasePageTabModel:()=>dV,BlockGridModel:()=>dw,BlockModel:()=>dS.z,BlockSceneEnum:()=>dS.P,BulkDeleteActionModel:()=>d6,CascadeSelectFieldModel:()=>g9,CascadeSelectInnerFieldModel:()=>g3,CascadeSelectListFieldModel:()=>g7,CheckboxFieldModel:()=>vP,CheckboxGroupFieldModel:()=>vj,ChildPageModel:()=>dN,ChildPageTabModel:()=>dK,ClickableFieldModel:()=>gH,CollectionActionGroupModel:()=>s_,CollectionActionModel:()=>dC.U,CollectionBlockModel:()=>dF.t,CollectionSelectorFieldModel:()=>vT,ColorFieldModel:()=>vN,CommonItemModel:()=>dk,CreateContent:()=>cG,CreateFormModel:()=>mZ,CustomWidth:()=>hJ,DataBlockModel:()=>dA.R,DateOnlyFieldModel:()=>vW,DateOnlyFilterFieldModel:()=>c7,DateOnlyPicker:()=>vU,DateTimeFilterFieldModel:()=>c6,DateTimeNoTzFieldModel:()=>vG,DateTimeNoTzFilterFieldModel:()=>pt,DateTimeNoTzPicker:()=>vH,DateTimeTzFieldModel:()=>vQ,DateTimeTzFilterFieldModel:()=>pn,DateTimeTzPicker:()=>vX,DeleteActionModel:()=>d9,DetailsAssociationFieldGroupModel:()=>ca,DetailsBlockModel:()=>cc,DetailsCustomItemModel:()=>cm,DetailsGridModel:()=>ch,DetailsItemModel:()=>u1,DetailsJSFieldItemModel:()=>cx,DisassociateActionModel:()=>d7,DisplayCheckboxFieldModel:()=>xV,DisplayColorFieldModel:()=>xc,DisplayDateTimeFieldModel:()=>xh,DisplayEnumFieldModel:()=>xy,DisplayHtmlFieldModel:()=>xb,DisplayIconFieldModel:()=>xw,DisplayJSONFieldModel:()=>xF,DisplayNumberFieldModel:()=>xN,DisplayPasswordFieldModel:()=>xB,DisplayPercentFieldModel:()=>x$,DisplaySubItemFieldModel:()=>xi,DisplaySubListFieldModel:()=>xu,DisplaySubTableFieldModel:()=>xr,DisplayTextFieldModel:()=>xO,DisplayTimeFieldModel:()=>xL,DisplayTitleFieldModel:()=>xe,DisplayURLFieldModel:()=>xq,DividerItemModel:()=>y2,EditActionModel:()=>ue,EditFormContent:()=>vu,EditFormModel:()=>u2.EditFormModel,ExpandCollapseActionModel:()=>u$,FieldDeletePlaceholder:()=>hW,FieldModel:()=>aT.o,FieldModelSelect:()=>pg,FieldOperatorSelect:()=>pN,FilterActionModel:()=>un,FilterBlockModel:()=>dP,FilterFormActionGroupModel:()=>pJ,FilterFormActionModel:()=>pY,FilterFormBlockModel:()=>mc,FilterFormCollapseActionModel:()=>mg,FilterFormCustomFieldModel:()=>pL,FilterFormCustomItemModel:()=>pD,FilterFormCustomRecordSelectFieldModel:()=>pG,FilterFormFieldModel:()=>cb,FilterFormGridModel:()=>mR,FilterFormItemModel:()=>mT,FilterFormJSActionModel:()=>mE,FilterFormRecordSelectFieldModel:()=>c4,FilterFormResetActionModel:()=>mN,FilterFormSubmitActionModel:()=>mD,FilterManager:()=>s7,FormActionGroupModel:()=>uh,FormActionModel:()=>up,FormAssociationFieldGroupModel:()=>hi,FormAssociationItemModel:()=>hp,FormBlockContent:()=>uV.JU,FormBlockModel:()=>uV.F4,FormComponent:()=>uV.s2,FormCustomItemModel:()=>m0,FormGridModel:()=>uK,FormItemModel:()=>u9,FormJSFieldItemModel:()=>m1,FormModel:()=>uV.mO,FormSubmitActionModel:()=>um,GRID_FLOW_KEY:()=>dp,GRID_STEP:()=>dm,GridModel:()=>df,IconFieldModel:()=>v8,InputFieldModel:()=>v5.m,InputNumberField:()=>yi,JSActionModel:()=>us,JSBlockModel:()=>hC,JSCollectionActionModel:()=>ud,JSColumnModel:()=>fR,JSEditableFieldModel:()=>yQ,JSFieldModel:()=>yL,JSFormActionModel:()=>m2,JSItemActionModel:()=>ux,JSItemModel:()=>y9,JSRecordActionModel:()=>ub,JsonFieldModel:()=>yn,JsonInput:()=>yl,LinkActionModel:()=>uB,MainPageModel:()=>d$,MarkdownItemModel:()=>y6,NBColorPicker:()=>vE,NumberFieldModel:()=>ya,ObjectNester:()=>gI,PageModel:()=>dR,PageTabModel:()=>dU,PasswordFieldModel:()=>ys,PercentFieldModel:()=>yp,PercentInput:()=>yc,PluginSettingsTopbarActionModel:()=>nq,PopupActionModel:()=>dG,PopupCollectionActionModel:()=>uw,PopupSubTableActionGroupModel:()=>vb,PopupSubTableActionsColumnModel:()=>vC,PopupSubTableEditActionModel:()=>vp,PopupSubTableFieldModel:()=>vy,PopupSubTableFormActionGroupModel:()=>uv,PopupSubTableFormModel:()=>vF,PopupSubTableFormSubmitActionModel:()=>ug,PopupSubTableRemoveActionModel:()=>vx,QUICK_EDIT_FORM_MAX_HEIGHT:()=>m5,QUICK_EDIT_MARKDOWN_HEIGHT:()=>m4,QUICK_EDIT_POPOVER_MAX_HEIGHT:()=>m8,QuickEditFormModel:()=>hr,RadioGroupFieldModel:()=>ym,RecordActionGroupModel:()=>sV,RecordActionModel:()=>dY.L,RecordPickerContent:()=>f4,RecordPickerFieldModel:()=>f6,RecordSelectFieldModel:()=>cZ,RefreshActionModel:()=>uS,RichTextField:()=>yS,RichTextFieldModel:()=>yC,RootPageModel:()=>dW,RootPageTabModel:()=>dz,RouteModel:()=>eg,SelectFieldModel:()=>yM,SourceCascader:()=>p$,SubFormFieldModel:()=>gT,SubFormListFieldModel:()=>gE,SubPageModel:()=>dH,SubTableColumnModel:()=>gy,SubTableFieldModel:()=>gP,SubTableRecordAction:()=>vc,TABLE_COLUMN_MIN_WIDTH:()=>hG,TableActionsColumnModel:()=>h4,TableAssociationFieldGroupModel:()=>h3,TableBlockModel:()=>fS,TableColumnModel:()=>hQ,TableCustomColumnModel:()=>hZ,TableJSFieldItemModel:()=>fI,TableSelectModel:()=>fM,TextareaFieldModel:()=>yR,TimeFieldModel:()=>y$,TopbarActionModel:()=>nE,UIEditorTopbarActionModel:()=>nO,USER_CENTER_ACTION_ID:()=>nL,UnitConversion:()=>xD,UpdateRecordActionModel:()=>uM,UserCenterActionItemModel:()=>nY,UserCenterItemModel:()=>nH,UserCenterSelectItemModel:()=>nJ,UserCenterTextItemModel:()=>nG,UserCenterTopbarActionModel:()=>n2,VariableFieldFormModel:()=>yO,ViewActionModel:()=>uI,applyAssociateAction:()=>d8,applyClickToOpenProps:()=>gK,applyClickToOpenSetting:()=>gW,applyDisassociateAction:()=>d2,buildDisplayPathFromValue:()=>g0,buildRecordPickerParentItemContext:()=>f1,buildRecordPickerPopupContextInputArgs:()=>f8,canRecordPickerSelectMultiple:()=>fG,collectAssociationHydrationCandidates:()=>cz,collectCascadeHydrationCandidate:()=>gQ,connectFields:()=>mq,createAssignFieldValuesStep:()=>uu.KW,createAssignFormSubModelOptions:()=>uu.nF,customizeFilterRender:()=>mY,defaultOperator:()=>mU,findOptionPathByTk:()=>g1,formatNumber:()=>xR,getAllDataModels:()=>s8,getAssignFieldValuesDefaultParams:()=>uu.Z1,getAssociationBlockResourceSettings:()=>dX,getAssociationHydrationNamePath:()=>cK,getAssociationHydrationSetterContext:()=>cU,getAssociationSelectAssociatedRecordsFilter:()=>fj,getAssociationSelectForeignKeyFilter:()=>fP,getAssociationSelectorContextInputArgs:()=>d0,getAssociationTargetResourceSettings:()=>dZ,getDefaultOperator:()=>s1,getDetailsItemValue:()=>uZ,getDisplayNumber:()=>xE,getFilterFormOperatorList:()=>sZ,getFilterFormOperatorMeta:()=>s0,getQuickEditFieldProps:()=>ht,getRecordPickerClearedValue:()=>fQ,getRecordPickerEmptyValue:()=>fX,getTopbarPluginSettingsItems:()=>nR,getValueWithIndex:()=>uQ,injectRecordPickerPopupContext:()=>f2,isAssociationBlockContext:()=>dQ,isFilterValueEmpty:()=>s2,joinUrlSearch:()=>uR,markCascadeHydrationDone:()=>gZ,mergeAssignFieldValues:()=>uu.GO,normalizeRecordPickerSelectedRows:()=>fJ,normalizeRecordPickerValue:()=>fZ,normalizeTableColumnWidth:()=>hY,operatorComponentProps:()=>mX,recalculateGridSizes:()=>dv,refreshClickToOpenRuntime:()=>gU,resolveAssignFieldValues:()=>uu.eu,resolveCustomFieldOperatorList:()=>pT,resolveDefaultCustomFieldOperator:()=>pR,shouldClearRecordPickerValueOnMultipleChange:()=>fY,tableRowActionsClassName:()=>h2,toOperatorSelectOptions:()=>pE,transformNestedData:()=>gL,transformRowsToSingleColumn:()=>dg});var d={};l.r(d),l.d(d,{aclCheck:()=>bT,aclCheckRefresh:()=>bB,actionLinkageRules:()=>SM,afterSuccess:()=>aj,blockHeight:()=>wk,blockLinkageRules:()=>Sj,confirm:()=>aM,customVariable:()=>x7,dataLoadingMode:()=>bC,dataScope:()=>s$,dateRangeLimit:()=>bb,dateTimeFormat:()=>bv,detailsFieldLinkageRules:()=>SE,displayFieldComponent:()=>bj,fieldComponent:()=>bM,fieldLinkageRules:()=>ST,filterFormDefaultValues:()=>wb,fixed:()=>bz,formAssignRules:()=>wy,layout:()=>bk,linkageAssignField:()=>Sw,linkageRulesRefresh:()=>ww,linkageRunjs:()=>SC,linkageSetActionProps:()=>Ss,linkageSetBlockProps:()=>Sr,linkageSetDetailsFieldProps:()=>Sp,linkageSetFieldProps:()=>Su,linkageSetMenuItemProps:()=>Sd,menuLinkageRules:()=>SI,navigateToURL:()=>x6,numberFormat:()=>S$,openView:()=>xZ,overflowMode:()=>SD,pattern:()=>bL,refreshTargetBlocks:()=>bo,renderMode:()=>bF,required:()=>bA,runjs:()=>x0,setTargetDataScope:()=>bu,showMessage:()=>x8,showNotification:()=>x3,sortingRule:()=>bS,subFormFieldLinkageRules:()=>SR,subFormLinkageAssignField:()=>SS,subFormLinkageSetFieldProps:()=>Sc,titleField:()=>bh,validation:()=>bV});var u={};l.r(u),l.d(u,{ACLContext:()=>nn.w0,ACLRolesCheckProvider:()=>nn.rR,ADMIN_LAYOUT_MODEL_UID:()=>tF,ADMIN_SETTINGS_KEY:()=>at.w$,ADMIN_SETTINGS_LAYOUT_MODEL_UID:()=>nk.O,ADMIN_SETTINGS_PATH:()=>at.wq,AIManager:()=>ea,APIClient:()=>M,ASSIGN_FIELD_VALUES_STEP_KEY:()=>uu.zL,ActionGroupModel:()=>sL,ActionModel:()=>sz.S0,ActionSceneEnum:()=>sz.s5,ActionWithoutPermission:()=>sz._T,AddChildActionModel:()=>uL,AddNewActionModel:()=>dJ,AdminLayoutComponent:()=>oM,AdminLayoutContent:()=>l6,AdminLayoutMenuItemModel:()=>lU,AdminLayoutMenuItemRenderer:()=>lh,AdminLayoutMenuModelRenderer:()=>lv,AdminLayoutModel:()=>o_,AdminLayoutRouteCoordinator:()=>tC,AdminSettingsLayout:()=>CF.AdminSettingsLayout,AdminSettingsLayoutModel:()=>Ck.C,AntdAppProvider:()=>Y,AppError:()=>ed.uV,AppMaintaining:()=>ed.be,AppMaintainingDialog:()=>ed.tp,AppNotFound:()=>ed.bM,AppSpin:()=>ed.gv,Application:()=>ac,ApplicationContext:()=>ap,ApplicationModel:()=>r9,AssignFormGridModel:()=>uW,AssignFormItemModel:()=>ci,AssignFormModel:()=>uz,AssociateActionModel:()=>d3,AssociationFieldGroupModel:()=>sK,AssociationFieldModel:()=>cS,BaseApplication:()=>r4,BaseLayoutModel:()=>e_,BaseLayoutRouteCoordinator:()=>ek,BasePageTabModel:()=>dV,BlankComponent:()=>ed.ct,BlockGridModel:()=>dw,BlockModel:()=>dS.z,BlockSceneEnum:()=>dS.P,BulkDeleteActionModel:()=>d6,CascadeSelectFieldModel:()=>g9,CascadeSelectInnerFieldModel:()=>g3,CascadeSelectListFieldModel:()=>g7,CheckboxFieldInterface:()=>Fe,CheckboxFieldModel:()=>vP,CheckboxGroupFieldInterface:()=>Ft,CheckboxGroupFieldModel:()=>vj,ChildPageModel:()=>dN,ChildPageTabModel:()=>dK,ClickableFieldModel:()=>gH,CodeEditor:()=>ui.BY,CodeEditorExtension:()=>ui.o8,CodeScanner:()=>ed.O5,CollectionActionGroupModel:()=>s_,CollectionActionModel:()=>dC.U,CollectionBlockModel:()=>dF.t,CollectionFieldInterface:()=>C7,CollectionFieldInterfaceManager:()=>iX,CollectionFilter:()=>ed.px,CollectionFilterPanel:()=>ed.XO,CollectionSelect:()=>iC,CollectionSelectFieldInterface:()=>Fl,CollectionSelectorFieldModel:()=>vT,ColorFieldInterface:()=>Fn,ColorFieldModel:()=>vN,CommonItemModel:()=>dk,CreateContent:()=>cG,CreateFormModel:()=>mZ,CreatedAtFieldInterface:()=>Fo,CreatedByFieldInterface:()=>Fr,CurrentUserContext:()=>Cz,CustomWidth:()=>hJ,DEFAULT_DATA_SOURCE_KEY:()=>ti.Ze,DEFAULT_PAGE_SIZE:()=>ed.yQ,DataBlockModel:()=>dA.R,DateFieldInterface:()=>Fq,DateOnlyFieldModel:()=>vW,DateOnlyFilterFieldModel:()=>c7,DateOnlyPicker:()=>vU,DateTimeFilterFieldModel:()=>c6,DateTimeNoTzFieldModel:()=>vG,DateTimeNoTzFilterFieldModel:()=>pt,DateTimeNoTzPicker:()=>vH,DateTimeTzFieldModel:()=>vQ,DateTimeTzFilterFieldModel:()=>pn,DateTimeTzPicker:()=>vX,DatetimeFieldInterface:()=>Fi,DatetimeNoTzFieldInterface:()=>FL,DefaultToolsManager:()=>ei,DeleteActionModel:()=>d9,DetailsAssociationFieldGroupModel:()=>ca,DetailsBlockModel:()=>cc,DetailsCustomItemModel:()=>cm,DetailsGridModel:()=>ch,DetailsItemModel:()=>u1,DetailsJSFieldItemModel:()=>cx,DialogFormLayout:()=>ed.xg,DisassociateActionModel:()=>d7,DisplayCheckboxFieldModel:()=>xV,DisplayColorFieldModel:()=>xc,DisplayDateTimeFieldModel:()=>xh,DisplayEnumFieldModel:()=>xy,DisplayHtmlFieldModel:()=>xb,DisplayIconFieldModel:()=>xw,DisplayJSONFieldModel:()=>xF,DisplayNumberFieldModel:()=>xN,DisplayPasswordFieldModel:()=>xB,DisplayPercentFieldModel:()=>x$,DisplaySubItemFieldModel:()=>xi,DisplaySubListFieldModel:()=>xu,DisplaySubTableFieldModel:()=>xr,DisplayTextFieldModel:()=>xO,DisplayTimeFieldModel:()=>xL,DisplayTitleFieldModel:()=>xe,DisplayURLFieldModel:()=>xq,DividerItemModel:()=>y2,DragSortRowContext:()=>ed.c5,DrawerFormLayout:()=>ed.gh,EditActionModel:()=>ue,EditFormContent:()=>vu,EditFormModel:()=>u2.EditFormModel,EmailFieldInterface:()=>Fa,EnvVariableInput:()=>ed.s9,ExpandCollapseActionModel:()=>u$,ExtendCollectionsProvider:()=>FK,FieldDeletePlaceholder:()=>hW,FieldFilterOperatorRegistry:()=>im,FieldModel:()=>aT.o,FieldModelSelect:()=>pg,FieldOperatorSelect:()=>pN,FieldValidationConfigureRegistry:()=>iW,FileSizeInput:()=>ed.c,FilterActionModel:()=>un,FilterBlockModel:()=>dP,FilterContent:()=>aI.oJ,FilterFormActionGroupModel:()=>pJ,FilterFormActionModel:()=>pY,FilterFormBlockModel:()=>mc,FilterFormCollapseActionModel:()=>mg,FilterFormCustomFieldModel:()=>pL,FilterFormCustomItemModel:()=>pD,FilterFormCustomRecordSelectFieldModel:()=>pG,FilterFormFieldModel:()=>cb,FilterFormGridModel:()=>mR,FilterFormItemModel:()=>mT,FilterFormJSActionModel:()=>mE,FilterFormRecordSelectFieldModel:()=>c4,FilterFormResetActionModel:()=>mN,FilterFormSubmitActionModel:()=>mD,FilterGroup:()=>aI.I8,FilterItem:()=>aI.qi,FilterManager:()=>s7,FlowModelRepository:()=>SV,FlowPage:()=>xW,FlowRoute:()=>o0,FormActionGroupModel:()=>uh,FormActionModel:()=>up,FormAssociationFieldGroupModel:()=>hi,FormAssociationItemModel:()=>hp,FormBlockContent:()=>uV.JU,FormBlockModel:()=>uV.F4,FormComponent:()=>uV.s2,FormCustomItemModel:()=>m0,FormGridModel:()=>uK,FormItemModel:()=>u9,FormJSFieldItemModel:()=>m1,FormModel:()=>uV.mO,FormSubmitActionModel:()=>um,GRID_FLOW_KEY:()=>dp,GRID_STEP:()=>dm,GlobalThemeProvider:()=>eo,GridModel:()=>df,HeaderContext:()=>lo,Icon:()=>ed.In,IconFieldInterface:()=>Fs,IconFieldModel:()=>v8,IdFieldInterface:()=>Fd,InputFieldInterface:()=>Fp,InputFieldModel:()=>v5.m,InputNumberField:()=>yi,IntegerFieldInterface:()=>Fm,InternalAdminSettingsLayout:()=>CF.InternalAdminSettingsLayout,JSActionModel:()=>us,JSBlockModel:()=>hC,JSCollectionActionModel:()=>ud,JSColumnModel:()=>fR,JSEditableFieldModel:()=>yQ,JSFieldModel:()=>yL,JSFormActionModel:()=>m2,JSItemActionModel:()=>ux,JSItemModel:()=>y9,JSRecordActionModel:()=>ub,JsonFieldInterface:()=>Fh,JsonFieldModel:()=>yn,JsonInput:()=>yl,JsonTextArea:()=>ed.V4,LayoutContent:()=>l9,LayoutContentRoute:()=>o2,LayoutManager:()=>ru,LayoutRoute:()=>re,LinkActionModel:()=>uB,LinkageFilterItem:()=>aI.Ru,M2MFieldInterface:()=>Ff,M2OFieldInterface:()=>Fg,MAX_MESSAGE_CHARS:()=>ui.hP,MENU_TYPE_OPTIONS:()=>lT,MainPageModel:()=>d$,MarkdownFieldInterface:()=>Fv,MarkdownItemModel:()=>y6,MobileMenuControlContext:()=>ln,MockFlowModelRepository:()=>S_,MultipleSelectFieldInterface:()=>Fy,NBColorPicker:()=>vE,NanoidFieldInterface:()=>F$,NocoBaseBuildInPlugin:()=>CY,NocoBaseBuildInPluginV2:()=>CY,NumberFieldInterface:()=>Fx,NumberFieldModel:()=>ya,O2MFieldInterface:()=>Fw,OBOFieldInterface:()=>Fb,OHOFieldInterface:()=>FS,ObjectNester:()=>gI,OptionsEditor:()=>iz,PAGE_SIZE_OPTIONS:()=>ed.xp,PLUGIN_MANAGER_SETTING_NAME:()=>nk.Bm,PageModel:()=>dR,PageTabModel:()=>dU,PasswordFieldInterface:()=>FC,PasswordFieldModel:()=>ys,PasswordInput:()=>ed.yA,PercentFieldInterface:()=>FF,PercentFieldModel:()=>yp,PercentInput:()=>yc,PhoneFieldInterface:()=>Fk,PinnedPluginListContext:()=>nr,PinnedPluginListLite:()=>n4,Plugin:()=>ay,PluginFlowEngine:()=>Cj,PluginManager:()=>ae,PluginManagerPage:()=>CA.PluginManagerPage,PluginSettingsManager:()=>at.mz,PluginSettingsTopbarActionModel:()=>nq,PopupActionModel:()=>dG,PopupCollectionActionModel:()=>uw,PopupSubTableActionGroupModel:()=>vb,PopupSubTableActionsColumnModel:()=>vC,PopupSubTableEditActionModel:()=>vp,PopupSubTableFieldModel:()=>vy,PopupSubTableFormActionGroupModel:()=>uv,PopupSubTableFormModel:()=>vF,PopupSubTableFormSubmitActionModel:()=>ug,PopupSubTableRemoveActionModel:()=>vx,PoweredBy:()=>ed.G5,QUICK_EDIT_FORM_MAX_HEIGHT:()=>m5,QUICK_EDIT_MARKDOWN_HEIGHT:()=>m4,QUICK_EDIT_POPOVER_MAX_HEIGHT:()=>m8,QuickEditFormModel:()=>hr,RadioGroupFieldInterface:()=>FA,RadioGroupFieldModel:()=>ym,RangeValidationItems:()=>iU,RecordActionGroupModel:()=>sV,RecordActionModel:()=>dY.L,RecordPickerContent:()=>f4,RecordPickerFieldModel:()=>f6,RecordSelectFieldModel:()=>cZ,RefreshActionModel:()=>uS,RemoteFlowModelRenderer:()=>xH,RemoteSelect:()=>ed.lT,ResetThemeTokenAndKeepAlgorithm:()=>tR,RichTextField:()=>yS,RichTextFieldInterface:()=>FP,RichTextFieldModel:()=>yC,RootPageModel:()=>dW,RootPageTabModel:()=>dz,RouteModel:()=>eg,RouteRepository:()=>rc,RouterContextCleaner:()=>ed.PK,RouterManager:()=>aa,SNIPPET_PREFIX:()=>at.tJ,SYSTEM_SETTINGS_SETTING_NAME:()=>nk.jm,ScanInput:()=>ed.E5,SelectFieldInterface:()=>Fj,SelectFieldModel:()=>yM,SkeletonFallback:()=>o4,SnowflakeIdFieldInterface:()=>FM,SortHandle:()=>ed.vm,SortableRow:()=>ed.B7,SourceCascader:()=>p$,SubFormFieldModel:()=>gT,SubFormListFieldModel:()=>gE,SubPageModel:()=>dH,SubTableColumnModel:()=>gy,SubTableFieldModel:()=>gP,SubTableRecordAction:()=>vc,SwitchLanguage:()=>ed.rw,SystemSettingsPage:()=>CP.SystemSettingsPage,SystemSettingsSource:()=>eu.o,TABLE_COLUMN_MIN_WIDTH:()=>hG,Table:()=>ed.XI,TableActionsColumnModel:()=>h4,TableAssociationFieldGroupModel:()=>h3,TableBlockModel:()=>fS,TableColumnModel:()=>hQ,TableCustomColumnModel:()=>hZ,TableJSFieldItemModel:()=>fI,TableSelectModel:()=>fM,TableoidFieldInterface:()=>FI,TextAreaWithContextSelector:()=>ab.n,TextareaFieldInterface:()=>FT,TextareaFieldModel:()=>yR,TimeFieldInterface:()=>FR,TimeFieldModel:()=>y$,TopbarActionModel:()=>nE,TypedVariableInput:()=>ed.Pb,UIEditorTopbarActionModel:()=>nO,USER_CENTER_ACTION_ID:()=>nL,UUIDFieldInterface:()=>FB,UnitConversion:()=>xD,UnixTimestampFieldInterface:()=>FO,UpdateRecordActionModel:()=>uM,UpdatedAtFieldInterface:()=>FE,UpdatedByFieldInterface:()=>FN,UrlFieldInterface:()=>FD,UserCenterActionItemModel:()=>nY,UserCenterItemModel:()=>nH,UserCenterSelectItemModel:()=>nJ,UserCenterTextItemModel:()=>nG,UserCenterTopbarActionModel:()=>n2,VariableFieldFormModel:()=>yO,VariableFilterItem:()=>aI.Et,VariableInput:()=>ed.P8,VariableJSON:()=>ed.hJ,VariableJsonTextArea:()=>ed.jr,VariableTextArea:()=>ed.hp,ViewActionModel:()=>uI,WebSocketClient:()=>rp,aclCheck:()=>bT,aclCheckRefresh:()=>bB,actionLinkageRules:()=>SM,addCustomAlgorithmToTheme:()=>et,addFieldValidationConfiguresToGroup:()=>iJ,afterSuccess:()=>aj,applyAssociateAction:()=>d8,applyClickToOpenProps:()=>gK,applyClickToOpenSetting:()=>gW,applyDisassociateAction:()=>d2,applyMobilePaginationProps:()=>uC.hO,array:()=>it,bigField:()=>ip,blockHeight:()=>wk,blockLinkageRules:()=>Sj,boolean:()=>id,buildDisplayPathFromValue:()=>g0,buildInsertRouteSchema:()=>lV,buildLinkSettingSchema:()=>lj,buildMenuBasicSchema:()=>lR,buildMenuTitleWithIcon:()=>lx,buildRecordPickerParentItemContext:()=>f1,buildRecordPickerPopupContextInputArgs:()=>f8,buildV2SigninHref:()=>tn,canRecordPickerSelectMultiple:()=>fG,collectAssociationHydrationCandidates:()=>cz,collectCascadeHydrationCandidate:()=>gQ,collection:()=>ic,compatOldTheme:()=>Z,configurePropertiesToItems:()=>iR,confirm:()=>aM,connectFields:()=>mq,createAclSnippetAllow:()=>nn.rN,createAssignFieldValuesStep:()=>uu.KW,createAssignFormSubModelOptions:()=>uu.nF,createCompactSimpleItemRender:()=>uC.hH,createDefaultCollectionBlockTitle:()=>uC.lr,createFilterable:()=>iw,createFormRegistry:()=>ed.oV,createInsertMenuStep:()=>l$,createMockClient:()=>av,createSettingsPathMap:()=>nk.nC,createTypedFilterable:()=>iS,customAlgorithm:()=>ee,customVariable:()=>x7,customizeFilterRender:()=>mY,dataLoadingMode:()=>bC,dataScope:()=>s$,dateRangeLimit:()=>bb,dateTimeFormat:()=>bv,dateTimeFormatConfigureItems:()=>iL,datetime:()=>io,defaultOperator:()=>mU,defaultTheme:()=>Q,detailsFieldLinkageRules:()=>SE,diagnoseRunJS:()=>ui.fL,dispatchEventDeep:()=>uC.Xi,displayFieldComponent:()=>bj,editMarkdownFlow:()=>y4,enumType:()=>ia,escapeHTML:()=>nc.Z,evaluateFieldConfigureExpression:()=>iP,fieldComponent:()=>bM,fieldFilterOperatorPresets:()=>iv,fieldFilterOperators:()=>ig,fieldLinkageRules:()=>ST,fieldValidationConfigureRegistry:()=>iH,filterFormDefaultValues:()=>wb,filterOperatorRegistry:()=>ih,filterRenderableSettings:()=>nk.Ui,filterVisibleSettings:()=>nk.eD,findFirstAccessiblePageRoute:()=>tb,findFirstInternalSettingsPage:()=>nk.X2,findFirstV2LandingRoute:()=>tx,findNextSiblingRoute:()=>lL,findOptionPathByTk:()=>g1,findPrevSiblingRoute:()=>lq,findSettingsByName:()=>nk.R0,fixed:()=>bz,formAssignRules:()=>wy,formatEnvPath:()=>ed.EM,formatNumber:()=>xR,formatRunJSPreviewMessage:()=>ui.by,formatVariablePath:()=>ed.X5,getAdminLayoutMenuInitializerButton:()=>ly,getAdminLayoutMenuMovePositionOptions:()=>lr,getAdminLayoutMenuVirtualPath:()=>tQ,getAdminLayoutModel:()=>oV,getAllDataModels:()=>s8,getAppVersionHTML:()=>nc.p,getAssignFieldValuesDefaultParams:()=>uu.Z1,getAssociationBlockResourceSettings:()=>dX,getAssociationHydrationNamePath:()=>cK,getAssociationHydrationSetterContext:()=>cU,getAssociationSelectAssociatedRecordsFilter:()=>fj,getAssociationSelectForeignKeyFilter:()=>fP,getAssociationSelectorContextInputArgs:()=>d0,getAssociationTargetResourceSettings:()=>dZ,getCoreFieldConfigureState:()=>i$,getCurrentV2RedirectPath:()=>tl,getDefaultOperator:()=>s1,getDefaultSettingsPath:()=>nk.C9,getDefaultV2AdminRedirectPath:()=>tt,getDetailsItemValue:()=>uZ,getDisplayNumber:()=>xE,getFilterFormOperatorList:()=>sZ,getFilterFormOperatorMeta:()=>s0,getLayoutContentRouteNames:()=>eT,getLayoutModel:()=>eV,getLayoutPageRouteName:()=>eP,getLayoutPageTabRouteName:()=>ej,getLayoutPageTabViewRouteName:()=>eI,getLayoutPageViewRouteName:()=>eM,getMenuCreationDefaultParams:()=>lI,getMenuCreationUiSchema:()=>lD,getMenuEditDefaultParams:()=>lN,getMenuItems:()=>nk.gL,getMobileCompactPaginationClassName:()=>uC.NY,getModernClientPrefix:()=>e4,getPinnedPluginListKeys:()=>no,getQuickEditFieldProps:()=>ht,getRecordPickerClearedValue:()=>fQ,getRecordPickerEmptyValue:()=>fX,getSimpleModePaginationClassName:()=>uC.HZ,getTopbarPluginSettingsItems:()=>nR,getUniqueKeyFromCollection:()=>F_,getUnknownCountPaginationTotal:()=>uC.SM,getV2EffectiveBasePath:()=>e6,getValueWithIndex:()=>uQ,hasIcon:()=>ed.cE,hasOwnSettingsPage:()=>nk.lv,icons:()=>ed.Pt,id:()=>ii,indexConfigureItems:()=>iq,injectRecordPickerPopupContext:()=>f2,insertRouteSchema:()=>lM,isAssociationBlockContext:()=>dQ,isFilterValueEmpty:()=>s2,isLayoutContentRouteName:()=>eR,isTitleField:()=>ti.ji,isTitleFieldInterface:()=>ti.w,isV2AdminRuntime:()=>tc,isV2MenuRoute:()=>ty,joinUrlSearch:()=>uR,languageCodes:()=>ax.A,layout:()=>bk,linkageAssignField:()=>Sw,linkageRulesRefresh:()=>ww,linkageRunjs:()=>SC,linkageSetActionProps:()=>Ss,linkageSetBlockProps:()=>Sr,linkageSetDetailsFieldProps:()=>Sp,linkageSetFieldProps:()=>Su,linkageSetMenuItemProps:()=>Sd,makeFormatVariablePath:()=>ed.nW,makeParseVariablePath:()=>ed.Dx,makeVariableRegExp:()=>ed.at,markCascadeHydrationDone:()=>gZ,matchSettingsRoute:()=>nk.CM,matchesRoutePath:()=>l_,menuLinkageRules:()=>SI,mergeAssignFieldValues:()=>uu.GO,mergePaginationClassName:()=>uC.M6,navigateToURL:()=>x6,normalizeAdminLayoutMenuLegacyVariables:()=>t2,normalizeCollectionTemplateField:()=>FV,normalizeCollectionTemplateFields:()=>Fz,normalizeFilterableOperators:()=>ix,normalizeLayoutRoutePath:()=>rs,normalizeRecordPickerSelectedRows:()=>fJ,normalizeRecordPickerValue:()=>fZ,normalizeTableColumnWidth:()=>hY,number:()=>ir,numberFormat:()=>S$,object:()=>il,openAdminLayoutMenuLink:()=>t5,openView:()=>xZ,openViewFlow:()=>eh,operatorComponentProps:()=>mX,overflowMode:()=>SD,parseEnvPath:()=>ed.uO,parseVariablePath:()=>ed.h7,pattern:()=>bL,previewRunJS:()=>ui.zA,recalculateGridSizes:()=>dv,reconcileAdminLayoutMenuItems:()=>la,redirectToV2Signin:()=>to,refreshClickToOpenRuntime:()=>gU,refreshTargetBlocks:()=>bo,registerFieldValidationConfigure:()=>iG,registerFieldValidationConfigureGroup:()=>iY,registerIcon:()=>ed.pU,registerIcons:()=>ed.K1,removeMarkdownIframes:()=>Co.VC,renderMode:()=>bF,replaceRouteParams:()=>nk.uT,required:()=>bA,resolveAdminLayoutMenuDragMoveOptions:()=>ls,resolveAdminLayoutMenuDragMoveOptionsFromEvent:()=>ld,resolveAdminLayoutMenuLink:()=>t8,resolveAdminRouteRuntimeTarget:()=>tS,resolveAssignFieldValues:()=>uu.eu,resolveCustomFieldOperatorList:()=>pT,resolveDefaultCustomFieldOperator:()=>pR,resolveDynamicNamePath:()=>a_.IJ,resolveFilterOperators:()=>iy,resolveV2SigninRedirect:()=>tr,reverseFieldConfigureItem:()=>iV,reverseFieldConfigureItems:()=>i_,runCoreFieldConfigureEffects:()=>iO,runjs:()=>x0,setTargetDataScope:()=>bu,shouldClearRecordPickerValueOnMultipleChange:()=>fY,shouldRenderIconInTitle:()=>lf,showMessage:()=>x8,showNotification:()=>x3,sortTopLevelSettings:()=>nk.p$,sortingRule:()=>bS,string:()=>ie,stripMarkdownIframeTags:()=>Co.jR,stripMarkdownIframes:()=>Co.$P,stripModernClientPrefix:()=>e3,subFormFieldLinkageRules:()=>SR,subFormLinkageAssignField:()=>SS,subFormLinkageSetFieldProps:()=>Sc,tableRowActionsClassName:()=>h2,tableoid:()=>iu,time:()=>is,titleField:()=>bh,toOperatorSelectOptions:()=>pE,toRouterNavigationPath:()=>tp,toToolsMap:()=>es,toTreeSelectItems:()=>lO,toViewStack:()=>eA,transformNestedData:()=>gL,transformRowsToSingleColumn:()=>dg,useACLContext:()=>nn.bq,useACLRoleContext:()=>nn.v6,useAclSnippets:()=>nn.K3,useAdminLayoutRoutePage:()=>CC,useApp:()=>U.n,useAppListRender:()=>oe,useApplications:()=>n3,useCurrentAppInfo:()=>ns.g,useCurrentRoleMode:()=>nn.GL,useCurrentRoles:()=>CU,useCurrentUserContext:()=>CK,useFilterOptions:()=>aI.uw,useFilteredMetaTree:()=>ed.a7,useGlobalTheme:()=>en,useLayoutRoutePage:()=>oz,useMobileLayout:()=>CS,usePlugin:()=>nd.n,useRoleRecheck:()=>nn.N5,useRouter:()=>nu,useSystemSettings:()=>eu.e,useUIConfigurationPermissions:()=>nn.uM,validation:()=>bV});var c={};l.r(c),l.d(c,{array:()=>Px,bigField:()=>PM,boolean:()=>PA,collection:()=>Pj,datetime:()=>Pw,enumType:()=>PF,id:()=>PC,number:()=>PS,object:()=>Pb,string:()=>Py,tableoid:()=>PP,time:()=>Pk});var p={};l.r(p),l.d(p,{autoFill:()=>PN,autoIncrement:()=>PE,collectionDataSource:()=>Pz,constraintsProps:()=>PB,dataSource:()=>PL,dateTimeProps:()=>PO,defaultProps:()=>P_,operators:()=>c,primaryKey:()=>PR,recordPickerViewer:()=>PV,relationshipType:()=>PD,reverseFieldProperties:()=>P$,timeProps:()=>Pq,type:()=>PI,unique:()=>PT});var m={};l.r(m),l.d(m,{FormActiveFieldsProvider:()=>qn,appendQueryStringToUrl:()=>HJ,completeURL:()=>H2,fillParentFields:()=>H5,findFilterTargets:()=>HS,getAppends:()=>HW,getAssociationPath:()=>HU,getCardItemSchema:()=>Hm,getFormValues:()=>Hy,getPageSchema:()=>Hp,navigateWithinSelf:()=>H8,parseVariablesAndChangeParamsToQueryString:()=>H0,reduceValueSize:()=>H1,replaceVariableValue:()=>HZ,updateFilterTargets:()=>HC,useAssociationCreateActionProps:()=>Hw,useAssociationFilterBlockProps:()=>Hz,useAssociationFilterProps:()=>HL,useAssociationNames:()=>HH,useBlockHeightProps:()=>Hc,useBulkDestroyActionProps:()=>HD,useCollectValuesToSubmit:()=>Hx,useCreateActionProps:()=>Hb,useCustomizeBulkUpdateActionProps:()=>HM,useCustomizeRequestActionProps:()=>HI,useCustomizeUpdateActionProps:()=>Hj,useDataBlockParentRecord:()=>Hh,useDestroyActionProps:()=>HR,useDetailsPaginationProps:()=>Hq,useDisassociateActionProps:()=>HN,useEditTableActionProps:()=>HO,useFilterBlockActionProps:()=>Hk,useFormActiveFields:()=>qo,useLinkActionProps:()=>HQ,useOptionalFieldList:()=>H_,useParseURLAndParams:()=>HX,useParsedFilter:()=>Tg,usePickActionProps:()=>Hf,useRefreshActionProps:()=>HB,useRemoveActionProps:()=>HE,useResetBlockActionProps:()=>HP,useTableColumns:()=>H$,useUpdateActionProps:()=>HT});var h={};l.r(h),l.d(h,{DateFilterDynamicComponent:()=>Gr,DndContext:()=>Rf,DragHandler:()=>ET,DraggableContext:()=>ES,ShowFormData:()=>Gl,Sortable:()=>EA,SortableContext:()=>EC,SortableItem:()=>EI,SortableProvider:()=>EF,getRenderContent:()=>MI});var f={};l.r(f),l.d(f,{AssignedField:()=>et$,AssignedFieldInner:()=>etB,AssignedFieldValueType:()=>etD,CreateAction:()=>etz,CreateRecordAction:()=>etU,useAclCheck:()=>etq});var g={};l.r(g),l.d(g,{Action:()=>Qf,ActionBar:()=>QP,ActionBarProvider:()=>QC,ActionContext:()=>Wu,ActionContextNoRerender:()=>Wm,ActionContextProvider:()=>Wc,ActionDesigner:()=>Yg,AfterSuccess:()=>Yu,AllDataBlocksContext:()=>jY,AllDataBlocksProvider:()=>jJ,AntdSchemaComponentPlugin:()=>ZY,AntdSchemaComponentProvider:()=>ZG,AppendsTreeSelect:()=>Z8,AssignedFieldValues:()=>Yl,AssociationField:()=>elS,AssociationFieldMode:()=>etP,AssociationFieldModeProvider:()=>etI,AssociationSelect:()=>elP,AttachmentList:()=>eeY,AutoComplete:()=>elM,BackButtonUsedInSubPage:()=>Dh,Block:()=>enV,BlockItem:()=>Gs,BlockItemCard:()=>Hu,BlockItemCardContext:()=>Hd,BlocksSelector:()=>Yd,ButtonEditor:()=>Yt,CardItem:()=>elN,Cascader:()=>elq,Checkbox:()=>etu,CollectionSelect:()=>elz,ColorPicker:()=>elG,ColorSelect:()=>elJ,Cron:()=>el0,CronSet:()=>el5,DataSourceCollectionCascader:()=>elH,DataSourceSelect:()=>elU,DateFormatCom:()=>Ph,DatePicker:()=>Vp,DatePickerProvider:()=>Vd,Details:()=>el4,DetailsDesigner:()=>QL,Divider:()=>el3,EditComponent:()=>Gy,EditDefaultValue:()=>Gv,EditDescription:()=>Gm,EditOperator:()=>Gw,EditPattern:()=>Gx,EditRequired:()=>Gf,EditSortField:()=>erk,EditTable:()=>env,EditTableAction:()=>enC,EditTableActionContext:()=>enw,EditTitle:()=>Gp,EditTitleField:()=>GS,EditTooltip:()=>Gh,EditValidationRules:()=>Gg,Editable:()=>eo$,EllipsisWithTooltip:()=>WT,ErrorFallback:()=>M6,Expand:()=>enN,ExpiresRadio:()=>Pv,FieldsTreeSelect:()=>Z2,Fieldset:()=>enD,Filter:()=>zd,FilterAction:()=>V4,FilterActionContext:()=>V8,FilterContext:()=>_L,FilterDynamicComponent:()=>zn,FilterLogicContext:()=>__,Form:()=>QB,FormDialog:()=>Kx,FormDrawer:()=>erG,FormField:()=>Zu,FormItem:()=>G$,FormV2:()=>Zi,G2Plot:()=>en_,G2PlotRenderer:()=>enL,Grid:()=>qt,GridCard:()=>en4,GridRowContext:()=>OJ,HTMLEncode:()=>WR,ICON_POPUP_Z_INDEX:()=>V0,IconPicker:()=>en7,Input:()=>W0,InputNumber:()=>eod,InputReadPretty:()=>WE,InputRecordPicker:()=>eoG,Json:()=>WA,LinkageFilter:()=>er6,List:()=>eoS,Markdown:()=>Ha,MarkdownReadPretty:()=>Hs,Menu:()=>E5,NanoIDInput:()=>eoC,Page:()=>ZE,PagePopups:()=>I5,PageTabs:()=>ZN,Pagination:()=>eoF,ParentRouteContext:()=>EY,Password:()=>eoR,Percent:()=>eoD,PopupSettingsProvider:()=>Im,Preview:()=>eoB,QuickEdit:()=>eoO,Radio:()=>eta,ReadPretty:()=>WE,ReadPrettyRecordPicker:()=>eoZ,RecordPicker:()=>eo0,RecordPickerContext:()=>eoz,RecordPickerProvider:()=>eoY,RefreshDataBlockRequest:()=>Yv,RemoteSelect:()=>Q2,RemoveButton:()=>Yc,RemoveConditionContext:()=>_q,RequestSettings:()=>Yn,RichText:()=>eo8,SecondConFirm:()=>Yh,Select:()=>QX,SkipValidation:()=>Yo,Space:()=>eo5,StablePopover:()=>V1,Table:()=>erb,TableBlockDesigner:()=>erA,TableField:()=>erP,TableSelectorDesigner:()=>erj,TableV2:()=>erM,Tabs:()=>erE,TabsContextProvider:()=>Iu,Templates:()=>Q5,TestDesigner:()=>Gd,TextAreaWithGlobalScope:()=>erU,TimePicker:()=>er$,TreeSelect:()=>erq,UnixTimestamp:()=>erV,Upload:()=>eeK,Uploader:()=>eeJ,Variable:()=>Y8,VariableScopeProvider:()=>Y1,VariableSelect:()=>W8,actionSettings:()=>Yf,actionSettingsItems:()=>Yp,allowAddNew:()=>zF,attachmentFileTypes:()=>eeh,defaultFieldNames:()=>QV,fetchTemplateData:()=>Q3,filterFormItemSettings:()=>Xy,findByUid:()=>EE,findKeysByUid:()=>EB,findMenuItem:()=>EN,formDetailsSettings:()=>Zd,formItemSettings:()=>zk,formSettings:()=>Za,formV1Settings:()=>Q$,genStyleHook:()=>kR,getCurrentOptions:()=>QU,getDateExact:()=>Mf,getDatePickerLabels:()=>eo_,getDateRanges:()=>Mh,getLabelFormatValue:()=>eoV,getPopupPathFromParams:()=>I_,getStoredPopupContext:()=>IN,getTabSchema:()=>Zz,getZIndex:()=>Dr,handleDateChangeOnForm:()=>Mi,inferPickerType:()=>Mv,isBulkEditAction:()=>Qy,isFileCollection:()=>GO,isMobile:()=>Ms,isShowFilePicker:()=>eoX,isTabPage:()=>ZV,isWriteEmailAction:()=>Qx,mapDatePicker:()=>Ma,mapRangePicker:()=>Md,mapTimeFormat:()=>erB,matchMimetype:()=>eef,moment2str:()=>Mo,navigateToTab:()=>Z_,pageSettings:()=>ZU,pageTabSettings:()=>ZH,readPrettyFormSettings:()=>Zs,removeNullCondition:()=>zv,resolveFilterPickerFormat:()=>Vi,storePopupContext:()=>ID,useActionBarContext:()=>QF,useActionContext:()=>Wh,useAfterSuccessOptions:()=>G3,useAllDataBlocks:()=>jX,useAssociationFieldContext:()=>Bp,useAssociationFieldModeContext:()=>etT,useBackButton:()=>Dm,useCloseAction:()=>Wf,useColumnSchema:()=>O_,useColumnSettings:()=>Bx,useCurrentPopupContext:()=>I9,useDatePickerContext:()=>Vs,useDownloadLogs:()=>M3,useEnsureOperatorsValid:()=>Gb,useFieldMode:()=>zE,useFieldNames:()=>eoq,useFilterActionProps:()=>zy,useFilterFieldOptions:()=>zf,useFilterFieldProps:()=>zx,useFilterOptions:()=>zc,useFormDataTemplates:()=>Q8,useGetAriaLabelOfAction:()=>Qp,useGetAriaLabelOfDrawer:()=>$d,useGetAriaLabelOfModal:()=>Dl,useGetAriaLabelOfPopover:()=>Qj,useGetFilterFieldOptions:()=>zp,useGetFilterOptions:()=>zu,useGridContext:()=>O9,useGridRowContext:()=>O7,useIsAddNewForm:()=>zA,useIsAssociationField:()=>zT,useIsFieldReadPretty:()=>zM,useIsFileField:()=>zR,useIsFormReadPretty:()=>zj,useIsSelectFieldMode:()=>zN,useKeepAliveLocationSearch:()=>ZR,useLabelUiSchema:()=>eoL,useLinkageAction:()=>Wg,useListBlockContext:()=>eom,useMenuDragEnd:()=>E8,useMenuTranslation:()=>ER,useNocoBaseRoutes:()=>EX,useParentRoute:()=>EJ,usePopupSettings:()=>Ih,useStyles:()=>Ei,useTableColumnIntegration:()=>Bb,useTabsContext:()=>Ic,useTitleFieldOptions:()=>z$,useUploadStyles:()=>eeM,useValidateSchema:()=>zD,useVariableScope:()=>Y2,useZIndexContext:()=>Do,withSearchParams:()=>IK,zIndexContext:()=>Dn});var v={};l.r(v),l.d(v,{isDeleteButtonDisabled:()=>ei5,useBulkDestroyAction:()=>eiQ,useBulkDestroyActionAndRefreshCM:()=>ei4,useCancelAction:()=>eiE,useChildrenCollections:()=>eiO,useCollectionFieldsOptions:()=>eiz,useCollectionFilterOptions:()=>eiL,useCollectionFilterOptionsV2:()=>ei_,useCreateAction:()=>eiW,useCreateActionAndRefreshCM:()=>ei0,useCreateActionWithoutRefresh:()=>eiH,useDeleteButtonDisabled:()=>ei8,useDestroyAction:()=>eiX,useDestroyActionAndRefreshCM:()=>ei2,useFilterAction:()=>eiU,useFilterActionProps:()=>ei3,useFilterDataSource:()=>eiK,useKanbanEvents:()=>eiB,useLinkageCollectionFilterOptions:()=>eiV,useMoveAction:()=>eiY,useResetFilterAction:()=>eiD,useSelfAndChildrenCollections:()=>eiq,useSortFields:()=>ei$,useUpdateAction:()=>eiJ,useUpdateActionAndRefreshCM:()=>ei1,useUpdateViewAction:()=>eiG,useValuesFromRA:()=>eiZ,useValuesFromRecord:()=>eiN});var y={};l.r(y),l.d(y,{FieldValidation:()=>eal,ForeignKey:()=>eau,SourceCollection:()=>eaa,SourceForeignKey:()=>eao,SourceKey:()=>eas,TargetForeignKey:()=>eai,TargetKey:()=>ead,ThroughCollection:()=>eac,ThroughForeignKey:()=>ear});var x={};l.r(x),l.d(x,{MenuConfigure:()=>eut,PermissionContext:()=>eun,PermissionProvider:()=>euo,RoleConfigure:()=>eui,RoleResourceCollectionContext:()=>euS,RoleTable:()=>euh,RolesResourcesActions:()=>euC,ScopeSelect:()=>eub,SettingCenterPermissionProvider:()=>eul,SettingCenterProvider:()=>eu3,SettingsCenterConfigure:()=>eu6,StrategyActions:()=>euA,useRolesResourcesScopesSelectedRowKeys:()=>eux});var b={};l.r(b),l.d(b,{ActionBarAssociationFilterAction:()=>ecA,ActionInitializer:()=>ecb,ActionInitializerItem:()=>ecu,AssociationFilter:()=>ecq,AssociationFilterDesignerDelete:()=>ec_,AssociationFilterDesignerDisplayField:()=>ecV,AssociationFilterPlugin:()=>ecL,BlockInitializer:()=>ecz,BlockItemInitializer:()=>ecK,CreateFilterActionInitializer:()=>ecU,CreateResetActionInitializer:()=>ecW,CustomizeActionInitializer:()=>ecH,DataBlockInitializer:()=>ec1,G2PlotInitializer:()=>ec2,InitializerWithSwitch:()=>ecx,ModalActionSchemaInitializerItem:()=>epf,RecordAssociationBlockInitializer:()=>ec5,RecordAssociationDetailsBlockInitializer:()=>ec9,RecordAssociationFormBlockInitializer:()=>ept,RecordAssociationGridCardBlockInitializer:()=>epo,RecordAssociationListBlockInitializer:()=>epa,RecordReadPrettyAssociationFormBlockInitializer:()=>epu,SearchCollections:()=>ecQ,SelectActionInitializer:()=>epp,SubmitActionInitializer:()=>epm,TableActionColumnInitializer:()=>eph,useCreateAssociationDetailsBlock:()=>ec7,useCreateAssociationDetailsWithoutPagination:()=>epc,useCreateAssociationFormBlock:()=>epl,useCreateAssociationGridCardBlock:()=>epr,useCreateAssociationListBlock:()=>eps,useCreateAssociationTableBlock:()=>ec4,useMenuSearch:()=>ec0});var w={};function S(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",l=(null==e?void 0:e.trim())||t;return l.endsWith("/")||(l=`${l}/`),l}function C(e,t,l){return S(e,S(t,S(l,"/")))}l.r(w),l.d(w,{ACLActionParamsContext:()=>edq,ACLActionProvider:()=>edX,ACLCollectionFieldProvider:()=>edZ,ACLCollectionProvider:()=>edG,ACLContext:()=>edE,ACLCustomContext:()=>edL,ACLMenuItemProvider:()=>ed0,ACLPane:()=>eu7,ACLPlugin:()=>ece,ACLProvider:()=>edN,ACLRolesCheckProvider:()=>edD,ADMIN_SETTINGS_KEY:()=>$5,ADMIN_SETTINGS_PATH:()=>$4,AIManager:()=>ea,APIClient:()=>ks,APIClientContext:()=>FX,APIClientProvider:()=>kd,AccessControl:()=>GU,Action:()=>Qf,ActionBar:()=>QP,ActionBarAssociationFilterAction:()=>ecA,ActionBarProvider:()=>QC,ActionContext:()=>Wu,ActionContextNoRerender:()=>Wm,ActionContextProvider:()=>Wc,ActionDesigner:()=>Yg,ActionGroupModel:()=>sL,ActionInitializer:()=>ecb,ActionInitializerItem:()=>ecu,ActionModel:()=>sz.S0,ActionSceneEnum:()=>sz.s5,ActionType:()=>T7,AddChildActionModel:()=>uL,AddCollection:()=>eaD,AddCollectionAction:()=>eaB,AddCollectionField:()=>eay,AddFieldAction:()=>eax,AddNewActionModel:()=>dJ,AddSubFieldAction:()=>esu,AdminDynamicPage:()=>R6,AdminLayout:()=>Bs,AdminLayoutMenuItemModel:()=>NG,AdminLayoutPlugin:()=>Bd,AdminProvider:()=>N7,AdminSettingsLayout:()=>eu2,AdminSettingsLayoutModel:()=>euG,AfterSuccess:()=>Yu,AllDataBlocksContext:()=>jY,AllDataBlocksProvider:()=>jJ,AntdAppProvider:()=>Y,AntdConfigPlugin:()=>eci,AntdConfigProvider:()=>ecr,AntdSchemaComponentPlugin:()=>ZY,AntdSchemaComponentProvider:()=>ZG,AppLangContext:()=>ecn,AppNotFound:()=>M9,AppendsTreeSelect:()=>Z8,Application:()=>zZ,ApplicationContext:()=>FQ,AssignFormModel:()=>uz,AssignedFieldValues:()=>Yl,AssociatedFields:()=>ep5,AssociationField:()=>elS,AssociationFieldMode:()=>etP,AssociationFieldModeProvider:()=>etI,AssociationFilter:()=>ecq,AssociationFilterDesignerDelete:()=>ec_,AssociationFilterDesignerDisplayField:()=>ecV,AssociationFilterPlugin:()=>ecL,AssociationOrCollectionProvider:()=>Kp,AssociationProvider:()=>IC,AssociationSelect:()=>elP,AsyncDataContext:()=>eaZ,AsyncDataProvider:()=>ea0,AttachmentList:()=>eeY,AutoComplete:()=>elM,BackButtonUsedInSubPage:()=>Dh,BaseVariableProvider:()=>qI,BlankComponent:()=>$9,Block:()=>enV,BlockAssociationContext:()=>edf,BlockConfigsContext:()=>eca,BlockConfigsProvider:()=>ecd,BlockContext:()=>edS,BlockGridModel:()=>dw,BlockInitializer:()=>ecz,BlockItem:()=>Gs,BlockItemCard:()=>Hu,BlockItemCardContext:()=>Hd,BlockItemInitializer:()=>ecK,BlockModel:()=>dS.z,BlockProvider:()=>edk,BlockRequestContextProvider:()=>Wr,BlockRequestContext_deprecated:()=>edg,BlockRequestLoadingContext:()=>Wt,BlockRequestProvider:()=>Wi,BlockRequestProvider_deprecated:()=>edx,BlockResourceContext:()=>edh,BlockSceneEnum:()=>dS.P,BlockSchemaComponentPlugin:()=>LI,BlockSchemaComponentProvider:()=>LM,BlockSchemaToolbar:()=>qd,BlockTemplateContext:()=>L_,BlockTemplateDetails:()=>qi,BlockTemplatePage:()=>Lq,BlockTemplateProvider:()=>LV,BlockTemplatesPane:()=>LL,BlocksSelector:()=>Yd,ButtonEditor:()=>Yt,CSSVariableProvider:()=>MN,CardItem:()=>elN,Cascader:()=>elq,Checkbox:()=>etu,CheckboxFieldInterface:()=>esF,CheckboxGroupFieldInterface:()=>esk,ChildPageModel:()=>dN,ChildPageTabModel:()=>dK,ClearCollectionFieldContext:()=>eio,ClickableFieldModel:()=>gH,CodeEditor:()=>ui.BY,CodeEditorExtension:()=>ui.o8,Collection:()=>ku,CollectionActionGroupModel:()=>s_,CollectionActionModel:()=>dC.U,CollectionBlockModel:()=>dF.t,CollectionCategoriesContext:()=>R$,CollectionCategoriesProvider:()=>RV,CollectionCategory:()=>esg,CollectionContext:()=>eii,CollectionDeletedPlaceholder:()=>er7,CollectionField:()=>MU,CollectionFieldContext:()=>eil,CollectionFieldInterface:()=>PK,CollectionFieldInterfaceManager:()=>PU,CollectionFieldInterfaceTag:()=>esf,CollectionFieldProvider:()=>ein,CollectionFieldUISchemaProvider:()=>Av,CollectionFieldsToFormInitializerItems:()=>eiS,CollectionFieldsToInitializerItems:()=>eib,CollectionFieldsToTableInitializerItems:()=>eiF,CollectionHistoryProvider:()=>Ry,CollectionManager:()=>eim,CollectionManagerContext:()=>kH,CollectionManagerProvider:()=>kY,CollectionManagerProvider_deprecated:()=>RO,CollectionManagerSchemaComponentProvider:()=>RB,CollectionNotAllowViewPlaceholder:()=>eit,CollectionPlugin:()=>edu,CollectionProvider:()=>eia,CollectionProvider_deprecated:()=>Rw,CollectionRecord:()=>A3,CollectionRecordContext:()=>A6,CollectionRecordProvider:()=>A9,CollectionSelect:()=>elz,CollectionSelectFieldInterface:()=>esA,CollectionTemplate:()=>eih,CollectionTemplateManager:()=>Pu,CollectionTemplateTag:()=>esv,ColorFieldInterface:()=>esP,ColorPicker:()=>elG,ColorSelect:()=>elJ,CommonItemModel:()=>dk,CompatibleSchemaInitializer:()=>OE,CreateFilterActionInitializer:()=>ecU,CreateFormModel:()=>mZ,CreateResetActionInitializer:()=>ecW,CreatedAtFieldInterface:()=>esj,CreatedByFieldInterface:()=>esM,Cron:()=>el0,CronSet:()=>el5,CurrentAppInfoContext:()=>NY,CurrentAppInfoProvider:()=>NX,CurrentPageUidContext:()=>P9,CurrentPageUidProvider:()=>jd,CurrentRouteProvider:()=>RJ,CurrentTabUidContext:()=>je,CurrentTabUidProvider:()=>ju,CurrentUserContext:()=>_X,CurrentUserProvider:()=>_1,CurrentUserSettingsMenuProvider:()=>_5,CustomRouterContextProvider:()=>jF,CustomizeActionInitializer:()=>ecH,DEBOUNCE_WAIT:()=>100,DEFAULT_DATA_SOURCE_KEY:()=>PW,DEFAULT_DATA_SOURCE_TITLE:()=>PH,DataBlockCollector:()=>j0,DataBlockContext:()=>Kd,DataBlockInitializer:()=>ec1,DataBlockModel:()=>dA.R,DataBlockProvider:()=>Km,DataBlockResourceContext:()=>j2,DataBlockResourceProvider:()=>j8,DataSource:()=>Ps,DataSourceApplicationProvider:()=>jB,DataSourceCollectionCascader:()=>elH,DataSourceContext:()=>kL,DataSourceContext_deprecated:()=>RT,DataSourceManager:()=>PG,DataSourceManagerContext:()=>kD,DataSourceManagerProvider:()=>kB,DataSourceProvider:()=>k_,DataSourceProvider_deprecated:()=>RN,DataSourceSelect:()=>elU,DateFieldInterface:()=>edl,DateFilterDynamicComponent:()=>Gr,DateFormatCom:()=>Ph,DatePicker:()=>Vp,DatePickerProvider:()=>Vd,DatetimeFieldInterface:()=>esI,DatetimeNoTzFieldInterface:()=>edn,DefaultToolsManager:()=>ei,DefaultValueProvider:()=>M$,DeleteCollection:()=>esl,DeleteCollectionAction:()=>esa,Designable:()=>AV,DesignableSwitch:()=>$j,Details:()=>el4,DetailsAssociationFieldGroupModel:()=>ca,DetailsBlockContext:()=>qL,DetailsBlockModel:()=>cc,DetailsBlockProvider:()=>qz,DetailsCustomItemModel:()=>cm,DetailsDesigner:()=>QL,DetailsGridModel:()=>ch,DetailsItemModel:()=>u1,DisplaySubTableFieldModel:()=>xr,DisplayTextFieldModel:()=>xO,DisplayTitleFieldModel:()=>xe,Divider:()=>el3,DndContext:()=>Rf,DocumentTitleContext:()=>Zb,DocumentTitleProvider:()=>Zw,DragHandler:()=>ET,DraggableContext:()=>ES,DropdownVisibleContext:()=>_J,EMPTY_OBJECT:()=>k6,EditCollection:()=>eaL,EditCollectionAction:()=>ea_,EditCollectionField:()=>eaS,EditComponent:()=>Gy,EditDefaultValue:()=>Gv,EditDescription:()=>Gm,EditFieldAction:()=>eaC,EditFormModel:()=>u2.EditFormModel,EditOperator:()=>Gw,EditPattern:()=>Gx,EditRequired:()=>Gf,EditSortField:()=>erk,EditSubFieldAction:()=>esm,EditTable:()=>env,EditTableAction:()=>enC,EditTableActionContext:()=>enw,EditTitle:()=>Gp,EditTitleField:()=>GS,EditTooltip:()=>Gh,EditValidationRules:()=>Gg,Editable:()=>eo$,EllipsisWithTooltip:()=>WT,EmailFieldInterface:()=>esT,ErrorFallback:()=>M6,Expand:()=>enN,ExpiresRadio:()=>Pv,ExtendCollectionsContext:()=>kK,ExtendCollectionsProvider:()=>kU,FieldModel:()=>aT.o,FieldModelRenderer:()=>D.FieldModelRenderer,FieldSummary:()=>esh,FieldValidation:()=>eal,FieldsTreeSelect:()=>Z2,Fieldset:()=>enD,Filter:()=>zd,FilterAction:()=>V4,FilterActionContext:()=>V8,FilterActionModel:()=>un,FilterAssociatedFields:()=>ep3,FilterBlockModel:()=>dP,FilterBlockProvider:()=>jZ,FilterBlockType:()=>j$,FilterContext:()=>_L,FilterDynamicComponent:()=>zn,FilterFormActionGroupModel:()=>pJ,FilterFormBlockModel:()=>mc,FilterFormBlockProvider:()=>Lf,FilterFormItemModel:()=>mT,FilterGroup:()=>aI.I8,FilterLogicContext:()=>__,FilterParentCollectionFields:()=>ep4,FlagContext:()=>T$,FlagProvider:()=>TO,ForeignKey:()=>eau,Form:()=>QB,FormActionGroupModel:()=>uh,FormActionModel:()=>up,FormActiveFieldsProvider:()=>qn,FormAssociationFieldGroupModel:()=>hi,FormBlockContext:()=>Wv,FormBlockInitializer:()=>epG,FormBlockModel:()=>uV.F4,FormBlockProvider:()=>Ww,FormComponent:()=>uV.s2,FormDialog:()=>Kx,FormDrawer:()=>erG,FormField:()=>Zu,FormFieldContext:()=>Lg,FormFieldProvider:()=>Lx,FormGridModel:()=>uK,FormItem:()=>G$,FormItemModel:()=>u9,FormItemSchemaToolbar:()=>qJ,FormProvider:()=>$T,FormSubmitActionModel:()=>um,FormV2:()=>Zi,G2Plot:()=>en_,G2PlotInitializer:()=>ec2,G2PlotRenderer:()=>enL,GeneralSchemaDesigner:()=>_x,GeneralSchemaItems:()=>G4,GlobalThemeProvider:()=>eo,Grid:()=>qt,GridCard:()=>en4,GridModel:()=>df,GridRowContext:()=>OJ,HTMLEncode:()=>WR,HeightMode:()=>B3,ICON_POPUP_Z_INDEX:()=>V0,Icon:()=>A2,IconFieldInterface:()=>esR,IconPicker:()=>en7,IdFieldInterface:()=>esE,InheritanceCollectionMixin:()=>edo,InitializerWithSwitch:()=>ecx,Input:()=>W0,InputFieldInterface:()=>esD,InputFieldModel:()=>v5.m,InputNumber:()=>eod,InputReadPretty:()=>WE,InputRecordPicker:()=>eoG,IntegerFieldInterface:()=>esB,InternalAdminSettingsLayout:()=>eu1,IsInNocoBaseRecursionFieldContext:()=>AC,IsSubPageClosedByPageMenuContext:()=>jn,IsSubPageClosedByPageMenuProvider:()=>jo,JSActionModel:()=>us,Json:()=>WA,JsonFieldInterface:()=>es$,KeepAlive:()=>Is,LAZY_COMPONENT_KEY:()=>AI,LOADING_DELAY:()=>void 0,Layout:()=>Gz,LayoutContent:()=>l9,LinkActionModel:()=>uB,LinkToFieldInterface:()=>esO,LinkageFilter:()=>er6,LinkageRuleCategory:()=>Re,LinkageRuleDataKeyMap:()=>Rt,List:()=>eoS,LocalDataSource:()=>Pd,LocationSearchContext:()=>P3,M2MFieldInterface:()=>esL,M2OFieldInterface:()=>es_,Markdown:()=>Ha,MarkdownFieldInterface:()=>esV,MarkdownReadPretty:()=>Hs,MaybeCollectionProvider:()=>edy,Menu:()=>E5,MenuConfigure:()=>eut,MockFlowModelRepository:()=>S_,ModalActionSchemaInitializerItem:()=>epf,MultipleSelectFieldInterface:()=>esz,NAMESPACE_UI_SCHEMA:()=>j4,NanoIDInput:()=>eoC,NanoidFieldInterface:()=>ede,NocoBaseBuildInPlugin:()=>ehb,NocoBaseDesktopRouteType:()=>Rz,NocoBaseRecursionField:()=>Ak,NocoBaseRouteContext:()=>RY,NumberFieldInterface:()=>esK,O2MFieldInterface:()=>esU,O2OFieldInterface:()=>esW,OBOFieldInterface:()=>esG,OHOFieldInterface:()=>esH,OpenModeProvider:()=>$x,OverridingCollectionField:()=>eak,OverridingFieldAction:()=>eaP,PMPlugin:()=>eu8,Page:()=>ZE,PagePopups:()=>I5,PageTabs:()=>ZN,Pagination:()=>eoF,ParentCollectionFields:()=>ep8,ParentRouteContext:()=>EY,Password:()=>eoR,PasswordFieldInterface:()=>esY,Percent:()=>eoD,PercentFieldInterface:()=>esJ,PermissionContext:()=>eun,PermissionProvider:()=>euo,PhoneFieldInterface:()=>esX,PinnedListPlugin:()=>DR,PinnedPluginList:()=>DT,PinnedPluginListContext:()=>nr,PinnedPluginListProvider:()=>Dj,Plugin:()=>R9,PluginManager:()=>euH,PluginManagerLink:()=>euP,PluginSettingsManager:()=>$6,PopupActionModel:()=>dG,PopupContextProvider:()=>ehA,PopupSettingsProvider:()=>Im,PopupSubTableFormActionGroupModel:()=>uv,PoweredBy:()=>ehw,Preview:()=>eoB,QuickEdit:()=>eoO,REGEX_OF_VARIABLE:()=>j3,REGEX_OF_VARIABLE_IN_EXPRESSION:()=>j6,Radio:()=>eta,RadioGroupFieldInterface:()=>esQ,ReadPretty:()=>WE,ReadPrettyRecordPicker:()=>eoZ,RecordActionGroupModel:()=>sV,RecordAssociationBlockInitializer:()=>ec5,RecordAssociationDetailsBlockInitializer:()=>ec9,RecordAssociationFormBlockInitializer:()=>ept,RecordAssociationGridCardBlockInitializer:()=>epo,RecordAssociationListBlockInitializer:()=>epa,RecordContext_deprecated:()=>eik,RecordFormBlockInitializer:()=>epX,RecordIndexContext:()=>eiA,RecordIndexProvider:()=>eiM,RecordLink:()=>edR,RecordPicker:()=>eo0,RecordPickerContent:()=>f4,RecordPickerContext:()=>eoz,RecordPickerProvider:()=>eoY,RecordProvider:()=>eiP,RecordReadPrettyAssociationFormBlockInitializer:()=>epu,RecordSelectFieldModel:()=>cZ,RecordSimpleProvider:()=>eij,RefreshActionModel:()=>uS,RefreshComponentProvider:()=>Am,RefreshDataBlockRequest:()=>Yv,RemoteCollectionManagerProvider:()=>R_,RemoteDocumentTitlePlugin:()=>Zk,RemoteDocumentTitleProvider:()=>ZS,RemoteSchemaComponent:()=>$D,RemoteSchemaTemplateManagerPlugin:()=>N4,RemoteSchemaTemplateManagerProvider:()=>N5,RemoteSelect:()=>Q2,RemoveButton:()=>Yc,RemoveConditionContext:()=>_q,RenderChildrenWithAssociationFilter:()=>edw,RequestSettings:()=>Yn,RerenderDataBlockProvider:()=>Kc,Resizable:()=>emC,ResourceActionContext:()=>RS,ResourceActionProvider:()=>RA,RichText:()=>eo8,RichTextFieldInterface:()=>esZ,RoleConfigure:()=>eui,RoleResourceCollectionContext:()=>euS,RoleTable:()=>euh,RolesResourcesActions:()=>euC,RouteSchemaComponent:()=>Ea,RouterContextCleaner:()=>$7,RouterManager:()=>Ol,SNIPPET_PREFIX:()=>$3,SanitizedCollectionProvider:()=>eis,SchemaComponent:()=>k3,SchemaComponentContext:()=>kQ,SchemaComponentOnChangeContext:()=>k8,SchemaComponentOptions:()=>k0,SchemaComponentPlugin:()=>$L,SchemaComponentProvider:()=>$q,SchemaInitializer:()=>OR,SchemaInitializerActionModal:()=>Oj,SchemaInitializerActionModalInternal:()=>OM,SchemaInitializerChild:()=>TZ,SchemaInitializerChildren:()=>TG,SchemaInitializerContext:()=>TK,SchemaInitializerDivider:()=>Ob,SchemaInitializerItem:()=>Oh,SchemaInitializerItemContext:()=>TW,SchemaInitializerItemGroup:()=>Ok,SchemaInitializerItemGroupInternal:()=>OA,SchemaInitializerItemInternal:()=>Of,SchemaInitializerItems:()=>T0,SchemaInitializerManager:()=>OB,SchemaInitializerMenu:()=>Ou,SchemaInitializerMenuProvider:()=>Os,SchemaInitializerOpenModeSchemaItems:()=>G8,SchemaInitializerPlugin:()=>ehy,SchemaInitializerSelect:()=>OI,SchemaInitializerSelectInternal:()=>OT,SchemaInitializerSubMenu:()=>Oc,SchemaInitializerSubMenuInternal:()=>Op,SchemaInitializerSwitch:()=>Oy,SchemaInitializerSwitchInternal:()=>Ox,SchemaSettingAccessControl:()=>GW,SchemaSettingItemContext:()=>zq,SchemaSettingOpenModeSchemaItems:()=>G5,SchemaSettings:()=>Br,SchemaSettingsActionLinkItem:()=>Y6,SchemaSettingsActionModalItem:()=>UG,SchemaSettingsBlockHeightItem:()=>B6,SchemaSettingsBlockTitleItem:()=>H6,SchemaSettingsCascaderItem:()=>Uz,SchemaSettingsChild:()=>zH,SchemaSettingsChildren:()=>zz,SchemaSettingsConnectDataBlocks:()=>H7,SchemaSettingsDataScope:()=>VV,SchemaSettingsDataTemplates:()=>UZ,SchemaSettingsDateFormat:()=>VK,SchemaSettingsDefaultSortingRules:()=>UJ,SchemaSettingsDefaultValue:()=>VG,SchemaSettingsDivider:()=>UO,SchemaSettingsDropdown:()=>UT,SchemaSettingsEnableChildCollections:()=>U0,SchemaSettingsFixed:()=>emF,SchemaSettingsFormItemTemplate:()=>UN,SchemaSettingsItem:()=>UD,SchemaSettingsItemGroup:()=>UB,SchemaSettingsLayoutItem:()=>GK,SchemaSettingsLinkageRules:()=>UX,SchemaSettingsManager:()=>O$,SchemaSettingsModalItem:()=>UY,SchemaSettingsNumberFormat:()=>Gt,SchemaSettingsPlugin:()=>XG,SchemaSettingsPopupItem:()=>UH,SchemaSettingsProvider:()=>Uj,SchemaSettingsRemove:()=>U_,SchemaSettingsRenderEngine:()=>GV,SchemaSettingsSelectItem:()=>UV,SchemaSettingsSortingRule:()=>VY,SchemaSettingsSubMenu:()=>U$,SchemaSettingsSwitchItem:()=>UW,SchemaSettingsTemplate:()=>Gq,SchemaSettingsWrapper:()=>zY,SchemaTemplateManagerContext:()=>NZ,SchemaToolbar:()=>_S,SchemaToolbarContext:()=>OK,SchemaToolbarProvider:()=>OU,SchemaToolbarVisibleContext:()=>_w,ScopeSelect:()=>eub,SearchCollections:()=>ecQ,SearchParamsContext:()=>jt,SecondConFirm:()=>Yh,Select:()=>QX,SelectActionInitializer:()=>epp,SelectFieldInterface:()=>es0,SelectWithTitle:()=>jN,SetDataLoadingMode:()=>U9,SettingCenterPermissionProvider:()=>eul,SettingCenterProvider:()=>eu3,SettingsCenterConfigure:()=>eu6,SettingsCenterContext:()=>euJ,SettingsCenterDropdown:()=>euj,SettingsMenuProvider:()=>_Y,ShowFormData:()=>Gl,SkeletonFallback:()=>o4,SkipValidation:()=>Yo,SnowflakeIdFieldInterface:()=>es1,Sortable:()=>EA,SortableContext:()=>EC,SortableItem:()=>EI,SortableProvider:()=>EF,SourceCollection:()=>eaa,SourceForeignKey:()=>eao,SourceKey:()=>eas,Space:()=>eo5,StablePopover:()=>V1,StrategyActions:()=>euA,SubFieldDataSourceProvider_deprecated:()=>RE,SubTableColumnModel:()=>gy,SubTableFieldInterface:()=>es2,SubTableFieldModel:()=>gP,SubmitActionInitializer:()=>epm,SwitchLanguage:()=>ehk,SyncFieldsAction:()=>eaX,SyncFieldsActionCom:()=>eaQ,SyncSQLFieldsAction:()=>est,SystemSettingsPane:()=>Zy,SystemSettingsPlugin:()=>Zx,SystemSettingsSource:()=>eu.o,Table:()=>erb,TableActionColumnInitializer:()=>eph,TableAssociationFieldGroupModel:()=>h3,TableBlockContext:()=>B0,TableBlockDesigner:()=>erA,TableBlockInitializer:()=>emT,TableBlockModel:()=>fS,TableBlockProvider:()=>B5,TableColumnModel:()=>hQ,TableColumnSchemaToolbar:()=>Ll,TableField:()=>erP,TableFieldContext:()=>LS,TableFieldProvider:()=>LA,TableFieldResource:()=>LF,TableSelectorContext:()=>TF,TableSelectorDesigner:()=>erj,TableSelectorInitializer:()=>emS,TableSelectorParamsProvider:()=>TP,TableSelectorProvider:()=>TT,TableV2:()=>erM,TableoidFieldInterface:()=>es8,Tabs:()=>erE,TabsContextProvider:()=>Iu,TargetForeignKey:()=>eai,TargetKey:()=>ead,TemplateBlockProvider:()=>jj,TemplateSummary:()=>eaR,Templates:()=>Q5,TestDesigner:()=>Gd,TextAreaWithContextSelector:()=>ab.n,TextAreaWithGlobalScope:()=>erU,TextareaFieldInterface:()=>es5,ThroughCollection:()=>eac,ThroughForeignKey:()=>ear,TimeFieldInterface:()=>es4,TimePicker:()=>er$,TreeSelect:()=>erq,UUIDFieldInterface:()=>es7,UnSupportFields:()=>eaV,UnixTimestamp:()=>erV,UnixTimestampFieldInterface:()=>edt,UpdateRecordActionModel:()=>uM,UpdatedAtFieldInterface:()=>es3,UpdatedByFieldInterface:()=>es6,Upload:()=>eeK,Uploader:()=>eeJ,UrlFieldInterface:()=>es9,Variable:()=>Y8,VariableFilterItem:()=>aI.Et,VariableInput:()=>Vq,VariablePopupRecordProvider:()=>Pr,VariableScope:()=>Ef,VariableScopeProvider:()=>Y1,VariableSelect:()=>W8,VariablesContext:()=>X4,VariablesProvider:()=>Qt,ViewCollectionField:()=>eaM,ViewFieldAction:()=>eaI,WithoutFormFieldResource:()=>Ly,WithoutTableFieldResource:()=>Lk,actionSettings:()=>Yf,actionSettingsItems:()=>Yp,addCustomAlgorithmToTheme:()=>et,allowAddNew:()=>zF,appendQueryStringToUrl:()=>HJ,applyCollectionFieldUiSchemaToDefaultValueSchema:()=>VH,applyMobilePaginationProps:()=>uC.hO,attachmentFileTypes:()=>eeh,autoFill:()=>PN,autoIncrement:()=>PE,cache:()=>k.cache,canMakeAssociationBlock:()=>ehn,collectionDataSource:()=>Pz,compatOldTheme:()=>Z,completeURL:()=>H2,compose:()=>Kn,constraintsProps:()=>PB,createCompactSimpleItemRender:()=>uC.hH,createCreateFormBlockUISchema:()=>epe,createDesignable:()=>AB,createDetailsBlockSchema:()=>_r,createFormActionInitializers:()=>ep1,createFormActionInitializers_deprecated:()=>ep0,createFormBlockSchema:()=>_i,createFormBlockSettings:()=>Jh,createModalSettingsItem:()=>z9,createReadPrettyFormBlockSchema:()=>_a,createRouterManager:()=>On,createSelectSchemaSettingsItem:()=>z7,createStyles:()=>lk.rU,createSwitchSettingsItem:()=>Ke,createTableBlockSchema:()=>_s,createTableBlockUISchema:()=>ec8,createTextSettingsItem:()=>Kt,css:()=>k.css,customAlgorithm:()=>ee,customFormItemInitializers:()=>ehl,customFormItemInitializers_deprecated:()=>eht,cx:()=>k.cx,dataSource:()=>PL,dateTimeProps:()=>PO,defaultFieldNames:()=>QV,defaultInputStyle:()=>U1,defaultProps:()=>P_,defaultTheme:()=>Q,dispatchEventDeep:()=>uC.Xi,ds:()=>RR,editFormBlockSettings:()=>Jf,editMarkdownFlow:()=>y4,fetchTemplateData:()=>Q3,fieldComponentSettingsItem:()=>Jg,fieldSettingsFormItem:()=>Jv,fileSizeSetting:()=>J9,fillParentFields:()=>H5,filterFormItemSettings:()=>Xy,findByUid:()=>EE,findFilterTargets:()=>HS,findFirstPageRoute:()=>RW,findFormBlock:()=>WF,findKanbanFormItem:()=>eiw,findKeysByUid:()=>EB,findMenuItem:()=>EN,findParentFieldSchema:()=>U2,findRouteBySchemaUid:()=>RK,flush:()=>k.flush,formActionInitializers:()=>ep2,formDetailsSettings:()=>Zd,formItemInitializers:()=>ep7,formItemInitializers_deprecated:()=>ep9,formItemSettings:()=>zk,formSettings:()=>Za,formV1Settings:()=>Q$,genStyleHook:()=>kR,getAppends:()=>HW,getAssociationPath:()=>HU,getCardItemSchema:()=>Hm,getCollectionTitle:()=>qu,getConfigurableProperties:()=>esC,getCurrentOptions:()=>QU,getDataSourceHeaders:()=>PQ,getDateExact:()=>Mf,getDatePickerLabels:()=>eo_,getDateRanges:()=>Mh,getFieldDefaultValue:()=>U4,getFilterByTkByCollection:()=>edP,getFlowPageMenuSchema:()=>Eu,getFormValues:()=>Hy,getIdsWithChildren:()=>B1,getLabelFormatValue:()=>eoV,getLabelWithTooltip:()=>qR,getPageMenuSchema:()=>Em,getPageSchema:()=>Hp,getPinnedPluginListKeys:()=>no,getPopupPathFromParams:()=>I_,getRegisteredStyles:()=>k.getRegisteredStyles,getRenderContent:()=>MI,getSchemaSettingsConfirmZIndex:()=>UL,getSchemaSettingsDialogZIndex:()=>Uq,getShouldChange:()=>VL,getSimpleModePaginationClassName:()=>uC.HZ,getStoredPopupContext:()=>IN,getSupportFieldsByAssociation:()=>jq,getSupportFieldsByForeignKey:()=>jL,getSystemSettingsMutationData:()=>Zf,getTabSchema:()=>Zz,getURLSearchParams:()=>VN,getURLSearchParamsChildren:()=>VD,getUniqueKeyFromCollection:()=>esq,getUnknownCountPaginationTotal:()=>uC.SM,getVariableComponentWithScope:()=>Y5,getVariableValue:()=>_G,getVariablesFromExpression:()=>j7,getZIndex:()=>Dr,gridRowColWrap:()=>LU,handleDateChangeOnForm:()=>Mi,hasIcon:()=>A0,hydrate:()=>k.hydrate,i18n:()=>MJ,icons:()=>AQ,inferPickerType:()=>Mv,injectGlobal:()=>k.injectGlobal,interfacesOfUnsupportedDefaultValue:()=>Mq,interfacesProperties:()=>p,isAssocField:()=>jK,isBulkEditAction:()=>Qy,isDeleteButtonDisabled:()=>ei5,isFileCollection:()=>GO,isInFilterFormBlock:()=>jH,isInitializersSame:()=>OD,isMobile:()=>Ms,isPatternDisabled:()=>MD,isSameCollection:()=>jU,isShowFilePicker:()=>eoX,isSystemField:()=>U5,isTabPage:()=>ZV,isTitleField:()=>PJ,isVariable:()=>j9,isWriteEmailAction:()=>Qx,itemsMerge:()=>LK,joinCollectionName:()=>edp,joinUrlSearch:()=>uR,keyframes:()=>k.keyframes,languageCodes:()=>MH,lazy:()=>AR,locale:()=>MG,mapDatePicker:()=>Ma,mapRangePicker:()=>Md,mapTimeFormat:()=>erB,matchMimetype:()=>eef,merge:()=>k.merge,mergeFilter:()=>jO,mergePaginationClassName:()=>uC.M6,mockAPIClient:()=>ehC,moment2str:()=>Mo,navigateToTab:()=>Z_,navigateWithinSelf:()=>H8,normalizeContainer:()=>Kl,openViewFlow:()=>eh,operators:()=>c,pageSettings:()=>ZU,pageTabSettings:()=>ZH,parseCollectionName:()=>edc,parseVariablesAndChangeParamsToQueryString:()=>H0,primaryKey:()=>PR,readPrettyFormSettings:()=>Zs,recordBlockInitializers:()=>ehi,recordBlockInitializers_deprecated:()=>ehr,recordPickerViewer:()=>PV,recursiveParent:()=>TM,reduceValueSize:()=>H1,registerIcon:()=>AZ,registerIcons:()=>A1,registerInitializerMenusGenerator:()=>_h,relationshipType:()=>PD,removeNullCondition:()=>zv,replaceVariableValue:()=>HZ,replaceVariables:()=>_B,requestParentRecordData:()=>Wo,resolveFilterPickerFormat:()=>Vi,reverseFieldProperties:()=>P$,schemaSettingsLabelLayout:()=>U8,setDataLoadingModeSettingsItem:()=>U3,setDefaultSortingRulesSchemaSettingsItem:()=>GL,setTheDataScopeSchemaSettingsItem:()=>G_,sheet:()=>k.sheet,shouldRenderIconInTitle:()=>NA,showFileName:()=>J7,splitWrapSchema:()=>AL,storePopupContext:()=>ID,subTableActionInitializers:()=>ehd,subTableActionInitializers_deprecated:()=>ehs,systemKeys:()=>P0,tabPaneInitializers:()=>ehf,tabPaneInitializersForBulkEditFormBlock:()=>ehv,tabPaneInitializersForRecordBlock:()=>ehg,tabPaneInitializers_deprecated:()=>ehh,tableActionColumnInitializers:()=>emP,tableActionColumnInitializers_deprecated:()=>emA,tableActionInitializers:()=>emI,tableActionInitializers_deprecated:()=>emM,tableBlockSettings:()=>JT,tableColumnInitializers:()=>emD,tableColumnInitializers_deprecated:()=>emN,tableColumnSettings:()=>JE,tableSelectorBlockSettings:()=>Jj,timeProps:()=>Pq,titleField:()=>bh,toToolsMap:()=>es,transformFilter:()=>er.transformFilter,transformToFilter:()=>jV,transformVariableValue:()=>Me,tval:()=>MY,type:()=>PI,unique:()=>PT,updateFilterTargets:()=>HC,updateFormActionInitializers:()=>eml,updateFormActionInitializers_deprecated:()=>emt,useACLActionParamsContext:()=>edY,useACLContext:()=>edO,useACLFieldWhitelist:()=>edQ,useACLRoleContext:()=>edW,useACLRolesCheck:()=>edV,useAPIClient:()=>F0,useAPITokenVariable:()=>_6,useAclSnippets:()=>zQ,useActionAvailable:()=>epE,useActionBarContext:()=>QF,useActionContext:()=>Wh,useAdminSchemaUid:()=>ed1,useAfterSuccessOptions:()=>G3,useAllAccessDesktopRoutes:()=>RZ,useAllCollectionsInheritChainGetter:()=>kO,useAllDataBlocks:()=>jX,useApp:()=>FZ,useAppLangContext:()=>eco,useAppSpin:()=>z0,useAriaAttributeOfMenuItem:()=>Om,useAssociatedFields:()=>jz,useAssociatedFormItemInitializerFields:()=>L8,useAssociatedTableColumnInitializerFields:()=>LQ,useAssociationCreateActionProps:()=>Hw,useAssociationFieldContext:()=>Bp,useAssociationFieldModeContext:()=>etT,useAssociationFilterBlockProps:()=>Hz,useAssociationFilterProps:()=>HL,useAssociationName:()=>IF,useAssociationNames:()=>HH,useAsyncData:()=>ea1,useAttach:()=>Tn,useBackButton:()=>Dm,useBaseVariable:()=>qE,useBlockAssociationContext:()=>edA,useBlockConfigs:()=>ecs,useBlockContext:()=>edC,useBlockHeight:()=>$r,useBlockHeightProps:()=>Hc,useBlockRequestContext:()=>edb,useBlockResource:()=>edv,useBlockTemplateContext:()=>Lz,useBuiltinVariables:()=>XY,useBulkDestroyAction:()=>esi,useBulkDestroyActionAndRefreshCM:()=>eso,useBulkDestroyActionProps:()=>HD,useCancelAction:()=>eiE,useCloseAction:()=>Wf,useCollectValuesToSubmit:()=>Hx,useCollection:()=>eid,useCollectionDataSource:()=>el_,useCollectionDataSourceItems:()=>_o,useCollectionField:()=>eir,useCollectionFieldFormValues:()=>eag,useCollectionField_deprecated:()=>elL,useCollectionFields:()=>eiu,useCollectionFieldsOptions:()=>eiz,useCollectionFilterOptions:()=>eiL,useCollectionHistory:()=>Rb,useCollectionManager:()=>kJ,useCollectionManager_deprecated:()=>jE,useCollectionParentRecord:()=>Pt,useCollectionParentRecordData:()=>Pl,useCollectionRecord:()=>A7,useCollectionRecordData:()=>Pe,useCollectionState:()=>P1,useCollection_deprecated:()=>OO,useCollections:()=>kX,useColumnSchema:()=>O_,useColumnSettings:()=>Bx,useCompatOldVariables:()=>V_,useCompile:()=>Ae,useComponent:()=>To,useContextAssociationFields:()=>_H,useContextVariable:()=>GP,useCreateActionProps:()=>Hb,useCreateAssociationDetailsBlock:()=>ec7,useCreateAssociationDetailsWithoutPagination:()=>epc,useCreateAssociationFormBlock:()=>epl,useCreateAssociationGridCardBlock:()=>epr,useCreateAssociationListBlock:()=>eps,useCreateAssociationTableBlock:()=>ec4,useCreateEditFormBlock:()=>epQ,useCreateFormBlock:()=>epY,useCreateTableBlock:()=>emR,useCurrentAppInfo:()=>NJ,useCurrentDocumentTitle:()=>ZF,useCurrentPageUid:()=>jy,useCurrentPopupContext:()=>I9,useCurrentPopupRecord:()=>Pi,useCurrentRoleMode:()=>ed$,useCurrentRoleVariable:()=>VE,useCurrentRoles:()=>_0,useCurrentRoute:()=>RX,useCurrentSchema:()=>_l,useCurrentSearchParams:()=>jw,useCurrentTabUid:()=>jb,useCurrentUserContext:()=>_Q,useCurrentUserSettingsMenu:()=>_8,useCurrentUserVariable:()=>_3,useCustomizeBulkUpdateActionProps:()=>HM,useCustomizeRequestActionProps:()=>HI,useCustomizeUpdateActionProps:()=>Hj,useDataBlock:()=>Kh,useDataBlockHeight:()=>$o,useDataBlockParentRecord:()=>Hh,useDataBlockProps:()=>Kf,useDataBlockRequest:()=>Wa,useDataBlockRequestData:()=>Wd,useDataBlockRequestGetter:()=>Ws,useDataBlockResource:()=>j5,useDataLoadingMode:()=>U6,useDataSource:()=>kV,useDataSourceFromRAC:()=>Rj,useDataSourceHeaders:()=>PX,useDataSourceKey:()=>kz,useDataSourceManager:()=>k$,useDataTemplates:()=>UQ,useDatePickerContext:()=>Vs,useDateVariable:()=>Vh,useDatetimeVariable:()=>Vg,useDatetimeVariableContext:()=>Vf,useDeleteRouteSchema:()=>Ba,useDesignable:()=>AK,useDesigner:()=>Ti,useDestroyAction:()=>esr,useDestroyActionAndRefreshCM:()=>esn,useDestroyActionProps:()=>HR,useDetailsBlockContext:()=>qK,useDetailsBlockProps:()=>qU,useDetailsDecoratorProps:()=>qH,useDetailsPaginationProps:()=>Hq,useDetailsParentRecord:()=>qG,useDetailsProps:()=>qY,useDetailsWithPaginationBlockParams:()=>qc,useDetailsWithPaginationDecoratorProps:()=>qp,useDetailsWithPaginationProps:()=>qW,useDisassociateActionProps:()=>HN,useDocumentTitle:()=>ZC,useDownloadLogs:()=>M3,useEditTableActionProps:()=>HO,useEnsureOperatorsValid:()=>Gb,useExactDateVariable:()=>Vy,useExactDateVariableContext:()=>Vv,useExtendCollections:()=>kW,useFieldComponentName:()=>zO,useFieldComponentOptions:()=>Td,useFieldInterfaceOptions:()=>eam,useFieldMode:()=>zE,useFieldModeOptions:()=>$s,useFieldNames:()=>eoq,useFieldProps:()=>Ta,useFieldTitle:()=>Tu,useFilterAPI:()=>jW,useFilterActionProps:()=>zy,useFilterBlock:()=>j1,useFilterBlockActionProps:()=>Hk,useFilterByTk:()=>edj,useFilterFieldOptions:()=>zf,useFilterFieldProps:()=>zx,useFilterOptions:()=>zc,useFindComponent:()=>Az,useFlag:()=>Tq,useFormActiveFields:()=>qo,useFormBlockContext:()=>WS,useFormBlockProps:()=>WC,useFormBlockType:()=>Wx,useFormDataTemplates:()=>Q8,useFormFieldContext:()=>Lb,useFormFieldProps:()=>Lw,useFormItemInitializerFields:()=>L1,useGetAriaLabelOfAction:()=>Qp,useGetAriaLabelOfDesigner:()=>_f,useGetAriaLabelOfDrawer:()=>$d,useGetAriaLabelOfModal:()=>Dl,useGetAriaLabelOfPopover:()=>Qj,useGetFilterFieldOptions:()=>zp,useGetFilterOptions:()=>zu,useGetSchemaInitializerMenuItems:()=>Oi,useGlobalTheme:()=>en,useGlobalVariable:()=>z8,useGlobalVariableCtx:()=>z5,useGridContext:()=>O9,useGridRowContext:()=>O7,useHistoryCollectionsByNames:()=>Rx,useInheritsTableColumnInitializerFields:()=>L0,useInsertPageSchema:()=>Ec,useIsAddNewForm:()=>zA,useIsAdminPage:()=>jv,useIsAllowToSetDefaultValue:()=>MO,useIsAssociationField:()=>zT,useIsDetailBlock:()=>Wb,useIsFieldReadPretty:()=>zM,useIsFileField:()=>zR,useIsFormReadPretty:()=>zj,useIsInSettingsPage:()=>jx,useIsLoggedIn:()=>_Z,useIsSameOrChildCollection:()=>_U,useIsSelectFieldMode:()=>zN,useIsSubPageClosedByPageMenu:()=>jC,useKeepAlive:()=>Io,useKeepAliveLocationSearch:()=>ZR,useLabelUiSchema:()=>eoL,useLazy:()=>AE,useLinkActionProps:()=>HQ,useLinkageAction:()=>Wg,useLinkageCollectionFilterOptions:()=>eiV,useListBlockContext:()=>eom,useLocalVariables:()=>Gj,useLocalVariablesWithoutCustomVariable:()=>Qi,useLocationNoUpdate:()=>jf,useLocationSearch:()=>jg,useMenuDragEnd:()=>E8,useMenuSearch:()=>ec0,useMenuTranslation:()=>ER,useMobileLayout:()=>CS,useNavigateNoUpdate:()=>jh,useNocoBaseRoutes:()=>EX,useOpenModeContext:()=>$b,useOptionalFieldList:()=>H_,useParamsFromRecord:()=>edT,useParentCollection:()=>IS,useParentRecordCommon:()=>Tv,useParentRoute:()=>EJ,useParseDataScopeFilter:()=>GG,useParseURLAndParams:()=>HX,useParsedFilter:()=>Tg,usePickActionProps:()=>Hf,usePlugin:()=>z1,usePopupSettings:()=>Ih,usePopupUtils:()=>IV,usePopupVariable:()=>VT,usePopupVariableContext:()=>VI,useProps:()=>Tp,useRecord:()=>eiI,useRecordCollectionDataSourceItems:()=>_n,useRecordIndex:()=>eiT,useRecordIsOwn:()=>eiR,useRecordPkValue:()=>edJ,useRefreshActionProps:()=>HB,useRefreshFieldSchema:()=>Af,useRemoteCollectionManagerLoading:()=>RL,useRemoveActionProps:()=>HE,useRemoveGridFormItem:()=>LG,useRequest:()=>ke,useRerenderDataBlock:()=>Kg,useResetBlockActionProps:()=>HP,useResource:()=>kt,useResourceActionContext:()=>RP,useResourceContext:()=>RM,useRoleRecheck:()=>edB,useRoleVariable:()=>VR,useRolesResourcesScopesSelectedRowKeys:()=>eux,useRouter:()=>z2,useRouterBasename:()=>jS,useSchemaComponentContext:()=>Ts,useSchemaInitializer:()=>TU,useSchemaInitializerItem:()=>TH,useSchemaInitializerMenuItems:()=>Or,useSchemaInitializerRender:()=>T9,useSchemaInitializerStyles:()=>T8,useSchemaInitializerSubMenuContext:()=>Od,useSchemaOptionsContext:()=>kZ,useSchemaSettings:()=>UP,useSchemaSettingsItem:()=>zL,useSchemaSettingsRender:()=>OG,useSchemaTemplate:()=>N1,useSchemaTemplateManager:()=>N2,useSchemaToolbar:()=>OW,useSchemaToolbarRender:()=>_F,useSortFields:()=>ei$,useSourceId:()=>edm,useSourceIdFromParentRecord:()=>edI,useSourceIdFromRecord:()=>edM,useStyles:()=>Ei,useSupportedBlocks:()=>j_,useSyncFromForm:()=>H3,useSystemSettings:()=>eu.e,useSystemSettingsVariable:()=>Kw,useTableBlockContext:()=>B4,useTableBlockContextBasicValue:()=>Ix,useTableBlockDecoratorProps:()=>Ty,useTableBlockParams:()=>Tx,useTableBlockProps:()=>Ln,useTableColumnInitializerFields:()=>LX,useTableColumnIntegration:()=>Bb,useTableColumns:()=>H$,useTableFieldContext:()=>LP,useTableFieldProps:()=>Lj,useTableSelectorContext:()=>TR,useTableSelectorProps:()=>TE,useTableSize:()=>$i,useTabsContext:()=>Ic,useTemplateBlockContext:()=>jA,useTitleFieldOptions:()=>z$,useToken:()=>Dt,useUIConfigurationPermissions:()=>edH,useURLAndHTMLSchema:()=>Y3,useURLSearchParamsCtx:()=>VB,useURLSearchParamsVariable:()=>V$,useUpdateActionProps:()=>HT,useUpdateCollectionActionAndRefreshCM:()=>eaq,useUploadStyles:()=>eeM,useUserVariable:()=>_4,useValidateSchema:()=>zD,useValuesFromRecord:()=>eaO,useVariableOptions:()=>VO,useVariableScope:()=>Y2,useVariableScopeInfo:()=>Eg,useVariables:()=>GM,useViewport:()=>ed8,useZIndexContext:()=>Do,withDynamicSchemaProps:()=>AY,withInitializer:()=>T3,withSearchParams:()=>IK,withSkeletonComponent:()=>T_,zIndexContext:()=>Dn});let F=l.p;"u">typeof window&&void 0!==l.p&&(l.p=C(window.__webpack_public_path__,window.__nocobase_public_path__,F)),l(37872),l(98867),l(8906),l(68313),l(21840),l(41816),l(83826),l(46986),l(70571);var k=l(22803),A=l(33329);function P(e){let t=Math.floor(Math.abs(e)),l=Math.abs(e%1*60),n=String(t).padStart(2,"0"),o=String(l).padStart(2,"0"),r=e>=0?"+":"-";return`${r}${n}:${o}`}function j(){return P(-(new Date().getTimezoneOffset()/60))}class M extends A.APIClient{getHostname(){var e,t;try{return new URL("/api/").hostname}catch{}return null==(t=window)||null==(e=t.location)?void 0:e.hostname}getHeaders(){let e=super.getHeaders();return this.appName&&(e["X-App"]=this.appName),e["X-Timezone"]=j(),e["X-Hostname"]=this.getHostname(),e}interceptors(){this.axios.interceptors.request.use(e=>{let t=this.getHeaders();return Object.keys(t).forEach(l=>{(0,A.hasHeaderValue)(e.headers,l)||(e.headers[l]=t[l])}),e}),super.interceptors()}constructor(e){super(e),e&&"function"!=typeof e&&(this.appName=e.appName)}}var I=l(58587),T=l(18150),R=l(68238),E=l(74848),N=l(95243),D=l(11869),B=l(40098),$=l.n(B),O=l(96540),q=l(5338),L=l(52230),_=l(47665),V=l(84976),z=l(47767),K=l(44363),U=l(36098),W=l(88040);let H=(0,O.memo)(e=>{let{children:t}=e,l=(0,U.n)(),{notification:n}=W.A.useApp();return(0,O.useLayoutEffect)(()=>{l.context.defineProperty("notification",{value:n})},[l,n]),(0,E.jsx)(E.Fragment,{children:t})});H.displayName="AppInner";let G=e=>{let{children:t,className:l,style:n}=e;return(0,E.jsx)(W.A,{className:l,style:{height:"100%",...n},children:(0,E.jsx)(H,{children:t})})};G.displayName="AntdAppProvider";let Y=G;var J=l(35710),X=l(4888);let Q={name:"",token:{colorPrimaryHeader:"#001529",colorBgHeader:"#001529",colorBgHeaderMenuHover:"#ffffff1a",colorBgHeaderMenuActive:"#ffffff1a",colorTextHeaderMenu:"#ffffffa6",colorTextHeaderMenuHover:"#ffffff",colorTextHeaderMenuActive:"#ffffff",colorSettings:"#F18B62",colorBgSettingsHover:"rgba(241, 139, 98, 0.06)",colorTemplateBgSettingsHover:"rgba(98, 200, 241, 0.06)",colorBorderSettingsHover:"rgba(241, 139, 98, 0.3)",motionUnit:.03}},Z=function(e){var t;return(null==(t=e.token)?void 0:t.colorSettings)||(e.token={...e.token,...Q.token}),e},ee=(e,t)=>{var l,n,o,r,i,a,s,d,u,c,p,m;let h=t||J.A.defaultAlgorithm(e);return(l=h).paddingPageHorizontal??(l.paddingPageHorizontal=h.sizeLG),(n=h).paddingPageVertical??(n.paddingPageVertical=h.sizeLG),(o=h).paddingPopupHorizontal??(o.paddingPopupHorizontal=h.sizeLG),(r=h).paddingPopupVertical??(r.paddingPopupVertical=h.size),(i=h).marginBlock??(i.marginBlock=h.sizeLG),(a=h).borderRadiusBlock??(a.borderRadiusBlock=h.borderRadiusLG),(s=h).colorBgSider??(s.colorBgSider=h.colorBgElevated),(d=h).colorBgSiderMenuHover??(d.colorBgSiderMenuHover=h.colorBgTextHover||h.colorFillSecondary),(u=h).colorBgSiderMenuActive??(u.colorBgSiderMenuActive=h.colorPrimaryBg),(c=h).colorTextSiderMenu??(c.colorTextSiderMenu=h.colorText),(p=h).colorTextSiderMenuHover??(p.colorTextSiderMenuHover=h.colorText),(m=h).colorTextSiderMenuActive??(m.colorTextSiderMenuActive=h.colorPrimary),h},et=e=>(Array.isArray(e.algorithm)?e.algorithm.includes(ee)||e.algorithm.push(ee):e.algorithm=[e.algorithm,ee].filter(Boolean),e.algorithm=e.algorithm.filter(Boolean),e);(0,k.injectGlobal)`
|
|
3
3
|
.ant-form-item-label > label {
|
|
4
4
|
font-weight: 600;
|
|
@@ -478,7 +478,7 @@ if (!ctx.record) {
|
|
|
478
478
|
flex-shrink: 0;
|
|
479
479
|
flex: 1;
|
|
480
480
|
}
|
|
481
|
-
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":ab.n,"x-component-props":{rows:1}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":t("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}}},handler(e,t){e.model.setProps({url:t.url,searchParams:t.searchParams,openInNewWindow:t.openInNewWindow})}}}});class u$ extends sz.S0{setTitle(e){this.setProps({title:e})}setExpandFlag(e){this.expandFlag=e}getTitle(){return this.expandFlag?this.context.t("Collapse all"):this.context.t("Expand all")}getIcon(){return this.expandFlag?"NodeCollapseOutlined":"NodeExpandOutlined"}constructor(...e){super(...e),this.defaultProps={type:"default",icon:"DownOutlined"}}}function uO(e){let{idKey:t="id",childrenKey:l="children"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];function o(e){if(Array.isArray(e))for(let r of e){let e=r[l];n.push(r[t]),Array.isArray(e)&&e.length>0&&o(e)}}return o(e),n}u$.scene=sz.s5.collection;let uq=e=>uO(e);u$.registerFlow({key:"expandCollapseSettingsInit",sort:200,steps:{init:{handler(e,t){e.blockModel.props.defaultExpandAllRows?e.model.setExpandFlag(!0):e.model.setExpandFlag(!1)}}}}),u$.registerFlow({key:"expandCollapseSettings",on:"click",steps:{expandCollapse:{async handler(e,t){var l;if(!(null==(l=e.blockModel)?void 0:l.resource))return;let n=e.blockModel.resource,{treeTable:o}=e.blockModel.props;if(o)if(e.model.expandFlag)e.blockModel.setProps({expandedRowKeys:[]}),e.model.setExpandFlag(!1);else{let t=uq(n.getData());e.blockModel.setProps({expandedRowKeys:t}),e.model.setExpandFlag(!0)}}}}}),u$.define({label:(0,D.escapeT)("Expand/Collapse"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.model.props.treeTable}});class uL extends dG{getAclActionName(){return"create"}onInit(e){super.onInit(e),this.context.defineProperty("association",{get:()=>this.context.blockModel.dataSource.getAssociation(`${this.context.blockModel.collection.name}.children`)})}constructor(...e){super(...e),this.defaultProps={type:"link",title:(0,D.tExpr)("Add child"),icon:"PlusOutlined"}}}uL.capabilityActionName=null,uL.registerFlow({key:"addChildSettingsInit",steps:{addChildInit:{async handler(e,t){e.model.onClick=t=>{e.model.dispatchEvent("click",{event:t,...e.inputArgs,sourceId:e.record.id,filterByTk:null},{debounce:!0})}}}}}),uL.define({label:(0,D.tExpr)("Add child"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.blockModel.props.treeTable}}),sV.registerActionModels({AddChildActionModel:uL});var u_=l(89013),uV=l(96491);class uz extends uV.F4{useHooksBeforeRender(){let[e]=u_.A.useForm();this.context.defineProperty("form",{get:()=>e})}onInit(e){super.onInit(e);let t=(0,D.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)},cache:!1,resolveOnServer:(0,D.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)}),meta:t}),this.context.defineProperty("filterManager",{once:!0,get:()=>new s7(this,null==e?void 0:e.filterManager)}),this.isManualRefresh=!0}createResource(e,t){let l=this.context.createResource(D.SingleRecordResource);return l.isNewRecord=!0,l}renderComponent(){var e;let{colon:t,labelAlign:l,labelWidth:n,labelWrap:o,layout:r}=this.props;return(0,E.jsx)(uV.s2,{model:this,layoutProps:{colon:t,labelAlign:l,labelWidth:n,labelWrap:o,layout:r},children:(0,E.jsx)(D.FlowModelRenderer,{model:null==(e=this.subModels)?void 0:e.grid,showFlowSettings:!1})})}setInitialAssignedValues(e){var t;let l=null==(t=this.subModels)?void 0:t.grid;Object.entries(e||{}).forEach(e=>{let[t,n]=e;l.addOrEnsureItem(t,n)})}getAssignedValues(){return this.subModels.grid.getAssignedValues()||{}}}uz.define({label:(0,D.tExpr)("Field assignments"),hide:!0,createModelOptions:{use:"AssignFormModel",subModels:{grid:{use:"AssignFormGridModel"}}}});class uK extends df{renderAddSubModelButton(){return(0,E.jsx)(D.AddSubModelButton,{subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("FormItemModel"),this.context.getModelClassName("FormAssociationFieldGroupModel"),this.context.getModelClassName("FormCustomItemModel"),this.context.getModelClassName("FormJSFieldItemModel")].filter(Boolean),model:this,keepDropdownOpen:!0,children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Fields")})})}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightModel,o=this.context.themeToken,r=super.render();return"defaultHeight"===n?r:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${o.marginLG}px`,marginRight:`-${o.marginLG}px`,paddingLeft:`${o.marginLG}px`,paddingRight:`${o.marginLG}px`,paddingTop:5},children:r})}constructor(...e){super(...e),this.itemFallback=(0,E.jsx)(o5.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}uK.registerFlow({key:"formFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});let uU=2;class uW extends uK{renderAddSubModelButton(){var e,t;let l=null==(e=this.context)?void 0:e.collection,n=(null==l||null==(t=l.getFields)?void 0:t.call(l))||[],o=this.context.prefixFieldPath?this.context.prefixFieldPath.split(".").filter(Boolean).length:0,r="function"==typeof(null==l?void 0:l.getPrimaryKey)?l.getPrimaryKey():void 0,i=null==l?void 0:l.filterTargetKey,a=e=>!!e&&!!(r&&e===r||"string"==typeof i&&e===i||Array.isArray(i)&&i.includes(e)),s=n.filter(e=>!a(null==e?void 0:e.name)).filter(e=>{var t;return o<uU||!((null==e||null==(t=e.isAssociationField)?void 0:t.call(e))||(null==e?void 0:e.target)||(null==e?void 0:e.targetCollection))}).map(e=>{let t=e.name,n=e.title||e.name,o=D.EditableItemModel.getDefaultBindingByField(this.context,e);if(!o)return;let r=o.modelName;return{key:t,label:n,toggleable:e=>{let l=e.getStepParams("fieldSettings","init")||{};return(null==l?void 0:l.fieldPath)===t},useModel:"AssignFormItemModel",createModelOptions:()=>({use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}},subModels:{field:{use:r,stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}}}}})}}).filter(Boolean);return(0,E.jsx)(D.AddSubModelButton,{subModelKey:"items",model:this,items:s,keepDropdownOpen:!0,children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Fields")})})}addOrEnsureItem(e,t){var l,n,o;let r=null==(l=this.context)?void 0:l.collection,i=((null==(n=this.subModels)?void 0:n.items)||[]).find(t=>{try{let l="function"==typeof(null==t?void 0:t.getStepParams)?t.getStepParams("fieldSettings","init"):null;return(null==l?void 0:l.fieldPath)===e}catch(e){return!1}});if(i){"function"==typeof(null==i?void 0:i.setStepParams)&&i.setStepParams("fieldSettings","assignValue",{value:t}),i.assignValue=t;return}let a=((null==r||null==(o=r.getFields)?void 0:o.call(r))||[]).find(t=>t.name===e),s=D.EditableItemModel.getDefaultBindingByField(this.context,a);if(!s)return;let d=s.modelName;this.addSubModel("items",{use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==r?void 0:r.dataSourceKey,collectionName:null==r?void 0:r.name,fieldPath:e},assignValue:{value:t}}},subModels:{field:{use:d,stepParams:{fieldSettings:{init:{dataSourceKey:null==r?void 0:r.dataSourceKey,collectionName:null==r?void 0:r.name,fieldPath:e}}}}}}).assignValue=t}getAssignedValues(){var e;let t=(null==(e=this.subModels)?void 0:e.items)||[],l={};for(let e of t){let t="function"==typeof e.getAssignedEntry?e.getAssignedEntry():null;t&&Array.isArray(t)&&(l[t[0]]=t[1])}return l}}uW.define({label:(0,D.tExpr)("Assign grid")});var uH=l(44329);function uG(e){return"string"==typeof e?e:"function"==typeof e&&e.name?e.name:void 0}function uY(e){var t,l;let n=null==e||null==(l=e.stepParams)||null==(t=l.fieldBinding)?void 0:t.use;return"string"==typeof n?n:void 0}async function uJ(e){var t,l,n;let{parentModel:o,targetUse:r,defaultProps:i,pattern:a,fieldSettingsInit:s}=e,d=o.subModels.field,u=null==d?void 0:d.uid,c=null==d||null==(l=d.serialize)||null==(t=l.call(d))?void 0:t.subModels;for(let e in c)!1===c[e].delegateToParent&&delete c[e];let p=uG(uY(d)||(null==d?void 0:d.use))===r&&(null==d?void 0:d.stepParams)||{},m=s??(null==(n=o.getFieldSettingsInitParams)?void 0:n.call(o)),{fieldBinding:h,...f}=p,g={...f,fieldSettings:{...f.fieldSettings||{},init:m}},v=o.flowEngine;u&&(null==d||d.invalidateFlowCache("beforeRender",!0),v.removeModelWithSubModels(u));let y=o.setSubModel("field",{uid:u,use:r,props:{...i||{},...a?{pattern:a}:{}},stepParams:g,subModels:c});await y.dispatchEvent("beforeRender",void 0,{useCache:!1}),await o.save()}var uX=l(13940);function uQ(e,t,l){let n=(0,B.castArray)(l).filter(e=>"string"==typeof e),o=t.split(".");if(null==n?void 0:n.length){let t=[],l=0,r=0;for(;l<o.length;){let e=o[l];if(t.push(e),r<n.length){let[l,o]=n[r].split(":");l===e&&(t.push(Number(o)),r++)}l++}return(0,B.get)(e,t)}return(0,B.get)(e,o)}function uZ(e){let{record:t,currentObject:l,fieldPath:n,prefixFieldPath:o,idx:r}=e,i=uQ(t,n,r);if(void 0!==i||null==l)return i;if(o&&n===o)return l;let a=o&&n.startsWith(`${o}.`)?n.slice(o.length+1):n;return a?(0,B.get)(l,a):l}function u0(e,t){return!(0,uX.E4)(e)||Array.isArray(t)?t:t&&"object"==typeof t&&Array.isArray(t.rows)?t.rows:null==t?[]:[t]}class u1 extends D.DisplayItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let n=this.getDefaultBindingByField(e,l,{fallbackToTargetTitleField:!0});if(!n)return null;let o=n.modelName,r=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:r,label:l.title,refreshTargets:["DetailsCustomItemModel/DetailsJSFieldItemModel"],toggleable:e=>{var t;return(null==(t=e.getStepParams("fieldSettings","init"))?void 0:t.fieldPath)===r},useModel:"DetailsItemModel",createModelOptions:()=>({use:"DetailsItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:r}}},subModels:{field:{use:o,props:"function"==typeof n.defaultProps?n.defaultProps(e,l):n.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>"view",cache:!1})}renderItem(){let e=this.subModels.field,t=this.context.fieldIndex,l=this.context.record,n=this.context.currentObject,o=this.context.item,r=this.context.getPropertyOptions("item"),i=this.context.prefixFieldPath,a=null!=t?(()=>{let i=e.createFork({},`${t}`);i.context.defineProperty("fieldIndex",{get:()=>t}),i.context.defineProperty("record",{get:()=>l,cache:!1}),i.context.defineProperty("currentObject",{get:()=>n,cache:!1});let{value:a,...s}=r||{};return i.context.defineProperty("item",{...s,get:()=>o,cache:!1}),this.context.pattern&&i.context.defineProperty("pattern",{get:()=>this.context.pattern}),i})():e,s=this.context.pattern?{...this.context.blockModel.props,...this.props,pattern:this.context.pattern,disabled:"readPretty"===this.context.pattern}:{...this.context.blockModel.props,...this.props},d=u0(this.collectionField,uZ({record:l,currentObject:n,fieldPath:this.fieldPath,prefixFieldPath:i,idx:t}));return(0,E.jsx)(D.FormItem,{...s,value:d,children:(0,E.jsx)(D.FieldModelRenderer,{model:a})})}}u1.define({label:(0,D.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search fields"),sort:100}),u1.registerFlow({key:"detailItemSettings",sort:300,title:(0,D.tExpr)("Detail item settings"),steps:{showLabel:{title:(0,D.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,D.tExpr)("Label"),uiSchema:e=>({title:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,o=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+o}}}}),defaultParams:e=>{var t;return{title:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.title,n)})}},aclCheck:{use:"aclCheck"},init:{async handler(e){let{collectionField:t}=e.model;t&&e.model.setProps(t.getComponentProps())}},tooltip:{title:(0,D.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,D.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},model:{title:(0,D.tExpr)("Field component"),use:"displayFieldComponent"},fieldNames:{use:"titleField",title:(0,D.tExpr)("Title field"),beforeParamsSave:async(e,t,l)=>{if(!e.collectionField||!e.collectionField.isAssociationField())return null;if(t.label!==l.label){var n,o;e.model.setProps({titleField:t.label,...null==(o=e.collectionField.targetCollection)||null==(n=o.getField(t.label))?void 0:n.getComponentProps()});let l=e.collectionField.targetCollection.getField(t.label),r=D.DisplayItemModel.getDefaultBindingByField(e,l),i=r.modelName;await uJ({parentModel:e.model,targetUse:i,defaultProps:"function"==typeof(null==r?void 0:r.defaultProps)?r.defaultProps(e,e.collectionField):null==r?void 0:r.defaultProps,pattern:e.model.getProps().pattern})}},async handler(e,t){var l,n;if(!e.collectionField||e.model.subModels.field.disableTitleField)return;e.model.setProps({titleField:t.label,...null==(n=e.collectionField.targetCollection)||null==(l=n.getField(t.label))?void 0:l.getComponentProps()});let o=e.collectionField.targetCollection;if(o){let l=o.getField(t.label),n=D.DisplayItemModel.getDefaultBindingByField(e,l).modelName;n!==e.model.subModels.field.use&&e.model.setStepParams(e.flowKey,"model",{use:n})}},hideInSettings:async e=>!e.collectionField||!e.collectionField.isAssociationField()||e.model.subModels.field.disableTitleField}}}),u1.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var u2=l(71616);function u8(e){if(!e)return!1;let t=null==e?void 0:e.type;return"belongsToMany"===t||"hasMany"===t||"belongsToArray"===t}function u5(e,t){var l;let n=!!(null==e||null==(l=e.isAssociationField)?void 0:l.call(e)),o=u8(e);return n&&!o&&Array.isArray(t)?t.length?t[0]:void 0:t}function u4(e,t){if(!(null==t?void 0:t.length))return e;let[l,n]=String(t[t.length-1]).split(":"),o=Number(n);if(!l||!Number.isFinite(o))return e;let r=0;for(let e of t){let[t]=String(e).split(":");t===l&&(r+=1)}let i=-1,a=0;for(let t=0;t<e.length;t++)if(String(e[t])===l&&(a+=1)===r){i=t;break}if(-1===i){for(let t=e.length-1;t>=0;t--)if(String(e[t])===l){i=t;break}}return -1===i?e:[o,...e.slice(i+1)]}let u3=["o2o","oho","obo","o2m","attachment","expression","point","lineString","circle","polygon","sequence","formula"],u6=2;class u9 extends D.EditableItemModel{static defineChildren(e){let t=e.collection,l=e.prefixFieldPath?e.prefixFieldPath.split(".").filter(Boolean).length:0;return t.getFields().map(n=>{var o;if(l>=u6&&((null==(o=n.isAssociationField)?void 0:o.call(n))||n.target||n.targetCollection))return;let r=this.getDefaultBindingByField(e,n);if(!r)return;let i=r.modelName,a=e.prefixFieldPath?`${e.prefixFieldPath}.${n.name}`:n.name;return{key:a,label:n.title,refreshTargets:["FormJSFieldItemModel","FormItemModel/FormJSFieldItemModel"],toggleable:e=>(0,uX.pX)(e).some(e=>e===a),useModel:"FormItemModel",createModelOptions:()=>({use:"FormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:a}}},subModels:{field:{use:i,props:"function"==typeof r.defaultProps?r.defaultProps(e,n):r.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{if(this.collectionField){let t=this.collectionField.getComponentProps();e.setProps(t),this.setProps({...$().pick(t,"rules")||{}})}})}renderItem(){var e,t;let l=this.subModels.field,n=this.context.fieldIndex,o=this.context.fieldKey,r=(null==(e=this.parent)?void 0:e.context.fieldPathArray)||[],i=!!this.context.flowSettingsEnabled&&!!this.props.hidden&&!this.hidden&&!this.forbidden,a=null!=n||i?(()=>{let e=i?`${this.uid}:config-visible`:`${o}`,t=l.createFork({},e);if(null!=n){t.context.defineProperty("fieldIndex",{get:()=>n}),t.context.defineProperty("fieldKey",{get:()=>o}),this.context.currentObject&&t.context.defineProperty("currentObject",{get:()=>this.context.currentObject});let e=this.context.getPropertyOptions("item");if(this.context.item){let{value:l,...n}=e||{};t.context.defineProperty("item",{...n,get:()=>this.context.item,cache:!1})}this.context.pattern&&t.context.defineProperty("pattern",{get:()=>this.context.pattern})}return t.context.defineProperty("fieldPathArray",{get:()=>this.context.fieldPathArray,cache:!1}),i&&t.setProps({hidden:!1}),t})():l,{initialValue:s,hidden:d,...u}=this.context.pattern?{...this.props,pattern:this.context.pattern}:this.props,c=i?u:{hidden:d,...u},p=u4(this.props.name,n);this.context.defineProperty("fieldPathArray",{get:()=>[...r,...$().castArray(p)],cache:!1});let m=(null==(t=this.context.item)?void 0:t.value)||this.context.record,h=(0,E.jsx)(D.FormItem,{...c,name:p,validateFirst:!0,disabled:this.props.disabled||!$().isEmpty(m)&&!m.__is_new__&&this.props.aclDisabled||!$().isEmpty(m)&&m.__is_new__&&this.props.aclCreateDisabled,children:(0,E.jsx)(D.FieldModelRenderer,{model:a,name:p})});return i?(0,E.jsx)(tP.A,{title:this.context.t("The field is hidden and only visible when the UI Editor is active"),children:(0,E.jsx)("div",{style:{opacity:.3},children:h})}):h}}u9.define({label:(0,D.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search fields"),sort:100}),u9.registerFlow({key:"editItemSettings",sort:300,title:(0,D.tExpr)("Form item settings"),steps:{showLabel:{title:(0,D.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,D.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,o=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+o}}}}),defaultParams:e=>{var t;return{label:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.label,n)})}},aclCheck:{use:"aclCheck",async handler(e,t){var l,n,o,r,i,a,s,d,u,c,p,m,h;if(!e.collectionField||!e.blockModel)return;let f=e.blockModel.context.actionName,g=await e.aclCheck({dataSourceKey:null==(l=e.dataSource)?void 0:l.key,resourceName:null==(n=e.collectionField)?void 0:n.collectionName,fields:[null==(o=e.collectionField)?void 0:o.name],actionName:f});if("update"===f){let t=await e.aclCheck({dataSourceKey:null==(r=e.dataSource)?void 0:r.key,resourceName:null==(i=e.collectionField)?void 0:i.collectionName,fields:[e.collectionField.name],actionName:"view"});e.prefixFieldPath&&e.item&&(await e.aclCheck({dataSourceKey:null==(s=e.dataSource)?void 0:s.key,resourceName:null==(d=e.collectionField)?void 0:d.collectionName,fields:[e.collectionField.name],actionName:"create"})||e.model.setProps({aclCreateDisabled:!0}));let l=(null==(a=e.item)?void 0:a.__is_new__)??!1;t||l||(e.model.hidden=!0,e.model.forbidden={actionName:"view"},e.exitAll()),g||e.model.setProps({aclDisabled:!0})}else if("create"===f){let t=await e.aclCheck({dataSourceKey:null==(u=e.dataSource)?void 0:u.key,resourceName:null==(c=e.collectionField)?void 0:c.collectionName,actionName:"update"}),l=await e.aclCheck({dataSourceKey:null==(p=e.dataSource)?void 0:p.key,resourceName:null==(m=e.collectionField)?void 0:m.collectionName,fields:[e.collectionField.name],actionName:"update"}),n=(null==(h=e.item)?void 0:h.__is_stored__)??!1;g||n||(e.model.hidden=!0,e.model.forbidden={actionName:f},e.exitAll()),t&&l||e.model.setProps({aclDisabled:!0})}}},init:{async handler(e){let t=e.model.fieldPath,l=t.includes(".")?t.split("."):t;e.model.setProps({name:l})}},tooltip:{title:(0,D.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,D.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem","x-component-props":{autoSize:!0}}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},initialValue:{title:(0,D.tExpr)("Default value"),disabledInSettings:!0,disabledReasonInSettings:e=>`${e.t("This setting has been moved to")}: ${e.t("Form block settings")} > ${e.t("Field values")}`,uiSchema:e=>{var t,l,n,o;if(e.model.parent.parent instanceof u2.EditFormModel||(null==(l=e.model.subModels)||null==(t=l.field)?void 0:t.updateAssociation))return;let r=null==(n=e.model.collectionField)?void 0:n.interface;if(null==u3||null==(o=u3.includes)||!o.call(u3,r))return{defaultValue:{"x-component":"DefaultValue","x-decorator":"FormItem"}}},defaultParams:e=>{let t=e.model.collectionField;if("nanoid"===t.interface&&!1!==t.options.autoFill){let{size:e,customAlphabet:l}=t.options||{size:21};return{defaultValue:(0,uH.d_)(l,e)()}}return{defaultValue:t.defaultValue}},handler(e,t){var l,n;let o=null==(l=e.model.collectionField)?void 0:l.interface;if(null==u3||null==(n=u3.includes)?void 0:n.call(u3,o))return;let r=u5(e.model.collectionField,t.defaultValue);e.model.setProps({initialValue:r})}},validation:{title:(0,D.tExpr)("Validation"),use:"validation"},required:{title:(0,D.tExpr)("Required"),use:"required"},model:{use:"fieldComponent",title:(0,D.tExpr)("Field component")},pattern:{use:"pattern"},titleField:{use:"titleField",hideInSettings:e=>!(e.collectionField&&e.collectionField.isAssociationField()&&e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern),defaultParams:e=>{var t,l,n;return{titleField:e.model.props.titleField||(null==(n=e.model)||null==(l=n.context)||null==(t=l.collectionField)?void 0:t.targetCollectionTitleFieldName)}},beforeParamsSave:async(e,t,l)=>{if(!(e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern))return null;let n=t.titleField||t.label;if(n!==l.titleField){let t=e.collectionField.targetCollection,l=t.getField(n),o=u1.getDefaultBindingByField(e,l);if(o.modelName!==e.model.subModels.field.use){let l=e.model.subModels.field.uid;await e.engine.destroyModel(l);let r=e.model.setSubModel("field",{use:o.modelName,stepParams:{fieldSettings:{init:{dataSourceKey:e.model.collectionField.dataSourceKey,collectionName:t.name,fieldPath:n}}}});await r.save()}e.model.setProps(e.collectionField.targetCollection.getField(n).getComponentProps())}},async handler(e,t){"readPretty"===e.model.props.pattern?e.model.setProps({titleField:null==t?void 0:t.label}):e.model.setProps({titleField:t.titleField})}}}}),u9.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var u7=l(85352),ce=l(90199),ct=l(97510);function cl(e,t){var l,n,o;let r=null==e||null==(l=e.props)?void 0:l.fieldNames,i=null==e||null==(n=e.props)?void 0:n.titleField,a=null==e||null==(o=e.getStepParams)?void 0:o.call(e,"selectSettings","fieldNames");return{stepParams:{fieldSettings:{init:t},...a?{selectSettings:{fieldNames:a}}:{}},props:{...void 0!==r?{fieldNames:r}:{},...void 0!==i?{titleField:i}:{}}}}function cn(e){try{return JSON.stringify(e)??""}catch{return String(e)}}function co(e){var t,l,n;let o=null==e||null==(t=e.props)?void 0:t.fieldNames,r=null==e||null==(l=e.props)?void 0:l.titleField,i=null==e||null==(n=e.getStepParams)?void 0:n.call(e,"selectSettings","fieldNames");return[(null==e?void 0:e.uid)||"",cn(o),cn(r),cn(i)].join("|")}function cr(e){if(!e||"object"!=typeof e||!("target"in e))return e;let t=e.target;return t&&"value"in t?t.value:e}class ci extends u9{onInit(e){var t,l,n,o,r,i,a;let s=null==(t=this.getStepParams("fieldSettings","assignValue"))?void 0:t.value;void 0!==s&&(this.assignValue=s),this.context.defineProperty("collectionField",{get:()=>{var e,t;let l=this.getStepParams("fieldSettings","init")||{},n=`${null==l?void 0:l.dataSourceKey}.${null==l?void 0:l.collectionName}.${null==l?void 0:l.fieldPath}`,o=null==(e=this.context)?void 0:e.dataSourceManager;return null==o||null==(t=o.getCollectionField)?void 0:t.call(o,n)}});let d=this.context,u=null==d?void 0:d.collection,c=this.fieldInit;if(!(null==(l=this.subModels)?void 0:l.field)&&(null==u?void 0:u.getFields)){let e=(u.getFields()||[]).find(e=>(null==e?void 0:e.name)===(null==c?void 0:c.fieldPath));null==u||null==(o=u.getField)||o.call(u,null==c?void 0:c.fieldPath);let t=D.EditableItemModel.getDefaultBindingByField(d,e);if(!t)return;let l=t.modelName;null==d||null==(i=d.engine)||null==(r=i.createModel)||r.call(i,{use:l,stepParams:{fieldSettings:{init:c}},parentId:this.uid,subKey:"field"})}let p=null==(n=this.context)?void 0:n.collection,m=this.fieldPath;if(m){let e=null==p||null==(a=p.getField)?void 0:a.call(p,m),t=(null==e?void 0:e.title)||m,l=m.includes(".")?m.split("."):[m];this.setProps({label:t,name:l})}}get fieldInit(){return this.getStepParams("fieldSettings","init")||{}}get fieldPath(){var e;return null==(e=this.fieldInit)?void 0:e.fieldPath}getAssignedEntry(){let e=this.fieldPath;return e?[e,this.assignValue]:null}render(){var e,t;let l=this.context,n=l.collection,o=this.fieldInit,r=(null==(e=this.props)?void 0:e.name)||(this.fieldPath?[this.fieldPath]:void 0),i=this.fieldPath,a=null==(t=this.subModels)?void 0:t.field,s=co(a),d=()=>{var e,t,s,d,u;let[c,p]=O.useState(null);O.useEffect(()=>{var e,t,r,s,d,u,c,m,h,f,g,v,y,x,b,w,S,C,F,k,A;if(!i)return;let P=((null==n||null==(e=n.getFields)?void 0:e.call(n))||[]).find(e=>(null==e?void 0:e.name)===i);n.getField(i);let j=D.EditableItemModel.getDefaultBindingByField(l,P);if(!j)return;let M=j.modelName,I=cl(a,o),T=null==l||null==(r=l.engine)||null==(t=r.createModel)?void 0:t.call(r,{use:"VariableFieldFormModel",subModels:{fields:[{use:M,...I}]}});if(!T)return;null==(d=T.context)||null==(s=d.defineProperty)||s.call(d,"collection",{value:n});let R=null==l?void 0:l.dataSource;R&&(null==(c=T.context)||null==(u=c.defineProperty)||u.call(c,"dataSource",{value:R}));let E=null==n||null==(m=n.getField)?void 0:m.call(n,null==o?void 0:o.fieldPath);E&&(null==(f=T.context)||null==(h=f.defineProperty)||h.call(f,"collectionField",{value:E}));let N=null==l?void 0:l.blockModel;N&&(null==(v=T.context)||null==(g=v.defineProperty)||g.call(v,"blockModel",{value:N}));let B=l.form;B&&(null==(k=T.context)||null==(F=k.defineProperty)||F.call(k,"form",{value:B})),T.context&&Object.defineProperty(T.context,"resource",{configurable:!0,enumerable:!0,get:()=>null==N?void 0:N.resource});let $=null==T||null==(x=T.subModels)||null==(y=x.fields)?void 0:y[0],O=null==n||null==(b=n.getField)?void 0:b.call(n,null==o?void 0:o.fieldPath),q=null==O?void 0:O.type,L=null==O?void 0:O.interface,_="belongsToMany"===q||"hasMany"===q||"belongsToArray"===q||"m2m"===L||"o2m"===L||"mbm"===L;if(null==$||null==(w=$.setProps)||w.call($,{disabled:!1,readPretty:!1,updateAssociation:!1,multiple:_}),null==$||null==(S=$.dispatchEvent)||S.call($,"beforeRender",void 0,{sequential:!0,useCache:!0}),(0,u7.NI)($,O),!(null==$||null==(C=$.props)?void 0:C.fieldNames)&&(null==O?void 0:O.targetCollection)){let e=O.targetCollection,t=(null==O?void 0:O.targetKey)||(null==e?void 0:e.filterTargetKey)||"id";null==$||null==(A=$.setProps)||A.call($,{fieldNames:{label:null==e?void 0:e.titleField,value:t}})}return p(T),()=>{var e,t,l,n;null==T||null==(l=T.subModels)||null==(t=l.fields)||null==(e=t.forEach)||e.call(t,e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),null==T||null==(n=T.remove)||n.call(T)}},[]);let m=e=>(O.useEffect(()=>{var t,l,n;if(!c)return;null==(t=c.setProps)||t.call(c,{...e});let o=null==c||null==(n=c.subModels)||null==(l=n.fields)?void 0:l[0];if(o){var r,i=this;null==(r=o.setProps)||r.call(o,{value:null==e?void 0:e.value,onChange:function(){for(var t,l,n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];let s=cr(r&&r.length?r[0]:void 0);null==(t=o.setProps)||t.call(o,{value:s}),i.assignValue=s,null==e||null==(l=e.onChange)||l.call(e,s)}})}},[e]),c?(0,E.jsx)("div",{style:{width:"100%"},children:(0,E.jsx)(D.FlowModelRenderer,{model:c,showFlowSettings:!1})}):null),h=()=>{var e,t;return(0,E.jsx)(ds.A,{placeholder:`<${(null==(e=(t=this.context).t)?void 0:e.call(t,"Null"))??"Null"}>`,readOnly:!0,style:{width:"100%"}})},f=e=>(0,E.jsx)(ce.h,{t:this.context.t,value:null==e?void 0:e.value,onChange:null==e?void 0:e.onChange,containerStyle:{width:"100%"}}),g=async()=>{var e;let t=null==(e=this.context)?void 0:e.getPropertyMetaTree;return"function"==typeof t?await t():[]},v=null==n||null==(e=n.getField)?void 0:e.call(n,this.fieldPath),y=(0,ct.kB)(v),x=(0,ct.Ot)(v,null==(t=this.fieldPath)?void 0:t.split(".").slice(-1)[0]),b=x?(0,ct.cd)(v,y):ct.tS,w=(null==(s=this.props)?void 0:s.label)??this.fieldPath??"",S=null==n||null==(d=n.getField)?void 0:d.call(n,this.fieldPath);return w=(null==(u=this.props)?void 0:u.label)??(null==S?void 0:S.title)??w,(0,E.jsx)(D.FormItem,{...this.props,label:w,name:r,initialValue:this.assignValue,valuePropName:"__assign_value__",trigger:"__assign_trigger__",validateTrigger:"__assign_trigger__",children:O.createElement(e=>{let t=null==e?void 0:e.__assign_value__,l=void 0===t?this.assignValue:t;return(0,E.jsx)(ct.Wm,{value:l,onChange:t=>{var l;this.assignValue=t,null==e||null==(l=e.__assign_trigger__)||l.call(e,t)},baseMetaTree:g,constantComponent:m,nullComponent:h,runJSComponent:f,isDateLikeField:x,dateComponentProps:b,clearValue:""})})})};return(0,E.jsx)(d,{},s)}constructor(e){super(e),this.assignValue=void 0,(0,N.define)(this,{assignValue:N.observable})}}ci.define({label:(0,D.tExpr)("Assign field")}),ci.registerFlow({key:"editItemSettings",sort:300,title:(0,D.tExpr)("Form item settings"),steps:{showLabel:{title:(0,D.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,D.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,o=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+o}}}}),defaultParams:e=>({label:e.model.collectionField.title}),handler(e,t){var l;t.label&&t.label===(null==(l=e.model.collectionField)?void 0:l.title)?e.model.setProps({label:t.label}):e.model.setProps({label:e.t(t.label,{ns:"lm-flow-engine"})})}},init:{async handler(e){let t=e.model.collectionField;t&&e.model.setProps(t.getComponentProps());let l=e.model.fieldPath,n=l.includes(".")?l.split("."):l;e.model.setProps({name:n})}},tooltip:{title:(0,D.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,D.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},validation:{title:(0,D.tExpr)("Validation"),use:"validation"},required:{title:(0,D.tExpr)("Required"),use:"required"}}});class ca extends sK{}ca.itemModelName="DetailsItemModel",ca.define({label:'{{t("Display association fields")}}'});var cs=l(58929);let cd=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,o=parseFloat(l.marginBottom)||0;return t.height+n+o},cu=e=>{let{heightMode:t,containerRef:l,actionsRef:n,paginationRef:o,deps:r=[]}=e,[i,a]=(0,O.useState)(),s=(0,O.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let r=e.getBoundingClientRect().height;if(!r)return;let i=Math.max(0,Math.floor(r-cd(n.current)-cd(o.current)));a(e=>e===i?e:i)},[t,l,n,o]);return(0,O.useLayoutEffect)(()=>{s()},[s,...r]),(0,O.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=n.current,r=o.current,i=new ResizeObserver(()=>s());return i.observe(e),t&&i.observe(t),r&&i.observe(r),()=>i.disconnect()},[s,l,n,o,...r]),i};class cc extends dF.t{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(D.SingleRecordResource);return e.isNewRecord=!1,e}let o=this.context.createResource(D.MultiRecordResource);return o.setPageSize(1),o}onInit(e){var t,l;super.onInit(e),this.hadSingleRecordData=(null==(l=this.resource)||null==(t=l.hasData)?void 0:t.call(l))??!1,this.hasMultiRefreshDispatched=!1;let n=(0,D.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1,resolveOnServer:(0,D.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>this.getCurrentRecord()),meta:n}),this.resource.on("refresh",()=>{var e,t;if(this.isMultiRecordResource()){this.hasMultiRefreshDispatched=!0,(0,uC.Xi)(this,"paginationChange");return}let l=this.hadSingleRecordData;this.hadSingleRecordData=(null==(t=this.resource)||null==(e=t.hasData)?void 0:e.call(t))??!1,l&&(0,uC.Xi)(this,"paginationChange")})}isMultiRecordResource(){return this.resource instanceof D.MultiRecordResource}hasDispatchedMultiRefresh(){return this.hasMultiRefreshDispatched}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}async refresh(){await this.resource.refresh()}renderPagination(){if(!this.resource.loading&&!this.hasAvailableData()){var e,t;return(0,E.jsx)("div",{style:{textAlign:"center",color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")})}let l=this.resource;return!this.isMultiRecordResource()||!l.getPage()||1>=this.resource.getMeta("count")?null:(0,E.jsx)("div",{style:{textAlign:"center"},children:(0,E.jsx)(cs.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:l.getPage(),total:l.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})})}renderConfigureActions(){return(0,E.jsx)(D.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("RecordActionGroupModel"),afterSubModelInit:async e=>{e.setStepParams("buttonSettings","general",{type:"default"})},children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Actions")})},"details-actions-add")}renderComponent(){let{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:o}=this.props,r=!!this.context.flowSettingsEnabled,i=!r&&!this.hasAvailableData(),{heightMode:a,height:s}=this.decoratorProps;return(0,E.jsx)(cp,{model:this,gridModel:this.subModels.grid,isConfigMode:r,heightMode:a,height:s,layoutProps:{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:o},actions:(0,E.jsx)(D.DndProvider,{children:(0,E.jsx)("div",{style:i?{pointerEvents:"none",opacity:.45}:void 0,children:(0,E.jsxs)(de.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||r)return(0,E.jsx)(D.Droppable,{model:e,children:(0,E.jsx)(D.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:D.DragHandler,sort:1}]})},e.uid)}),this.renderConfigureActions()]})})})})}constructor(...e){super(...e),this.hadSingleRecordData=!1,this.hasMultiRefreshDispatched=!1,this._defaultCustomModelClasses={RecordActionGroupModel:"RecordActionGroupModel",DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"},this.customModelClasses={},this.handlePageChange=async e=>{if(this.resource instanceof D.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await this.refresh()}}}}cc.scene=dS.P.oam;let cp=e=>{let{model:t,gridModel:l,isConfigMode:n,heightMode:o,height:r,layoutProps:i,actions:a}=e,s=(0,O.useRef)(null),d=(0,O.useRef)(null),u=(0,O.useRef)(null),c="specifyValue"===o||"fullHeight"===o,p=cu({heightMode:o,containerRef:s,actionsRef:d,paginationRef:u,deps:[r]});(0,O.useEffect)(()=>{var e,t;if(!l)return;let n=c?p:void 0;((null==(e=l.props)?void 0:e.height)!==n||(null==(t=l.props)?void 0:t.heightMode)!==o)&&l.setProps({height:n,heightMode:o})},[l,p,c,o]);let m=c?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,h=c?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,E.jsx)(uV.s2,{model:t,layoutProps:i,style:m,children:(0,E.jsxs)("div",{ref:s,style:h,children:[(0,E.jsx)("div",{ref:d,style:{textAlign:"right",lineHeight:"0px",paddingBottom:n&&t.context.themeToken.padding},children:a}),(0,E.jsx)(D.FlowModelRenderer,{model:l,showFlowSettings:!1},`${(null==l?void 0:l.uid)||"details-grid"}:${n?"design":"runtime"}`),(0,E.jsx)("div",{ref:u,children:t.renderPagination()})]})})};cc.registerFlow({key:"detailsSettings",title:(0,D.tExpr)("Details settings"),sort:150,steps:{refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");await e.model.applySubModelsBeforeRenderFlows("grid")}},layout:{use:"layout",title:(0,D.tExpr)("Layout")},dataScope:{use:"dataScope"},defaultSorting:{use:"sortingRule",title:(0,D.tExpr)("Default sorting")},linkageRules:{use:"detailsFieldLinkageRules"}}}),cc.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldslinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"detailsFieldLinkageRules",flowKey:"detailsSettings",stepKey:"linkageRules"}}}}),cc.registerFlow({key:"initialPaginationChangeRefresh",sort:10001,steps:{refreshPaginationRelatedStates:{async handler(e){if(e.model.hidden||!e.model.isMultiRecordResource()||e.model.hasDispatchedMultiRefresh())return;let t=e.model.resource;if(!t)return;let l="manual"===(t.dataLoadingMode??t.loadingMode),n="function"==typeof t.hasActiveFilters&&t.hasActiveFilters();l&&!n&&await (0,uC.Xi)(e.model,"paginationChange")}}}}),cc.define({label:(0,D.tExpr)("Details"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search"),createModelOptions:{use:"DetailsBlockModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});class cm extends D.FlowModel{static defineChildren(e){let t=e.engine.filterModelClassByParent("CommonItemModel"),l=e.engine.filterModelClassByParent("DetailsCustomItemModel"),n=t=>Array.from(t.entries()).map(t=>{var l,n,o,r,i;let[a,s]=t,d="function"==typeof s.defineChildren||!!(null==(l=s.meta)?void 0:l.children),u={key:a,label:e.t(s.meta.label),sort:s.meta.sort??999,searchable:!!(null==(n=s.meta)?void 0:n.searchable),searchPlaceholder:null==(o=s.meta)?void 0:o.searchPlaceholder,hide:null==(r=s.meta)?void 0:r.hide};return d?u.children=e=>{var t;return"function"==typeof s.defineChildren?s.defineChildren(e):(null==(t=s.meta)?void 0:t.children)||[]}:u.createModelOptions=(null==(i=s.meta)?void 0:i.createModelOptions)||{use:a},u});return $().sortBy([...n(t),...n(l)],"sort")}}cm.renderMode=D.ModelRenderMode.RenderFunction,cm.define({hide:!0,label:(0,D.tExpr)("Others")});class ch extends df{renderAddSubModelButton(){return this.context.flowSettingsEnabled?(0,E.jsx)(D.AddSubModelButton,{model:this,subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("DetailsItemModel"),this.context.getModelClassName("DetailsAssociationFieldGroupModel"),this.context.getModelClassName("DetailsCustomItemModel")].filter(Boolean),keepDropdownOpen:!0,children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Fields")})}):null}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightMode,o=this.context.themeToken,r=super.render();return"defaultHeight"===n?r:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${o.marginLG}px`,marginRight:`-${o.marginLG}px`,paddingLeft:`${o.marginLG}px`,paddingRight:`${o.marginLG}px`},children:r})}constructor(...e){super(...e),this.itemFallback=(0,E.jsx)(o5.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}function cf(e,t){let{fieldUseModel:l,refreshTargets:n}=t,o=e=>Array.isArray(e)?e.map(e=>{let t={...e};if(t.children)if("function"==typeof t.children){let e=t.children;t.children=async t=>o(await e(t))}else Array.isArray(t.children)&&(t.children=o(t.children));if(t.createModelOptions){let e=t.createModelOptions;t.createModelOptions=async(t,n)=>{let o=await ("function"==typeof e?e(t,n):e);return o.subModels=o.subModels||{},o.subModels.field={...o.subModels.field||{},use:l},o},t.refreshTargets=t.refreshTargets||n}return t}):[];return o(e)}function cg(e,t,l){let{fieldUseModel:n,refreshTargets:o}=l,r=l.key??"js-association-fields",i=l.label??(0,D.tExpr)("Display association fields");return{key:r,type:"group",label:i,searchable:l.searchable??!0,searchPlaceholder:l.searchPlaceholder??(0,D.tExpr)("Search fields"),children:async e=>cf(await t(e),{fieldUseModel:n,refreshTargets:o})}}ch.registerFlow({key:"detailFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class cv extends sK{}async function cy(e,t){var l;let{useModel:n,fieldUseModel:o,refreshTargets:r,associationPathName:i,associationProvider:a}=t,s=(0,D.buildWrapperFieldChildren)(e,{useModel:n,fieldUseModel:o,associationPathName:i,refreshTargets:r}),d=[],u=null==s||null==(l=s[0])?void 0:l.children;if(Array.isArray(u)&&(d=u),!a)return d;let c=await a(e);return Array.isArray(c)&&0!==c.length?[...d,cg(e,a,{fieldUseModel:o,refreshTargets:r})]:d}cv.itemModelName="FormItemModel";class cx extends cm{static defineChildren(e){return cy(e,{useModel:"DetailsItemModel",fieldUseModel:"JSFieldModel",refreshTargets:["DetailsItemModel"],associationProvider:e=>ca.defineChildren(e)})}}cx.define({label:(0,D.tExpr)("JS field"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search fields"),sort:110});class cb extends aT.o{}var cw=l(85196);class cS extends aT.o{constructor(...e){super(...e),this.operator="$eq",this.updateAssociation=!1}}cS.registerFlow({key:"AssociationFieldInit",sort:800,steps:{init:{async handler(e,t){if(e.model.updateAssociation){var l,n;let t=e.model.context.blockModel,o=null==t||null==(l=t.context)?void 0:l.resource,r=null==(n=e.model.parent)?void 0:n.fieldPath;o&&r&&o.addUpdateAssociationValues(r)}}},allowCreateCheck:{async handler(e){var t;let l=await e.aclCheck({dataSourceKey:e.collectionField.dataSourceKey,resourceName:null==(t=e.collectionField)?void 0:t.target,actionName:"create"});e.model.setProps({allowCreate:!!l})}}}});let cC=(e,t)=>e===t,cF=e=>{if(e&&"object"==typeof e){let t=e.data;return t&&"object"==typeof t?t:e}};function ck(e){return"string"==typeof e&&e?e:Array.isArray(e)&&1===e.length&&"string"==typeof e[0]?e[0]:void 0}function cA(e,t){var l;let n="string"==typeof(null==t||null==(l=t.titleCollectionField)?void 0:l.name)?t.titleCollectionField.name:void 0,o=ck(null==t?void 0:t.filterTargetKey)||"id",r="string"==typeof(null==e?void 0:e.value)&&e.value&&!cC(e.value,"value")?e.value:void 0,i="string"==typeof(null==e?void 0:e.label)&&e.label&&!cC(e.label,"label")?e.label:void 0,a=r||o;return{label:i||n||a,value:a}}function cP(e){var t,l,n,o,r,i;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!!a.navigation,d=e=>{if(Array.isArray(e))return e.filter(e=>"string"==typeof e&&!!e)},u=d(null==(l=e.view)||null==(t=l.inputArgs)?void 0:t.openerUids),c=d(a.openerUids),p=u||c||[];if(s)return(c||p).filter(Boolean);let m=null==(o=e.view)||null==(n=o.inputArgs)?void 0:n.viewUid,h=null==(i=e.model.context)||null==(r=i.inputArgs)?void 0:r.viewUid;return[...p,"string"==typeof m&&m?m:"string"==typeof h&&h?h:e.model.uid].filter(Boolean)}function cj(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.map(e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}).filter(e=>void 0!==e);return t.length?t.map(String).join(", "):void 0}if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}function cM(e){var t,l,n;let{option:o,fieldNames:r}=e,i=(0,D.useFlowModel)(),a=cF(o),s=cA(r,null==(t=i.context.collectionField)?void 0:t.targetCollection),d=i.subModels.field,u=cj(null==a?void 0:a[s.label])??cj(null==a?void 0:a.label)??cj(null==a?void 0:a[s.value]);if(!d)return(0,E.jsx)("span",{children:u??"N/A"});let c=String((null==a?void 0:a[s.value])??u??"association-option"),p=d.createFork({},c);p.context.defineProperty("record",{get:()=>a,cache:!1,meta:(0,D.createCurrentRecordMetaFactory)(p.context,()=>p.context.collection)});let m=null==(n=i.context.collectionField.targetCollection)||null==(l=n.getField)?void 0:l.call(n,s.label),h=m&&"function"==typeof m.getComponentProps?m.getComponentProps():{};p.setProps({value:u,clickToOpen:!1,...h});let f=null!=u&&""!==u?p.render():"N/A";return(0,E.jsx)("span",{style:{pointerEvents:"none"},children:f})}function cI(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"record",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];if(!e)return l?[]:void 0;let{value:r}=t||{},i=e=>"object"==typeof e&&null!==e,a=e=>{if(i(e))return{label:(0,E.jsx)(cM,{option:e,fieldNames:t}),value:e[r]}};if("value"===n){let t=e=>{if("object"==typeof e&&null!==e)return a(e);let t=o.find(t=>(null==t?void 0:t[r])===e);return t?a(t):{label:String(e),value:e}};return l?Array.isArray(e)?e.map(e=>t(e)).filter(Boolean):[]:Array.isArray(e)?t(e[0]):t(e)}if(l)return Array.isArray(e)?e.filter(i).map(a).filter(Boolean):[];if(Array.isArray(e)){let t=e[0];return i(t)?a(t):void 0}return i(e)?a(e):void 0}function cT(e,t,l){return(null==e?void 0:e.length)?e.map(e=>(0,B.omit)(e,"disabled","options","style")):l?Array.isArray(t)?t.filter(e=>"object"==typeof e&&null!==e):[]:t&&"object"==typeof t?[t]:[]}var cR=l(33022);let cE="calc(12px + env(safe-area-inset-bottom, 0px))",cN={paddingBottom:cE};function cD(e){return{maxHeight:"60vh",overflowY:"auto",paddingBottom:e?void 0:cE}}let cB=(0,k.css)`
|
|
481
|
+
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":ab.n,"x-component-props":{rows:1}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":t("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}}},handler(e,t){e.model.setProps({url:t.url,searchParams:t.searchParams,openInNewWindow:t.openInNewWindow})}}}});class u$ extends sz.S0{setTitle(e){this.setProps({title:e})}setExpandFlag(e){this.expandFlag=e}getTitle(){return this.expandFlag?this.context.t("Collapse all"):this.context.t("Expand all")}getIcon(){return this.expandFlag?"NodeCollapseOutlined":"NodeExpandOutlined"}constructor(...e){super(...e),this.defaultProps={type:"default",icon:"DownOutlined"}}}function uO(e){let{idKey:t="id",childrenKey:l="children"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];function o(e){if(Array.isArray(e))for(let r of e){let e=r[l];n.push(r[t]),Array.isArray(e)&&e.length>0&&o(e)}}return o(e),n}u$.scene=sz.s5.collection;let uq=e=>uO(e);u$.registerFlow({key:"expandCollapseSettingsInit",sort:200,steps:{init:{handler(e,t){e.blockModel.props.defaultExpandAllRows?e.model.setExpandFlag(!0):e.model.setExpandFlag(!1)}}}}),u$.registerFlow({key:"expandCollapseSettings",on:"click",steps:{expandCollapse:{async handler(e,t){var l;if(!(null==(l=e.blockModel)?void 0:l.resource))return;let n=e.blockModel.resource,{treeTable:o}=e.blockModel.props;if(o)if(e.model.expandFlag)e.blockModel.setProps({expandedRowKeys:[]}),e.model.setExpandFlag(!1);else{let t=uq(n.getData());e.blockModel.setProps({expandedRowKeys:t}),e.model.setExpandFlag(!0)}}}}}),u$.define({label:(0,D.escapeT)("Expand/Collapse"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.model.props.treeTable}});class uL extends dG{getAclActionName(){return"create"}onInit(e){super.onInit(e),this.context.defineProperty("association",{get:()=>this.context.blockModel.dataSource.getAssociation(`${this.context.blockModel.collection.name}.children`)})}constructor(...e){super(...e),this.defaultProps={type:"link",title:(0,D.tExpr)("Add child"),icon:"PlusOutlined"}}}uL.capabilityActionName=null,uL.registerFlow({key:"addChildSettingsInit",steps:{addChildInit:{async handler(e,t){e.model.onClick=t=>{e.model.dispatchEvent("click",{event:t,...e.inputArgs,sourceId:e.record.id,filterByTk:null},{debounce:!0})}}}}}),uL.define({label:(0,D.tExpr)("Add child"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.blockModel.props.treeTable}}),sV.registerActionModels({AddChildActionModel:uL});var u_=l(89013),uV=l(96491);class uz extends uV.F4{useHooksBeforeRender(){let[e]=u_.A.useForm();this.context.defineProperty("form",{get:()=>e})}onInit(e){super.onInit(e);let t=(0,D.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)},cache:!1,resolveOnServer:(0,D.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)}),meta:t}),this.context.defineProperty("filterManager",{once:!0,get:()=>new s7(this,null==e?void 0:e.filterManager)}),this.isManualRefresh=!0}createResource(e,t){let l=this.context.createResource(D.SingleRecordResource);return l.isNewRecord=!0,l}renderComponent(){var e;let{colon:t,labelAlign:l,labelWidth:n,labelWrap:o,layout:r}=this.props;return(0,E.jsx)(uV.s2,{model:this,layoutProps:{colon:t,labelAlign:l,labelWidth:n,labelWrap:o,layout:r},children:(0,E.jsx)(D.FlowModelRenderer,{model:null==(e=this.subModels)?void 0:e.grid,showFlowSettings:!1})})}setInitialAssignedValues(e){var t;let l=null==(t=this.subModels)?void 0:t.grid;Object.entries(e||{}).forEach(e=>{let[t,n]=e;l.addOrEnsureItem(t,n)})}getAssignedValues(){return this.subModels.grid.getAssignedValues()||{}}}uz.define({label:(0,D.tExpr)("Field assignments"),hide:!0,createModelOptions:{use:"AssignFormModel",subModels:{grid:{use:"AssignFormGridModel"}}}});class uK extends df{serialize(){return{...super.serialize(),variableContractType:{type:"formGrid",use:this.use}}}renderAddSubModelButton(){return(0,E.jsx)(D.AddSubModelButton,{subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("FormItemModel"),this.context.getModelClassName("FormAssociationFieldGroupModel"),this.context.getModelClassName("FormCustomItemModel"),this.context.getModelClassName("FormJSFieldItemModel")].filter(Boolean),model:this,keepDropdownOpen:!0,children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Fields")})})}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightModel,o=this.context.themeToken,r=super.render();return"defaultHeight"===n?r:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${o.marginLG}px`,marginRight:`-${o.marginLG}px`,paddingLeft:`${o.marginLG}px`,paddingRight:`${o.marginLG}px`,paddingTop:5},children:r})}constructor(...e){super(...e),this.itemFallback=(0,E.jsx)(o5.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}uK.registerFlow({key:"formFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});let uU=2;class uW extends uK{renderAddSubModelButton(){var e,t;let l=null==(e=this.context)?void 0:e.collection,n=(null==l||null==(t=l.getFields)?void 0:t.call(l))||[],o=this.context.prefixFieldPath?this.context.prefixFieldPath.split(".").filter(Boolean).length:0,r="function"==typeof(null==l?void 0:l.getPrimaryKey)?l.getPrimaryKey():void 0,i=null==l?void 0:l.filterTargetKey,a=e=>!!e&&!!(r&&e===r||"string"==typeof i&&e===i||Array.isArray(i)&&i.includes(e)),s=n.filter(e=>!a(null==e?void 0:e.name)).filter(e=>{var t;return o<uU||!((null==e||null==(t=e.isAssociationField)?void 0:t.call(e))||(null==e?void 0:e.target)||(null==e?void 0:e.targetCollection))}).map(e=>{let t=e.name,n=e.title||e.name,o=D.EditableItemModel.getDefaultBindingByField(this.context,e);if(!o)return;let r=o.modelName;return{key:t,label:n,toggleable:e=>{let l=e.getStepParams("fieldSettings","init")||{};return(null==l?void 0:l.fieldPath)===t},useModel:"AssignFormItemModel",createModelOptions:()=>({use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}},subModels:{field:{use:r,stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}}}}})}}).filter(Boolean);return(0,E.jsx)(D.AddSubModelButton,{subModelKey:"items",model:this,items:s,keepDropdownOpen:!0,children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Fields")})})}addOrEnsureItem(e,t){var l,n,o;let r=null==(l=this.context)?void 0:l.collection,i=((null==(n=this.subModels)?void 0:n.items)||[]).find(t=>{try{let l="function"==typeof(null==t?void 0:t.getStepParams)?t.getStepParams("fieldSettings","init"):null;return(null==l?void 0:l.fieldPath)===e}catch(e){return!1}});if(i){"function"==typeof(null==i?void 0:i.setStepParams)&&i.setStepParams("fieldSettings","assignValue",{value:t}),i.assignValue=t;return}let a=((null==r||null==(o=r.getFields)?void 0:o.call(r))||[]).find(t=>t.name===e),s=D.EditableItemModel.getDefaultBindingByField(this.context,a);if(!s)return;let d=s.modelName;this.addSubModel("items",{use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==r?void 0:r.dataSourceKey,collectionName:null==r?void 0:r.name,fieldPath:e},assignValue:{value:t}}},subModels:{field:{use:d,stepParams:{fieldSettings:{init:{dataSourceKey:null==r?void 0:r.dataSourceKey,collectionName:null==r?void 0:r.name,fieldPath:e}}}}}}).assignValue=t}getAssignedValues(){var e;let t=(null==(e=this.subModels)?void 0:e.items)||[],l={};for(let e of t){let t="function"==typeof e.getAssignedEntry?e.getAssignedEntry():null;t&&Array.isArray(t)&&(l[t[0]]=t[1])}return l}}uW.define({label:(0,D.tExpr)("Assign grid")});var uH=l(44329);function uG(e){return"string"==typeof e?e:"function"==typeof e&&e.name?e.name:void 0}function uY(e){var t,l;let n=null==e||null==(l=e.stepParams)||null==(t=l.fieldBinding)?void 0:t.use;return"string"==typeof n?n:void 0}async function uJ(e){var t,l,n;let{parentModel:o,targetUse:r,defaultProps:i,pattern:a,fieldSettingsInit:s}=e,d=o.subModels.field,u=null==d?void 0:d.uid,c=null==d||null==(l=d.serialize)||null==(t=l.call(d))?void 0:t.subModels;for(let e in c)!1===c[e].delegateToParent&&delete c[e];let p=uG(uY(d)||(null==d?void 0:d.use))===r&&(null==d?void 0:d.stepParams)||{},m=s??(null==(n=o.getFieldSettingsInitParams)?void 0:n.call(o)),{fieldBinding:h,...f}=p,g={...f,fieldSettings:{...f.fieldSettings||{},init:m}},v=o.flowEngine;u&&(null==d||d.invalidateFlowCache("beforeRender",!0),v.removeModelWithSubModels(u));let y=o.setSubModel("field",{uid:u,use:r,props:{...i||{},...a?{pattern:a}:{}},stepParams:g,subModels:c});await y.dispatchEvent("beforeRender",void 0,{useCache:!1}),await o.save()}var uX=l(13940);function uQ(e,t,l){let n=(0,B.castArray)(l).filter(e=>"string"==typeof e),o=t.split(".");if(null==n?void 0:n.length){let t=[],l=0,r=0;for(;l<o.length;){let e=o[l];if(t.push(e),r<n.length){let[l,o]=n[r].split(":");l===e&&(t.push(Number(o)),r++)}l++}return(0,B.get)(e,t)}return(0,B.get)(e,o)}function uZ(e){let{record:t,currentObject:l,fieldPath:n,prefixFieldPath:o,idx:r}=e,i=uQ(t,n,r);if(void 0!==i||null==l)return i;if(o&&n===o)return l;let a=o&&n.startsWith(`${o}.`)?n.slice(o.length+1):n;return a?(0,B.get)(l,a):l}function u0(e,t){return!(0,uX.E4)(e)||Array.isArray(t)?t:t&&"object"==typeof t&&Array.isArray(t.rows)?t.rows:null==t?[]:[t]}class u1 extends D.DisplayItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let n=this.getDefaultBindingByField(e,l,{fallbackToTargetTitleField:!0});if(!n)return null;let o=n.modelName,r=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:r,label:l.title,refreshTargets:["DetailsCustomItemModel/DetailsJSFieldItemModel"],toggleable:e=>{var t;return(null==(t=e.getStepParams("fieldSettings","init"))?void 0:t.fieldPath)===r},useModel:"DetailsItemModel",createModelOptions:()=>({use:"DetailsItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:r}}},subModels:{field:{use:o,props:"function"==typeof n.defaultProps?n.defaultProps(e,l):n.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>"view",cache:!1})}renderItem(){let e=this.subModels.field,t=this.context.fieldIndex,l=this.context.record,n=this.context.currentObject,o=this.context.item,r=this.context.getPropertyOptions("item"),i=this.context.prefixFieldPath,a=null!=t?(()=>{let i=e.createFork({},`${t}`);i.context.defineProperty("fieldIndex",{get:()=>t}),i.context.defineProperty("record",{get:()=>l,cache:!1}),i.context.defineProperty("currentObject",{get:()=>n,cache:!1});let{value:a,...s}=r||{};return i.context.defineProperty("item",{...s,get:()=>o,cache:!1}),this.context.pattern&&i.context.defineProperty("pattern",{get:()=>this.context.pattern}),i})():e,s=this.context.pattern?{...this.context.blockModel.props,...this.props,pattern:this.context.pattern,disabled:"readPretty"===this.context.pattern}:{...this.context.blockModel.props,...this.props},d=u0(this.collectionField,uZ({record:l,currentObject:n,fieldPath:this.fieldPath,prefixFieldPath:i,idx:t}));return(0,E.jsx)(D.FormItem,{...s,value:d,children:(0,E.jsx)(D.FieldModelRenderer,{model:a})})}}u1.define({label:(0,D.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search fields"),sort:100}),u1.registerFlow({key:"detailItemSettings",sort:300,title:(0,D.tExpr)("Detail item settings"),steps:{showLabel:{title:(0,D.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,D.tExpr)("Label"),uiSchema:e=>({title:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,o=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+o}}}}),defaultParams:e=>{var t;return{title:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.title,n)})}},aclCheck:{use:"aclCheck"},init:{async handler(e){let{collectionField:t}=e.model;t&&e.model.setProps(t.getComponentProps())}},tooltip:{title:(0,D.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,D.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},model:{title:(0,D.tExpr)("Field component"),use:"displayFieldComponent"},fieldNames:{use:"titleField",title:(0,D.tExpr)("Title field"),beforeParamsSave:async(e,t,l)=>{if(!e.collectionField||!e.collectionField.isAssociationField())return null;if(t.label!==l.label){var n,o;e.model.setProps({titleField:t.label,...null==(o=e.collectionField.targetCollection)||null==(n=o.getField(t.label))?void 0:n.getComponentProps()});let l=e.collectionField.targetCollection.getField(t.label),r=D.DisplayItemModel.getDefaultBindingByField(e,l),i=r.modelName;await uJ({parentModel:e.model,targetUse:i,defaultProps:"function"==typeof(null==r?void 0:r.defaultProps)?r.defaultProps(e,e.collectionField):null==r?void 0:r.defaultProps,pattern:e.model.getProps().pattern})}},async handler(e,t){var l,n;if(!e.collectionField||e.model.subModels.field.disableTitleField)return;e.model.setProps({titleField:t.label,...null==(n=e.collectionField.targetCollection)||null==(l=n.getField(t.label))?void 0:l.getComponentProps()});let o=e.collectionField.targetCollection;if(o){let l=o.getField(t.label),n=D.DisplayItemModel.getDefaultBindingByField(e,l).modelName;n!==e.model.subModels.field.use&&e.model.setStepParams(e.flowKey,"model",{use:n})}},hideInSettings:async e=>!e.collectionField||!e.collectionField.isAssociationField()||e.model.subModels.field.disableTitleField}}}),u1.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var u2=l(71616);function u8(e){if(!e)return!1;let t=null==e?void 0:e.type;return"belongsToMany"===t||"hasMany"===t||"belongsToArray"===t}function u5(e,t){var l;let n=!!(null==e||null==(l=e.isAssociationField)?void 0:l.call(e)),o=u8(e);return n&&!o&&Array.isArray(t)?t.length?t[0]:void 0:t}function u4(e,t){if(!(null==t?void 0:t.length))return e;let[l,n]=String(t[t.length-1]).split(":"),o=Number(n);if(!l||!Number.isFinite(o))return e;let r=0;for(let e of t){let[t]=String(e).split(":");t===l&&(r+=1)}let i=-1,a=0;for(let t=0;t<e.length;t++)if(String(e[t])===l&&(a+=1)===r){i=t;break}if(-1===i){for(let t=e.length-1;t>=0;t--)if(String(e[t])===l){i=t;break}}return -1===i?e:[o,...e.slice(i+1)]}let u3=["o2o","oho","obo","o2m","attachment","expression","point","lineString","circle","polygon","sequence","formula"],u6=2;class u9 extends D.EditableItemModel{static defineChildren(e){let t=e.collection,l=e.prefixFieldPath?e.prefixFieldPath.split(".").filter(Boolean).length:0;return t.getFields().map(n=>{var o;if(l>=u6&&((null==(o=n.isAssociationField)?void 0:o.call(n))||n.target||n.targetCollection))return;let r=this.getDefaultBindingByField(e,n);if(!r)return;let i=r.modelName,a=e.prefixFieldPath?`${e.prefixFieldPath}.${n.name}`:n.name;return{key:a,label:n.title,refreshTargets:["FormJSFieldItemModel","FormItemModel/FormJSFieldItemModel"],toggleable:e=>(0,uX.pX)(e).some(e=>e===a),useModel:"FormItemModel",createModelOptions:()=>({use:"FormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:a}}},subModels:{field:{use:i,props:"function"==typeof r.defaultProps?r.defaultProps(e,n):r.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{if(this.collectionField){let t=this.collectionField.getComponentProps();e.setProps(t),this.setProps({...$().pick(t,"rules")||{}})}})}renderItem(){var e,t;let l=this.subModels.field,n=this.context.fieldIndex,o=this.context.fieldKey,r=(null==(e=this.parent)?void 0:e.context.fieldPathArray)||[],i=!!this.context.flowSettingsEnabled&&!!this.props.hidden&&!this.hidden&&!this.forbidden,a=null!=n||i?(()=>{let e=i?`${this.uid}:config-visible`:`${o}`,t=l.createFork({},e);if(null!=n){t.context.defineProperty("fieldIndex",{get:()=>n}),t.context.defineProperty("fieldKey",{get:()=>o}),this.context.currentObject&&t.context.defineProperty("currentObject",{get:()=>this.context.currentObject});let e=this.context.getPropertyOptions("item");if(this.context.item){let{value:l,...n}=e||{};t.context.defineProperty("item",{...n,get:()=>this.context.item,cache:!1})}this.context.pattern&&t.context.defineProperty("pattern",{get:()=>this.context.pattern})}return t.context.defineProperty("fieldPathArray",{get:()=>this.context.fieldPathArray,cache:!1}),i&&t.setProps({hidden:!1}),t})():l,{initialValue:s,hidden:d,...u}=this.context.pattern?{...this.props,pattern:this.context.pattern}:this.props,c=i?u:{hidden:d,...u},p=u4(this.props.name,n);this.context.defineProperty("fieldPathArray",{get:()=>[...r,...$().castArray(p)],cache:!1});let m=(null==(t=this.context.item)?void 0:t.value)||this.context.record,h=(0,E.jsx)(D.FormItem,{...c,name:p,validateFirst:!0,disabled:this.props.disabled||!$().isEmpty(m)&&!m.__is_new__&&this.props.aclDisabled||!$().isEmpty(m)&&m.__is_new__&&this.props.aclCreateDisabled,children:(0,E.jsx)(D.FieldModelRenderer,{model:a,name:p})});return i?(0,E.jsx)(tP.A,{title:this.context.t("The field is hidden and only visible when the UI Editor is active"),children:(0,E.jsx)("div",{style:{opacity:.3},children:h})}):h}}u9.define({label:(0,D.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search fields"),sort:100}),u9.registerFlow({key:"editItemSettings",sort:300,title:(0,D.tExpr)("Form item settings"),steps:{showLabel:{title:(0,D.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,D.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,o=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+o}}}}),defaultParams:e=>{var t;return{label:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.label,n)})}},aclCheck:{use:"aclCheck",async handler(e,t){var l,n,o,r,i,a,s,d,u,c,p,m,h;if(!e.collectionField||!e.blockModel)return;let f=e.blockModel.context.actionName,g=await e.aclCheck({dataSourceKey:null==(l=e.dataSource)?void 0:l.key,resourceName:null==(n=e.collectionField)?void 0:n.collectionName,fields:[null==(o=e.collectionField)?void 0:o.name],actionName:f});if("update"===f){let t=await e.aclCheck({dataSourceKey:null==(r=e.dataSource)?void 0:r.key,resourceName:null==(i=e.collectionField)?void 0:i.collectionName,fields:[e.collectionField.name],actionName:"view"});e.prefixFieldPath&&e.item&&(await e.aclCheck({dataSourceKey:null==(s=e.dataSource)?void 0:s.key,resourceName:null==(d=e.collectionField)?void 0:d.collectionName,fields:[e.collectionField.name],actionName:"create"})||e.model.setProps({aclCreateDisabled:!0}));let l=(null==(a=e.item)?void 0:a.__is_new__)??!1;t||l||(e.model.hidden=!0,e.model.forbidden={actionName:"view"},e.exitAll()),g||e.model.setProps({aclDisabled:!0})}else if("create"===f){let t=await e.aclCheck({dataSourceKey:null==(u=e.dataSource)?void 0:u.key,resourceName:null==(c=e.collectionField)?void 0:c.collectionName,actionName:"update"}),l=await e.aclCheck({dataSourceKey:null==(p=e.dataSource)?void 0:p.key,resourceName:null==(m=e.collectionField)?void 0:m.collectionName,fields:[e.collectionField.name],actionName:"update"}),n=(null==(h=e.item)?void 0:h.__is_stored__)??!1;g||n||(e.model.hidden=!0,e.model.forbidden={actionName:f},e.exitAll()),t&&l||e.model.setProps({aclDisabled:!0})}}},init:{async handler(e){let t=e.model.fieldPath,l=t.includes(".")?t.split("."):t;e.model.setProps({name:l})}},tooltip:{title:(0,D.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,D.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem","x-component-props":{autoSize:!0}}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},initialValue:{title:(0,D.tExpr)("Default value"),disabledInSettings:!0,disabledReasonInSettings:e=>`${e.t("This setting has been moved to")}: ${e.t("Form block settings")} > ${e.t("Field values")}`,uiSchema:e=>{var t,l,n,o;if(e.model.parent.parent instanceof u2.EditFormModel||(null==(l=e.model.subModels)||null==(t=l.field)?void 0:t.updateAssociation))return;let r=null==(n=e.model.collectionField)?void 0:n.interface;if(null==u3||null==(o=u3.includes)||!o.call(u3,r))return{defaultValue:{"x-component":"DefaultValue","x-decorator":"FormItem"}}},defaultParams:e=>{let t=e.model.collectionField;if("nanoid"===t.interface&&!1!==t.options.autoFill){let{size:e,customAlphabet:l}=t.options||{size:21};return{defaultValue:(0,uH.d_)(l,e)()}}return{defaultValue:t.defaultValue}},handler(e,t){var l,n;let o=null==(l=e.model.collectionField)?void 0:l.interface;if(null==u3||null==(n=u3.includes)?void 0:n.call(u3,o))return;let r=u5(e.model.collectionField,t.defaultValue);e.model.setProps({initialValue:r})}},validation:{title:(0,D.tExpr)("Validation"),use:"validation"},required:{title:(0,D.tExpr)("Required"),use:"required"},model:{use:"fieldComponent",title:(0,D.tExpr)("Field component")},pattern:{use:"pattern"},titleField:{use:"titleField",hideInSettings:e=>!(e.collectionField&&e.collectionField.isAssociationField()&&e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern),defaultParams:e=>{var t,l,n;return{titleField:e.model.props.titleField||(null==(n=e.model)||null==(l=n.context)||null==(t=l.collectionField)?void 0:t.targetCollectionTitleFieldName)}},beforeParamsSave:async(e,t,l)=>{if(!(e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern))return null;let n=t.titleField||t.label;if(n!==l.titleField){let t=e.collectionField.targetCollection,l=t.getField(n),o=u1.getDefaultBindingByField(e,l);if(o.modelName!==e.model.subModels.field.use){let l=e.model.subModels.field.uid;await e.engine.destroyModel(l);let r=e.model.setSubModel("field",{use:o.modelName,stepParams:{fieldSettings:{init:{dataSourceKey:e.model.collectionField.dataSourceKey,collectionName:t.name,fieldPath:n}}}});await r.save()}e.model.setProps(e.collectionField.targetCollection.getField(n).getComponentProps())}},async handler(e,t){"readPretty"===e.model.props.pattern?e.model.setProps({titleField:null==t?void 0:t.label}):e.model.setProps({titleField:t.titleField})}}}}),u9.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var u7=l(85352),ce=l(90199),ct=l(97510);function cl(e,t){var l,n,o;let r=null==e||null==(l=e.props)?void 0:l.fieldNames,i=null==e||null==(n=e.props)?void 0:n.titleField,a=null==e||null==(o=e.getStepParams)?void 0:o.call(e,"selectSettings","fieldNames");return{stepParams:{fieldSettings:{init:t},...a?{selectSettings:{fieldNames:a}}:{}},props:{...void 0!==r?{fieldNames:r}:{},...void 0!==i?{titleField:i}:{}}}}function cn(e){try{return JSON.stringify(e)??""}catch{return String(e)}}function co(e){var t,l,n;let o=null==e||null==(t=e.props)?void 0:t.fieldNames,r=null==e||null==(l=e.props)?void 0:l.titleField,i=null==e||null==(n=e.getStepParams)?void 0:n.call(e,"selectSettings","fieldNames");return[(null==e?void 0:e.uid)||"",cn(o),cn(r),cn(i)].join("|")}function cr(e){if(!e||"object"!=typeof e||!("target"in e))return e;let t=e.target;return t&&"value"in t?t.value:e}class ci extends u9{onInit(e){var t,l,n,o,r,i,a;let s=null==(t=this.getStepParams("fieldSettings","assignValue"))?void 0:t.value;void 0!==s&&(this.assignValue=s),this.context.defineProperty("collectionField",{get:()=>{var e,t;let l=this.getStepParams("fieldSettings","init")||{},n=`${null==l?void 0:l.dataSourceKey}.${null==l?void 0:l.collectionName}.${null==l?void 0:l.fieldPath}`,o=null==(e=this.context)?void 0:e.dataSourceManager;return null==o||null==(t=o.getCollectionField)?void 0:t.call(o,n)}});let d=this.context,u=null==d?void 0:d.collection,c=this.fieldInit;if(!(null==(l=this.subModels)?void 0:l.field)&&(null==u?void 0:u.getFields)){let e=(u.getFields()||[]).find(e=>(null==e?void 0:e.name)===(null==c?void 0:c.fieldPath));null==u||null==(o=u.getField)||o.call(u,null==c?void 0:c.fieldPath);let t=D.EditableItemModel.getDefaultBindingByField(d,e);if(!t)return;let l=t.modelName;null==d||null==(i=d.engine)||null==(r=i.createModel)||r.call(i,{use:l,stepParams:{fieldSettings:{init:c}},parentId:this.uid,subKey:"field"})}let p=null==(n=this.context)?void 0:n.collection,m=this.fieldPath;if(m){let e=null==p||null==(a=p.getField)?void 0:a.call(p,m),t=(null==e?void 0:e.title)||m,l=m.includes(".")?m.split("."):[m];this.setProps({label:t,name:l})}}get fieldInit(){return this.getStepParams("fieldSettings","init")||{}}get fieldPath(){var e;return null==(e=this.fieldInit)?void 0:e.fieldPath}getAssignedEntry(){let e=this.fieldPath;return e?[e,this.assignValue]:null}render(){var e,t;let l=this.context,n=l.collection,o=this.fieldInit,r=(null==(e=this.props)?void 0:e.name)||(this.fieldPath?[this.fieldPath]:void 0),i=this.fieldPath,a=null==(t=this.subModels)?void 0:t.field,s=co(a),d=()=>{var e,t,s,d,u;let[c,p]=O.useState(null);O.useEffect(()=>{var e,t,r,s,d,u,c,m,h,f,g,v,y,x,b,w,S,C,F,k,A;if(!i)return;let P=((null==n||null==(e=n.getFields)?void 0:e.call(n))||[]).find(e=>(null==e?void 0:e.name)===i);n.getField(i);let j=D.EditableItemModel.getDefaultBindingByField(l,P);if(!j)return;let M=j.modelName,I=cl(a,o),T=null==l||null==(r=l.engine)||null==(t=r.createModel)?void 0:t.call(r,{use:"VariableFieldFormModel",subModels:{fields:[{use:M,...I}]}});if(!T)return;null==(d=T.context)||null==(s=d.defineProperty)||s.call(d,"collection",{value:n});let R=null==l?void 0:l.dataSource;R&&(null==(c=T.context)||null==(u=c.defineProperty)||u.call(c,"dataSource",{value:R}));let E=null==n||null==(m=n.getField)?void 0:m.call(n,null==o?void 0:o.fieldPath);E&&(null==(f=T.context)||null==(h=f.defineProperty)||h.call(f,"collectionField",{value:E}));let N=null==l?void 0:l.blockModel;N&&(null==(v=T.context)||null==(g=v.defineProperty)||g.call(v,"blockModel",{value:N}));let B=l.form;B&&(null==(k=T.context)||null==(F=k.defineProperty)||F.call(k,"form",{value:B})),T.context&&Object.defineProperty(T.context,"resource",{configurable:!0,enumerable:!0,get:()=>null==N?void 0:N.resource});let $=null==T||null==(x=T.subModels)||null==(y=x.fields)?void 0:y[0],O=null==n||null==(b=n.getField)?void 0:b.call(n,null==o?void 0:o.fieldPath),q=null==O?void 0:O.type,L=null==O?void 0:O.interface,_="belongsToMany"===q||"hasMany"===q||"belongsToArray"===q||"m2m"===L||"o2m"===L||"mbm"===L;if(null==$||null==(w=$.setProps)||w.call($,{disabled:!1,readPretty:!1,updateAssociation:!1,multiple:_}),null==$||null==(S=$.dispatchEvent)||S.call($,"beforeRender",void 0,{sequential:!0,useCache:!0}),(0,u7.NI)($,O),!(null==$||null==(C=$.props)?void 0:C.fieldNames)&&(null==O?void 0:O.targetCollection)){let e=O.targetCollection,t=(null==O?void 0:O.targetKey)||(null==e?void 0:e.filterTargetKey)||"id";null==$||null==(A=$.setProps)||A.call($,{fieldNames:{label:null==e?void 0:e.titleField,value:t}})}return p(T),()=>{var e,t,l,n;null==T||null==(l=T.subModels)||null==(t=l.fields)||null==(e=t.forEach)||e.call(t,e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),null==T||null==(n=T.remove)||n.call(T)}},[]);let m=e=>(O.useEffect(()=>{var t,l,n;if(!c)return;null==(t=c.setProps)||t.call(c,{...e});let o=null==c||null==(n=c.subModels)||null==(l=n.fields)?void 0:l[0];if(o){var r,i=this;null==(r=o.setProps)||r.call(o,{value:null==e?void 0:e.value,onChange:function(){for(var t,l,n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];let s=cr(r&&r.length?r[0]:void 0);null==(t=o.setProps)||t.call(o,{value:s}),i.assignValue=s,null==e||null==(l=e.onChange)||l.call(e,s)}})}},[e]),c?(0,E.jsx)("div",{style:{width:"100%"},children:(0,E.jsx)(D.FlowModelRenderer,{model:c,showFlowSettings:!1})}):null),h=()=>{var e,t;return(0,E.jsx)(ds.A,{placeholder:`<${(null==(e=(t=this.context).t)?void 0:e.call(t,"Null"))??"Null"}>`,readOnly:!0,style:{width:"100%"}})},f=e=>(0,E.jsx)(ce.h,{t:this.context.t,value:null==e?void 0:e.value,onChange:null==e?void 0:e.onChange,containerStyle:{width:"100%"}}),g=async()=>{var e;let t=null==(e=this.context)?void 0:e.getPropertyMetaTree;return"function"==typeof t?await t():[]},v=null==n||null==(e=n.getField)?void 0:e.call(n,this.fieldPath),y=(0,ct.kB)(v),x=(0,ct.Ot)(v,null==(t=this.fieldPath)?void 0:t.split(".").slice(-1)[0]),b=x?(0,ct.cd)(v,y):ct.tS,w=(null==(s=this.props)?void 0:s.label)??this.fieldPath??"",S=null==n||null==(d=n.getField)?void 0:d.call(n,this.fieldPath);return w=(null==(u=this.props)?void 0:u.label)??(null==S?void 0:S.title)??w,(0,E.jsx)(D.FormItem,{...this.props,label:w,name:r,initialValue:this.assignValue,valuePropName:"__assign_value__",trigger:"__assign_trigger__",validateTrigger:"__assign_trigger__",children:O.createElement(e=>{let t=null==e?void 0:e.__assign_value__,l=void 0===t?this.assignValue:t;return(0,E.jsx)(ct.Wm,{value:l,onChange:t=>{var l;this.assignValue=t,null==e||null==(l=e.__assign_trigger__)||l.call(e,t)},baseMetaTree:g,constantComponent:m,nullComponent:h,runJSComponent:f,isDateLikeField:x,dateComponentProps:b,clearValue:""})})})};return(0,E.jsx)(d,{},s)}constructor(e){super(e),this.assignValue=void 0,(0,N.define)(this,{assignValue:N.observable})}}ci.define({label:(0,D.tExpr)("Assign field")}),ci.registerFlow({key:"editItemSettings",sort:300,title:(0,D.tExpr)("Form item settings"),steps:{showLabel:{title:(0,D.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,D.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,o=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+o}}}}),defaultParams:e=>({label:e.model.collectionField.title}),handler(e,t){var l;t.label&&t.label===(null==(l=e.model.collectionField)?void 0:l.title)?e.model.setProps({label:t.label}):e.model.setProps({label:e.t(t.label,{ns:"lm-flow-engine"})})}},init:{async handler(e){let t=e.model.collectionField;t&&e.model.setProps(t.getComponentProps());let l=e.model.fieldPath,n=l.includes(".")?l.split("."):l;e.model.setProps({name:n})}},tooltip:{title:(0,D.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,D.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},validation:{title:(0,D.tExpr)("Validation"),use:"validation"},required:{title:(0,D.tExpr)("Required"),use:"required"}}});class ca extends sK{}ca.itemModelName="DetailsItemModel",ca.define({label:'{{t("Display association fields")}}'});var cs=l(58929);let cd=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,o=parseFloat(l.marginBottom)||0;return t.height+n+o},cu=e=>{let{heightMode:t,containerRef:l,actionsRef:n,paginationRef:o,deps:r=[]}=e,[i,a]=(0,O.useState)(),s=(0,O.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let r=e.getBoundingClientRect().height;if(!r)return;let i=Math.max(0,Math.floor(r-cd(n.current)-cd(o.current)));a(e=>e===i?e:i)},[t,l,n,o]);return(0,O.useLayoutEffect)(()=>{s()},[s,...r]),(0,O.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=n.current,r=o.current,i=new ResizeObserver(()=>s());return i.observe(e),t&&i.observe(t),r&&i.observe(r),()=>i.disconnect()},[s,l,n,o,...r]),i};class cc extends dF.t{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(D.SingleRecordResource);return e.isNewRecord=!1,e}let o=this.context.createResource(D.MultiRecordResource);return o.setPageSize(1),o}onInit(e){var t,l;super.onInit(e),this.hadSingleRecordData=(null==(l=this.resource)||null==(t=l.hasData)?void 0:t.call(l))??!1,this.hasMultiRefreshDispatched=!1;let n=(0,D.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1,resolveOnServer:(0,D.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>this.getCurrentRecord()),meta:n}),this.resource.on("refresh",()=>{var e,t;if(this.isMultiRecordResource()){this.hasMultiRefreshDispatched=!0,(0,uC.Xi)(this,"paginationChange");return}let l=this.hadSingleRecordData;this.hadSingleRecordData=(null==(t=this.resource)||null==(e=t.hasData)?void 0:e.call(t))??!1,l&&(0,uC.Xi)(this,"paginationChange")})}isMultiRecordResource(){return this.resource instanceof D.MultiRecordResource}hasDispatchedMultiRefresh(){return this.hasMultiRefreshDispatched}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}async refresh(){await this.resource.refresh()}renderPagination(){if(!this.resource.loading&&!this.hasAvailableData()){var e,t;return(0,E.jsx)("div",{style:{textAlign:"center",color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")})}let l=this.resource;return!this.isMultiRecordResource()||!l.getPage()||1>=this.resource.getMeta("count")?null:(0,E.jsx)("div",{style:{textAlign:"center"},children:(0,E.jsx)(cs.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:l.getPage(),total:l.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})})}renderConfigureActions(){return(0,E.jsx)(D.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("RecordActionGroupModel"),afterSubModelInit:async e=>{e.setStepParams("buttonSettings","general",{type:"default"})},children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Actions")})},"details-actions-add")}renderComponent(){let{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:o}=this.props,r=!!this.context.flowSettingsEnabled,i=!r&&!this.hasAvailableData(),{heightMode:a,height:s}=this.decoratorProps;return(0,E.jsx)(cp,{model:this,gridModel:this.subModels.grid,isConfigMode:r,heightMode:a,height:s,layoutProps:{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:o},actions:(0,E.jsx)(D.DndProvider,{children:(0,E.jsx)("div",{style:i?{pointerEvents:"none",opacity:.45}:void 0,children:(0,E.jsxs)(de.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||r)return(0,E.jsx)(D.Droppable,{model:e,children:(0,E.jsx)(D.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:D.DragHandler,sort:1}]})},e.uid)}),this.renderConfigureActions()]})})})})}constructor(...e){super(...e),this.hadSingleRecordData=!1,this.hasMultiRefreshDispatched=!1,this._defaultCustomModelClasses={RecordActionGroupModel:"RecordActionGroupModel",DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"},this.customModelClasses={},this.handlePageChange=async e=>{if(this.resource instanceof D.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await this.refresh()}}}}cc.scene=dS.P.oam;let cp=e=>{let{model:t,gridModel:l,isConfigMode:n,heightMode:o,height:r,layoutProps:i,actions:a}=e,s=(0,O.useRef)(null),d=(0,O.useRef)(null),u=(0,O.useRef)(null),c="specifyValue"===o||"fullHeight"===o,p=cu({heightMode:o,containerRef:s,actionsRef:d,paginationRef:u,deps:[r]});(0,O.useEffect)(()=>{var e,t;if(!l)return;let n=c?p:void 0;((null==(e=l.props)?void 0:e.height)!==n||(null==(t=l.props)?void 0:t.heightMode)!==o)&&l.setProps({height:n,heightMode:o})},[l,p,c,o]);let m=c?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,h=c?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,E.jsx)(uV.s2,{model:t,layoutProps:i,style:m,children:(0,E.jsxs)("div",{ref:s,style:h,children:[(0,E.jsx)("div",{ref:d,style:{textAlign:"right",lineHeight:"0px",paddingBottom:n&&t.context.themeToken.padding},children:a}),(0,E.jsx)(D.FlowModelRenderer,{model:l,showFlowSettings:!1},`${(null==l?void 0:l.uid)||"details-grid"}:${n?"design":"runtime"}`),(0,E.jsx)("div",{ref:u,children:t.renderPagination()})]})})};cc.registerFlow({key:"detailsSettings",title:(0,D.tExpr)("Details settings"),sort:150,steps:{refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");await e.model.applySubModelsBeforeRenderFlows("grid")}},layout:{use:"layout",title:(0,D.tExpr)("Layout")},dataScope:{use:"dataScope"},defaultSorting:{use:"sortingRule",title:(0,D.tExpr)("Default sorting")},linkageRules:{use:"detailsFieldLinkageRules"}}}),cc.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldslinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"detailsFieldLinkageRules",flowKey:"detailsSettings",stepKey:"linkageRules"}}}}),cc.registerFlow({key:"initialPaginationChangeRefresh",sort:10001,steps:{refreshPaginationRelatedStates:{async handler(e){if(e.model.hidden||!e.model.isMultiRecordResource()||e.model.hasDispatchedMultiRefresh())return;let t=e.model.resource;if(!t)return;let l="manual"===(t.dataLoadingMode??t.loadingMode),n="function"==typeof t.hasActiveFilters&&t.hasActiveFilters();l&&!n&&await (0,uC.Xi)(e.model,"paginationChange")}}}}),cc.define({label:(0,D.tExpr)("Details"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search"),createModelOptions:{use:"DetailsBlockModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});class cm extends D.FlowModel{static defineChildren(e){let t=e.engine.filterModelClassByParent("CommonItemModel"),l=e.engine.filterModelClassByParent("DetailsCustomItemModel"),n=t=>Array.from(t.entries()).map(t=>{var l,n,o,r,i;let[a,s]=t,d="function"==typeof s.defineChildren||!!(null==(l=s.meta)?void 0:l.children),u={key:a,label:e.t(s.meta.label),sort:s.meta.sort??999,searchable:!!(null==(n=s.meta)?void 0:n.searchable),searchPlaceholder:null==(o=s.meta)?void 0:o.searchPlaceholder,hide:null==(r=s.meta)?void 0:r.hide};return d?u.children=e=>{var t;return"function"==typeof s.defineChildren?s.defineChildren(e):(null==(t=s.meta)?void 0:t.children)||[]}:u.createModelOptions=(null==(i=s.meta)?void 0:i.createModelOptions)||{use:a},u});return $().sortBy([...n(t),...n(l)],"sort")}}cm.renderMode=D.ModelRenderMode.RenderFunction,cm.define({hide:!0,label:(0,D.tExpr)("Others")});class ch extends df{renderAddSubModelButton(){return this.context.flowSettingsEnabled?(0,E.jsx)(D.AddSubModelButton,{model:this,subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("DetailsItemModel"),this.context.getModelClassName("DetailsAssociationFieldGroupModel"),this.context.getModelClassName("DetailsCustomItemModel")].filter(Boolean),keepDropdownOpen:!0,children:(0,E.jsx)(D.FlowSettingsButton,{icon:(0,E.jsx)(nC.A,{}),children:this.translate("Fields")})}):null}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightMode,o=this.context.themeToken,r=super.render();return"defaultHeight"===n?r:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${o.marginLG}px`,marginRight:`-${o.marginLG}px`,paddingLeft:`${o.marginLG}px`,paddingRight:`${o.marginLG}px`},children:r})}constructor(...e){super(...e),this.itemFallback=(0,E.jsx)(o5.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}function cf(e,t){let{fieldUseModel:l,refreshTargets:n}=t,o=e=>Array.isArray(e)?e.map(e=>{let t={...e};if(t.children)if("function"==typeof t.children){let e=t.children;t.children=async t=>o(await e(t))}else Array.isArray(t.children)&&(t.children=o(t.children));if(t.createModelOptions){let e=t.createModelOptions;t.createModelOptions=async(t,n)=>{let o=await ("function"==typeof e?e(t,n):e);return o.subModels=o.subModels||{},o.subModels.field={...o.subModels.field||{},use:l},o},t.refreshTargets=t.refreshTargets||n}return t}):[];return o(e)}function cg(e,t,l){let{fieldUseModel:n,refreshTargets:o}=l,r=l.key??"js-association-fields",i=l.label??(0,D.tExpr)("Display association fields");return{key:r,type:"group",label:i,searchable:l.searchable??!0,searchPlaceholder:l.searchPlaceholder??(0,D.tExpr)("Search fields"),children:async e=>cf(await t(e),{fieldUseModel:n,refreshTargets:o})}}ch.registerFlow({key:"detailFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class cv extends sK{}async function cy(e,t){var l;let{useModel:n,fieldUseModel:o,refreshTargets:r,associationPathName:i,associationProvider:a}=t,s=(0,D.buildWrapperFieldChildren)(e,{useModel:n,fieldUseModel:o,associationPathName:i,refreshTargets:r}),d=[],u=null==s||null==(l=s[0])?void 0:l.children;if(Array.isArray(u)&&(d=u),!a)return d;let c=await a(e);return Array.isArray(c)&&0!==c.length?[...d,cg(e,a,{fieldUseModel:o,refreshTargets:r})]:d}cv.itemModelName="FormItemModel";class cx extends cm{static defineChildren(e){return cy(e,{useModel:"DetailsItemModel",fieldUseModel:"JSFieldModel",refreshTargets:["DetailsItemModel"],associationProvider:e=>ca.defineChildren(e)})}}cx.define({label:(0,D.tExpr)("JS field"),searchable:!0,searchPlaceholder:(0,D.tExpr)("Search fields"),sort:110});class cb extends aT.o{}var cw=l(85196);class cS extends aT.o{constructor(...e){super(...e),this.operator="$eq",this.updateAssociation=!1}}cS.registerFlow({key:"AssociationFieldInit",sort:800,steps:{init:{async handler(e,t){if(e.model.updateAssociation){var l,n;let t=e.model.context.blockModel,o=null==t||null==(l=t.context)?void 0:l.resource,r=null==(n=e.model.parent)?void 0:n.fieldPath;o&&r&&o.addUpdateAssociationValues(r)}}},allowCreateCheck:{async handler(e){var t;let l=await e.aclCheck({dataSourceKey:e.collectionField.dataSourceKey,resourceName:null==(t=e.collectionField)?void 0:t.target,actionName:"create"});e.model.setProps({allowCreate:!!l})}}}});let cC=(e,t)=>e===t,cF=e=>{if(e&&"object"==typeof e){let t=e.data;return t&&"object"==typeof t?t:e}};function ck(e){return"string"==typeof e&&e?e:Array.isArray(e)&&1===e.length&&"string"==typeof e[0]?e[0]:void 0}function cA(e,t){var l;let n="string"==typeof(null==t||null==(l=t.titleCollectionField)?void 0:l.name)?t.titleCollectionField.name:void 0,o=ck(null==t?void 0:t.filterTargetKey)||"id",r="string"==typeof(null==e?void 0:e.value)&&e.value&&!cC(e.value,"value")?e.value:void 0,i="string"==typeof(null==e?void 0:e.label)&&e.label&&!cC(e.label,"label")?e.label:void 0,a=r||o;return{label:i||n||a,value:a}}function cP(e){var t,l,n,o,r,i;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!!a.navigation,d=e=>{if(Array.isArray(e))return e.filter(e=>"string"==typeof e&&!!e)},u=d(null==(l=e.view)||null==(t=l.inputArgs)?void 0:t.openerUids),c=d(a.openerUids),p=u||c||[];if(s)return(c||p).filter(Boolean);let m=null==(o=e.view)||null==(n=o.inputArgs)?void 0:n.viewUid,h=null==(i=e.model.context)||null==(r=i.inputArgs)?void 0:r.viewUid;return[...p,"string"==typeof m&&m?m:"string"==typeof h&&h?h:e.model.uid].filter(Boolean)}function cj(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.map(e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}).filter(e=>void 0!==e);return t.length?t.map(String).join(", "):void 0}if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}function cM(e){var t,l,n;let{option:o,fieldNames:r}=e,i=(0,D.useFlowModel)(),a=cF(o),s=cA(r,null==(t=i.context.collectionField)?void 0:t.targetCollection),d=i.subModels.field,u=cj(null==a?void 0:a[s.label])??cj(null==a?void 0:a.label)??cj(null==a?void 0:a[s.value]);if(!d)return(0,E.jsx)("span",{children:u??"N/A"});let c=String((null==a?void 0:a[s.value])??u??"association-option"),p=d.createFork({},c);p.context.defineProperty("record",{get:()=>a,cache:!1,meta:(0,D.createCurrentRecordMetaFactory)(p.context,()=>p.context.collection)});let m=null==(n=i.context.collectionField.targetCollection)||null==(l=n.getField)?void 0:l.call(n,s.label),h=m&&"function"==typeof m.getComponentProps?m.getComponentProps():{};p.setProps({value:u,clickToOpen:!1,...h});let f=null!=u&&""!==u?p.render():"N/A";return(0,E.jsx)("span",{style:{pointerEvents:"none"},children:f})}function cI(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"record",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];if(!e)return l?[]:void 0;let{value:r}=t||{},i=e=>"object"==typeof e&&null!==e,a=e=>{if(i(e))return{label:(0,E.jsx)(cM,{option:e,fieldNames:t}),value:e[r]}};if("value"===n){let t=e=>{if("object"==typeof e&&null!==e)return a(e);let t=o.find(t=>(null==t?void 0:t[r])===e);return t?a(t):{label:String(e),value:e}};return l?Array.isArray(e)?e.map(e=>t(e)).filter(Boolean):[]:Array.isArray(e)?t(e[0]):t(e)}if(l)return Array.isArray(e)?e.filter(i).map(a).filter(Boolean):[];if(Array.isArray(e)){let t=e[0];return i(t)?a(t):void 0}return i(e)?a(e):void 0}function cT(e,t,l){return(null==e?void 0:e.length)?e.map(e=>(0,B.omit)(e,"disabled","options","style")):l?Array.isArray(t)?t.filter(e=>"object"==typeof e&&null!==e):[]:t&&"object"==typeof t?[t]:[]}var cR=l(33022);let cE="calc(12px + env(safe-area-inset-bottom, 0px))",cN={paddingBottom:cE};function cD(e){return{maxHeight:"60vh",overflowY:"auto",paddingBottom:e?void 0:cE}}let cB=(0,k.css)`
|
|
482
482
|
div {
|
|
483
483
|
white-space: nowrap !important;
|
|
484
484
|
overflow: hidden;
|
|
@@ -1024,7 +1024,7 @@ ctx.render(<JsItem />);
|
|
|
1024
1024
|
display: flex;
|
|
1025
1025
|
margin: 5px 0px;
|
|
1026
1026
|
}
|
|
1027
|
-
`,defaultValue:"h:mm a",formats:["hh:mm:ss a","HH:mm:ss"],timeFormat:!0},default:"HH:mm:ss",enum:[{label:(0,CJ.b)({format:"hh:mm:ss a"}),value:"hh:mm:ss a"},{label:(0,CJ.b)({format:"HH:mm:ss"}),value:"HH:mm:ss"},{label:"custom",value:"custom"}]}},C3={type:"array",title:'{{t("Options")}}',"x-decorator":"FormItem","x-component":"ArrayTable","x-component-props":{pagination:{pageSize:1e3}},items:{type:"object",properties:{column1:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:50,title:"",align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},column2:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:'{{t("Option value")}}'},properties:{value:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},column3:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:'{{t("Option label")}}'},properties:{label:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},column4:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:'{{t("Color")}}'},properties:{color:{type:"string","x-decorator":"FormItem","x-component":"ColorSelect"}}},column5:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:"",dataIndex:"operations",fixed:"right"},properties:{item:{type:"void","x-component":"FormItem",properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}}}},properties:{add:{type:"void","x-component":"ArrayTable.Addition","x-component-props":{randomValue:!0},title:"{{t('Add option')}}"}}},C6={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input","x-validator":"uid",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"}},C9={type:"string",title:'{{t("Options")}}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!0},enum:"{{collections}}"};class C7{addComponentOption(e){if(!this.componentOptions){var t,l,n,o,r,i;this.componentOptions=[];let e=null==(l=this.default)||null==(t=l.uiSchema)?void 0:t["x-component"],a=null==(o=this.default)||null==(n=o.uiSchema)?void 0:n["x-component-props"];if(e){let t=(null==(i=this.default)||null==(r=i.uiSchema)?void 0:r.type)||"string",l=(0,er.tval)(e.startsWith("Input")?(0,B.capitalize)(t):e.split(".").pop());this.componentOptions=[{label:l,value:e,useProps:()=>a||{}}]}}this.componentOptions.push(e)}getConfigureFormProperties(e){var t,l,n,o;let r=(null==(l=this.configure)||null==(t=l.getConfigureFormProperties)?void 0:t.call(l,e))||(null==(n=this.configure)?void 0:n.properties)||{},i=this.hasDefaultValue?this.getDefaultValueProperty():{},a=null==e?void 0:e.view,s=(null==e?void 0:e.template)==="sql"||(null==e?void 0:e.sql),d=[...new Set([...this.availableValidationOptions,"required"])],u=a||s||!this.validationType?{}:{validation:{title:'{{ t("Validation") }}',required:!1,"x-decorator":"FormItem","x-component":"FieldValidation","x-component-props":{type:this.validationType,availableValidationOptions:d,excludeValidationOptions:[...new Set(this.excludeValidationOptions)],isAssociation:this.isAssociation}}};return{...(0,B.cloneDeep)({...C6,...null==(o=this)?void 0:o.properties,...r}),...i,...u}}getDefaultValueProperty(){var e,t,l,n;return{defaultValue:{...(0,B.cloneDeep)(null==(t=this)||null==(e=t.default)?void 0:e.uiSchema),...null==(n=this)||null==(l=n.properties)?void 0:l.uiSchema,required:!1,title:'{{ t("Default value") }}',"x-decorator":"FormItem"}}}addOperator(e){this.filterable||(0,B.set)(this,"filterable",{});let t=Array.isArray(this.filterable.operatorOverrides)?[...this.filterable.operatorOverrides]:[],l=t.findIndex(t=>t.value===e.value);-1!==l?t[l]=e:t.push(e),(0,B.set)(this,"filterable.operatorOverrides",t),ix(this.filterable)}constructor(e){this.collectionFieldInterfaceManager=e,this.availableValidationOptions=[]}}class Fe extends C7{constructor(...e){super(...e),this.name="checkbox",this.type="object",this.group="choices",this.order=1,this.title='{{t("Checkbox")}}',this.default={type:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},this.availableTypes=["boolean","integer","bigInt","bit"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"boolean"}}}class Ft extends C7{constructor(...e){super(...e),this.name="checkboxGroup",this.type="object",this.group="choices",this.order=5,this.title='{{t("Checkbox group")}}',this.default={interface:"checkboxGroup",type:"array",defaultValue:[],uiSchema:{type:"string","x-component":"Checkbox.Group"}},this.availableTypes=["array","json"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"array"}}}class Fl extends C7{constructor(...e){super(...e),this.name="collection",this.type="string",this.group="advanced",this.order=5,this.title='{{t("Collection selector")}}',this.description='{{t("Providing certain collections as options for users, typically used in polymorphic or inheritance scenarios")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"CollectionSelect"}},this.availableTypes=["string"],this.hasDefaultValue=!1,this.properties={...C6,"uiSchema.enum":C9},this.filterable={operators:"collection"}}}class Fn extends C7{constructor(...e){super(...e),this.name="color",this.type="object",this.group="basic",this.order=10,this.title='{{t("Color")}}',this.default={type:"string",uiSchema:{type:"string","x-component":"ColorPicker"}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"string"}}}class Fo extends C7{constructor(...e){super(...e),this.name="createdAt",this.type="object",this.group="systemInfo",this.order=1,this.title='{{t("Created at")}}',this.sortable=!0,this.default={type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},this.description='{{t("Store the creation time of each record")}}',this.availableTypes=[],this.properties={...C6,...C5},this.filterable={operators:"datetime"},this.titleUsable=!0}}class Fr extends C7{constructor(...e){super(...e),this.name="createdBy",this.type="object",this.group="systemInfo",this.order=3,this.title='{{t("Created by")}}',this.isAssociation=!0,this.default={type:"belongsTo",target:"users",foreignKey:"createdById",uiSchema:{type:"object",title:'{{t("Created by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}},this.availableTypes=["belongsTo"],this.properties={...C6},this.filterable={nested:!0,children:[]},this.description='{{t("Store the creation user of each record")}}'}}class Fi extends C7{constructor(...e){super(...e),this.name="datetime",this.type="object",this.group="datetime",this.order=1,this.title='{{t("Datetime (with time zone)")}}',this.sortable=!0,this.default={type:"date",defaultToCurrentTime:!1,onUpdateToCurrentTime:!1,timezone:!0,uiSchema:{type:"string","x-component":"DatePicker","x-component-props":{showTime:!1,utc:!0}}},this.availableTypes=["date","string","datetime","datetimeTz"],this.hasDefaultValue=!0,this.validationType="date",this.properties={...C6,...C5,defaultToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Default value to current time")}}'},onUpdateToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Automatically update timestamp on update")}}'},"uiSchema.x-component-props.gmt":{type:"boolean",title:'{{t("GMT")}}',"x-hidden":!0,"x-component":"Checkbox","x-content":'{{t("Use the same time zone (GMT) for all users")}}',"x-decorator":"FormItem",default:!1}},this.filterable={operators:"datetime"},this.titleUsable=!0}}class Fa extends C7{constructor(...e){super(...e),this.name="email",this.type="object",this.group="basic",this.order=4,this.title='{{t("Email")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Input","x-validator":"email"}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.validationType="string",this.availableValidationOptions=["min","max","length","email","pattern"],this.properties={...C6,unique:CX},this.filterable={operators:"string"},this.titleUsable=!0}}class Fs extends C7{constructor(...e){super(...e),this.name="icon",this.type="object",this.group="basic",this.order=10,this.title='{{t("Icon")}}',this.default={type:"string",uiSchema:{type:"string","x-component":"IconPicker"}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.properties={...C6}}}class Fd extends C7{constructor(...e){super(...e),this.name="id",this.type="object",this.group="systemInfo",this.order=0,this.title='{{t("ID")}}',this.hidden=!0,this.sortable=!0,this.default={name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0}},this.availableTypes=["bigInt","integer"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,default:"ID","x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"}},this.filterable={operators:"id"},this.description='{{t("Primary key, unique identifier, self growth") }}',this.titleUsable=!0}}let Fu=e=>e,Fc=e=>{if((0,rk.isArr)(e)){for(let t=0;t<e.length;t++)if((0,rk.isValid)(e[t]))return!1;return!0}if(null==e?void 0:e.getCurrentContent){var t;return!(null==(t=e.getCurrentContent())?void 0:t.hasText())}return(0,rk.isEmpty)(e)};(0,CM.registerValidateRules)({username:e=>/^[^@<>"'/]{1,50}$/.test(e)||Fu("Must be 1-50 characters in length (excluding @<>\"'/)"),required:(e,t)=>!1===t.required?"":("string"==typeof e&&(e=e.trim()),Fc(e)?t.message:"")});class Fp extends C7{constructor(...e){super(...e),this.name="input",this.type="object",this.group="basic",this.order=1,this.title='{{t("Single line text")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier")}}',this.sortable=!0,this.default={interface:"input",type:"string",uiSchema:{type:"string","x-component":"Input"}},this.availableTypes=["string","uid"],this.hasDefaultValue=!0,this.validationType="string",this.availableValidationOptions=["min","max","length","pattern"],this.properties={...C6,trim:{type:"boolean","x-content":'{{t("Automatically remove heading and tailing spaces")}}',"x-decorator":"FormItem","x-component":"Checkbox"},layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"string"},this.titleUsable=!0}}(0,rF.registerValidateFormats)({odd:/^-?\d*[13579]$/,even:/^-?\d*[02468]$/});class Fm extends C7{constructor(...e){super(...e),this.name="integer",this.type="object",this.group="basic",this.order=6,this.title='{{t("Integer")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier, self growth")}}',this.sortable=!0,this.default={type:"bigInt",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"},"x-validator":"integer"}},this.availableTypes=["bigInt","integer","sort","snowflakeId"],this.hasDefaultValue=!0,this.validationType="number",this.excludeValidationOptions=["precision"],this.properties={...C6,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}},autoIncrement:CZ},this.filterable={operators:"number"},this.titleUsable=!0}}(0,rF.registerValidateRules)({json(e){try{return JSON.parse(e),!0}catch(e){return{type:"error",message:e.message}}}});class Fh extends C7{constructor(...e){super(...e),this.name="json",this.type="object",this.group="advanced",this.order=4,this.title='{{t("JSON")}}',this.sortable=!1,this.default={type:"json",uiSchema:{type:"object","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5}},default:null}},this.availableTypes=["json","array","set","jsonb","text","circle","lineString","point","polygon"],this.hasDefaultValue=!0,this.properties={...C6,jsonb:{title:"JSONB","x-component":"Checkbox"}},this.configure={items:[{name:"jsonb",title:"JSONB",component:"Checkbox",schema:{"x-content":" "},hidden:e=>{let{context:t}=e,l=t.isDialect;return"function"!=typeof l||!l("postgres")},disabled:e=>{let{context:t}=e;return!!t.disabledJSONB}}]}}}class Ff extends C7{initialize(e){"belongsToMany"===e.type&&(e.through||(e.through=`t_${(0,rk.uid)()}`),e.foreignKey||(e.foreignKey=`f_${(0,rk.uid)()}`),e.otherKey||(e.otherKey=`f_${(0,rk.uid)()}`),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id"))}constructor(...e){super(...e),this.name="m2m",this.type="object",this.group="relation",this.order=6,this.title='{{t("Many to many")}}',this.description='{{t("Many to many description")}}',this.isAssociation=!0,this.default={type:"belongsToMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}},reverseField:{interface:"m2m",type:"belongsToMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}},this.availableTypes=["belongsToMany"],this.validationType="object",this.properties={...C6,type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"string",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{through:{type:"string",title:'{{t("Through collection")}}',description:'{{ t("Generated automatically if left blank") }}',"x-decorator":"FormItem","x-disabled":"{{ !createOnly }}","x-component":"ThroughCollection","x-component-props":{allowClear:!0}}}},col13:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{sourceKey:{type:"string",title:'{{t("Source key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"SourceKey","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key 1")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly||override }}"}}},col23:{type:"void","x-component":"Grid.Col",properties:{}}}},row3:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{}},col22:{type:"void","x-component":"Grid.Col",properties:{otherKey:{type:"string",title:'{{t("Foreign key 2")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly||override }}"}}},col23:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',"x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}",description:"{{t('Field values must be unique.')}}"}}}}}}},...C8},this.filterable={nested:!0,children:[]}}}class Fg extends C7{constructor(...e){super(...e),this.name="m2o",this.type="object",this.group="relation",this.order=5,this.title='{{t("Many to one")}}',this.description='{{t("Many to one description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}},reverseField:{interface:"o2m",type:"hasMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}},this.availableTypes=["belongsTo"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class Fv extends C7{constructor(...e){super(...e),this.name="markdown",this.type="object",this.title='{{t("Markdown")}}',this.group="media",this.default={type:"text",uiSchema:{type:"string","x-component":"Markdown"}},this.availableTypes=["text","json","string"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"bigField"}}}class Fy extends C7{constructor(...e){super(...e),this.name="multipleSelect",this.type="object",this.group="choices",this.order=3,this.title='{{t("Multiple select")}}',this.default={type:"array",defaultValue:[],uiSchema:{type:"array","x-component":"Select","x-component-props":{mode:"multiple"},enum:[]}},this.availableTypes=["array","json"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"array"}}}class Fx extends C7{constructor(...e){super(...e),this.name="number",this.type="object",this.group="basic",this.order=7,this.title='{{t("Number")}}',this.sortable=!0,this.default={type:"double",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"}}},this.availableTypes=["double","float","decimal"],this.hasDefaultValue=!0,this.validationType="number",this.excludeValidationOptions=["integer"],this.properties={type:{type:"string",title:'{{t("Data type")}}',"x-component":"Select","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",default:"double",enum:[{label:'{{t("Double")}}',value:"double"},{label:'{{t("Float")}}',value:"float"},{label:'{{t("Decimal")}}',value:"decimal"}]},...C6,unique:CX,"uiSchema.x-component-props.step":{type:"string",title:'{{t("Precision(UI)")}}',"x-component":"Select","x-decorator":"FormItem",default:"1",enum:[{value:"1",label:"1"},{value:"0.1",label:"1.0"},{value:"0.01",label:"1.00"},{value:"0.001",label:"1.000"},{value:"0.0001",label:"1.0000"},{value:"0.00001",label:"1.00000"},{value:"0.000001",label:"1.000000"},{value:"0.0000001",label:"1.0000000"},{value:"0.00000001",label:"1.00000000"}]},precision:{type:"string",title:'{{t("Precision")}}',"x-component":"InputNumber","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",default:10},scale:{type:"string",title:'{{t("Scale")}}',"x-component":"InputNumber","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",default:2}},this.filterable={operators:"number"},this.titleUsable=!0}}class Fb extends C7{constructor(...e){super(...e),this.name="obo",this.type="object",this.group="relation",this.order=3.1,this.title='{{t("One to one (belongs to)")}}',this.description='{{t("One to one description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}},reverseField:{interface:"oho",type:"hasOne",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}}}},this.availableTypes=["belongsTo"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class Fw extends C7{constructor(...e){super(...e),this.name="o2m",this.type="object",this.group="relation",this.order=4,this.title='{{t("One to many")}}',this.description='{{t("One to many description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"hasMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}},reverseField:{interface:"m2o",type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}}}},this.availableTypes=["hasMany"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection"}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{sourceKey:{type:"string",title:'{{t("Source key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"SourceKey","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}}}},row3:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{}},col22:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',"x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}",description:"{{t('Field values must be unique.')}}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class FS extends C7{constructor(...e){super(...e),this.name="oho",this.type="object",this.group="relation",this.order=3,this.title='{{t("One to one (has one)")}}',this.description='{{t("One to one description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"hasOne",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}},reverseField:{interface:"obo",type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}}}},this.availableTypes=["hasOne"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{sourceKey:{type:"string",title:'{{t("Source key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"SourceKey","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class FC extends C7{constructor(...e){super(...e),this.name="password",this.type="object",this.group="basic",this.order=9,this.title='{{t("Password")}}',this.default={type:"password",hidden:!0,uiSchema:{type:"string","x-component":"Password"}},this.availableTypes=["password","string"],this.hasDefaultValue=!0,this.validationType="string",this.availableValidationOptions=["min","max","length","pattern"],this.properties={...C6,unique:CX},this.filterable={operators:"string"}}}(0,rF.registerValidateRules)({percentMode(e,t){let{maxValue:l,minValue:n}=t;return l&&e>l?{type:"error",message:`${Fu("The field value cannot be greater than ")}${100*l}%`}:!n||!(e<n)||{type:"error",message:`${Fu("The field value cannot be less than ")}${100*n}%`}},percentFormats(e,t){let{percentFormat:l}=t;return!e||"Integer"!==l||!1!==/^-?[1-9]\d*$/.test((100*e).toString())||{type:"error",message:`${Fu("The field value is not an integer number")}`}}});class FF extends C7{constructor(...e){super(...e),this.name="percent",this.type="object",this.group="basic",this.order=8,this.title='{{t("Percent")}}',this.sortable=!0,this.default={type:"float",uiSchema:{type:"string","x-component":"Percent","x-component-props":{stringMode:!0,step:"1",addonAfter:"%"}}},this.availableTypes=["float","double","decimal"],this.hasDefaultValue=!0,this.validationType="number",this.excludeValidationOptions=["integer"],this.properties={...C6,unique:CX,"uiSchema.x-component-props.step":{type:"string",title:'{{t("Precision")}}',"x-component":"Select","x-decorator":"FormItem",default:"1",enum:[{value:"1",label:"1%"},{value:"0.1",label:"1.0%"},{value:"0.01",label:"1.00%"},{value:"0.001",label:"1.000%"},{value:"0.0001",label:"1.0000%"},{value:"0.00001",label:"1.00000%"}]}},this.filterable={operators:"number"},this.titleUsable=!0}}class Fk extends C7{constructor(...e){super(...e),this.name="phone",this.type="object",this.group="basic",this.order=3,this.title='{{t("Phone")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Input","x-component-props":{type:"tel"}}},this.availableTypes=["string"],this.validationType="string",this.availableValidationOptions=["min","max","length","pattern"],this.hasDefaultValue=!0,this.properties={...C6,unique:CX},this.filterable={operators:"string"},this.titleUsable=!0}}class FA extends C7{constructor(...e){super(...e),this.name="radioGroup",this.type="object",this.group="choices",this.order=4,this.title='{{t("Radio group")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Radio.Group"}},this.availableTypes=["string","integer","boolean","integer"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"enumType"},this.titleUsable=!0}}class FP extends C7{constructor(...e){super(...e),this.name="richText",this.type="object",this.group="media",this.order=2,this.title='{{t("Rich Text")}}',this.default={interface:"richText",type:"text",uiSchema:{type:"string","x-component":"RichText"}},this.availableTypes=["text","json","string"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"bigField"}}}class Fj extends C7{constructor(...e){super(...e),this.name="select",this.type="object",this.group="choices",this.order=2,this.title='{{t("Single select")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Select",enum:[]}},this.availableTypes=["string","bigInt","boolean"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"enumType"},this.titleUsable=!0}}class FM extends C7{constructor(...e){super(...e),this.name="snowflakeId",this.type="object",this.group="advanced",this.order=0,this.title='{{t("Snowflake ID (53-bit)")}}',this.primaryKeyDescription='{{t("Primary key, distributed uniqueness, time-ordering")}}',this.hidden=!1,this.sortable=!0,this.default={type:"snowflakeId",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,separator:"0.00",step:"1"},"x-validator":"integer"}},this.availableTypes=["snowflakeId"],this.properties={...C6,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"number"},this.description='{{t("A 53-bit Snowflake ID designed to be compatible with JavaScript’s safe integer range, providing both time-ordering and uniqueness.") }}',this.titleUsable=!0}}class FI extends C7{constructor(...e){super(...e),this.name="tableoid",this.type="object",this.group="systemInfo",this.order=0,this.title='{{t("Table OID")}}',this.sortable=!0,this.default={name:"__collection",type:"virtual",uiSchema:{type:"string",title:'{{t("Table OID")}}',"x-component":"CollectionSelect","x-component-props":{isTableOid:!0},"x-read-pretty":!0}},this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Input"}},this.filterable={operators:"tableoid"}}}class FT extends C7{constructor(...e){super(...e),this.name="textarea",this.type="object",this.group="basic",this.order=2,this.title='{{t("Long text")}}',this.default={interface:"textarea",type:"text",uiSchema:{type:"string","x-component":"Input.TextArea"}},this.availableTypes=["text","json","string"],this.validationType="string",this.availableValidationOptions=["min","max","length","case","pattern"],this.hasDefaultValue=!0,this.titleUsable=!0,this.properties={...C6,trim:{type:"boolean","x-content":'{{t("Automatically remove heading and tailing spaces")}}',"x-decorator":"FormItem","x-component":"Checkbox"}},this.filterable={operators:"string"}}}class FR extends C7{constructor(...e){super(...e),this.name="time",this.type="object",this.group="datetime",this.order=4,this.title='{{t("Time")}}',this.sortable=!0,this.default={type:"time",uiSchema:{type:"string","x-component":"TimePicker"}},this.availableTypes=["time"],this.hasDefaultValue=!0,this.properties={...C6,...C4},this.filterable={operators:"time"},this.titleUsable=!0}}class FE extends C7{constructor(...e){super(...e),this.name="updatedAt",this.type="object",this.group="systemInfo",this.order=2,this.title='{{t("Last updated at")}}',this.sortable=!0,this.default={type:"date",field:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},this.description='{{t("Store the last update time of each record")}}',this.availableTypes=[],this.properties={...C6,...C5},this.filterable={operators:"datetime"},this.titleUsable=!0}}class FN extends C7{constructor(...e){super(...e),this.name="updatedBy",this.type="object",this.group="systemInfo",this.order=4,this.title='{{t("Last updated by")}}',this.isAssociation=!0,this.default={type:"belongsTo",target:"users",foreignKey:"updatedById",uiSchema:{type:"object",title:'{{t("Last updated by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}},this.availableTypes=["belongsTo"],this.properties={...C6},this.filterable={nested:!0,children:[]},this.description='{{t("Store the last update user of each record")}}'}}class FD extends C7{constructor(...e){super(...e),this.name="url",this.type="string",this.group="basic",this.order=5,this.title='{{t("URL")}}',this.default={type:"text",uiSchema:{type:"string","x-component":"Input.URL"}},this.componentOptions=[{label:"URL",value:"Input.URL"},{label:"Preview",value:"Input.Preview"}],this.availableTypes=["string","text"],this.validationType="string",this.availableValidationOptions=["uri","pattern"],this.properties={...C6},this.titleUsable=!0,this.filterable={operators:"string"}}}class FB extends C7{constructor(...e){super(...e),this.name="uuid",this.type="object",this.group="advanced",this.order=0,this.title='{{t("UUID")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier")}}',this.hidden=!1,this.sortable=!0,this.default={type:"uuid",uiSchema:{type:"string","x-component":"Input","x-validator":"uuid"}},this.availableTypes=["uid","uuid"],this.validationType="string",this.availableValidationOptions=["uuid","pattern"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":"{{ !createOnly }}",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},autoFill:C0,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"string"},this.titleUsable=!0}}class F$ extends C7{constructor(...e){super(...e),this.name="nanoid",this.type="object",this.group="advanced",this.order=0,this.title='{{t("Nano ID")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier")}}',this.hidden=!1,this.sortable=!0,this.default={type:"nanoid",uiSchema:{type:"string","x-component":"NanoIDInput"}},this.availableTypes=["nanoid"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":"{{ !createOnly }}",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},customAlphabet:{type:"string",title:'{{t("Alphabet")}}',default:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz","x-decorator":"FormItem","x-component":"Input"},size:{type:"number",title:'{{t("Length")}}',default:21,"x-decorator":"FormItem","x-component":"InputNumber"},autoFill:C0,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"string"},this.titleUsable=!0}}class FO extends C7{constructor(...e){super(...e),this.name="unixTimestamp",this.type="object",this.group="datetime",this.order=4,this.title='{{t("Unix Timestamp")}}',this.sortable=!0,this.default={type:"unixTimestamp",accuracy:"second",timezone:!0,defaultToCurrentTime:!1,onUpdateToCurrentTime:!1,uiSchema:{type:"number","x-component":"UnixTimestamp","x-component-props":{showTime:!0}}},this.availableTypes=["unixTimestamp"],this.hasDefaultValue=!1,this.validationType="date",this.availableValidationOptions=["timestamp"],this.properties={...C6,...C5,accuracy:{type:"string",title:'{{t("Accuracy")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"second",enum:[{value:"millisecond",label:'{{t("Millisecond")}}'},{value:"second",label:'{{t("Second")}}'}]},defaultToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Default value to current time")}}'},onUpdateToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Automatically update timestamp on update")}}'}},this.filterable={operators:"datetime"},this.titleUsable=!0}}class Fq extends C7{constructor(...e){super(...e),this.name="date",this.type="object",this.group="datetime",this.order=3,this.title='{{t("DateOnly")}}',this.sortable=!0,this.default={type:"dateOnly",uiSchema:{type:"string","x-component":"DatePicker","x-component-props":{dateOnly:!0,showTime:!1}}},this.availableTypes=["dateOnly"],this.hasDefaultValue=!0,this.validationType="date",this.properties={...C6,...C5,"uiSchema.x-component-props.showTime":{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-visible":!1},"uiSchema.x-component-props.timeFormat":{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-visible":!1}},this.filterable={operators:"datetime"},this.titleUsable=!0}}class FL extends C7{constructor(...e){super(...e),this.name="datetimeNoTz",this.type="object",this.group="datetime",this.order=2,this.title='{{t("Datetime (without time zone)")}}',this.sortable=!0,this.default={type:"datetimeNoTz",defaultToCurrentTime:!1,onUpdateToCurrentTime:!1,timezone:!1,uiSchema:{type:"string","x-component":"DatePicker","x-component-props":{showTime:!1,utc:!1}}},this.availableTypes=["string","datetimeNoTz"],this.hasDefaultValue=!0,this.validationType="date",this.properties={...C6,...C5,defaultToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Default value to current server time")}}'},onUpdateToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Automatically update timestamp to the current server time on update")}}'},"uiSchema.x-component-props.gmt":{type:"boolean",title:'{{t("GMT")}}',"x-hidden":!0,"x-component":"Checkbox","x-content":'{{t("Use the same time zone (GMT) for all users")}}',"x-decorator":"FormItem",default:!1}},this.filterable={operators:"datetime"},this.titleUsable=!0}}function F_(e){if(null==e?void 0:e.filterTargetKey){if(Array.isArray(e.filterTargetKey)){var t;return null==e||null==(t=e.filterTargetKey)?void 0:t[0]}return null==e?void 0:e.filterTargetKey}return(null==e?void 0:e.getPrimaryKey())||"id"}function FV(e,t){var l,n,o,r,i;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=e.interface,d=s?(null==t||null==(n=t.getFieldInterfaceConfigure)||null==(l=n.call(t,s,a.collectionInfo))?void 0:l.default)||(null==t||null==(r=t.getFieldInterface)||null==(o=r.call(t,s))?void 0:o.default):void 0,u=(0,B.merge)({},(0,B.cloneDeep)(d||{}),(0,B.cloneDeep)(e)),c=(0,B.merge)({},(0,B.cloneDeep)((null==d?void 0:d.uiSchema)||{}),(0,B.cloneDeep)(e.uiSchema||{}));return void 0!==e.title&&(c.title=e.title),void 0!==e.options&&(c.enum=(0,B.cloneDeep)(e.options)),void 0!==e.component&&(c["x-component"]=e.component),void 0!==e.componentProps&&(c["x-component-props"]=(0,B.merge)({},(0,B.cloneDeep)((null==d||null==(i=d.uiSchema)?void 0:i["x-component-props"])||{}),(0,B.cloneDeep)(e.componentProps))),delete u.title,delete u.options,delete u.component,delete u.componentProps,Object.keys(c).length&&(u.uiSchema=c),u}function Fz(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return e.map(e=>FV(e,t,l))}let FK=e=>{var t,l,n,o,r,i,a,s,d;let{dataSource:u="main",collections:c,syncOnChange:p=!1,children:m}=e,h=(0,U.n)(),f=(0,O.useRef)(null),g=(0,O.useRef)(null);if(null===f.current){let e=null==(l=h.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,u),r=[];if(e)for(let t of c)null!=(n=e.getCollection)&&n.call(e,t.name)||(null==(o=e.addCollection)||o.call(e,t),r.push(t));f.current=r,g.current=c}else if(p&&g.current!==c){let e=null==(i=h.dataSourceManager)||null==(r=i.getDataSource)?void 0:r.call(i,u);if(e){let t=new Set(c.map(e=>e.name)),l=new Map(f.current.map(e=>[e.name,e]));for(let n of l.keys())t.has(n)||null==(a=e.removeCollection)||a.call(e,n);let n=[];for(let t of c){let o=l.get(t.name);if(o){n.push(o);continue}null!=(s=e.getCollection)&&s.call(e,t.name)||(null==(d=e.addCollection)||d.call(e,t),n.push(t))}f.current=n}g.current=c}return(0,O.useEffect)(()=>{var e;let t=e=>{var t,l,n,o,r;let i=null==(t=e.detail)?void 0:t.dataSourceKey;if(i!==u&&"*"!==i)return;let a=null==(n=h.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u);if(a&&f.current)for(let e of f.current)null!=(o=a.getCollection)&&o.call(a,e.name)||null==(r=a.addCollection)||r.call(a,e)};return null==(e=h.eventBus)||e.addEventListener("dataSource:loaded",t),()=>{var e,l,n,o;null==(e=h.eventBus)||e.removeEventListener("dataSource:loaded",t);let r=null==(n=h.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u),i=f.current??[];if(f.current=null,g.current=null,r)for(let e of i)null==(o=r.removeCollection)||o.call(r,e.name)}},[h,u]),(0,E.jsx)(E.Fragment,{children:m})};var FU=l(30872),FW=l.n(FU),FH=l(88055),FG=l.n(FH),FY=l(90179),FJ=l.n(FY);let FX=(0,O.createContext)(null);FX.displayName="APIClientContext";let FQ=(0,O.createContext)(null);FQ.displayName="ApplicationContext";let FZ=()=>{var e;let t=(0,O.useContext)(FQ),l=(0,D.useFlowEngine)({throwError:!1});return(null==l||null==(e=l.context)?void 0:e.app)||t||{}};function F0(){let e=FZ();return(0,O.useContext)(FX)||e.apiClient}var F1=l(89412),F2=l(14744),F8=l.n(F2),F5=l(63375),F4=l.n(F5);function F3(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(t=>e.propertyIsEnumerable(t)):[]}function F6(e){return Object.keys(e).concat(F3(e))}let F9=new Map;function F7(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return F6(t).forEach(n=>{let o=l[n],r=F9.get("deepMerge");"function"==typeof o?r=o:"string"==typeof o&&F9.has(o)&&(r=F9.get(o)),e[n]=r(e[n],t[n])}),e}function ke(e){let t,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[n,o]=(0,F1.A)({}),r=F0();t="function"==typeof e?e:e?async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{resource:l,url:n}=e,o=FG()(e);l||n?(o.params=o.params||{},F7(o.params,t)):o=(0,rk.merge)(o,t);let i=await r.request(o);return null==i?void 0:i.data}:async()=>{};let i={...l,onSuccess(){for(var e,t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];null==(e=l.onSuccess)||e.call(l,...n),l.uid&&(r.services[l.uid]=a)}},a=(0,o8.A)(t,i);return(0,O.useMemo)(()=>({...a,state:n,setState:o}),[a,o,n])}function kt(e,t){return F0().resource(e,t)}F9.set("overwrite",(e,t)=>t),F9.set("andMerge",(e,t)=>{if(e||t)return e?t?{$and:[e,t]}:e:t}),F9.set("orMerge",(e,t)=>{if(e||t)return e?t?{$or:[e,t]}:e:t}),F9.set("deepMerge",(e,t)=>(0,er.isPlainObject)(e)&&(0,er.isPlainObject)(t)?F8()(e,t,{arrayMerge:(e,t)=>t}):t),F9.set("merge",(e,t)=>(0,er.isPlainObject)(e)&&(0,er.isPlainObject)(t)?Object.assign(e,t):t),F9.set("union",(e,t)=>("string"==typeof e&&(e=e.split(",")),"string"==typeof t&&(t=t.split(",")),F4()((e||[]).concat(t||[])))),F9.set("intersect",(e,t)=>("string"==typeof e&&(e=e.split(",")),"string"==typeof t&&(t=t.split(",")),Array.isArray(e)&&0!==e.length)?Array.isArray(t)&&0!==t.length?e.filter(e=>t.includes(e)):e||[]:t||[]);var kl=l(76511);function kn(e,t,l){var n;(null==t?void 0:t.length)&&l[e]({message:null==(n=t.map)?void 0:n.call(t,(e,t)=>O.createElement("div",{key:`${t}_${e.message}`},"string"==typeof e?e:e.message))})}let ko=(e,t)=>{var l;let n=new FileReader;n.readAsText(null==e||null==(l=e.response)?void 0:l.data,"utf-8"),n.onload=function(){kn("error",JSON.parse(n.result).errors,t)}};function kr(e){let t=Math.floor(Math.abs(e)),l=Math.abs(e%1*60);return(e>=0?"+":"-")+(t<10?"0":"")+t+":"+(l<10?"0":"")+l}let ki=()=>kr(-(new Date().getTimezoneOffset()/60)),ka=new Map;class ks extends A.APIClient{get notification(){var e,t;return(null==(t=this.app)||null==(e=t.context)?void 0:e.notification)||kl.Ay}cloneInstance(){let e=new ks(this.options);e.options=this.options,e.services=this.services,e.storage=this.storage,e.app=this.app,e.auth=this.auth,e.storagePrefix=this.storagePrefix;let t=[];for(let n of this.axios.interceptors.response.handlers){var l;(null==n||null==(l=n.rejected)?void 0:l._name)==="handleNotificationError"?t.push({...n,rejected:e.handleNotificationError.bind(e)}):t.push(n)}return e.axios.interceptors.response.handlers=t,e}getHostname(){var e,t;try{return new URL("/api/").hostname}catch(e){}return null==(t=window)||null==(e=t.location)?void 0:e.hostname}getHeaders(){var e;let t=super.getHeaders(),l=null==(e=this.app)?void 0:e.getName();return l&&(t["X-App"]=l),t["X-Timezone"]=ki(),t["X-Hostname"]=this.getHostname(),t}service(e){return this.services[e]}interceptors(){this.axios.interceptors.request.use(e=>{e.headers["X-With-ACL-Meta"]=!0;let t=this.getHeaders();return Object.keys(t).forEach(l=>{(0,A.hasHeaderValue)(e.headers,l)||(e.headers[l]=t[l])}),e}),super.interceptors(),this.useNotificationMiddleware(),this.axios.interceptors.response.use(e=>e,e=>{let t=this.toErrMessages(e);throw t.find(e=>"ROLE_NOT_FOUND_ERR"===e.code)&&(this.auth.setRole(null),window.location.reload()),t.find(e=>"TOKEN_INVALID"===e.code||"USER_LOCKED"===e.code)&&this.auth.setToken(null),t.find(e=>"ROLE_NOT_FOUND_FOR_USER"===e.code)&&(this.auth.setRole(null),window.location.reload()),e})}toErrMessages(e){var t,l,n,o,r,i,a,s,d,u,c;if("string"==typeof(null==e||null==(t=e.response)?void 0:t.data)){let t=document.createElement("div");t.innerHTML=null==e||null==(d=e.response)?void 0:d.data;let l=t.textContent||t.innerText;return l.includes("Error occurred while trying")||l.includes("502 Bad Gateway")?[{code:"APP_WARNING",message:l="The application may be starting up. Please try again later."}]:[{message:l}]}return(null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.error)?[null==e||null==(c=e.response)||null==(u=c.data)?void 0:u.error]:(null==e||null==(r=e.response)||null==(o=r.data)?void 0:o.errors)||(null==e||null==(a=e.response)||null==(i=a.data)?void 0:i.messages)||(null==e||null==(s=e.response)?void 0:s.error)||[{message:e.message||"Server error"}]}async handleNotificationError(e){var t,l,n,o,r,i,a,s,d,u;if(this.silence)throw e;let c=null==(t=e.config)?void 0:t.skipNotify;if(c&&("function"==typeof c&&c(e)||!0===c))throw e;let p=null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.redirectTo;if(p)return window.location.href=p;if((null==e||null==(r=e.response)||null==(o=r.data)?void 0:o.type)==="application/json")ko(e,this.notification);else{ka.size>10&&ka.clear();let t=!!(null==e||null==(s=e.response)||null==(a=s.data)||null==(i=a.error)?void 0:i.maintaining);if(this.app.maintaining!==t&&(this.app.maintaining=t),this.app.maintaining)throw this.app.error=null==e||null==(u=e.response)||null==(d=u.data)?void 0:d.error,e;this.app.error&&(this.app.error=null);let l=this.toErrMessages(e);if(0===(l=l.filter(e=>{let t=ka.get(e.message);return!(t&&new Date().getTime()-t<500)&&(ka.set(e.message,new Date().getTime()),!0)})).length)throw e;kn("error",l,this.notification)}throw e}useNotificationMiddleware(){let e=this.handleNotificationError.bind(this);e._name="handleNotificationError",this.axios.interceptors.response.use(e=>{var t,l;return(null==(l=e.data)||null==(t=l.messages)?void 0:t.length)&&kn("success",e.data.messages.filter(e=>{let t=ka.get("string"==typeof e?e:e.message);return!(t&&new Date().getTime()-t<500)&&(ka.set(e.message,new Date().getTime()),!0)}),this.notification),e},e)}silent(){let e=this.cloneInstance();return e.silence=!0,e}constructor(...e){super(...e),this.services={},this.silence=!1}}let kd=e=>{let{apiClient:t,children:l}=e;return(0,E.jsx)(FX.Provider,{value:t,children:l})};class ku{get fields(){return this.options.fields||[]}get app(){return this.collectionManager.app}get dataSource(){return this.options.dataSource}get sourceKey(){return this.options.sourceKey}get name(){return this.options.name}get key(){return this.options.key}get title(){return this.options.title}get inherit(){return this.options.inherit}get hidden(){return this.options.hidden}get description(){return this.options.description}get duplicator(){return this.options.duplicator}get category(){return this.options.category}get targetKey(){return this.options.targetKey}get model(){return this.options.model}get createdBy(){return this.options.createdBy}get updatedBy(){return this.options.updatedBy}get logging(){return this.options.logging}get from(){return this.options.from}get rawTitle(){return this.options.rawTitle}getPrimaryKey(){if(this.primaryKey)return this.primaryKey;if(this.options.targetKey)return this.options.targetKey;let e=this.getFields({primaryKey:!0})[0];return this.primaryKey=null==e?void 0:e.name,this.primaryKey}getFilterTargetKey(){return this.filterTargetKey||this.getPrimaryKey()||"id"}get inherits(){return this.options.inherits||[]}get titleField(){return this.hasField(this.options.titleField)?this.options.titleField:this.getPrimaryKey()}get sources(){return this.options.sources||[]}get template(){return this.options.template}get tableName(){return this.options.tableName}get viewName(){return this.options.viewName}get writableView(){return this.options.writableView}get filterTargetKey(){return this.options.filterTargetKey}get sortable(){return this.options.sortable}get autoGenId(){return this.options.autoGenId}get magicAttribute(){return this.options.magicAttribute}get tree(){return this.options.tree}get isThrough(){return this.options.isThrough}get autoCreate(){return this.options.autoCreate}get resource(){return this.options.resource}setOption(e,t){return this.options[e]=t,this}getOptions(){return this.options}getOption(e){return this.options[e]}getFields(e){return e?(0,rj.filter)(this.fields,e):this.fields}getAllFields(e){return this.getFields(e)}getFieldsMap(){return this.fieldsMap||(this.fieldsMap=this.getFields().reduce((e,t)=>(e[t.name]=t,e),{})),this.fieldsMap}getFieldByAssociationName(e){let t=this.getFieldsMap(),[l,...n]=String(e).split("."),o=t[l];if(!o)return;let r=null==o?void 0:o.target;if(!r)return;let i=this.collectionManager.getCollection(r);if(i)return i.getField(n.join("."))}getField(e){if(!e)return;let t=this.getFieldsMap();if(String(e).split(".").length>1){let t=this.getFieldByAssociationName(e);return t||("string"==typeof e&&e.startsWith(`${this.name}.`)?(e=e.replace(`${this.name}.`,""),this.getField(e)):void 0)}return t[e]}hasField(e){return!!this.getField(e)}isTitleField(e){var t;return null==(t=this.app.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface))?void 0:t.titleUsable}isInherited(){return this.inherits.length>0}constructor(e,t){this.options=e,this.collectionManager=t}}let{ConfigContext:kc}=X.Ay,kp=()=>(0,O.useContext)(kc),km=(e,t)=>{let{getPrefixCls:l}=(0,O.useContext)(X.Ay.ConfigContext)||{};if("ConfigContext"in X.Ay)return(null==l?void 0:l(e,null==t?void 0:t.prefixCls))||"";{let l=(null==t?void 0:t.prefixCls)??"ant-";return`${l}${e??""}`}},kh=()=>J.A.useToken(),kf=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Loading...",t=arguments.length>1?arguments[1]:void 0,l=null,n=setTimeout(()=>{l=wd.Ay.loading(e)},100);try{return await t()}finally{null==l||l(),clearTimeout(n)}},kg={...lP},{version:kv,render:ky,unmountComponentAtNode:kx}=kg;try{Number((kv||"").split(".")[0])>=18&&kg.createRoot&&(n=kg.createRoot)}catch(e){}function kb(e){let{__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:t}=kg;t&&"object"==typeof t&&(t.usingClientEntryPoint=e)}let kw="__antd_mobile_root__";function kS(e,t){ky(e,t)}function kC(e,t){kb(!0);let l=t[kw]||n(t);kb(!1),l.render(e),t[kw]=l}function kF(e,t){n?kC(e,t):kS(e,t)}function kk(e){return kx(e)}async function kA(e){return Promise.resolve().then(()=>{var t;null==(t=e[kw])||t.unmount(),delete e[kw]})}function kP(e){return n?kA(e):kk(e)}let kj=(0,N.observable)(new Map),kM=e=>{let t=e=>(e.id&&!kj.has(e.id)&&kj.set(e.id,null),(0,E.jsxs)(O.Fragment,{children:[e.children,(0,E.jsx)(l7.Observer,{children:()=>{if(!e.id)return(0,E.jsx)(E.Fragment,{});let t=kj.get(e.id);return t?(0,lA.createPortal)(t,document.body):(0,E.jsx)(E.Fragment,{})}})]}));return t.defaultProps={id:e},t};function kI(e,t){return{render:function(l){kj.has(t)?kj.set(t,null==l?void 0:l()):e&&kF((0,E.jsx)(O.Fragment,{children:null==l?void 0:l()}),e)},unmount:function(){if(kj.has(t)&&kj.set(t,null),e&&kP(e)&&e.parentNode){var l;null==(l=e.parentNode)||l.removeChild(e)}}}}let kT=(e,t)=>{let{fontFamily:l,fontSize:n}=e,o=`[class^="${t}"], [class*=" ${t}"]`;return{[o]:{fontFamily:l,fontSize:n,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[o]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}},kR=(e,t)=>l=>{let{theme:n,token:o,hashId:r}=kh(),{getPrefixCls:i,iconPrefixCls:a}=kp(),s=km(e),d=i(),u=(0,rx.useStyleRegister)({theme:n,token:o,hashId:r,path:["formily-antd",e,s,a]},()=>{let e=`.${s}`,n=t((0,rk.merge)(o,{componentCls:e,prefixCls:s,iconCls:`.${a}`,antCls:`.${d}`}),l,{hashId:r,prefixCls:s,rootPrefixCls:d,iconPrefixCls:a});return[kT(o,s),n]});return{wrapSSR:(0,O.useMemo)(()=>u,[n,o,r,s,a,d,l]),hashId:r,componentCls:s,rootPrefixCls:d}};var kE=l(38221),kN=l.n(kE);let kD=(0,O.createContext)(null);kD.displayName="DataSourceManagerContext";let kB=e=>{let{children:t,dataSourceManager:l}=e;return(0,E.jsx)(kD.Provider,{value:l,children:t})};function k$(){return(0,O.useContext)(kD)}function kO(){let e=k$();return{getAllCollectionsInheritChain:(0,O.useCallback)((t,l)=>{var n,o,r;return null==e||null==(r=e.getDataSource(l))||null==(o=r.collectionManager)||null==(n=o.getCollection(t))?void 0:n.getInheritChain()},[e])}}var kq=l(68870);let kL=(0,O.createContext)(null);kL.displayName="DataSourceContext";let k_=e=>{let{children:t,dataSource:l}=e,n=k$(),{t:o}=(0,eU.B)(),{refresh:r}=Ts(),[i,a]=O.useState(0),s=null==n?void 0:n.getDataSource(l);return s?"loading-failed"===s.status?(0,E.jsx)(er7,{type:"Data Source",name:s.displayName||l,message:s.errorMessage||"loading failed"}):"loading"===s.status||"reloading"===s.status?(0,E.jsx)(elN,{children:(0,E.jsx)(ez.Ay,{icon:(0,E.jsx)(kq.A,{}),title:`${s.displayName||l} ${o("data source")} ${o("loading")}...`,extra:(0,E.jsx)(eK.Ay,{type:"primary",onClick:()=>s.reload().then(()=>{r(),a(Math.random())}),children:o("Refresh")})})}):(0,E.jsx)(kL.Provider,{value:s,children:t}):(0,E.jsx)(er7,{type:"Data Source",name:l})};function kV(){return(0,O.useContext)(kL)}function kz(){let e=(0,O.useContext)(kL);return null==e?void 0:e.key}let kK=(0,O.createContext)(null);kK.displayName="ExtendCollectionsContext";let kU=e=>{let{children:t,collections:l}=e,n=kW(),o=(0,O.useMemo)(()=>n?[...n,...l]:l,[n,l]),r=kz();return(0,E.jsx)(kK.Provider,{value:o,children:(0,E.jsx)(kY,{dataSource:r,children:t})})};function kW(){return(0,O.useContext)(kK)}let kH=(0,O.createContext)(null);kH.displayName="CollectionManagerContext";let kG=e=>{let{instance:t,children:l}=e,n=kV(),o=kW(),r=(0,O.useMemo)(()=>t||(null==n?void 0:n.collectionManager),[t,n]),[i,a]=O.useState(Math.random());(0,O.useEffect)(()=>{r.dataSource.addReloadCallback(()=>{a(Math.random())})},[r]);let s=(0,O.useMemo)(()=>{let e=r;return(null==o?void 0:o.length)?e.clone(o):e},[r,o,i]);return(0,E.jsx)(kH.Provider,{value:s,children:l})},kY=e=>{let{instance:t,dataSource:l,children:n}=e;return(0,E.jsx)(k_,{dataSource:l,children:(0,E.jsx)(kG,{instance:t,children:n})})};function kJ(){return(0,O.useContext)(kH)}let kX=e=>{let t=kJ();return(0,O.useMemo)(()=>t.getCollections(e),[t,e])},kQ=(0,O.createContext)({});kQ.displayName="SchemaComponentContext.Provider";let kZ=()=>(0,O.useContext)(l7.SchemaOptionsContext)||{},k0=(0,O.memo)(e=>{let{children:t}=e,l=kZ(),n=(0,O.useMemo)(()=>({...l.components,...e.components}),[l.components,e.components]),o=(0,O.useMemo)(()=>({...l.scope,...e.scope}),[l.scope,e.scope]),r=(0,O.useMemo)(()=>({scope:o,components:n}),[o,n]);return(0,E.jsx)(l7.SchemaOptionsContext.Provider,{value:r,children:(0,E.jsx)(l7.SchemaComponentsContext.Provider,{value:n,children:(0,E.jsx)(l7.ExpressionScope,{value:o,children:t})})})});function k1(e){return l7.Schema.isSchemaInstance(e)?e:new l7.Schema((null==e?void 0:e.name)?{type:"object",properties:{[e.name]:e},name:`p_${e.name}`}:e)}k0.displayName="SchemaComponentOptions";let k2=e=>(0,O.useMemo)(()=>k1(e),[]),k8=(0,O.createContext)({onChange:rM().noop}),k5=(0,O.memo)(e=>{let{components:t,scope:l,schema:n,distributed:o,onChange:r,parentSchema:i,...a}=e,s=(0,O.useContext)(kQ),d=(0,O.useMemo)(()=>k1(n),[n]),u=(0,O.useMemo)(()=>({...s,distributed:!1!=s.distributed&&o,refresh:s.refresh||rM().noop}),[s,o]),{onChange:c}=(0,O.useContext)(k8),p=(0,O.useMemo)(()=>({onChange:()=>{null==r||r(d),null==c||c()}}),[r,c,d]);return(0,E.jsx)(k8.Provider,{value:p,children:(0,E.jsx)(kQ.Provider,{value:u,children:(0,E.jsx)(k0,{inherit:!0,components:t,scope:l,children:(0,E.jsx)(Ak,{...a,schema:d,isUseFormilyField:!0,parentSchema:i})})})})});k5.displayName="RecursionSchemaComponent";let k4=(0,O.memo)(e=>{let{schema:t,parentSchema:l,...n}=e,o=k2(t);return(0,E.jsx)(k5,{...n,schema:o,parentSchema:l})});k4.displayName="MemoizedSchemaComponent";let k3=(0,O.memo)(e=>{let{memoized:t,...l}=e;return t?(0,E.jsx)(k4,{...l}):(0,E.jsx)(k5,{...l})});k3.displayName="SchemaComponent";let k6=Object.freeze({}),k9={},k7=e=>/{{.*?}}/g.test(e),Ae=function(){let{noCache:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{noCache:!1},t=(0,O.useContext)(l7.SchemaOptionsContext),l=(0,O.useContext)(l7.SchemaExpressionScopeContext);return(n,o)=>{let r,i=!1;if("string"==typeof n&&n.startsWith("{{")&&(i=!0,r=n),n&&"object"==typeof n&&!(0,O.isValidElement)(n)){try{r=JSON.stringify(n)}catch(e){return console.warn("Failed to stringify:",e),n}if(k9[r])return k9[r];i=k7(r)}if(Array.isArray(n)){try{r=JSON.stringify(n)}catch(e){return console.warn("Failed to stringify:",e),n}if(k9[r])return k9[r];i=k7(r)}if(i){let i={...null==t?void 0:t.scope,...l,...o};if(!r)return l7.Schema.compile(n,i);try{if(e)return l7.Schema.compile(n,i);return k9[r]=k9[r]||l7.Schema.compile(n,i),k9[r]}catch(e){return console.log("useCompile error",n,e),l7.Schema.compile(n,i)}}return n}},At=(e,t)=>{if((e||t)&&!(0,rk.isFn)(e))return(0,E.jsxs)(O.Fragment,{children:[e,t]})},Al=e=>e&&("object"==typeof e||"function"==typeof e),An=(e,t,l)=>(0,rk.isFn)(e)?e(t,l):e,Ao=e=>{let t,l=(0,O.useContext)(l7.SchemaComponentsContext),n=e.field,o=At(An(e.children,n,n.form),n.content??n.componentProps.children);if("visible"!==n.display)return null;let r=e=>Al(e)?e:rk.FormPath.getIn(l,e)??e;return t=n.componentType?O.createElement(r(n.componentType),{...n.componentProps,value:n.value},o):o,n.decoratorType?O.createElement(r(n.decoratorType),n.decoratorProps,t):(0,E.jsx)(O.Fragment,{children:t})};Ao.displayName="NocoBaseReactiveInternal";let Ar=Ao;function Ai(e){return new Aa(e)}Ar.displayName="NocoBaseReactiveField";class Aa{initialize(){var e,t,l,n,o,r,i,a,s,d,u,c,p,m,h,f,g,v,y,x;let b=this.props.compile;this.pattern="readPretty",this.readPretty=!0,this.initialized=!0,this.loading=!1,this.validating=!1,this.submitting=!1,this.selfModified=!1,this.active=!1,this.visited=!0,this.mounted=!0,this.unmounted=!1,this.inputValues=[],this.inputValue=null,this.feedbacks=[],this.title=b(this.props.title||(null==(e=this.props.schema)?void 0:e.title)),this.description=b(this.props.description||(null==(t=this.props.schema)?void 0:t.description)),this.display="visible",this.editable=this.props.editable||(null==(l=this.props.schema)?void 0:l["x-editable"]),this.disabled=this.props.disabled||(null==(n=this.props.schema)?void 0:n["x-disabled"]),this.readOnly=this.props.readOnly||(null==(o=this.props.schema)?void 0:o["x-read-only"]),this.visible=this.props.visible||(null==(r=this.props.schema)?void 0:r["x-visible"]),this.hidden=this.props.hidden||(null==(i=this.props.schema)?void 0:i["x-hidden"]),this.dataSource=b(this.props.dataSource||(null==(a=this.props.schema)?void 0:a.enum)),this.validator=this.props.validator,this.required=this.props.required||!!(null==(s=this.props.schema)?void 0:s.required),this.content=b(this.props.content||(null==(d=this.props.schema)?void 0:d["x-content"])),this.initialValue=b(this.props.initialValue||(null==(u=this.props.schema)?void 0:u.default)),this.value=b(this.props.value),this.data=this.props.data||(null==(c=this.props.schema)?void 0:c["x-data"]),this.decorator=this.props.decorator?(0,rk.toArr)(this.props.decorator):[null==(p=this.props.schema)?void 0:p["x-decorator"],null==(m=this.props.schema)?void 0:m["x-decorator-props"]],this.component=this.props.component?(0,rk.toArr)(this.props.component):[null==(h=this.props.schema)?void 0:h["x-component"],null==(f=this.props.schema)?void 0:f["x-component-props"]],this.decoratorProps=(null==(g=this.props.schema)?void 0:g["x-decorator-props"])||{},this.componentProps=(null==(v=this.props.schema)?void 0:v["x-component-props"])||{},this.decoratorType=null==(y=this.props.schema)?void 0:y["x-decorator"],this.componentType=null==(x=this.props.schema)?void 0:x["x-component"],this.path={},this.form={},this.address={concat:rM().noop}}constructor(e){this.props=e,this.initialize()}}let As=e=>{let t=Ae(),l=(0,l7.useFieldSchema)(),n=(0,O.useMemo)(()=>Ai({...e,compile:t}),[]);return Object.assign(n.componentProps,l["x-component-props"]),n.value=e.value,(0,E.jsx)(l7.FieldContext.Provider,{value:n,children:(0,E.jsx)(Ar,{field:n,children:e.children})})},Ad=O.createContext({}),Au=O.createContext(rM().noop),Ac=e=>{let{children:t,refresh:l}=e,n=Af(),o=(0,O.useCallback)(e=>{l(),(null==e?void 0:e.refreshParentSchema)&&(null==n||n())},[n,l]);return(0,E.jsx)(Au.Provider,{value:o,children:t})},Ap=O.createContext(rM().noop),Am=e=>{let{children:t,refresh:l}=e;return(0,E.jsx)(Ap.Provider,{value:l,children:t})},Ah=()=>O.useContext(Ap),Af=()=>O.useContext(Au),Ag=()=>O.useContext(Ad)||{},Av=e=>{let{children:t,fieldSchema:l}=e,n=eid(),o=kJ(),r=null==l?void 0:l.name,i=(0,O.useMemo)(()=>{var e;if(!n)return null;let t=null==l||null==(e=l["x-component-props"])?void 0:e.field;return o.getCollectionField(null==l?void 0:l["x-collection-field"])||t||n.getField((null==t?void 0:t.name)||r)},[n,o,l,r]);return(0,E.jsx)(Ad.Provider,{value:i,children:t})},Ay=rM().memoize((e,t)=>e.toFieldProps({scope:t})),Ax=e=>Ay(e,(0,l7.useExpressionScope)()),Ab=e=>{let t=(0,l7.useField)();if(e.onlyRenderProperties){var l;return e.basePath||(null==t||null==(l=t.address)?void 0:l.concat(e.name))}return e.basePath||(null==t?void 0:t.address)},Aw=(e,t,l)=>{let n=e.toJSON();if(l){if(!n.properties)return e;let l=Object.keys(n.properties)[0],o=Object.values(n.properties)[0];return n.properties[l]=(0,rk.merge)(rM().omit(t,"type","x-read-pretty"),o),new l7.Schema(n)}return new l7.Schema((0,rk.merge)(rM().omit(t,"type","x-read-pretty"),n))},AS=e=>{let{schema:t,field:l,basePath:n,mapProperties:o,filterProperties:r,propsRecursion:i,values:a,isUseFormilyField:s}=e,d=l7.Schema.getOrderProperties(t);return d.length?(0,E.jsx)(O.Fragment,{children:d.map((e,t)=>{let{schema:d,key:u}=e,c=(null==l?void 0:l.address)||n,p=d;if((0,rk.isFn)(o)){let e=o(d,u);e&&(p=e)}if((0,rk.isFn)(r)&&!1===r(p,u))return null;let m=(0,rk.isBool)(i)&&i?(0,E.jsx)(Ak,{propsRecursion:!0,filterProperties:r,mapProperties:o,schema:p,name:u,basePath:c,values:rM().get(a,u),isUseFormilyField:s}):(0,E.jsx)(Ak,{schema:p,name:u,basePath:c,values:rM().get(a,u),isUseFormilyField:s});return"CollectionField"===p["x-component"]?(0,E.jsx)(AC.Provider,{value:!0,children:(0,E.jsx)(Av,{fieldSchema:p,children:m})},`${t}-${u}`):(0,E.jsx)(AC.Provider,{value:!1,children:(0,E.jsx)(Ad.Provider,{value:k6,children:m})},`${t}-${u}`)})}):null},AC=O.createContext(!1),AF=()=>O.useContext(AC),Ak=O.memo(e=>{let{schema:t,name:l,onlyRenderProperties:n,onlyRenderSelf:o,mapProperties:r,filterProperties:i,propsRecursion:a,values:s,isUseFormilyField:d=!0,uiSchema:u,parentSchema:c}=e,p=Ab(e),m=(0,O.useRef)(null),h=(0,O.useMemo)(()=>(m.current=null,new l7.Schema(t)),[t]),{uiSchema:f,defaultValue:g}=Ag(),v=(0,SK.A)(),{onChange:y}=(0,O.useContext)(k8),x=m.current||h;if(!x.parent&&c){var b,w;x.parent=c,(null==(w=x.parent)||null==(b=w.properties)?void 0:b[x.name])||!x.name||rM().set(x.parent,`properties.${x.name}`,x)}let S=(0,O.useCallback)(()=>{let e=x.parent;m.current=new l7.Schema(x.toJSON(),e),(null==e?void 0:e.properties)&&Object.keys(e.properties).forEach(t=>{t===x.name&&(e.properties[t]=m.current)}),v(),null==y||y()},[x,y,v]),C=(0,O.useMemo)(()=>u?Aw(x,u,n):f?(f.default=g,Aw(x,f,n)):x,[f,g,x,n,u]),F=Ax(C),k=e=>{if(!o)return AS({schema:x,field:e,basePath:p,mapProperties:r,filterProperties:i,propsRecursion:a,values:s,isUseFormilyField:d})},A=()=>(0,rk.isValid)(l)?"object"===C.type?n?k():(0,E.jsx)(l7.ObjectField,{...F,name:l,basePath:p,children:k}):"array"===C.type?(0,E.jsx)(l7.ArrayField,{...F,name:l,basePath:p}):"void"===C.type?n?k():(0,E.jsx)(l7.VoidField,{...F,name:l,basePath:p,children:k}):d?(0,E.jsx)(l7.Field,{...F,name:l,basePath:p}):(0,E.jsx)(As,{name:l,value:s,initialValue:s,basePath:p,schema:C}):k();return x?(0,E.jsx)(l7.SchemaContext.Provider,{value:x,children:(0,E.jsx)(Ac,{refresh:S,children:A()})}):(0,E.jsx)(O.Fragment,{})});Ak.displayName="NocoBaseRecursionField";var AA=l(58156),AP=l.n(AA),Aj=l(63560),AM=l.n(Aj);let AI=Symbol("LAZY_COMPONENT_KEY"),AT=new Map;function AR(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(0===l.length){let t=(0,O.lazy)(()=>e().then(e=>{let t=e.default;return l[AI]=t,{default:t}})),l=e=>(0,E.jsx)(O.Suspense,{fallback:(0,E.jsx)(ny.A,{}),children:(0,E.jsx)(t,{...e})});return l}return l.reduce((t,l)=>{let n=(0,O.lazy)(()=>e().then(e=>{let n=(0,rj.get)(e,l);return t[l][AI]=n,{default:n}}));return t[l]=e=>(0,E.jsx)(O.Suspense,{fallback:(0,E.jsx)(ny.A,{}),children:(0,E.jsx)(n,{...e})}),t},{})}function AE(e,t){let l="function"==typeof t?t:e=>e[t],n=e.toString(),o=AT.get(n);if(null==o?void 0:o.error)throw o.error;if(null==o?void 0:o.module)return l(o.module);if(!(null==o?void 0:o.promise)){let t=o||{};throw t.promise=e().then(e=>(t.module=e,e)).catch(e=>{throw t.error=e,e}),AT.set(n,t),t.promise}throw o.promise}function AN(e,t){if(e)return e["x-app-version"]||(e["x-app-version"]=t),Object.keys(e.properties||{}).forEach(l=>{var n;AN(null==(n=e.properties)?void 0:n[l],t)}),e}var AD="2.1.37";function AB(e){return new AV(e)}let A$=e=>{e&&(e["x-uid"]||(e["x-uid"]=(0,rk.uid)()),Object.keys(e.properties||{}).forEach(t=>{A$(e.properties[t])}))},AO=e=>e,Aq=(e,t)=>{if(e&&t){for(let l in t)if(Object.prototype.hasOwnProperty.call(t,l)&&t[l]!==(null==e?void 0:e[l]))return!1;return!0}},AL=(e,t)=>{if(e["x-uid"]&&e["x-uid"]===t["x-uid"])return[null,e.toJSON()];let l=e.toJSON(),n={...l,properties:{}},o=null,r=(e,l)=>{Object.keys(e||{}).forEach(n=>{let i=e[n];if(i["x-uid"]===t["x-uid"]){o=e[n];return}l.properties[n]={...i,properties:{}},r(null==i?void 0:i.properties,l.properties[n])})};return r(l.properties,n),[n,o]},A_=e=>e;class AV{get model(){return this.options.model}get query(){return this.options.query}loadAPIClientEvents(){let{api:e,t=A_}=this.options;if(!e)return;let l=e=>{if(!e)return[];let t=Object.values(e.properties).length,l=[];return(e.mapProperties(e=>{e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].width=100/t,e["x-uid"]&&l.push({"x-uid":e["x-uid"],"x-component-props":e["x-component-props"]})}),e["x-uid"]&&l.length)?l:[]};this.on("insertAdjacent",async n=>{var o;let{onSuccess:r,current:i,position:a,schema:s,wrap:d,wrapped:u,removed:c}=n,p=[];if((null==u?void 0:u["x-component"])==="Grid.Col"&&(p=p.concat(l(u.parent))),(null==c?void 0:c["x-component"])==="Grid.Col"&&(p=p.concat(l(c.parent))),this.refresh(),!i["x-uid"])return;let m=await e.request({url:`/uiSchemas:insertAdjacent/${i["x-uid"]}?position=${a}`,method:"post",data:{schema:AN(s,this.appVersion),wrap:d}});p.length&&await e.request({url:"/uiSchemas:batchPatch",method:"post",data:p}),(null==c?void 0:c["x-uid"])&&await e.request({url:`/uiSchemas:remove/${c["x-uid"]}`,method:"post"}),null==r||r(null==m||null==(o=m.data)?void 0:o.data),wd.Ay.success(t("Saved successfully"),.2)}),this.on("patch",async l=>{let{schema:n}=l;this.refresh(),(null==n?void 0:n["x-uid"])&&(await e.request({url:"/uiSchemas:patch",method:"post",data:{...n}}),wd.Ay.success(t("Saved successfully"),.2))}),this.on("initializeActionContext",async t=>{let{schema:l}=t;(null==l?void 0:l["x-uid"])&&await e.request({url:"/uiSchemas:initializeActionContext",method:"post",data:{...l}})}),this.on("batchPatch",async l=>{let{schemas:n}=l;this.refresh(),await e.request({url:"/uiSchemas:batchPatch",method:"post",data:n}),wd.Ay.success(t("Saved successfully"),.2)}),this.on("remove",async n=>{let{removed:o}=n,r=[];(null==o?void 0:o["x-component"])==="Grid.Col"&&(r=l(o.parent)),this.refresh(),(null==o?void 0:o["x-uid"])&&(await e.request({url:`/uiSchemas:remove/${o["x-uid"]}`,method:"post"}),r.length&&await e.request({url:"/uiSchemas:batchPatch",method:"post",data:r}),wd.Ay.success(t("Saved successfully"),.2))})}prepareProperty(e){e.type||(e.type="void"),e.name||(e.name=(0,rk.uid)()),this.current["x-uid"]&&A$(e)}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}async emit(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(!this.events[e])return;let[o,...r]=l;return Promise.all(this.events[e].map(e=>e.bind(this)({current:this.current,...o},...r)))}parentsIn(e){if(!e||!l7.Schema.isSchemaInstance(e))return!1;let t=this.current;for(;null==t?void 0:t.parent;){if(t.parent===e)return!0;t=t.parent}return!1}refresh(e){let{refresh:t}=this.options;return null==t?void 0:t(e)}deepMerge(e){let t={title:"title",description:"description",default:"initialValue",readOnly:"readOnly",writeOnly:"editable",enum:"dataSource","x-pattern":"pattern","x-display":"display","x-validator":"validator","x-decorator":"decorator","x-component":"component","x-reactions":"reactions","x-content":"content","x-visible":"visible","x-hidden":"hidden","x-disabled":"disabled","x-editable":"editable","x-read-only":"readOnly"},l={"x-decorator-props":"decoratorProps","x-component-props":"componentProps","x-data":"data"};Object.keys(e).forEach(n=>{t[n]?(this.current[n]=e[n],this.updateModel(t[n],e[n])):l[n]?Object.keys(e[n]).forEach(t=>{AM()(this.current,[n,t],e[n][t]),this.updateModel([l[n],t],e[n][t])}):this.current[n]=e[n]}),this.emit("patch",{schema:e})}getSchemaAttribute(e,t){return AP()(this.current,e,t)}shallowMerge(e){let t={title:"title",description:"description",default:"initialValue",readOnly:"readOnly",writeOnly:"editable",enum:"dataSource","x-pattern":"pattern","x-display":"display","x-validator":"validator","x-decorator":"decorator","x-component":"component","x-reactions":"reactions","x-content":"content","x-visible":"visible","x-hidden":"hidden","x-disabled":"disabled","x-editable":"editable","x-read-only":"readOnly","x-decorator-props":"decoratorProps","x-component-props":"componentProps","x-data":"data"};Object.keys(e).forEach(l=>{this.current[l]=e[l],t[l]&&this.updateModel(t[l],e[l])}),this.emit("patch",{schema:e})}updateModel(e,t){let l=l=>{AM()(l,e,t)};this.model&&l(this.model),this.query&&this.query.take(l)}insertAdjacent(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(e){case"beforeBegin":return this.insertBeforeBegin(t,l);case"afterBegin":return this.insertAfterBegin(t,l);case"beforeEnd":return this.insertBeforeEnd(t,l);case"afterEnd":return this.insertAfterEnd(t,l)}}recursiveRemoveIfNoChildren(e,t){let l;if(!e)return;let n=e,o=null==t?void 0:t.breakRemoveOn;for(;n;){if("function"==typeof o){if(o(n))break}else if(Aq(n,o))break;if(Object.keys(n.properties||{}).length>0)break;n.parent&&(l=n.parent.removeProperty(n.name)),n=n.parent}return l}remove(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{breakRemoveOn:l,removeParentsIfNoChildren:n}=t,o=e||this.current,r=o.parent.removeProperty(o.name);if(n){let e=this.recursiveRemoveIfNoChildren(o.parent,{breakRemoveOn:l});e&&(r=e)}return this.emit("remove",{removed:r})}removeWithoutEmit(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{breakRemoveOn:l,removeParentsIfNoChildren:n}=t,o=e||this.current,r=o.parent.removeProperty(o.name);if(n){let e=this.recursiveRemoveIfNoChildren(o.parent,{breakRemoveOn:l});e&&(r=e)}return r}insertBeforeBeginOrAfterEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current)||!l7.Schema.isSchemaInstance(e)||this.current.parent!==e.parent)return;let l=0,n=0;return this.current.parent.mapProperties((t,o,r)=>{this.current.name===o&&(n=r),e.name===o&&(l=r)}),l>n?this.insertBeforeBegin(e,t):this.insertAfterEnd(e,t)}insertBeforeBegin(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;let l={onSuccess:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t;if(l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o}))}else e&&(e=FG()(e));let i={},a=!1,s=0,d=0;this.current.parent.mapProperties((e,t)=>{t===this.current.name&&(d=s,a=!0,++s),e["x-index"]=s,++s,a&&(i[t]=e,this.current.parent.removeProperty(t))}),this.prepareProperty(e);let u=n(e),c=this.current.parent.addProperty(u.name||(0,rk.uid)(),u);c["x-index"]=d,c.parent=this.current.parent,this.current.parent.setProperties(i);let[p,m]=AL(c,e);this.emit("insertAdjacent",{position:"beforeBegin",schema:m,wrapped:u,wrap:p,...l})}insertAfterBegin(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;let l={onSuccess:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t;if(l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o}))}else e&&(e=FG()(e));let i={},a=1;this.current.mapProperties((e,t)=>{e["x-index"]=a,++a,i[t]=e}),this.current.properties={},this.prepareProperty(e);let s=n(e),d=this.current.addProperty(s.name||(0,rk.uid)(),s);d["x-index"]=0,d.parent=this.current,this.current.setProperties(i);let[u,c]=AL(d,e);this.emit("insertAdjacent",{position:"afterBegin",schema:c,wrap:u,wrapped:s,...l})}insertBeforeEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;delete e["x-index"];let l={onSuccess:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t;if(l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o}))}else e&&(e=FG()(e));this.prepareProperty(e);let i=n(e),a=this.current.addProperty(i.name||(0,rk.uid)(),i);a.parent=this.current;let[s,d]=AL(a,e);return this.emit("insertAdjacent",{position:"beforeEnd",schema:d,wrap:s,wrapped:i,...l})}insertAfterEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;let l={onSuccess:null==t?void 0:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t,i=0,a=0,s=!1,d={};if(this.current.parent.mapProperties((e,t)=>{e["x-index"]=i,t===this.current.name&&(a=++i,s=!0),++i,s&&t!==this.current.name&&(d[t]=e,this.current.parent.removeProperty(t))}),l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o})),e.parent=null}else e&&(e=FG()(e));this.prepareProperty(e);let u=n(e),c=this.current.parent.addProperty(u.name||(0,rk.uid)(),u);c.parent=this.current.parent,c["x-index"]=a,this.current.parent.setProperties(d);let[p,m]=AL(c,e);this.emit("insertAdjacent",{position:"afterEnd",schema:m,wrap:p,wrapped:u,...l})}constructor(e){this.events={},this.options=e,this.current=e.current,this.appVersion=e.appVersion}}function Az(){let e=(0,O.useContext)(l7.SchemaOptionsContext),t=(0,O.useMemo)(()=>(null==e?void 0:e.components)||{},[e]);return e=>{if(!e)return null;if("string"!=typeof e)return e;let l=AP()(t,e);return l||console.error(`[nocobase]: Component "${e}" not found`),l}}function AK(){let{designable:e,setDesignable:t,refresh:l,reset:n}=(0,O.useContext)(kQ),o=(0,O.useContext)(l7.SchemaOptionsContext),r=(0,O.useMemo)(()=>(null==o?void 0:o.components)||{},[o]),i=(0,O.useMemo)(()=>()=>(0,E.jsx)(E.Fragment,{}),[]),a=(0,SK.A)(),s=Af(),d=Ah(),u=(0,O.useCallback)(e=>{null==l||l(),a(),null==s||s(e),null==d||d()},[l,a,s,d]),c=(0,l7.useField)(),p=(0,l7.useFieldSchema)(),m=F0(),{t:h}=(0,eU.B)(),f=(0,O.useMemo)(()=>AB({t:h,api:m,refresh:u,current:p,model:c,appVersion:AD}),[h,m,u,p,c]);(0,O.useEffect)(()=>{f.loadAPIClientEvents()},[f]);let{isMobileLayout:g}=CS();return{dn:f,designable:!g&&e,reset:n,refresh:u,setDesignable:t,DesignableBar:i,findComponent:(0,O.useCallback)(e=>{if(!e)return null;if("string"!=typeof e)return e;let t=AP()(r,e);return(null==t?void 0:t[AI])??t},[AP()]),on:f.on.bind(f),patch:(0,O.useCallback)((e,t)=>{let l=e=>{Object.keys(e).forEach(t=>{let l=e[t];"title"===t&&(c.title=l,p.title=l),"x-decorator-props"===t&&(c.decoratorProps||(c.decoratorProps={}),p["x-decorator-props"]||(p["x-decorator-props"]={}),Object.keys(l).forEach(e=>{c.decoratorProps[e]=l[e],p["x-decorator-props"][e]=l[e]})),"x-component-props"===t&&(c.componentProps||(c.componentProps={}),p["x-component-props"]||(p["x-component-props"]={}),Object.keys(l).forEach(e=>{c.componentProps[e]=l[e],p["x-component-props"][e]=l[e]}))})};if("string"==typeof e){let n={};return AM()(n,e,t),l(n)}l(e),u()},[f]),shallowMerge:(0,O.useCallback)(e=>{f.shallowMerge(e)},[f]),deepMerge:(0,O.useCallback)(e=>{f.deepMerge(e)},[f]),remove:(0,O.useCallback)((e,t)=>{f.remove(e,t)},[f]),insertAdjacent:(0,O.useCallback)((e,t,l)=>{f.insertAdjacent(e,t,l)},[f]),insertBeforeBegin:(0,O.useCallback)(e=>{f.insertBeforeBegin(e)},[f]),insertAfterBegin:(0,O.useCallback)(e=>{f.insertAfterBegin(e)},[f]),insertBeforeEnd:(0,O.useCallback)(e=>{f.insertBeforeEnd(e)},[f]),insertAfterEnd:(0,O.useCallback)(e=>{f.insertAfterEnd(e)},[f])}}let AU=()=>void 0,AW=(e,t,l)=>{let n;return rM().isFunction(e)?n=e:(n=t[e])||console.error(`${l} is not registered`),n||AU},AH=(e,t)=>{let l;if(!e)return AU;if(rM().isFunction(e))return e;for(let n of e.split("."))l=AW(n,l||t,e);return l};function AG(e,t){return AH(e,(0,l7.useExpressionScope)())(t)}function AY(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=t.displayName||e.displayName||e.name,n=t=>{let{dn:l,findComponent:o}=AK(),r=AG((0,O.useMemo)(()=>{let e=l.getSchemaAttribute("x-component"),t=l.getSchemaAttribute("x-decorator"),r=l.getSchemaAttribute("x-use-component-props"),i=l.getSchemaAttribute("x-use-decorator-props");return e&&r&&o(e)===n?r:t&&i&&o(t)===n?i:void 0},[l]),t),i=(0,O.useMemo)(()=>({...t,...r}),[r,t]);return(0,E.jsx)(O.Suspense,{fallback:(0,E.jsx)(ny.A,{}),children:(0,E.jsx)(e,{...i,children:t.children})})};return e.displayName=l,n.displayName=`withSchemaProps(${l})`,n}var AJ=l(16933),AX=l(60152);let AQ=new Map;function AZ(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;AQ.set(e.toLowerCase(),t)}function A0(e){return!!e&&AQ.has(e.toLowerCase())}function A1(e){Object.keys(e).forEach(t=>{AZ(t,e[t])})}Object.keys(rb).forEach(e=>{AZ(e,rb[e])});let A2=e=>{let{type:t="",component:l,...n}=e;if(l)return(0,E.jsx)(AJ.A,{component:l,...n});if(t&&AQ.has(t.toLowerCase())){let e=AQ.get(t.toLowerCase());return(0,E.jsx)(e,{...n})}return t&&o?(0,E.jsx)(o,{type:t}):null};A2.createFromIconfontCN=e=>{o=(0,AX.A)(e)},A2.register=e=>{A1(e)};let A8=(0,O.createContext)(null),A5=e=>{let{children:t,parent:l}=e;return(0,E.jsx)(A8.Provider,{value:{parent:l},children:t})},A4=()=>{let e=O.useContext(A8);return null==e?void 0:e.parent};class A3{setData(e){this.data=e}setParentRecord(e){this.parentRecord=e}constructor(e){const{data:t,parentRecord:l,isNew:n}=e;this.isNew=n,this.data=t,this.parentRecord=l}}let A6=(0,O.createContext)(null);A6.displayName="CollectionRecordContext";let A9=O.memo(e=>{let{isNew:t,record:l,parentRecord:n,children:o}=e,r=(0,O.useMemo)(()=>n?n instanceof A3?n:new A3({data:n}):l instanceof A3?l.parentRecord:void 0,[n,l]),i=(0,O.useMemo)(()=>{let e;return l?l instanceof A3?(e=l).isNew=l.isNew||t:e=new A3({data:l,isNew:t}):e=new A3({isNew:t}),e.setParentRecord(r),e},[l,r,t]);return(0,E.jsx)(A6.Provider,{value:i,children:o})});function A7(){return(0,O.useContext)(A6)}function Pe(){let e=A7();return null==e?void 0:e.data}function Pt(){let e=A7();return null==e?void 0:e.parentRecord}function Pl(){var e;let t=A7();return null==t||null==(e=t.parentRecord)?void 0:e.data}A9.displayName="CollectionRecordProvider";let Pn=O.createContext(null),Po=O.createContext(null),Pr=O.memo(e=>{var t,l;let{t:n}=(0,eU.B)(),o=Pe(),r=eid(),i=Pi();return(0,E.jsx)(Po.Provider,{value:{name:"$nParentPopupRecord",title:n("Parent popup record"),value:(null==(t=e.parent)?void 0:t.recordData)||(null==i?void 0:i.value),collection:(null==(l=e.parent)?void 0:l.collection)||(null==i?void 0:i.collection)},children:(0,E.jsx)(Pn.Provider,{value:{name:"$nPopupRecord",title:n("Current popup record"),value:e.recordData||o,collection:e.collection||r},children:e.children})})});Pr.displayName="VariablePopupRecordProvider";let Pi=()=>O.useContext(Pn),Pa=()=>O.useContext(Po);class Ps{get app(){return this.dataSourceManager.app}get key(){return this.options.key}get displayName(){return this.options.displayName}get status(){return this.options.status}get errorMessage(){return this.options.errorMessage}get collections(){return this.collectionManager.getCollections()||[]}getOptions(){return this.options}setOptions(e){Object.assign(this.options,e)}getOption(e){return this.options[e]}addReloadCallback(e){this.reloadCallbacks.includes(e)||this.reloadCallbacks.push(e)}removeReloadCallback(e){this.reloadCallbacks=this.reloadCallbacks.filter(t=>t!==e)}get flowEngineDataSourceManager(){var e;return null==(e=this.app.flowEngine)?void 0:e.context.dataSourceManager}async reload(){let e=await this.getDataSource(),t=this.flowEngineDataSourceManager;return t&&(t.upsertDataSource(this.options),t.getDataSource(this.key).upsertCollections(e.collections||[],{clearFields:!0})),this.setOptions(e),this.collectionManager.setCollections(e.collections||[]),this.reloadCallbacks.forEach(t=>t(e.collections)),this.options}constructor(e,t){this.options=e,this.dataSourceManager=t,this.reloadCallbacks=[],this.collectionManager=new eim(e.collections,this)}}class Pd extends Ps{getDataSource(){return{collections:this.collections}}}class Pu{addCollectionTemplates(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.reduce((e,t)=>{let l=new t(this);return e[l.name]=l,e},{});return Object.assign(this.collectionTemplateInstances,t),this.dataSourceManager.getDataSources().forEach(e=>{let l=e.collectionManager.getCollections(e=>t[e.template]);e.collectionManager.reAddCollections(l)}),t}getCollectionTemplate(e){return this.collectionTemplateInstances[e]}getCollectionTemplates(e){return Object.values(this.collectionTemplateInstances).filter(t=>{var l,n;return!e||!t.supportDataSourceType&&!t.notSupportDataSourceType||(t.supportDataSourceType?null==(l=t.supportDataSourceType)?void 0:l.includes(e):t.notSupportDataSourceType?!(null==(n=t.notSupportDataSourceType)?void 0:n.includes(e)):void 0)}).sort((e,t)=>(e.order||0)-(t.order||0))}constructor(e,t){this.dataSourceManager=t,this.collectionTemplateInstances={},this.addCollectionTemplates(e)}}var Pc=l(84795);let Pp=v$()(),Pm=(0,k.css)`
|
|
1027
|
+
`,defaultValue:"h:mm a",formats:["hh:mm:ss a","HH:mm:ss"],timeFormat:!0},default:"HH:mm:ss",enum:[{label:(0,CJ.b)({format:"hh:mm:ss a"}),value:"hh:mm:ss a"},{label:(0,CJ.b)({format:"HH:mm:ss"}),value:"HH:mm:ss"},{label:"custom",value:"custom"}]}},C3={type:"array",title:'{{t("Options")}}',"x-decorator":"FormItem","x-component":"ArrayTable","x-component-props":{pagination:{pageSize:1e3}},items:{type:"object",properties:{column1:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:50,title:"",align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},column2:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:'{{t("Option value")}}'},properties:{value:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},column3:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:'{{t("Option label")}}'},properties:{label:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},column4:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:'{{t("Color")}}'},properties:{color:{type:"string","x-decorator":"FormItem","x-component":"ColorSelect"}}},column5:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:"",dataIndex:"operations",fixed:"right"},properties:{item:{type:"void","x-component":"FormItem",properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}}}},properties:{add:{type:"void","x-component":"ArrayTable.Addition","x-component-props":{randomValue:!0},title:"{{t('Add option')}}"}}},C6={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input","x-validator":"uid",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"}},C9={type:"string",title:'{{t("Options")}}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!0},enum:"{{collections}}"};class C7{addComponentOption(e){if(!this.componentOptions){var t,l,n,o,r,i;this.componentOptions=[];let e=null==(l=this.default)||null==(t=l.uiSchema)?void 0:t["x-component"],a=null==(o=this.default)||null==(n=o.uiSchema)?void 0:n["x-component-props"];if(e){let t=(null==(i=this.default)||null==(r=i.uiSchema)?void 0:r.type)||"string",l=(0,er.tval)(e.startsWith("Input")?(0,B.capitalize)(t):e.split(".").pop());this.componentOptions=[{label:l,value:e,useProps:()=>a||{}}]}}this.componentOptions.push(e)}getConfigureFormProperties(e){var t,l,n,o;let r=(null==(l=this.configure)||null==(t=l.getConfigureFormProperties)?void 0:t.call(l,e))||(null==(n=this.configure)?void 0:n.properties)||{},i=this.hasDefaultValue?this.getDefaultValueProperty():{},a=null==e?void 0:e.view,s=(null==e?void 0:e.template)==="sql"||(null==e?void 0:e.sql),d=[...new Set([...this.availableValidationOptions,"required"])],u=a||s||!this.validationType?{}:{validation:{title:'{{ t("Validation") }}',required:!1,"x-decorator":"FormItem","x-component":"FieldValidation","x-component-props":{type:this.validationType,availableValidationOptions:d,excludeValidationOptions:[...new Set(this.excludeValidationOptions)],isAssociation:this.isAssociation}}};return{...(0,B.cloneDeep)({...C6,...null==(o=this)?void 0:o.properties,...r}),...i,...u}}getDefaultValueProperty(){var e,t,l,n;return{defaultValue:{...(0,B.cloneDeep)(null==(t=this)||null==(e=t.default)?void 0:e.uiSchema),...null==(n=this)||null==(l=n.properties)?void 0:l.uiSchema,required:!1,title:'{{ t("Default value") }}',"x-decorator":"FormItem"}}}addOperator(e){this.filterable||(0,B.set)(this,"filterable",{});let t=Array.isArray(this.filterable.operatorOverrides)?[...this.filterable.operatorOverrides]:[],l=t.findIndex(t=>t.value===e.value);-1!==l?t[l]=e:t.push(e),(0,B.set)(this,"filterable.operatorOverrides",t),ix(this.filterable)}constructor(e){this.collectionFieldInterfaceManager=e,this.availableValidationOptions=[]}}class Fe extends C7{constructor(...e){super(...e),this.name="checkbox",this.type="object",this.group="choices",this.order=1,this.title='{{t("Checkbox")}}',this.default={type:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},this.availableTypes=["boolean","integer","bigInt","bit"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"boolean"}}}class Ft extends C7{constructor(...e){super(...e),this.name="checkboxGroup",this.type="object",this.group="choices",this.order=5,this.title='{{t("Checkbox group")}}',this.default={interface:"checkboxGroup",type:"array",defaultValue:[],uiSchema:{type:"string","x-component":"Checkbox.Group"}},this.availableTypes=["array","json"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"array"}}}class Fl extends C7{constructor(...e){super(...e),this.name="collection",this.type="string",this.group="advanced",this.order=5,this.title='{{t("Collection selector")}}',this.description='{{t("Providing certain collections as options for users, typically used in polymorphic or inheritance scenarios")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"CollectionSelect"}},this.availableTypes=["string"],this.hasDefaultValue=!1,this.properties={...C6,"uiSchema.enum":C9},this.filterable={operators:"collection"}}}class Fn extends C7{constructor(...e){super(...e),this.name="color",this.type="object",this.group="basic",this.order=10,this.title='{{t("Color")}}',this.default={type:"string",uiSchema:{type:"string","x-component":"ColorPicker"}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"string"}}}class Fo extends C7{constructor(...e){super(...e),this.name="createdAt",this.type="object",this.group="systemInfo",this.order=1,this.title='{{t("Created at")}}',this.sortable=!0,this.default={type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},this.description='{{t("Store the creation time of each record")}}',this.availableTypes=[],this.properties={...C6,...C5},this.filterable={operators:"datetime"},this.titleUsable=!0}}class Fr extends C7{constructor(...e){super(...e),this.name="createdBy",this.type="object",this.group="systemInfo",this.order=3,this.title='{{t("Created by")}}',this.isAssociation=!0,this.default={type:"belongsTo",target:"users",foreignKey:"createdById",uiSchema:{type:"object",title:'{{t("Created by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}},this.availableTypes=["belongsTo"],this.properties={...C6},this.filterable={nested:!0,children:[]},this.description='{{t("Store the creation user of each record")}}'}}class Fi extends C7{constructor(...e){super(...e),this.name="datetime",this.type="object",this.group="datetime",this.order=1,this.title='{{t("Datetime (with time zone)")}}',this.sortable=!0,this.default={type:"date",defaultToCurrentTime:!1,onUpdateToCurrentTime:!1,timezone:!0,uiSchema:{type:"string","x-component":"DatePicker","x-component-props":{showTime:!1,utc:!0}}},this.availableTypes=["date","string","datetime","datetimeTz"],this.hasDefaultValue=!0,this.validationType="date",this.properties={...C6,...C5,defaultToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Default value to current time")}}'},onUpdateToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Automatically update timestamp on update")}}'},"uiSchema.x-component-props.gmt":{type:"boolean",title:'{{t("GMT")}}',"x-hidden":!0,"x-component":"Checkbox","x-content":'{{t("Use the same time zone (GMT) for all users")}}',"x-decorator":"FormItem",default:!1}},this.filterable={operators:"datetime"},this.titleUsable=!0}}class Fa extends C7{constructor(...e){super(...e),this.name="email",this.type="object",this.group="basic",this.order=4,this.title='{{t("Email")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Input","x-validator":"email"}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.validationType="string",this.availableValidationOptions=["min","max","length","email","pattern"],this.properties={...C6,unique:CX},this.filterable={operators:"string"},this.titleUsable=!0}}class Fs extends C7{constructor(...e){super(...e),this.name="icon",this.type="object",this.group="basic",this.order=10,this.title='{{t("Icon")}}',this.default={type:"string",uiSchema:{type:"string","x-component":"IconPicker"}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.properties={...C6}}}class Fd extends C7{constructor(...e){super(...e),this.name="id",this.type="object",this.group="systemInfo",this.order=0,this.title='{{t("ID")}}',this.hidden=!0,this.sortable=!0,this.default={name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0}},this.availableTypes=["bigInt","integer"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,default:"ID","x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"}},this.filterable={operators:"id"},this.description='{{t("Primary key, unique identifier, self growth") }}',this.titleUsable=!0}}let Fu=e=>e,Fc=e=>{if((0,rk.isArr)(e)){for(let t=0;t<e.length;t++)if((0,rk.isValid)(e[t]))return!1;return!0}if(null==e?void 0:e.getCurrentContent){var t;return!(null==(t=e.getCurrentContent())?void 0:t.hasText())}return(0,rk.isEmpty)(e)};(0,CM.registerValidateRules)({username:e=>/^[^@<>"'/]{1,50}$/.test(e)||Fu("Must be 1-50 characters in length (excluding @<>\"'/)"),required:(e,t)=>!1===t.required?"":("string"==typeof e&&(e=e.trim()),Fc(e)?t.message:"")});class Fp extends C7{constructor(...e){super(...e),this.name="input",this.type="object",this.group="basic",this.order=1,this.title='{{t("Single line text")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier")}}',this.sortable=!0,this.default={interface:"input",type:"string",uiSchema:{type:"string","x-component":"Input"}},this.availableTypes=["string","uid"],this.hasDefaultValue=!0,this.validationType="string",this.availableValidationOptions=["min","max","length","pattern"],this.properties={...C6,trim:{type:"boolean","x-content":'{{t("Automatically remove heading and tailing spaces")}}',"x-decorator":"FormItem","x-component":"Checkbox"},layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"string"},this.titleUsable=!0}}(0,rF.registerValidateFormats)({odd:/^-?\d*[13579]$/,even:/^-?\d*[02468]$/});class Fm extends C7{constructor(...e){super(...e),this.name="integer",this.type="object",this.group="basic",this.order=6,this.title='{{t("Integer")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier, self growth")}}',this.sortable=!0,this.default={type:"bigInt",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"},"x-validator":"integer"}},this.availableTypes=["bigInt","integer","sort","snowflakeId"],this.hasDefaultValue=!0,this.validationType="number",this.excludeValidationOptions=["precision"],this.properties={...C6,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}},autoIncrement:CZ},this.filterable={operators:"number"},this.titleUsable=!0}}(0,rF.registerValidateRules)({json(e){try{return JSON.parse(e),!0}catch(e){return{type:"error",message:e.message}}}});class Fh extends C7{constructor(...e){super(...e),this.name="json",this.type="object",this.group="advanced",this.order=4,this.title='{{t("JSON")}}',this.sortable=!1,this.default={type:"json",uiSchema:{type:"object","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5}},default:null}},this.availableTypes=["json","array","set","jsonb","text","circle","lineString","point","polygon"],this.hasDefaultValue=!0,this.properties={...C6,jsonb:{title:"JSONB","x-component":"Checkbox"}},this.configure={items:[{name:"jsonb",title:"JSONB",component:"Checkbox",schema:{"x-content":" "},hidden:e=>{let{context:t}=e,l=t.isDialect;return"function"!=typeof l||!l("postgres")},disabled:e=>{let{context:t}=e;return!!t.disabledJSONB}}]}}}class Ff extends C7{initialize(e){"belongsToMany"===e.type&&(e.through||(e.through=`t_${(0,rk.uid)()}`),e.foreignKey||(e.foreignKey=`f_${(0,rk.uid)()}`),e.otherKey||(e.otherKey=`f_${(0,rk.uid)()}`),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id"))}constructor(...e){super(...e),this.name="m2m",this.type="object",this.group="relation",this.order=6,this.title='{{t("Many to many")}}',this.description='{{t("Many to many description")}}',this.isAssociation=!0,this.default={type:"belongsToMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}},reverseField:{interface:"m2m",type:"belongsToMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}},this.availableTypes=["belongsToMany"],this.validationType="object",this.properties={...C6,type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"string",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{through:{type:"string",title:'{{t("Through collection")}}',description:'{{ t("Generated automatically if left blank") }}',"x-decorator":"FormItem","x-disabled":"{{ !createOnly }}","x-component":"ThroughCollection","x-component-props":{allowClear:!0}}}},col13:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{sourceKey:{type:"string",title:'{{t("Source key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"SourceKey","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key 1")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly||override }}"}}},col23:{type:"void","x-component":"Grid.Col",properties:{}}}},row3:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{}},col22:{type:"void","x-component":"Grid.Col",properties:{otherKey:{type:"string",title:'{{t("Foreign key 2")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly||override }}"}}},col23:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',"x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}",description:"{{t('Field values must be unique.')}}"}}}}}}},...C8},this.filterable={nested:!0,children:[]}}}class Fg extends C7{constructor(...e){super(...e),this.name="m2o",this.type="object",this.group="relation",this.order=5,this.title='{{t("Many to one")}}',this.description='{{t("Many to one description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}},reverseField:{interface:"o2m",type:"hasMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}},this.availableTypes=["belongsTo"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class Fv extends C7{constructor(...e){super(...e),this.name="markdown",this.type="object",this.title='{{t("Markdown")}}',this.group="media",this.default={type:"text",uiSchema:{type:"string","x-component":"Markdown"}},this.availableTypes=["text","json","string"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"bigField"}}}class Fy extends C7{constructor(...e){super(...e),this.name="multipleSelect",this.type="object",this.group="choices",this.order=3,this.title='{{t("Multiple select")}}',this.default={type:"array",defaultValue:[],uiSchema:{type:"array","x-component":"Select","x-component-props":{mode:"multiple"},enum:[]}},this.availableTypes=["array","json"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"array"}}}class Fx extends C7{constructor(...e){super(...e),this.name="number",this.type="object",this.group="basic",this.order=7,this.title='{{t("Number")}}',this.sortable=!0,this.default={type:"double",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"}}},this.availableTypes=["double","float","decimal"],this.hasDefaultValue=!0,this.validationType="number",this.excludeValidationOptions=["integer"],this.properties={type:{type:"string",title:'{{t("Data type")}}',"x-component":"Select","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",default:"double",enum:[{label:'{{t("Double")}}',value:"double"},{label:'{{t("Float")}}',value:"float"},{label:'{{t("Decimal")}}',value:"decimal"}]},...C6,unique:CX,"uiSchema.x-component-props.step":{type:"string",title:'{{t("Precision(UI)")}}',"x-component":"Select","x-decorator":"FormItem",default:"1",enum:[{value:"1",label:"1"},{value:"0.1",label:"1.0"},{value:"0.01",label:"1.00"},{value:"0.001",label:"1.000"},{value:"0.0001",label:"1.0000"},{value:"0.00001",label:"1.00000"},{value:"0.000001",label:"1.000000"},{value:"0.0000001",label:"1.0000000"},{value:"0.00000001",label:"1.00000000"}]},precision:{type:"string",title:'{{t("Precision")}}',"x-component":"InputNumber","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",default:10},scale:{type:"string",title:'{{t("Scale")}}',"x-component":"InputNumber","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",default:2}},this.filterable={operators:"number"},this.titleUsable=!0}}class Fb extends C7{constructor(...e){super(...e),this.name="obo",this.type="object",this.group="relation",this.order=3.1,this.title='{{t("One to one (belongs to)")}}',this.description='{{t("One to one description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}},reverseField:{interface:"oho",type:"hasOne",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}}}},this.availableTypes=["belongsTo"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class Fw extends C7{constructor(...e){super(...e),this.name="o2m",this.type="object",this.group="relation",this.order=4,this.title='{{t("One to many")}}',this.description='{{t("One to many description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"hasMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}},reverseField:{interface:"m2o",type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}}}},this.availableTypes=["hasMany"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection"}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{sourceKey:{type:"string",title:'{{t("Source key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"SourceKey","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}}}},row3:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{}},col22:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',"x-decorator":"FormItem","x-component":"TargetKey","x-disabled":"{{ !createOnly }}",description:"{{t('Field values must be unique.')}}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class FS extends C7{constructor(...e){super(...e),this.name="oho",this.type="object",this.group="relation",this.order=3,this.title='{{t("One to one (has one)")}}',this.description='{{t("One to one description")}}',this.isAssociation=!0,this.validationType="object",this.default={type:"hasOne",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}},reverseField:{interface:"obo",type:"belongsTo",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1}}}},this.availableTypes=["hasOne"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},type:C1,grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection","x-disabled":!0}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{sourceKey:{type:"string",title:'{{t("Source key")}}',description:"{{t('Field values must be unique.')}}","x-decorator":"FormItem","x-component":"SourceKey","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}}}}}},...C2,...C8},this.filterable={nested:!0,children:[]}}}class FC extends C7{constructor(...e){super(...e),this.name="password",this.type="object",this.group="basic",this.order=9,this.title='{{t("Password")}}',this.default={type:"password",hidden:!0,uiSchema:{type:"string","x-component":"Password"}},this.availableTypes=["password","string"],this.hasDefaultValue=!0,this.validationType="string",this.availableValidationOptions=["min","max","length","pattern"],this.properties={...C6,unique:CX},this.filterable={operators:"string"}}}(0,rF.registerValidateRules)({percentMode(e,t){let{maxValue:l,minValue:n}=t;return l&&e>l?{type:"error",message:`${Fu("The field value cannot be greater than ")}${100*l}%`}:!n||!(e<n)||{type:"error",message:`${Fu("The field value cannot be less than ")}${100*n}%`}},percentFormats(e,t){let{percentFormat:l}=t;return!e||"Integer"!==l||!1!==/^-?[1-9]\d*$/.test((100*e).toString())||{type:"error",message:`${Fu("The field value is not an integer number")}`}}});class FF extends C7{constructor(...e){super(...e),this.name="percent",this.type="object",this.group="basic",this.order=8,this.title='{{t("Percent")}}',this.sortable=!0,this.default={type:"float",uiSchema:{type:"string","x-component":"Percent","x-component-props":{stringMode:!0,step:"1",addonAfter:"%"}}},this.availableTypes=["float","double","decimal"],this.hasDefaultValue=!0,this.validationType="number",this.excludeValidationOptions=["integer"],this.properties={...C6,unique:CX,"uiSchema.x-component-props.step":{type:"string",title:'{{t("Precision")}}',"x-component":"Select","x-decorator":"FormItem",default:"1",enum:[{value:"1",label:"1%"},{value:"0.1",label:"1.0%"},{value:"0.01",label:"1.00%"},{value:"0.001",label:"1.000%"},{value:"0.0001",label:"1.0000%"},{value:"0.00001",label:"1.00000%"}]}},this.filterable={operators:"number"},this.titleUsable=!0}}class Fk extends C7{constructor(...e){super(...e),this.name="phone",this.type="object",this.group="basic",this.order=3,this.title='{{t("Phone")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Input","x-component-props":{type:"tel"}}},this.availableTypes=["string"],this.validationType="string",this.availableValidationOptions=["min","max","length","pattern"],this.hasDefaultValue=!0,this.properties={...C6,unique:CX},this.filterable={operators:"string"},this.titleUsable=!0}}class FA extends C7{constructor(...e){super(...e),this.name="radioGroup",this.type="object",this.group="choices",this.order=4,this.title='{{t("Radio group")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Radio.Group"}},this.availableTypes=["string","integer","boolean","integer"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"enumType"},this.titleUsable=!0}}class FP extends C7{constructor(...e){super(...e),this.name="richText",this.type="object",this.group="media",this.order=2,this.title='{{t("Rich Text")}}',this.default={interface:"richText",type:"text",uiSchema:{type:"string","x-component":"RichText"}},this.availableTypes=["text","json","string"],this.hasDefaultValue=!0,this.properties={...C6},this.filterable={operators:"bigField"}}}class Fj extends C7{constructor(...e){super(...e),this.name="select",this.type="object",this.group="choices",this.order=2,this.title='{{t("Single select")}}',this.sortable=!0,this.default={type:"string",uiSchema:{type:"string","x-component":"Select",enum:[]}},this.availableTypes=["string","bigInt","boolean"],this.hasDefaultValue=!0,this.properties={...C6,"uiSchema.enum":C3},this.filterable={operators:"enumType"},this.titleUsable=!0}}class FM extends C7{constructor(...e){super(...e),this.name="snowflakeId",this.type="object",this.group="advanced",this.order=0,this.title='{{t("Snowflake ID (53-bit)")}}',this.primaryKeyDescription='{{t("Primary key, distributed uniqueness, time-ordering")}}',this.hidden=!1,this.sortable=!0,this.default={type:"snowflakeId",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,separator:"0.00",step:"1"},"x-validator":"integer"}},this.availableTypes=["snowflakeId"],this.properties={...C6,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"number"},this.description='{{t("A 53-bit Snowflake ID designed to be compatible with JavaScript’s safe integer range, providing both time-ordering and uniqueness.") }}',this.titleUsable=!0}}class FI extends C7{constructor(...e){super(...e),this.name="tableoid",this.type="object",this.group="systemInfo",this.order=0,this.title='{{t("Table OID")}}',this.sortable=!0,this.default={name:"__collection",type:"virtual",uiSchema:{type:"string",title:'{{t("Table OID")}}',"x-component":"CollectionSelect","x-component-props":{isTableOid:!0},"x-read-pretty":!0}},this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Input"}},this.filterable={operators:"tableoid"}}}class FT extends C7{constructor(...e){super(...e),this.name="textarea",this.type="object",this.group="basic",this.order=2,this.title='{{t("Long text")}}',this.default={interface:"textarea",type:"text",uiSchema:{type:"string","x-component":"Input.TextArea"}},this.availableTypes=["text","json","string"],this.validationType="string",this.availableValidationOptions=["min","max","length","case","pattern"],this.hasDefaultValue=!0,this.titleUsable=!0,this.properties={...C6,trim:{type:"boolean","x-content":'{{t("Automatically remove heading and tailing spaces")}}',"x-decorator":"FormItem","x-component":"Checkbox"}},this.filterable={operators:"string"}}}class FR extends C7{constructor(...e){super(...e),this.name="time",this.type="object",this.group="datetime",this.order=4,this.title='{{t("Time")}}',this.sortable=!0,this.default={type:"time",uiSchema:{type:"string","x-component":"TimePicker"}},this.availableTypes=["time"],this.hasDefaultValue=!0,this.properties={...C6,...C4},this.filterable={operators:"time"},this.titleUsable=!0}}class FE extends C7{constructor(...e){super(...e),this.name="updatedAt",this.type="object",this.group="systemInfo",this.order=2,this.title='{{t("Last updated at")}}',this.sortable=!0,this.default={type:"date",field:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},this.description='{{t("Store the last update time of each record")}}',this.availableTypes=[],this.properties={...C6,...C5},this.filterable={operators:"datetime"},this.titleUsable=!0}}class FN extends C7{constructor(...e){super(...e),this.name="updatedBy",this.type="object",this.group="systemInfo",this.order=4,this.title='{{t("Last updated by")}}',this.isAssociation=!0,this.default={type:"belongsTo",target:"users",foreignKey:"updatedById",uiSchema:{type:"object",title:'{{t("Last updated by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}},this.availableTypes=["belongsTo"],this.properties={...C6},this.filterable={nested:!0,children:[]},this.description='{{t("Store the last update user of each record")}}'}}class FD extends C7{constructor(...e){super(...e),this.name="url",this.type="string",this.group="basic",this.order=5,this.title='{{t("URL")}}',this.default={type:"text",uiSchema:{type:"string","x-component":"Input.URL"}},this.componentOptions=[{label:"URL",value:"Input.URL"},{label:"Preview",value:"Input.Preview"}],this.availableTypes=["string","text"],this.validationType="string",this.availableValidationOptions=["uri","pattern"],this.properties={...C6},this.titleUsable=!0,this.filterable={operators:"string"}}}class FB extends C7{constructor(...e){super(...e),this.name="uuid",this.type="object",this.group="advanced",this.order=0,this.title='{{t("UUID")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier")}}',this.hidden=!1,this.sortable=!0,this.default={type:"uuid",uiSchema:{type:"string","x-component":"Input","x-validator":"uuid"}},this.availableTypes=["uid","uuid"],this.validationType="string",this.availableValidationOptions=["uuid","pattern"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":"{{ !createOnly }}",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},autoFill:C0,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"string"},this.titleUsable=!0}}class F$ extends C7{constructor(...e){super(...e),this.name="nanoid",this.type="object",this.group="advanced",this.order=0,this.title='{{t("Nano ID")}}',this.primaryKeyDescription='{{t("Primary key, unique identifier")}}',this.hidden=!1,this.sortable=!0,this.default={type:"nanoid",uiSchema:{type:"string","x-component":"NanoIDInput"}},this.availableTypes=["nanoid"],this.properties={"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":"{{ !createOnly }}",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.')}}"},customAlphabet:{type:"string",title:'{{t("Alphabet")}}',default:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz","x-decorator":"FormItem","x-component":"Input"},size:{type:"number",title:'{{t("Length")}}',default:21,"x-decorator":"FormItem","x-component":"InputNumber"},autoFill:C0,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:CQ,unique:CX}}},this.filterable={operators:"string"},this.titleUsable=!0}}class FO extends C7{constructor(...e){super(...e),this.name="unixTimestamp",this.type="object",this.group="datetime",this.order=4,this.title='{{t("Unix Timestamp")}}',this.sortable=!0,this.default={type:"unixTimestamp",accuracy:"second",timezone:!0,defaultToCurrentTime:!1,onUpdateToCurrentTime:!1,uiSchema:{type:"number","x-component":"UnixTimestamp","x-component-props":{showTime:!0}}},this.availableTypes=["unixTimestamp"],this.hasDefaultValue=!1,this.validationType="date",this.availableValidationOptions=["timestamp"],this.properties={...C6,...C5,accuracy:{type:"string",title:'{{t("Accuracy")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"second",enum:[{value:"millisecond",label:'{{t("Millisecond")}}'},{value:"second",label:'{{t("Second")}}'}]},defaultToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Default value to current time")}}'},onUpdateToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Automatically update timestamp on update")}}'}},this.filterable={operators:"datetime"},this.titleUsable=!0}}class Fq extends C7{constructor(...e){super(...e),this.name="date",this.type="object",this.group="datetime",this.order=3,this.title='{{t("DateOnly")}}',this.sortable=!0,this.default={type:"dateOnly",uiSchema:{type:"string","x-component":"DatePicker","x-component-props":{dateOnly:!0,showTime:!1}}},this.availableTypes=["dateOnly"],this.hasDefaultValue=!0,this.validationType="date",this.properties={...C6,...C5,"uiSchema.x-component-props.showTime":{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-visible":!1},"uiSchema.x-component-props.timeFormat":{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-visible":!1}},this.filterable={operators:"datetime"},this.titleUsable=!0}}class FL extends C7{constructor(...e){super(...e),this.name="datetimeNoTz",this.type="object",this.group="datetime",this.order=2,this.title='{{t("Datetime (without time zone)")}}',this.sortable=!0,this.default={type:"datetimeNoTz",defaultToCurrentTime:!1,onUpdateToCurrentTime:!1,timezone:!1,uiSchema:{type:"string","x-component":"DatePicker","x-component-props":{showTime:!1,utc:!1}}},this.availableTypes=["string","datetimeNoTz"],this.hasDefaultValue=!0,this.validationType="date",this.properties={...C6,...C5,defaultToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Default value to current server time")}}'},onUpdateToCurrentTime:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Automatically update timestamp to the current server time on update")}}'},"uiSchema.x-component-props.gmt":{type:"boolean",title:'{{t("GMT")}}',"x-hidden":!0,"x-component":"Checkbox","x-content":'{{t("Use the same time zone (GMT) for all users")}}',"x-decorator":"FormItem",default:!1}},this.filterable={operators:"datetime"},this.titleUsable=!0}}function F_(e){if(null==e?void 0:e.filterTargetKey){if(Array.isArray(e.filterTargetKey)){var t;return null==e||null==(t=e.filterTargetKey)?void 0:t[0]}return null==e?void 0:e.filterTargetKey}return(null==e?void 0:e.getPrimaryKey())||"id"}function FV(e,t){var l,n,o,r,i;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=e.interface,d=s?(null==t||null==(n=t.getFieldInterfaceConfigure)||null==(l=n.call(t,s,a.collectionInfo))?void 0:l.default)||(null==t||null==(r=t.getFieldInterface)||null==(o=r.call(t,s))?void 0:o.default):void 0,u=(0,B.merge)({},(0,B.cloneDeep)(d||{}),(0,B.cloneDeep)(e)),c=(0,B.merge)({},(0,B.cloneDeep)((null==d?void 0:d.uiSchema)||{}),(0,B.cloneDeep)(e.uiSchema||{}));return void 0!==e.title&&(c.title=e.title),void 0!==e.options&&(c.enum=(0,B.cloneDeep)(e.options)),void 0!==e.component&&(c["x-component"]=e.component),void 0!==e.componentProps&&(c["x-component-props"]=(0,B.merge)({},(0,B.cloneDeep)((null==d||null==(i=d.uiSchema)?void 0:i["x-component-props"])||{}),(0,B.cloneDeep)(e.componentProps))),delete u.title,delete u.options,delete u.component,delete u.componentProps,Object.keys(c).length&&(u.uiSchema=c),u}function Fz(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return e.map(e=>FV(e,t,l))}let FK=e=>{var t,l,n,o,r,i,a,s,d;let{dataSource:u="main",collections:c,syncOnChange:p=!1,children:m}=e,h=(0,U.n)(),f=(0,O.useRef)(null),g=(0,O.useRef)(null);if(null===f.current){let e=null==(l=h.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,u),r=[];if(e)for(let t of c)null!=(n=e.getCollection)&&n.call(e,t.name)||(null==(o=e.addCollection)||o.call(e,t),r.push(t));f.current=r,g.current=c}else if(p&&g.current!==c){let e=null==(i=h.dataSourceManager)||null==(r=i.getDataSource)?void 0:r.call(i,u);if(e){let t=new Set(c.map(e=>e.name)),l=new Map(f.current.map(e=>[e.name,e]));for(let n of l.keys())t.has(n)||null==(a=e.removeCollection)||a.call(e,n);let n=[];for(let t of c){let o=l.get(t.name);if(o){n.push(o);continue}null!=(s=e.getCollection)&&s.call(e,t.name)||(null==(d=e.addCollection)||d.call(e,t),n.push(t))}f.current=n}g.current=c}return(0,O.useEffect)(()=>{var e;let t=e=>{var t,l,n,o,r;let i=null==(t=e.detail)?void 0:t.dataSourceKey;if(i!==u&&"*"!==i)return;let a=null==(n=h.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u);if(a&&f.current)for(let e of f.current)null!=(o=a.getCollection)&&o.call(a,e.name)||null==(r=a.addCollection)||r.call(a,e)};return null==(e=h.eventBus)||e.addEventListener("dataSource:loaded",t),()=>{var e,l,n,o;null==(e=h.eventBus)||e.removeEventListener("dataSource:loaded",t);let r=null==(n=h.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u),i=f.current??[];if(f.current=null,g.current=null,r)for(let e of i)null==(o=r.removeCollection)||o.call(r,e.name)}},[h,u]),(0,E.jsx)(E.Fragment,{children:m})};var FU=l(30872),FW=l.n(FU),FH=l(88055),FG=l.n(FH),FY=l(90179),FJ=l.n(FY);let FX=(0,O.createContext)(null);FX.displayName="APIClientContext";let FQ=(0,O.createContext)(null);FQ.displayName="ApplicationContext";let FZ=()=>{var e;let t=(0,O.useContext)(FQ),l=(0,D.useFlowEngine)({throwError:!1});return(null==l||null==(e=l.context)?void 0:e.app)||t||{}};function F0(){let e=FZ();return(0,O.useContext)(FX)||e.apiClient}var F1=l(89412),F2=l(14744),F8=l.n(F2),F5=l(63375),F4=l.n(F5);function F3(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(t=>e.propertyIsEnumerable(t)):[]}function F6(e){return Object.keys(e).concat(F3(e))}let F9=new Map;function F7(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return F6(t).forEach(n=>{let o=l[n],r=F9.get("deepMerge");"function"==typeof o?r=o:"string"==typeof o&&F9.has(o)&&(r=F9.get(o)),e[n]=r(e[n],t[n])}),e}function ke(e){let t,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[n,o]=(0,F1.A)({}),r=F0();t="function"==typeof e?e:e?async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{resource:l,url:n}=e,o=FG()(e);l||n?(o.params=o.params||{},F7(o.params,t)):o=(0,rk.merge)(o,t);let i=await r.request(o);return null==i?void 0:i.data}:async()=>{};let i={...l,onSuccess(){for(var e,t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];null==(e=l.onSuccess)||e.call(l,...n),l.uid&&(r.services[l.uid]=a)}},a=(0,o8.A)(t,i);return(0,O.useMemo)(()=>({...a,state:n,setState:o}),[a,o,n])}function kt(e,t){return F0().resource(e,t)}F9.set("overwrite",(e,t)=>t),F9.set("andMerge",(e,t)=>{if(e||t)return e?t?{$and:[e,t]}:e:t}),F9.set("orMerge",(e,t)=>{if(e||t)return e?t?{$or:[e,t]}:e:t}),F9.set("deepMerge",(e,t)=>(0,er.isPlainObject)(e)&&(0,er.isPlainObject)(t)?F8()(e,t,{arrayMerge:(e,t)=>t}):t),F9.set("merge",(e,t)=>(0,er.isPlainObject)(e)&&(0,er.isPlainObject)(t)?Object.assign(e,t):t),F9.set("union",(e,t)=>("string"==typeof e&&(e=e.split(",")),"string"==typeof t&&(t=t.split(",")),F4()((e||[]).concat(t||[])))),F9.set("intersect",(e,t)=>("string"==typeof e&&(e=e.split(",")),"string"==typeof t&&(t=t.split(",")),Array.isArray(e)&&0!==e.length)?Array.isArray(t)&&0!==t.length?e.filter(e=>t.includes(e)):e||[]:t||[]);var kl=l(76511);function kn(e,t,l){var n;(null==t?void 0:t.length)&&l[e]({message:null==(n=t.map)?void 0:n.call(t,(e,t)=>O.createElement("div",{key:`${t}_${e.message}`},"string"==typeof e?e:e.message))})}let ko=(e,t)=>{var l;let n=new FileReader;n.readAsText(null==e||null==(l=e.response)?void 0:l.data,"utf-8"),n.onload=function(){kn("error",JSON.parse(n.result).errors,t)}};function kr(e){let t=Math.floor(Math.abs(e)),l=Math.abs(e%1*60);return(e>=0?"+":"-")+(t<10?"0":"")+t+":"+(l<10?"0":"")+l}let ki=()=>kr(-(new Date().getTimezoneOffset()/60)),ka=new Map;class ks extends A.APIClient{get notification(){var e,t;return(null==(t=this.app)||null==(e=t.context)?void 0:e.notification)||kl.Ay}cloneInstance(){let e=new ks(this.options);e.options=this.options,e.services=this.services,e.storage=this.storage,e.app=this.app,e.auth=this.auth,e.storagePrefix=this.storagePrefix;let t=[];for(let n of this.axios.interceptors.response.handlers){var l;(null==n||null==(l=n.rejected)?void 0:l._name)==="handleNotificationError"?t.push({...n,rejected:e.handleNotificationError.bind(e)}):t.push(n)}return e.axios.interceptors.response.handlers=t,e}getHostname(){var e,t;try{return new URL("/api/").hostname}catch(e){}return null==(t=window)||null==(e=t.location)?void 0:e.hostname}getHeaders(){var e;let t=super.getHeaders(),l=null==(e=this.app)?void 0:e.getName();return l&&(t["X-App"]=l),t["X-Timezone"]=ki(),t["X-Hostname"]=this.getHostname(),t}service(e){return this.services[e]}interceptors(){this.axios.interceptors.request.use(e=>{e.headers["X-With-ACL-Meta"]=!0;let t=this.getHeaders();return Object.keys(t).forEach(l=>{(0,A.hasHeaderValue)(e.headers,l)||(e.headers[l]=t[l])}),e}),super.interceptors(),this.useNotificationMiddleware(),this.axios.interceptors.response.use(e=>e,e=>{let t=this.toErrMessages(e);throw t.find(e=>"ROLE_NOT_FOUND_ERR"===e.code)&&(this.auth.setRole(null),window.location.reload()),t.find(e=>"TOKEN_INVALID"===e.code||"USER_LOCKED"===e.code)&&this.auth.setToken(null),t.find(e=>"ROLE_NOT_FOUND_FOR_USER"===e.code)&&(this.auth.setRole(null),window.location.reload()),e})}toErrMessages(e){var t,l,n,o,r,i,a,s,d,u,c;if("string"==typeof(null==e||null==(t=e.response)?void 0:t.data)){let t=document.createElement("div");t.innerHTML=null==e||null==(d=e.response)?void 0:d.data;let l=t.textContent||t.innerText;return l.includes("Error occurred while trying")||l.includes("502 Bad Gateway")?[{code:"APP_WARNING",message:l="The application may be starting up. Please try again later."}]:[{message:l}]}return(null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.error)?[null==e||null==(c=e.response)||null==(u=c.data)?void 0:u.error]:(null==e||null==(r=e.response)||null==(o=r.data)?void 0:o.errors)||(null==e||null==(a=e.response)||null==(i=a.data)?void 0:i.messages)||(null==e||null==(s=e.response)?void 0:s.error)||[{message:e.message||"Server error"}]}async handleNotificationError(e){var t,l,n,o,r,i,a,s,d,u;if(this.silence)throw e;let c=null==(t=e.config)?void 0:t.skipNotify;if(c&&("function"==typeof c&&c(e)||!0===c))throw e;let p=null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.redirectTo;if(p)return window.location.href=p;if((null==e||null==(r=e.response)||null==(o=r.data)?void 0:o.type)==="application/json")ko(e,this.notification);else{ka.size>10&&ka.clear();let t=!!(null==e||null==(s=e.response)||null==(a=s.data)||null==(i=a.error)?void 0:i.maintaining);if(this.app.maintaining!==t&&(this.app.maintaining=t),this.app.maintaining)throw this.app.error=null==e||null==(u=e.response)||null==(d=u.data)?void 0:d.error,e;this.app.error&&(this.app.error=null);let l=this.toErrMessages(e);if(0===(l=l.filter(e=>{let t=ka.get(e.message);return!(t&&new Date().getTime()-t<500)&&(ka.set(e.message,new Date().getTime()),!0)})).length)throw e;kn("error",l,this.notification)}throw e}useNotificationMiddleware(){let e=this.handleNotificationError.bind(this);e._name="handleNotificationError",this.axios.interceptors.response.use(e=>{var t,l;return(null==(l=e.data)||null==(t=l.messages)?void 0:t.length)&&kn("success",e.data.messages.filter(e=>{let t=ka.get("string"==typeof e?e:e.message);return!(t&&new Date().getTime()-t<500)&&(ka.set(e.message,new Date().getTime()),!0)}),this.notification),e},e)}silent(){let e=this.cloneInstance();return e.silence=!0,e}constructor(...e){super(...e),this.services={},this.silence=!1}}let kd=e=>{let{apiClient:t,children:l}=e;return(0,E.jsx)(FX.Provider,{value:t,children:l})};class ku{get fields(){return this.options.fields||[]}get app(){return this.collectionManager.app}get dataSource(){return this.options.dataSource}get sourceKey(){return this.options.sourceKey}get name(){return this.options.name}get key(){return this.options.key}get title(){return this.options.title}get inherit(){return this.options.inherit}get hidden(){return this.options.hidden}get description(){return this.options.description}get duplicator(){return this.options.duplicator}get category(){return this.options.category}get targetKey(){return this.options.targetKey}get model(){return this.options.model}get createdBy(){return this.options.createdBy}get updatedBy(){return this.options.updatedBy}get logging(){return this.options.logging}get from(){return this.options.from}get rawTitle(){return this.options.rawTitle}getPrimaryKey(){if(this.primaryKey)return this.primaryKey;if(this.options.targetKey)return this.options.targetKey;let e=this.getFields({primaryKey:!0})[0];return this.primaryKey=null==e?void 0:e.name,this.primaryKey}getFilterTargetKey(){return this.filterTargetKey||this.getPrimaryKey()||"id"}get inherits(){return this.options.inherits||[]}get titleField(){return this.hasField(this.options.titleField)?this.options.titleField:this.getPrimaryKey()}get sources(){return this.options.sources||[]}get template(){return this.options.template}get tableName(){return this.options.tableName}get viewName(){return this.options.viewName}get writableView(){return this.options.writableView}get filterTargetKey(){return this.options.filterTargetKey}get sortable(){return this.options.sortable}get autoGenId(){return this.options.autoGenId}get magicAttribute(){return this.options.magicAttribute}get tree(){return this.options.tree}get isThrough(){return this.options.isThrough}get autoCreate(){return this.options.autoCreate}get resource(){return this.options.resource}setOption(e,t){return this.options[e]=t,this}getOptions(){return this.options}getOption(e){return this.options[e]}getFields(e){return e?(0,rj.filter)(this.fields,e):this.fields}getAllFields(e){return this.getFields(e)}getFieldsMap(){return this.fieldsMap||(this.fieldsMap=this.getFields().reduce((e,t)=>(e[t.name]=t,e),{})),this.fieldsMap}getFieldByAssociationName(e){let t=this.getFieldsMap(),[l,...n]=String(e).split("."),o=t[l];if(!o)return;let r=null==o?void 0:o.target;if(!r)return;let i=this.collectionManager.getCollection(r);if(i)return i.getField(n.join("."))}getField(e){if(!e)return;let t=this.getFieldsMap();if(String(e).split(".").length>1){let t=this.getFieldByAssociationName(e);return t||("string"==typeof e&&e.startsWith(`${this.name}.`)?(e=e.replace(`${this.name}.`,""),this.getField(e)):void 0)}return t[e]}hasField(e){return!!this.getField(e)}isTitleField(e){var t;return null==(t=this.app.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface))?void 0:t.titleUsable}isInherited(){return this.inherits.length>0}constructor(e,t){this.options=e,this.collectionManager=t}}let{ConfigContext:kc}=X.Ay,kp=()=>(0,O.useContext)(kc),km=(e,t)=>{let{getPrefixCls:l}=(0,O.useContext)(X.Ay.ConfigContext)||{};if("ConfigContext"in X.Ay)return(null==l?void 0:l(e,null==t?void 0:t.prefixCls))||"";{let l=(null==t?void 0:t.prefixCls)??"ant-";return`${l}${e??""}`}},kh=()=>J.A.useToken(),kf=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Loading...",t=arguments.length>1?arguments[1]:void 0,l=null,n=setTimeout(()=>{l=wd.Ay.loading(e)},100);try{return await t()}finally{null==l||l(),clearTimeout(n)}},kg={...lP},{version:kv,render:ky,unmountComponentAtNode:kx}=kg;try{Number((kv||"").split(".")[0])>=18&&kg.createRoot&&(n=kg.createRoot)}catch(e){}function kb(e){let{__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:t}=kg;t&&"object"==typeof t&&(t.usingClientEntryPoint=e)}let kw="__antd_mobile_root__";function kS(e,t){ky(e,t)}function kC(e,t){kb(!0);let l=t[kw]||n(t);kb(!1),l.render(e),t[kw]=l}function kF(e,t){n?kC(e,t):kS(e,t)}function kk(e){return kx(e)}async function kA(e){return Promise.resolve().then(()=>{var t;null==(t=e[kw])||t.unmount(),delete e[kw]})}function kP(e){return n?kA(e):kk(e)}let kj=(0,N.observable)(new Map),kM=e=>{let t=e=>(e.id&&!kj.has(e.id)&&kj.set(e.id,null),(0,E.jsxs)(O.Fragment,{children:[e.children,(0,E.jsx)(l7.Observer,{children:()=>{if(!e.id)return(0,E.jsx)(E.Fragment,{});let t=kj.get(e.id);return t?(0,lA.createPortal)(t,document.body):(0,E.jsx)(E.Fragment,{})}})]}));return t.defaultProps={id:e},t};function kI(e,t){return{render:function(l){kj.has(t)?kj.set(t,null==l?void 0:l()):e&&kF((0,E.jsx)(O.Fragment,{children:null==l?void 0:l()}),e)},unmount:function(){if(kj.has(t)&&kj.set(t,null),e&&kP(e)&&e.parentNode){var l;null==(l=e.parentNode)||l.removeChild(e)}}}}let kT=(e,t)=>{let{fontFamily:l,fontSize:n}=e,o=`[class^="${t}"], [class*=" ${t}"]`;return{[o]:{fontFamily:l,fontSize:n,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[o]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}},kR=(e,t)=>l=>{let{theme:n,token:o,hashId:r}=kh(),{getPrefixCls:i,iconPrefixCls:a}=kp(),s=km(e),d=i(),u=(0,rx.useStyleRegister)({theme:n,token:o,hashId:r,path:["formily-antd",e,s,a]},()=>{let e=`.${s}`,n=t((0,rk.merge)(o,{componentCls:e,prefixCls:s,iconCls:`.${a}`,antCls:`.${d}`}),l,{hashId:r,prefixCls:s,rootPrefixCls:d,iconPrefixCls:a});return[kT(o,s),n]});return{wrapSSR:(0,O.useMemo)(()=>u,[n,o,r,s,a,d,l]),hashId:r,componentCls:s,rootPrefixCls:d}};var kE=l(38221),kN=l.n(kE);let kD=(0,O.createContext)(null);kD.displayName="DataSourceManagerContext";let kB=e=>{let{children:t,dataSourceManager:l}=e;return(0,E.jsx)(kD.Provider,{value:l,children:t})};function k$(){return(0,O.useContext)(kD)}function kO(){let e=k$();return{getAllCollectionsInheritChain:(0,O.useCallback)((t,l)=>{var n,o,r;return null==e||null==(r=e.getDataSource(l))||null==(o=r.collectionManager)||null==(n=o.getCollection(t))?void 0:n.getInheritChain()},[e])}}var kq=l(68870);let kL=(0,O.createContext)(null);kL.displayName="DataSourceContext";let k_=e=>{let{children:t,dataSource:l}=e,n=k$(),{t:o}=(0,eU.B)(),{refresh:r}=Ts(),[i,a]=O.useState(0),s=null==n?void 0:n.getDataSource(l);return s?"loading-failed"===s.status?(0,E.jsx)(er7,{type:"Data Source",name:s.displayName||l,message:s.errorMessage||"loading failed"}):"loading"===s.status||"reloading"===s.status?(0,E.jsx)(elN,{children:(0,E.jsx)(ez.Ay,{icon:(0,E.jsx)(kq.A,{}),title:`${s.displayName||l} ${o("data source")} ${o("loading")}...`,extra:(0,E.jsx)(eK.Ay,{type:"primary",onClick:()=>s.reload().then(()=>{r(),a(Math.random())}),children:o("Refresh")})})}):(0,E.jsx)(kL.Provider,{value:s,children:t}):(0,E.jsx)(er7,{type:"Data Source",name:l})};function kV(){return(0,O.useContext)(kL)}function kz(){let e=(0,O.useContext)(kL);return null==e?void 0:e.key}let kK=(0,O.createContext)(null);kK.displayName="ExtendCollectionsContext";let kU=e=>{let{children:t,collections:l}=e,n=kW(),o=(0,O.useMemo)(()=>n?[...n,...l]:l,[n,l]),r=kz();return(0,E.jsx)(kK.Provider,{value:o,children:(0,E.jsx)(kY,{dataSource:r,children:t})})};function kW(){return(0,O.useContext)(kK)}let kH=(0,O.createContext)(null);kH.displayName="CollectionManagerContext";let kG=e=>{let{instance:t,children:l}=e,n=kV(),o=kW(),r=(0,O.useMemo)(()=>t||(null==n?void 0:n.collectionManager),[t,n]),[i,a]=O.useState(Math.random());(0,O.useEffect)(()=>{r.dataSource.addReloadCallback(()=>{a(Math.random())})},[r]);let s=(0,O.useMemo)(()=>{let e=r;return(null==o?void 0:o.length)?e.clone(o):e},[r,o,i]);return(0,E.jsx)(kH.Provider,{value:s,children:l})},kY=e=>{let{instance:t,dataSource:l,children:n}=e;return(0,E.jsx)(k_,{dataSource:l,children:(0,E.jsx)(kG,{instance:t,children:n})})};function kJ(){return(0,O.useContext)(kH)}let kX=e=>{let t=kJ();return(0,O.useMemo)(()=>t.getCollections(e),[t,e])},kQ=(0,O.createContext)({});kQ.displayName="SchemaComponentContext.Provider";let kZ=()=>(0,O.useContext)(l7.SchemaOptionsContext)||{},k0=(0,O.memo)(e=>{let{children:t}=e,l=kZ(),n=(0,O.useMemo)(()=>({...l.components,...e.components}),[l.components,e.components]),o=(0,O.useMemo)(()=>({...l.scope,...e.scope}),[l.scope,e.scope]),r=(0,O.useMemo)(()=>({scope:o,components:n}),[o,n]);return(0,E.jsx)(l7.SchemaOptionsContext.Provider,{value:r,children:(0,E.jsx)(l7.SchemaComponentsContext.Provider,{value:n,children:(0,E.jsx)(l7.ExpressionScope,{value:o,children:t})})})});function k1(e){return l7.Schema.isSchemaInstance(e)?e:new l7.Schema((null==e?void 0:e.name)?{type:"object",properties:{[e.name]:e},name:`p_${e.name}`}:e)}k0.displayName="SchemaComponentOptions";let k2=e=>(0,O.useMemo)(()=>k1(e),[]),k8=(0,O.createContext)({onChange:rM().noop}),k5=(0,O.memo)(e=>{let{components:t,scope:l,schema:n,distributed:o,onChange:r,parentSchema:i,...a}=e,s=(0,O.useContext)(kQ),d=(0,O.useMemo)(()=>k1(n),[n]),u=(0,O.useMemo)(()=>({...s,distributed:!1!=s.distributed&&o,refresh:s.refresh||rM().noop}),[s,o]),{onChange:c}=(0,O.useContext)(k8),p=(0,O.useMemo)(()=>({onChange:()=>{null==r||r(d),null==c||c()}}),[r,c,d]);return(0,E.jsx)(k8.Provider,{value:p,children:(0,E.jsx)(kQ.Provider,{value:u,children:(0,E.jsx)(k0,{inherit:!0,components:t,scope:l,children:(0,E.jsx)(Ak,{...a,schema:d,isUseFormilyField:!0,parentSchema:i})})})})});k5.displayName="RecursionSchemaComponent";let k4=(0,O.memo)(e=>{let{schema:t,parentSchema:l,...n}=e,o=k2(t);return(0,E.jsx)(k5,{...n,schema:o,parentSchema:l})});k4.displayName="MemoizedSchemaComponent";let k3=(0,O.memo)(e=>{let{memoized:t,...l}=e;return t?(0,E.jsx)(k4,{...l}):(0,E.jsx)(k5,{...l})});k3.displayName="SchemaComponent";let k6=Object.freeze({}),k9={},k7=e=>/{{.*?}}/g.test(e),Ae=function(){let{noCache:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{noCache:!1},t=(0,O.useContext)(l7.SchemaOptionsContext),l=(0,O.useContext)(l7.SchemaExpressionScopeContext);return(n,o)=>{let r,i=!1;if("string"==typeof n&&n.startsWith("{{")&&(i=!0,r=n),n&&"object"==typeof n&&!(0,O.isValidElement)(n)){try{r=JSON.stringify(n)}catch(e){return console.warn("Failed to stringify:",e),n}if(k9[r])return k9[r];i=k7(r)}if(Array.isArray(n)){try{r=JSON.stringify(n)}catch(e){return console.warn("Failed to stringify:",e),n}if(k9[r])return k9[r];i=k7(r)}if(i){let i={...null==t?void 0:t.scope,...l,...o};if(!r)return l7.Schema.compile(n,i);try{if(e)return l7.Schema.compile(n,i);return k9[r]=k9[r]||l7.Schema.compile(n,i),k9[r]}catch(e){return console.log("useCompile error",n,e),l7.Schema.compile(n,i)}}return n}},At=(e,t)=>{if((e||t)&&!(0,rk.isFn)(e))return(0,E.jsxs)(O.Fragment,{children:[e,t]})},Al=e=>e&&("object"==typeof e||"function"==typeof e),An=(e,t,l)=>(0,rk.isFn)(e)?e(t,l):e,Ao=e=>{let t,l=(0,O.useContext)(l7.SchemaComponentsContext),n=e.field,o=At(An(e.children,n,n.form),n.content??n.componentProps.children);if("visible"!==n.display)return null;let r=e=>Al(e)?e:rk.FormPath.getIn(l,e)??e;return t=n.componentType?O.createElement(r(n.componentType),{...n.componentProps,value:n.value},o):o,n.decoratorType?O.createElement(r(n.decoratorType),n.decoratorProps,t):(0,E.jsx)(O.Fragment,{children:t})};Ao.displayName="NocoBaseReactiveInternal";let Ar=Ao;function Ai(e){return new Aa(e)}Ar.displayName="NocoBaseReactiveField";class Aa{initialize(){var e,t,l,n,o,r,i,a,s,d,u,c,p,m,h,f,g,v,y,x;let b=this.props.compile;this.pattern="readPretty",this.readPretty=!0,this.initialized=!0,this.loading=!1,this.validating=!1,this.submitting=!1,this.selfModified=!1,this.active=!1,this.visited=!0,this.mounted=!0,this.unmounted=!1,this.inputValues=[],this.inputValue=null,this.feedbacks=[],this.title=b(this.props.title||(null==(e=this.props.schema)?void 0:e.title)),this.description=b(this.props.description||(null==(t=this.props.schema)?void 0:t.description)),this.display="visible",this.editable=this.props.editable||(null==(l=this.props.schema)?void 0:l["x-editable"]),this.disabled=this.props.disabled||(null==(n=this.props.schema)?void 0:n["x-disabled"]),this.readOnly=this.props.readOnly||(null==(o=this.props.schema)?void 0:o["x-read-only"]),this.visible=this.props.visible||(null==(r=this.props.schema)?void 0:r["x-visible"]),this.hidden=this.props.hidden||(null==(i=this.props.schema)?void 0:i["x-hidden"]),this.dataSource=b(this.props.dataSource||(null==(a=this.props.schema)?void 0:a.enum)),this.validator=this.props.validator,this.required=this.props.required||!!(null==(s=this.props.schema)?void 0:s.required),this.content=b(this.props.content||(null==(d=this.props.schema)?void 0:d["x-content"])),this.initialValue=b(this.props.initialValue||(null==(u=this.props.schema)?void 0:u.default)),this.value=b(this.props.value),this.data=this.props.data||(null==(c=this.props.schema)?void 0:c["x-data"]),this.decorator=this.props.decorator?(0,rk.toArr)(this.props.decorator):[null==(p=this.props.schema)?void 0:p["x-decorator"],null==(m=this.props.schema)?void 0:m["x-decorator-props"]],this.component=this.props.component?(0,rk.toArr)(this.props.component):[null==(h=this.props.schema)?void 0:h["x-component"],null==(f=this.props.schema)?void 0:f["x-component-props"]],this.decoratorProps=(null==(g=this.props.schema)?void 0:g["x-decorator-props"])||{},this.componentProps=(null==(v=this.props.schema)?void 0:v["x-component-props"])||{},this.decoratorType=null==(y=this.props.schema)?void 0:y["x-decorator"],this.componentType=null==(x=this.props.schema)?void 0:x["x-component"],this.path={},this.form={},this.address={concat:rM().noop}}constructor(e){this.props=e,this.initialize()}}let As=e=>{let t=Ae(),l=(0,l7.useFieldSchema)(),n=(0,O.useMemo)(()=>Ai({...e,compile:t}),[]);return Object.assign(n.componentProps,l["x-component-props"]),n.value=e.value,(0,E.jsx)(l7.FieldContext.Provider,{value:n,children:(0,E.jsx)(Ar,{field:n,children:e.children})})},Ad=O.createContext({}),Au=O.createContext(rM().noop),Ac=e=>{let{children:t,refresh:l}=e,n=Af(),o=(0,O.useCallback)(e=>{l(),(null==e?void 0:e.refreshParentSchema)&&(null==n||n())},[n,l]);return(0,E.jsx)(Au.Provider,{value:o,children:t})},Ap=O.createContext(rM().noop),Am=e=>{let{children:t,refresh:l}=e;return(0,E.jsx)(Ap.Provider,{value:l,children:t})},Ah=()=>O.useContext(Ap),Af=()=>O.useContext(Au),Ag=()=>O.useContext(Ad)||{},Av=e=>{let{children:t,fieldSchema:l}=e,n=eid(),o=kJ(),r=null==l?void 0:l.name,i=(0,O.useMemo)(()=>{var e;if(!n)return null;let t=null==l||null==(e=l["x-component-props"])?void 0:e.field;return o.getCollectionField(null==l?void 0:l["x-collection-field"])||t||n.getField((null==t?void 0:t.name)||r)},[n,o,l,r]);return(0,E.jsx)(Ad.Provider,{value:i,children:t})},Ay=rM().memoize((e,t)=>e.toFieldProps({scope:t})),Ax=e=>Ay(e,(0,l7.useExpressionScope)()),Ab=e=>{let t=(0,l7.useField)();if(e.onlyRenderProperties){var l;return e.basePath||(null==t||null==(l=t.address)?void 0:l.concat(e.name))}return e.basePath||(null==t?void 0:t.address)},Aw=(e,t,l)=>{let n=e.toJSON();if(l){if(!n.properties)return e;let l=Object.keys(n.properties)[0],o=Object.values(n.properties)[0];return n.properties[l]=(0,rk.merge)(rM().omit(t,"type","x-read-pretty"),o),new l7.Schema(n)}return new l7.Schema((0,rk.merge)(rM().omit(t,"type","x-read-pretty"),n))},AS=e=>{let{schema:t,field:l,basePath:n,mapProperties:o,filterProperties:r,propsRecursion:i,values:a,isUseFormilyField:s}=e,d=l7.Schema.getOrderProperties(t);return d.length?(0,E.jsx)(O.Fragment,{children:d.map((e,t)=>{let{schema:d,key:u}=e,c=(null==l?void 0:l.address)||n,p=d;if((0,rk.isFn)(o)){let e=o(d,u);e&&(p=e)}if((0,rk.isFn)(r)&&!1===r(p,u))return null;let m=(0,rk.isBool)(i)&&i?(0,E.jsx)(Ak,{propsRecursion:!0,filterProperties:r,mapProperties:o,schema:p,name:u,basePath:c,values:rM().get(a,u),isUseFormilyField:s}):(0,E.jsx)(Ak,{schema:p,name:u,basePath:c,values:rM().get(a,u),isUseFormilyField:s});return"CollectionField"===p["x-component"]?(0,E.jsx)(AC.Provider,{value:!0,children:(0,E.jsx)(Av,{fieldSchema:p,children:m})},`${t}-${u}`):(0,E.jsx)(AC.Provider,{value:!1,children:(0,E.jsx)(Ad.Provider,{value:k6,children:m})},`${t}-${u}`)})}):null},AC=O.createContext(!1),AF=()=>O.useContext(AC),Ak=O.memo(e=>{let{schema:t,name:l,onlyRenderProperties:n,onlyRenderSelf:o,mapProperties:r,filterProperties:i,propsRecursion:a,values:s,isUseFormilyField:d=!0,uiSchema:u,parentSchema:c}=e,p=Ab(e),m=(0,O.useRef)(null),h=(0,O.useMemo)(()=>(m.current=null,new l7.Schema(t)),[t]),{uiSchema:f,defaultValue:g}=Ag(),v=(0,SK.A)(),{onChange:y}=(0,O.useContext)(k8),x=m.current||h;if(!x.parent&&c){var b,w;x.parent=c,(null==(w=x.parent)||null==(b=w.properties)?void 0:b[x.name])||!x.name||rM().set(x.parent,`properties.${x.name}`,x)}let S=(0,O.useCallback)(()=>{let e=x.parent;m.current=new l7.Schema(x.toJSON(),e),(null==e?void 0:e.properties)&&Object.keys(e.properties).forEach(t=>{t===x.name&&(e.properties[t]=m.current)}),v(),null==y||y()},[x,y,v]),C=(0,O.useMemo)(()=>u?Aw(x,u,n):f?(f.default=g,Aw(x,f,n)):x,[f,g,x,n,u]),F=Ax(C),k=e=>{if(!o)return AS({schema:x,field:e,basePath:p,mapProperties:r,filterProperties:i,propsRecursion:a,values:s,isUseFormilyField:d})},A=()=>(0,rk.isValid)(l)?"object"===C.type?n?k():(0,E.jsx)(l7.ObjectField,{...F,name:l,basePath:p,children:k}):"array"===C.type?(0,E.jsx)(l7.ArrayField,{...F,name:l,basePath:p}):"void"===C.type?n?k():(0,E.jsx)(l7.VoidField,{...F,name:l,basePath:p,children:k}):d?(0,E.jsx)(l7.Field,{...F,name:l,basePath:p}):(0,E.jsx)(As,{name:l,value:s,initialValue:s,basePath:p,schema:C}):k();return x?(0,E.jsx)(l7.SchemaContext.Provider,{value:x,children:(0,E.jsx)(Ac,{refresh:S,children:A()})}):(0,E.jsx)(O.Fragment,{})});Ak.displayName="NocoBaseRecursionField";var AA=l(58156),AP=l.n(AA),Aj=l(63560),AM=l.n(Aj);let AI=Symbol("LAZY_COMPONENT_KEY"),AT=new Map;function AR(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(0===l.length){let t=(0,O.lazy)(()=>e().then(e=>{let t=e.default;return l[AI]=t,{default:t}})),l=e=>(0,E.jsx)(O.Suspense,{fallback:(0,E.jsx)(ny.A,{}),children:(0,E.jsx)(t,{...e})});return l}return l.reduce((t,l)=>{let n=(0,O.lazy)(()=>e().then(e=>{let n=(0,rj.get)(e,l);return t[l][AI]=n,{default:n}}));return t[l]=e=>(0,E.jsx)(O.Suspense,{fallback:(0,E.jsx)(ny.A,{}),children:(0,E.jsx)(n,{...e})}),t},{})}function AE(e,t){let l="function"==typeof t?t:e=>e[t],n=e.toString(),o=AT.get(n);if(null==o?void 0:o.error)throw o.error;if(null==o?void 0:o.module)return l(o.module);if(!(null==o?void 0:o.promise)){let t=o||{};throw t.promise=e().then(e=>(t.module=e,e)).catch(e=>{throw t.error=e,e}),AT.set(n,t),t.promise}throw o.promise}function AN(e,t){if(e)return e["x-app-version"]||(e["x-app-version"]=t),Object.keys(e.properties||{}).forEach(l=>{var n;AN(null==(n=e.properties)?void 0:n[l],t)}),e}var AD="2.1.38";function AB(e){return new AV(e)}let A$=e=>{e&&(e["x-uid"]||(e["x-uid"]=(0,rk.uid)()),Object.keys(e.properties||{}).forEach(t=>{A$(e.properties[t])}))},AO=e=>e,Aq=(e,t)=>{if(e&&t){for(let l in t)if(Object.prototype.hasOwnProperty.call(t,l)&&t[l]!==(null==e?void 0:e[l]))return!1;return!0}},AL=(e,t)=>{if(e["x-uid"]&&e["x-uid"]===t["x-uid"])return[null,e.toJSON()];let l=e.toJSON(),n={...l,properties:{}},o=null,r=(e,l)=>{Object.keys(e||{}).forEach(n=>{let i=e[n];if(i["x-uid"]===t["x-uid"]){o=e[n];return}l.properties[n]={...i,properties:{}},r(null==i?void 0:i.properties,l.properties[n])})};return r(l.properties,n),[n,o]},A_=e=>e;class AV{get model(){return this.options.model}get query(){return this.options.query}loadAPIClientEvents(){let{api:e,t=A_}=this.options;if(!e)return;let l=e=>{if(!e)return[];let t=Object.values(e.properties).length,l=[];return(e.mapProperties(e=>{e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].width=100/t,e["x-uid"]&&l.push({"x-uid":e["x-uid"],"x-component-props":e["x-component-props"]})}),e["x-uid"]&&l.length)?l:[]};this.on("insertAdjacent",async n=>{var o;let{onSuccess:r,current:i,position:a,schema:s,wrap:d,wrapped:u,removed:c}=n,p=[];if((null==u?void 0:u["x-component"])==="Grid.Col"&&(p=p.concat(l(u.parent))),(null==c?void 0:c["x-component"])==="Grid.Col"&&(p=p.concat(l(c.parent))),this.refresh(),!i["x-uid"])return;let m=await e.request({url:`/uiSchemas:insertAdjacent/${i["x-uid"]}?position=${a}`,method:"post",data:{schema:AN(s,this.appVersion),wrap:d}});p.length&&await e.request({url:"/uiSchemas:batchPatch",method:"post",data:p}),(null==c?void 0:c["x-uid"])&&await e.request({url:`/uiSchemas:remove/${c["x-uid"]}`,method:"post"}),null==r||r(null==m||null==(o=m.data)?void 0:o.data),wd.Ay.success(t("Saved successfully"),.2)}),this.on("patch",async l=>{let{schema:n}=l;this.refresh(),(null==n?void 0:n["x-uid"])&&(await e.request({url:"/uiSchemas:patch",method:"post",data:{...n}}),wd.Ay.success(t("Saved successfully"),.2))}),this.on("initializeActionContext",async t=>{let{schema:l}=t;(null==l?void 0:l["x-uid"])&&await e.request({url:"/uiSchemas:initializeActionContext",method:"post",data:{...l}})}),this.on("batchPatch",async l=>{let{schemas:n}=l;this.refresh(),await e.request({url:"/uiSchemas:batchPatch",method:"post",data:n}),wd.Ay.success(t("Saved successfully"),.2)}),this.on("remove",async n=>{let{removed:o}=n,r=[];(null==o?void 0:o["x-component"])==="Grid.Col"&&(r=l(o.parent)),this.refresh(),(null==o?void 0:o["x-uid"])&&(await e.request({url:`/uiSchemas:remove/${o["x-uid"]}`,method:"post"}),r.length&&await e.request({url:"/uiSchemas:batchPatch",method:"post",data:r}),wd.Ay.success(t("Saved successfully"),.2))})}prepareProperty(e){e.type||(e.type="void"),e.name||(e.name=(0,rk.uid)()),this.current["x-uid"]&&A$(e)}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}async emit(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(!this.events[e])return;let[o,...r]=l;return Promise.all(this.events[e].map(e=>e.bind(this)({current:this.current,...o},...r)))}parentsIn(e){if(!e||!l7.Schema.isSchemaInstance(e))return!1;let t=this.current;for(;null==t?void 0:t.parent;){if(t.parent===e)return!0;t=t.parent}return!1}refresh(e){let{refresh:t}=this.options;return null==t?void 0:t(e)}deepMerge(e){let t={title:"title",description:"description",default:"initialValue",readOnly:"readOnly",writeOnly:"editable",enum:"dataSource","x-pattern":"pattern","x-display":"display","x-validator":"validator","x-decorator":"decorator","x-component":"component","x-reactions":"reactions","x-content":"content","x-visible":"visible","x-hidden":"hidden","x-disabled":"disabled","x-editable":"editable","x-read-only":"readOnly"},l={"x-decorator-props":"decoratorProps","x-component-props":"componentProps","x-data":"data"};Object.keys(e).forEach(n=>{t[n]?(this.current[n]=e[n],this.updateModel(t[n],e[n])):l[n]?Object.keys(e[n]).forEach(t=>{AM()(this.current,[n,t],e[n][t]),this.updateModel([l[n],t],e[n][t])}):this.current[n]=e[n]}),this.emit("patch",{schema:e})}getSchemaAttribute(e,t){return AP()(this.current,e,t)}shallowMerge(e){let t={title:"title",description:"description",default:"initialValue",readOnly:"readOnly",writeOnly:"editable",enum:"dataSource","x-pattern":"pattern","x-display":"display","x-validator":"validator","x-decorator":"decorator","x-component":"component","x-reactions":"reactions","x-content":"content","x-visible":"visible","x-hidden":"hidden","x-disabled":"disabled","x-editable":"editable","x-read-only":"readOnly","x-decorator-props":"decoratorProps","x-component-props":"componentProps","x-data":"data"};Object.keys(e).forEach(l=>{this.current[l]=e[l],t[l]&&this.updateModel(t[l],e[l])}),this.emit("patch",{schema:e})}updateModel(e,t){let l=l=>{AM()(l,e,t)};this.model&&l(this.model),this.query&&this.query.take(l)}insertAdjacent(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(e){case"beforeBegin":return this.insertBeforeBegin(t,l);case"afterBegin":return this.insertAfterBegin(t,l);case"beforeEnd":return this.insertBeforeEnd(t,l);case"afterEnd":return this.insertAfterEnd(t,l)}}recursiveRemoveIfNoChildren(e,t){let l;if(!e)return;let n=e,o=null==t?void 0:t.breakRemoveOn;for(;n;){if("function"==typeof o){if(o(n))break}else if(Aq(n,o))break;if(Object.keys(n.properties||{}).length>0)break;n.parent&&(l=n.parent.removeProperty(n.name)),n=n.parent}return l}remove(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{breakRemoveOn:l,removeParentsIfNoChildren:n}=t,o=e||this.current,r=o.parent.removeProperty(o.name);if(n){let e=this.recursiveRemoveIfNoChildren(o.parent,{breakRemoveOn:l});e&&(r=e)}return this.emit("remove",{removed:r})}removeWithoutEmit(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{breakRemoveOn:l,removeParentsIfNoChildren:n}=t,o=e||this.current,r=o.parent.removeProperty(o.name);if(n){let e=this.recursiveRemoveIfNoChildren(o.parent,{breakRemoveOn:l});e&&(r=e)}return r}insertBeforeBeginOrAfterEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current)||!l7.Schema.isSchemaInstance(e)||this.current.parent!==e.parent)return;let l=0,n=0;return this.current.parent.mapProperties((t,o,r)=>{this.current.name===o&&(n=r),e.name===o&&(l=r)}),l>n?this.insertBeforeBegin(e,t):this.insertAfterEnd(e,t)}insertBeforeBegin(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;let l={onSuccess:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t;if(l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o}))}else e&&(e=FG()(e));let i={},a=!1,s=0,d=0;this.current.parent.mapProperties((e,t)=>{t===this.current.name&&(d=s,a=!0,++s),e["x-index"]=s,++s,a&&(i[t]=e,this.current.parent.removeProperty(t))}),this.prepareProperty(e);let u=n(e),c=this.current.parent.addProperty(u.name||(0,rk.uid)(),u);c["x-index"]=d,c.parent=this.current.parent,this.current.parent.setProperties(i);let[p,m]=AL(c,e);this.emit("insertAdjacent",{position:"beforeBegin",schema:m,wrapped:u,wrap:p,...l})}insertAfterBegin(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;let l={onSuccess:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t;if(l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o}))}else e&&(e=FG()(e));let i={},a=1;this.current.mapProperties((e,t)=>{e["x-index"]=a,++a,i[t]=e}),this.current.properties={},this.prepareProperty(e);let s=n(e),d=this.current.addProperty(s.name||(0,rk.uid)(),s);d["x-index"]=0,d.parent=this.current,this.current.setProperties(i);let[u,c]=AL(d,e);this.emit("insertAdjacent",{position:"afterBegin",schema:c,wrap:u,wrapped:s,...l})}insertBeforeEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;delete e["x-index"];let l={onSuccess:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t;if(l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o}))}else e&&(e=FG()(e));this.prepareProperty(e);let i=n(e),a=this.current.addProperty(i.name||(0,rk.uid)(),i);a.parent=this.current;let[s,d]=AL(a,e);return this.emit("insertAdjacent",{position:"beforeEnd",schema:d,wrap:s,wrapped:i,...l})}insertAfterEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l7.Schema.isSchemaInstance(this.current))return;let l={onSuccess:null==t?void 0:t.onSuccess},{wrap:n=AO,breakRemoveOn:o,removeParentsIfNoChildren:r}=t,i=0,a=0,s=!1,d={};if(this.current.parent.mapProperties((e,t)=>{e["x-index"]=i,t===this.current.name&&(a=++i,s=!0),++i,s&&t!==this.current.name&&(d[t]=e,this.current.parent.removeProperty(t))}),l7.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(l.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:o})),e.parent=null}else e&&(e=FG()(e));this.prepareProperty(e);let u=n(e),c=this.current.parent.addProperty(u.name||(0,rk.uid)(),u);c.parent=this.current.parent,c["x-index"]=a,this.current.parent.setProperties(d);let[p,m]=AL(c,e);this.emit("insertAdjacent",{position:"afterEnd",schema:m,wrap:p,wrapped:u,...l})}constructor(e){this.events={},this.options=e,this.current=e.current,this.appVersion=e.appVersion}}function Az(){let e=(0,O.useContext)(l7.SchemaOptionsContext),t=(0,O.useMemo)(()=>(null==e?void 0:e.components)||{},[e]);return e=>{if(!e)return null;if("string"!=typeof e)return e;let l=AP()(t,e);return l||console.error(`[nocobase]: Component "${e}" not found`),l}}function AK(){let{designable:e,setDesignable:t,refresh:l,reset:n}=(0,O.useContext)(kQ),o=(0,O.useContext)(l7.SchemaOptionsContext),r=(0,O.useMemo)(()=>(null==o?void 0:o.components)||{},[o]),i=(0,O.useMemo)(()=>()=>(0,E.jsx)(E.Fragment,{}),[]),a=(0,SK.A)(),s=Af(),d=Ah(),u=(0,O.useCallback)(e=>{null==l||l(),a(),null==s||s(e),null==d||d()},[l,a,s,d]),c=(0,l7.useField)(),p=(0,l7.useFieldSchema)(),m=F0(),{t:h}=(0,eU.B)(),f=(0,O.useMemo)(()=>AB({t:h,api:m,refresh:u,current:p,model:c,appVersion:AD}),[h,m,u,p,c]);(0,O.useEffect)(()=>{f.loadAPIClientEvents()},[f]);let{isMobileLayout:g}=CS();return{dn:f,designable:!g&&e,reset:n,refresh:u,setDesignable:t,DesignableBar:i,findComponent:(0,O.useCallback)(e=>{if(!e)return null;if("string"!=typeof e)return e;let t=AP()(r,e);return(null==t?void 0:t[AI])??t},[AP()]),on:f.on.bind(f),patch:(0,O.useCallback)((e,t)=>{let l=e=>{Object.keys(e).forEach(t=>{let l=e[t];"title"===t&&(c.title=l,p.title=l),"x-decorator-props"===t&&(c.decoratorProps||(c.decoratorProps={}),p["x-decorator-props"]||(p["x-decorator-props"]={}),Object.keys(l).forEach(e=>{c.decoratorProps[e]=l[e],p["x-decorator-props"][e]=l[e]})),"x-component-props"===t&&(c.componentProps||(c.componentProps={}),p["x-component-props"]||(p["x-component-props"]={}),Object.keys(l).forEach(e=>{c.componentProps[e]=l[e],p["x-component-props"][e]=l[e]}))})};if("string"==typeof e){let n={};return AM()(n,e,t),l(n)}l(e),u()},[f]),shallowMerge:(0,O.useCallback)(e=>{f.shallowMerge(e)},[f]),deepMerge:(0,O.useCallback)(e=>{f.deepMerge(e)},[f]),remove:(0,O.useCallback)((e,t)=>{f.remove(e,t)},[f]),insertAdjacent:(0,O.useCallback)((e,t,l)=>{f.insertAdjacent(e,t,l)},[f]),insertBeforeBegin:(0,O.useCallback)(e=>{f.insertBeforeBegin(e)},[f]),insertAfterBegin:(0,O.useCallback)(e=>{f.insertAfterBegin(e)},[f]),insertBeforeEnd:(0,O.useCallback)(e=>{f.insertBeforeEnd(e)},[f]),insertAfterEnd:(0,O.useCallback)(e=>{f.insertAfterEnd(e)},[f])}}let AU=()=>void 0,AW=(e,t,l)=>{let n;return rM().isFunction(e)?n=e:(n=t[e])||console.error(`${l} is not registered`),n||AU},AH=(e,t)=>{let l;if(!e)return AU;if(rM().isFunction(e))return e;for(let n of e.split("."))l=AW(n,l||t,e);return l};function AG(e,t){return AH(e,(0,l7.useExpressionScope)())(t)}function AY(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=t.displayName||e.displayName||e.name,n=t=>{let{dn:l,findComponent:o}=AK(),r=AG((0,O.useMemo)(()=>{let e=l.getSchemaAttribute("x-component"),t=l.getSchemaAttribute("x-decorator"),r=l.getSchemaAttribute("x-use-component-props"),i=l.getSchemaAttribute("x-use-decorator-props");return e&&r&&o(e)===n?r:t&&i&&o(t)===n?i:void 0},[l]),t),i=(0,O.useMemo)(()=>({...t,...r}),[r,t]);return(0,E.jsx)(O.Suspense,{fallback:(0,E.jsx)(ny.A,{}),children:(0,E.jsx)(e,{...i,children:t.children})})};return e.displayName=l,n.displayName=`withSchemaProps(${l})`,n}var AJ=l(16933),AX=l(60152);let AQ=new Map;function AZ(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;AQ.set(e.toLowerCase(),t)}function A0(e){return!!e&&AQ.has(e.toLowerCase())}function A1(e){Object.keys(e).forEach(t=>{AZ(t,e[t])})}Object.keys(rb).forEach(e=>{AZ(e,rb[e])});let A2=e=>{let{type:t="",component:l,...n}=e;if(l)return(0,E.jsx)(AJ.A,{component:l,...n});if(t&&AQ.has(t.toLowerCase())){let e=AQ.get(t.toLowerCase());return(0,E.jsx)(e,{...n})}return t&&o?(0,E.jsx)(o,{type:t}):null};A2.createFromIconfontCN=e=>{o=(0,AX.A)(e)},A2.register=e=>{A1(e)};let A8=(0,O.createContext)(null),A5=e=>{let{children:t,parent:l}=e;return(0,E.jsx)(A8.Provider,{value:{parent:l},children:t})},A4=()=>{let e=O.useContext(A8);return null==e?void 0:e.parent};class A3{setData(e){this.data=e}setParentRecord(e){this.parentRecord=e}constructor(e){const{data:t,parentRecord:l,isNew:n}=e;this.isNew=n,this.data=t,this.parentRecord=l}}let A6=(0,O.createContext)(null);A6.displayName="CollectionRecordContext";let A9=O.memo(e=>{let{isNew:t,record:l,parentRecord:n,children:o}=e,r=(0,O.useMemo)(()=>n?n instanceof A3?n:new A3({data:n}):l instanceof A3?l.parentRecord:void 0,[n,l]),i=(0,O.useMemo)(()=>{let e;return l?l instanceof A3?(e=l).isNew=l.isNew||t:e=new A3({data:l,isNew:t}):e=new A3({isNew:t}),e.setParentRecord(r),e},[l,r,t]);return(0,E.jsx)(A6.Provider,{value:i,children:o})});function A7(){return(0,O.useContext)(A6)}function Pe(){let e=A7();return null==e?void 0:e.data}function Pt(){let e=A7();return null==e?void 0:e.parentRecord}function Pl(){var e;let t=A7();return null==t||null==(e=t.parentRecord)?void 0:e.data}A9.displayName="CollectionRecordProvider";let Pn=O.createContext(null),Po=O.createContext(null),Pr=O.memo(e=>{var t,l;let{t:n}=(0,eU.B)(),o=Pe(),r=eid(),i=Pi();return(0,E.jsx)(Po.Provider,{value:{name:"$nParentPopupRecord",title:n("Parent popup record"),value:(null==(t=e.parent)?void 0:t.recordData)||(null==i?void 0:i.value),collection:(null==(l=e.parent)?void 0:l.collection)||(null==i?void 0:i.collection)},children:(0,E.jsx)(Pn.Provider,{value:{name:"$nPopupRecord",title:n("Current popup record"),value:e.recordData||o,collection:e.collection||r},children:e.children})})});Pr.displayName="VariablePopupRecordProvider";let Pi=()=>O.useContext(Pn),Pa=()=>O.useContext(Po);class Ps{get app(){return this.dataSourceManager.app}get key(){return this.options.key}get displayName(){return this.options.displayName}get status(){return this.options.status}get errorMessage(){return this.options.errorMessage}get collections(){return this.collectionManager.getCollections()||[]}getOptions(){return this.options}setOptions(e){Object.assign(this.options,e)}getOption(e){return this.options[e]}addReloadCallback(e){this.reloadCallbacks.includes(e)||this.reloadCallbacks.push(e)}removeReloadCallback(e){this.reloadCallbacks=this.reloadCallbacks.filter(t=>t!==e)}get flowEngineDataSourceManager(){var e;return null==(e=this.app.flowEngine)?void 0:e.context.dataSourceManager}async reload(){let e=await this.getDataSource(),t=this.flowEngineDataSourceManager;return t&&(t.upsertDataSource(this.options),t.getDataSource(this.key).upsertCollections(e.collections||[],{clearFields:!0})),this.setOptions(e),this.collectionManager.setCollections(e.collections||[]),this.reloadCallbacks.forEach(t=>t(e.collections)),this.options}constructor(e,t){this.options=e,this.dataSourceManager=t,this.reloadCallbacks=[],this.collectionManager=new eim(e.collections,this)}}class Pd extends Ps{getDataSource(){return{collections:this.collections}}}class Pu{addCollectionTemplates(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.reduce((e,t)=>{let l=new t(this);return e[l.name]=l,e},{});return Object.assign(this.collectionTemplateInstances,t),this.dataSourceManager.getDataSources().forEach(e=>{let l=e.collectionManager.getCollections(e=>t[e.template]);e.collectionManager.reAddCollections(l)}),t}getCollectionTemplate(e){return this.collectionTemplateInstances[e]}getCollectionTemplates(e){return Object.values(this.collectionTemplateInstances).filter(t=>{var l,n;return!e||!t.supportDataSourceType&&!t.notSupportDataSourceType||(t.supportDataSourceType?null==(l=t.supportDataSourceType)?void 0:l.includes(e):t.notSupportDataSourceType?!(null==(n=t.notSupportDataSourceType)?void 0:n.includes(e)):void 0)}).sort((e,t)=>(e.order||0)-(t.order||0))}constructor(e,t){this.dataSourceManager=t,this.collectionTemplateInstances={},this.addCollectionTemplates(e)}}var Pc=l(84795);let Pp=v$()(),Pm=(0,k.css)`
|
|
1028
1028
|
width: 100%;
|
|
1029
1029
|
& > .ant-space-item {
|
|
1030
1030
|
flex: 1;
|
|
@@ -3121,7 +3121,7 @@ ${o}`,c)}}let n=T(e.issues.filter(e=>"runtime"===e.type)),o=n?`Key runtime issue
|
|
|
3121
3121
|
&:hover {
|
|
3122
3122
|
background-color: ${g.colorFillSecondary};
|
|
3123
3123
|
}
|
|
3124
|
-
`;return(0,n.jsxs)("div",{style:{maxHeight:300,overflowY:"auto"},children:[e.map(e=>(0,n.jsx)("div",{role:"option",onClick:()=>b(e.value),className:l,children:f(e.label)},e.value)),(0,n.jsx)(i.A,{style:{margin:"4px 0"}}),t.map(e=>(0,n.jsx)("div",{role:"option",className:l,onClick:()=>b(e.value),title:f(e.label),children:f(e.label)},e.value))]})};return(0,n.jsxs)(a.A.Compact,{style:{...m.style,width:"100%"},children:[(0,n.jsx)(s.A,{options:x,open:v,onDropdownVisibleChange:y,...m,allowClear:!1,style:{width:"100%",minWidth:100,maxWidth:["past","next","exact",void 0].includes(null==t?void 0:t.type)?100:null},value:(null==t?void 0:t.type)||"exact",onChange:b,dropdownRender:w}),["past","next"].includes(null==t?void 0:t.type)&&[(0,n.jsx)(d.A,{style:{flex:1},value:null==t?void 0:t.number,onChange:e=>{l({...t,number:e})}},"number"),(0,n.jsx)(s.A,{value:null==t?void 0:t.unit,style:{minWidth:130,maxWidth:140},onChange:e=>{l({...t,unit:e})},options:[{value:"day",label:f("Day")},{value:"week",label:f("Calendar week")},{value:"month",label:f("Calendar Month")},{value:"year",label:f("Calendar Year")}],popupMatchSelectWidth:!0},"unit")],((null==t?void 0:t.type)==="exact"||!(null==t?void 0:t.type))&&(0,n.jsx)(F,{...m,value:t,onChange:l})]})}},32644(e,t,l){"use strict";l.d(t,{S:()=>i});let n=new Set(["$match","$notMatch","$anyOf","$noneOf","$childIn","$childNotIn","$in","$notIn"]);function o(e){return!!e&&"object"==typeof e&&!Array.isArray(e)&&"type"in e}function r(e){return null==e||"string"==typeof e&&""===e.trim()}function i(e,t){if(!e)return t;if("$dateBetween"===e){if(null==t||o(t))return t;if(Array.isArray(t)){if(0===t.length)return t;let e=t[0],l=t.length>1?t[1]:void 0,n=r(e),o=r(l);return(1!==t.length||n)&&(n||!o)?n&&!o?[l,l]:t:[e,e]}return[t,t]}return n.has(e)?null==t||Array.isArray(t)?t:"string"==typeof t&&""===t.trim()?[]:[t]:t}},71616(e,t,l){"use strict";l.d(t,{EditFormModel:()=>c});var n=l(74848),o=l(11869),r=l(58929),i=l(84626),a=l(40098);l(96540);var s=l(15892),d=l(96491),u=l(84759);class c extends d.F4{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(o.SingleRecordResource);return e.isNewRecord=!1,e}let r=this.context.createResource(o.MultiRecordResource);return r.setPageSize(1),r}isMultiRecordResource(){return this.resource instanceof o.MultiRecordResource}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}getAclActionName(){return"update"}async submitHandler(e,t,n){let{submitHandler:o}=await Promise.resolve().then(l.bind(l,53831));await o(e,t,n)}async submit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,{submitHandler:n}=await Promise.resolve().then(l.bind(l,53831));await n(this.context,e,t)}renderComponent(){var e,t;let{colon:l,labelAlign:a,labelWidth:s,labelWrap:u,layout:c}=this.props,p=!!this.context.flowSettingsEnabled,m=this.hasAvailableData(),h=!p&&!m,{heightMode:f,height:g}=this.decoratorProps,v=this.resource.loading||m?this.isMultiRecordResource()&&this.resource.getMeta("count")>1?(0,n.jsx)("div",{style:{textAlign:"center",marginTop:16},children:(0,n.jsx)(r.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:this.resource.getPage(),total:this.resource.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})}):null:(0,n.jsx)("div",{style:{textAlign:"center",marginTop:16,color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")});return(0,n.jsx)(d.JU,{model:this,gridModel:this.subModels.grid,layoutProps:{colon:l,labelAlign:a,labelWidth:s,labelWrap:u,layout:c},heightMode:f,height:g,grid:(0,n.jsx)(o.FlowModelRenderer,{model:this.subModels.grid,showFlowSettings:!1}),actions:(0,n.jsx)("div",{style:h?{pointerEvents:"none",opacity:.45}:void 0,children:(0,n.jsx)(o.DndProvider,{children:(0,n.jsxs)(i.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||p)return(0,n.jsx)(o.Droppable,{model:e,children:(0,n.jsx)(o.MemoFlowModelRenderer,{model:e,showFlowSettings:!!this.context.flowSettingsEnabled&&this.actionFlowSettings,extraToolbarItems:this.actionExtraToolbarItems},e.uid)},e.uid)}),this.renderConfigureActions()]})})}),footer:v})}constructor(...e){super(...e),this.actionFlowSettings={showBackground:!1,showBorder:!1,toolbarPosition:"above"},this.actionExtraToolbarItems=[{key:"drag-handler",component:o.DragHandler,sort:1}],this.handlePageChange=async e=>{if(this.resource instanceof o.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await t.refresh(),await (0,u.Xi)(this,"paginationChange")}}}}c.scene=s.P.oam,c.blockCapabilityActionName="update",c.registerFlow({key:"formSettings",title:(0,o.tExpr)("Edit form settings"),steps:{init:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");e.resource.on("refresh",async()=>{var t,l,n,o,r,i,s,d;let u=e.resource.getMeta("currentFilterByTk"),c={...e.model.getCurrentRecord()};if(!c)return;let p=null==(t=e.association)?void 0:t.targetKey;if(p&&(null==(l=e.association)?void 0:l.interface)!=="m2m"?e.resource.setMeta({currentFilterByTk:null==c?void 0:c[p]}):e.resource.setMeta({currentFilterByTk:e.collection.getFilterByTK(c)}),!e.form)return;let m=e.resource.getMeta("currentFilterByTk"),h=!(0,a.isEqual)(u,m),f=null==(n=(o=e.model).getUserModifiedFields)?void 0:n.call(o),g=!!(null==f?void 0:f.size),v=()=>{if(!(null==f?void 0:f.size))return;let t=e=>null!==e&&"object"==typeof e;for(let l of Array.from(f)){let n=e.form.getFieldValue(l),o=null==c?void 0:c[l];(Object.is(n,o)||t(n)&&t(o)&&(0,a.isEqual)(n,o))&&f.delete(l)}};if(!h&&g){let t={...c};for(let l of f)t[l]=e.form.getFieldValue(l);e.form.setFieldsValue(t),v();return}h&&(null==(r=(i=e.model).resetUserModifiedFields)||r.call(i),null==(s=(d=e.model).resetRuntimeUserEditedState)||s.call(d)),e.form.setFieldsValue(c),v()})}},dataScope:{use:"dataScope"},refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized")}}}}),c.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldsLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"fieldLinkageRules",flowKey:"eventSettings",stepKey:"linkageRules"}}}}),c.define({label:(0,o.tExpr)("Form (Edit)"),searchable:!0,searchPlaceholder:(0,o.tExpr)("Search"),createModelOptions:{use:"EditFormModel",subModels:{grid:{use:"FormGridModel"}}},sort:340})},96491(e,t,l){"use strict";l.d(t,{JU:()=>V,s2:()=>O,F4:()=>$,mO:()=>z});var n=l(74848),o=l(49655),r=l(22803),i=l(11869),a=l(89013),s=l(40098),d=l.n(s),u=l(40542),c=l(96540),p=l(2117),m=l(25359),h=l(52175),f=l(95243),g=l(29676),v=l(47632);function y(e){let t,l,n,o=()=>{let e=t;e&&(l&&(e.setFieldValue=l),n&&(e.setFieldsValue=n),t=void 0,l=void 0,n=void 0)};return{patch:r=>{if(t===r)return;o();let i="function"==typeof(null==r?void 0:r.setFieldValue)?r.setFieldValue.bind(r):void 0,a="function"==typeof(null==r?void 0:r.setFieldsValue)?r.setFieldsValue.bind(r):void 0;t=r,l=i,n=a,i&&(r.setFieldValue=(t,l)=>{e.isSuppressed()?i(t,l):e.setFormValues(e.getCallerContext(),[{path:t,value:l}],{source:"system"}).catch(()=>void 0)}),a&&(r.setFieldsValue=t=>{e.isSuppressed()?a(t):e.setFormValues(e.getCallerContext(),t,{source:"system"}).catch(()=>void 0)})},restore:o}}var x=l(12197),b=l(13939),w=l(65421),S=l(13940),C=l(26866);let F=Symbol("SKIP_RULE_VALUE"),k=Symbol("UNRESOLVED_ASSOCIATION_IDENTITY"),A=1e3;function P(e){return"default"===e?"default":"override"===e?"override":"assign"}function j(e){return"default"===e?"default":"override"===e?"override":"system"}class M{getAssignRuleBlockId(e){return`form-assign:${e}:block`}removeAssignRuleBlockInstance(e){let t=this.getAssignRuleBlockId(e);this.rules.has(t)&&this.removeRule(t)}removeRowGridAssignRuleInstances(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e),n=[];for(let[e,i]of this.rules.entries()){var o,r;if(!e.startsWith(t)||e===l)continue;let a=null==i||null==(r=i.rule)||null==(o=r.getContext)?void 0:o.call(r),s=null==a?void 0:a.model;s&&this.isRowGridModel(s)&&n.push(e)}for(let e of n)this.removeRule(e)}hasAnyNonBlockAssignRuleInstance(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e);for(let e of this.rules.keys())if(e.startsWith(t)&&e!==l)return!0;return!1}ensureBlockAssignRuleInstancesForTargetPath(e){if(this.options.isDisposed()||!e||!this.shouldCreateBlockLevelAssignRule(e))return;let t=this.assignTemplatesByTargetPath.get(e)||[];if(t.length)for(let l of t){let t=(null==l?void 0:l.__key)?String(l.__key):"";if(!t||this.hasAnyNonBlockAssignRuleInstance(t))continue;let n=j(P(null==l?void 0:l.mode)),o=(null==l?void 0:l.enable)!==!1,r=this.getAssignRuleBlockId(t);if(this.rules.has(r))continue;let i={id:r,source:n,priority:10+(l.__order||0),debounceMs:0,getEnabled:()=>o&&!!e,getTarget:()=>e,getValue:()=>null==l?void 0:l.value,getCondition:()=>null==l?void 0:l.condition,getContext:()=>this.options.getBlockContext()};this.rules.set(r,{rule:i,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(r)}}getCollectionFromContext(e){var t,l;return(null==e?void 0:e.collection)??(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.collection)}getRootCollection(){let e=this.options.getBlockContext();return this.getCollectionFromContext(e)}shouldCreateBlockLevelAssignRule(e){let t=this.options.getBlockContext(),l=this.getCollectionFromContext(t);if(!(null==l?void 0:l.getField))return!0;let n=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(n.length<=1)return!0;for(let e=0;e<n.length-1;e++){var o,r;let t=n[e];if("string"!=typeof t)continue;let i=null==l||null==(o=l.getField)?void 0:o.call(l,t);if(!(null==i||null==(r=i.isAssociationField)?void 0:r.call(i)))break;if((0,S.E4)(i)){if("number"!=typeof n[e+1])return!1;e+=1}if(!(null==(l=null==i?void 0:i.targetCollection)?void 0:l.getField))break}return!0}collectAssociationPrefixPaths(e,t){let l=[],n=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==n?void 0:n.getField))return l;let o=[];for(let e=0;e<t.length-1;e++){var r,i;let a=t[e];if("string"!=typeof a)break;let s=null==n||null==(r=n.getField)?void 0:r.call(n,a);if(!(null==s||null==(i=s.isAssociationField)?void 0:i.call(s)))break;if(o.push(a),(0,S.E4)(s)){let l=t[e+1];if("number"!=typeof l)break;o.push(l),e+=1}if(l.push([...o]),!(null==(n=null==s?void 0:s.targetCollection)?void 0:n.getField))break}return l}shouldSkipToManyAssociationWriteWithoutIndex(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return!1;for(let e=0;e<t.length-1;e++){var n,o;let r=t[e];if("string"!=typeof r)continue;let i=null==l||null==(n=l.getField)?void 0:n.call(l,r);if(!(null==i||null==(o=i.isAssociationField)?void 0:o.call(i)))break;if((0,S.E4)(i)){if("number"!=typeof t[e+1])return!0;e+=1}if(!(null==(l=null==i?void 0:i.targetCollection)?void 0:l.getField))break}return!1}shouldSkipAssociationNestedWrite(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return!1;for(let n of l){let l=this.options.getFormValueAtPath(n);if(null==l){let l=n.filter(e=>"string"==typeof e).join(".");if(l&&this.getUpdateAssociationForTargetPath(l)||this.isAssociationTargetKeyWrite(e,t,n))continue;return!0}if("object"!=typeof l)return!0}return!1}getAssociationTargetKeyFields(e){var t,l;let n=(null==e?void 0:e.targetKey)??(null==e||null==(t=e.targetCollection)?void 0:t.filterTargetKey)??(null==e||null==(l=e.targetCollection)?void 0:l.filterByTk)??"id";return Array.isArray(n)?n.filter(e=>"string"==typeof e&&!!e):"string"==typeof n&&n?[n]:["id"]}resolveAssociationFieldByPrefixPath(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;let n=null;for(let e of t){var o,r;if("number"==typeof e)continue;if("string"!=typeof e||!e)break;let t=null==l||null==(o=l.getField)?void 0:o.call(l,e);if(!(null==t||null==(r=t.isAssociationField)?void 0:r.call(t))||(n=t,!(null==(l=null==t?void 0:t.targetCollection)?void 0:l.getField)))break}return n}isAssociationTargetKeyWrite(e,t,l){var n;if(!Array.isArray(t)||!Array.isArray(l)||t.length!==l.length+1)return!1;let o=t[l.length];if("string"!=typeof o||!o)return!1;let r=this.resolveAssociationFieldByPrefixPath(e,l);return!(!(null==r||null==(n=r.isAssociationField)?void 0:n.call(r))||(0,S.E4)(r))&&this.getAssociationTargetKeyFields(r).includes(o)}collectUpdateAssociationInitPatches(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return[];let n=[];for(let o of l){let l=this.options.getFormValueAtPath(o);if(null==l){let l=o.filter(e=>"string"==typeof e).join(".");if(!l)return null;if(this.getUpdateAssociationForTargetPath(l)){n.push({path:[...o,"__is_new__"],value:!0});continue}if(this.isAssociationTargetKeyWrite(e,t,o)){n.push({path:[...o],value:{}});continue}return null}if("object"!=typeof l)return null}let o=new Map;for(let e of n){let t=(0,x.Qc)(e.path);o.has(t)||o.set(t,e)}return Array.from(o.values())}dispose(){for(let{state:e}of this.rules.values())e.depDisposers.forEach(e=>e());for(let e of(this.rules.clear(),this.pendingRuleIds.clear(),this.assignTemplatesByTargetPath.clear(),this.defaultRuleMasterDisposers.values()))e();for(let e of(this.defaultRuleMasterDisposers.clear(),this.defaultRuleIdsByMasterUid.clear(),this.ruleDebounceTimersById.values()))clearTimeout(e);this.ruleDebounceTimersById.clear(),this.ruleDebounceUntilById.clear()}enable(){this.rulesEnabled=!0,this.pendingRuleIds.size&&!this.runningRules&&this.flushRules()}syncAssignRules(e){if(this.options.isDisposed())return;let t=(Array.isArray(e)?e:[]).map((e,t)=>({...e,key:(null==e?void 0:e.key)?String(e.key):`idx:${t}`})),l="form-assign:";for(let e of Array.from(this.rules.keys()))e.startsWith(l)&&this.removeRule(e);this.assignTemplatesByTargetPath.clear(),this.formItemTargetPaths.clear(),this.updateAssociationByTargetPath.clear();let n=0;for(let e of t){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=this.assignTemplatesByTargetPath.get(t)||[];n+=1,l.push({...e,__key:String(e.key),__order:n}),this.assignTemplatesByTargetPath.set(t,l)}let o=this.options.getEngine(),r=new Set;if(null==o?void 0:o.forEachModel){o.forEachModel(e=>{var t;if(!this.isModelInThisForm(e)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let l=this.getModelTargetPath(e);l&&this.formItemTargetPaths.add(l),this.cacheUpdateAssociationForModel(e)});let e=e=>{this.cacheUpdateAssociationForModel(e),this.tryRegisterAssignRuleInstancesForModel(e,r);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e,r)})};o.forEachModel(t=>{e(t)})}for(let[e,t]of this.assignTemplatesByTargetPath.entries())if(!r.has(e)&&this.shouldCreateBlockLevelAssignRule(e))for(let n of t){let t=j(P(null==n?void 0:n.mode)),o=(null==n?void 0:n.enable)!==!1,r=`${l}${n.__key}:block`;this.rules.has(r)&&this.removeRule(r);let i={id:r,source:t,priority:10+(n.__order||0),debounceMs:0,getEnabled:()=>o&&!!e,getTarget:()=>e,getValue:()=>null==n?void 0:n.value,getCondition:()=>null==n?void 0:n.condition,getContext:()=>this.options.getBlockContext()};this.rules.set(r,{rule:i,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(r)}for(let e of Array.from(this.rules.keys()))e.startsWith("default:")&&this.scheduleRule(e)}onModelMounted(e){var t;if(this.isModelInThisForm(e)&&!(null==e?void 0:e.isFork)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);t&&this.formItemTargetPaths.add(t),this.cacheUpdateAssociationForModel(e)}this.tryRegisterDefaultRuleInstance(e),this.tryRegisterAssignRuleInstancesForModel(e)}onModelUnmounted(e){var t;if(this.tryUnregisterDefaultRuleInstance(e),this.tryUnregisterAssignRuleInstancesForModel(e),this.isModelInThisForm(e)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);if(t&&(this.ensureBlockAssignRuleInstancesForTargetPath(t),!(null==e?void 0:e.isFork))){this.updateAssociationByTargetPath.delete(t),this.formItemTargetPaths.delete(t);let e=`${t}.`;for(let t of this.assignTemplatesByTargetPath.keys())t.startsWith(e)&&this.ensureBlockAssignRuleInstancesForTargetPath(t);let l=this.options.getEngine();if(null==l?void 0:l.forEachModel){let e=e=>{this.tryRegisterAssignRuleInstancesForModel(e);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e)})};l.forEachModel(t=>e(t))}}}}isModelInThisForm(e){var t;let l=null==e||null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.options.getBlockModelUid())}cacheUpdateAssociationForModel(e){var t,l;if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e||(null==e?void 0:e.isFork)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let n=this.getModelTargetPath(e);if(!n)return;let o=null==e||null==(l=e.subModels)?void 0:l.field,r=!!(null==o?void 0:o.updateAssociation);!0!==this.updateAssociationByTargetPath.get(n)&&this.updateAssociationByTargetPath.set(n,r)}getUpdateAssociationForTargetPath(e){let t=String(e||"");if(!t)return!1;if(this.updateAssociationByTargetPath.has(t))return!!this.updateAssociationByTargetPath.get(t);let l=this.options.getEngine();return((null==l?void 0:l.forEachModel)&&l.forEachModel(e=>{this.cacheUpdateAssociationForModel(e)}),this.updateAssociationByTargetPath.has(t))?!!this.updateAssociationByTargetPath.get(t):(this.updateAssociationByTargetPath.set(t,!1),!1)}getDefaultRuleId(e){let t=(null==e?void 0:e.isFork)?String((null==e?void 0:e.forkId)??"fork"):"master",l=(null==e?void 0:e.uid)?String(e.uid):String(e);return`default:${l}:${t}`}getModelTargetNamePath(e){var t;let l=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(l)&&l.length)return l;let n="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,o=null==n?void 0:n.name;return Array.isArray(o)?o:"string"==typeof o?o.includes(".")?o.split("."):[o]:null}getAssignTemplateTargetPathForModel(e){let t=this.getModelTargetPath(e);if(t)return t;let l=this.getModelTargetNamePath(e);if(!(null==l?void 0:l.length))return"";let n=l.filter(e=>"number"!=typeof e);return n.length?(0,x.Qc)(n):""}hasAssignTemplateForTargetPath(e){let t=String(e||"");return!!t&&this.assignTemplatesByTargetPath.has(t)}tryRegisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(!t||"object"!=typeof t)return;let l=this.getModelTargetNamePath(e);if(!l)return;let n=this.getDefaultRuleId(e);if(this.rules.has(n))return;let o=e.master||e,r=this.getAssignTemplateTargetPathForModel(e);this.bindMasterInitialValue(o,n);let i=()=>{var e;let t=(null==o||null==(e=o.getProps)?void 0:e.call(o))??(null==o?void 0:o.props);return null==t?void 0:t.initialValue},a=i(),s=!1,u=()=>{let e=i();if(s||d().isEqual(e,a)||(s=!0),!this.hasAssignTemplateForTargetPath(r)||s||void 0===a)return e},c=()=>{if(!this.hasAssignTemplateForTargetPath(r))try{var e,t,l,n;let r=null==o||null==(t=o.getStepParams)||null==(e=t.call(o,"editItemSettings","initialValue"))?void 0:e.defaultValue;if(void 0!==r)return r;let i=null==o||null==(n=o.getStepParams)||null==(l=n.call(o,"formItemSettings","initialValue"))?void 0:l.defaultValue;if(void 0!==i)return i}catch{}},p={id:n,source:"default",priority:void 0!==u()?A:0,debounceMs:0,getEnabled:()=>void 0!==u()||void 0!==c(),getTarget:()=>this.getModelTargetNamePath(e)||l,getValue:()=>{let e=u();return void 0!==e?e:c()},getContext:()=>null==e?void 0:e.context};this.rules.set(n,{rule:p,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(n)}getModelTargetPath(e){try{var t;let l=null==e||null==(t=e.getStepParams)?void 0:t.call(e,"fieldSettings","init"),n=null==l?void 0:l.fieldPath;if(n)return String(n)}catch{}let l=null==e?void 0:e.fieldPath;if(l)return String(l);let n=this.getModelTargetNamePath(e);return(null==n?void 0:n.length)&&n.filter(e=>"string"==typeof e).join(".")||null}getAssignRuleInstanceId(e,t){let l=(null==t?void 0:t.isFork)?String((null==t?void 0:t.forkId)??"fork"):"master",n=(null==t?void 0:t.uid)?String(t.uid):String(t);return`form-assign:${e}:${n}:${l}`}getDeepestFieldIndexKey(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex),o=Array.isArray(n)?n:[];if(!o.length)return null;let r=o[o.length-1];if("string"!=typeof r)return null;let[i,a]=r.split(":");return!i||Number.isNaN(Number(a))?null:i}getDeepestToManyAssociationKey(e){let t=this.getRootCollection();if(!(null==t?void 0:t.getField))return null;let l=(0,x.EA)(String(e||"")).filter(e=>"object"!=typeof e);if(l.length<2)return null;let n=t,o=null;for(let e=0;e<l.length-1;e++){var r,i;let t=l[e];if("string"!=typeof t)continue;let a=null==n||null==(r=n.getField)?void 0:r.call(n,t);if(!(null==a||null==(i=a.isAssociationField)?void 0:i.call(a)))break;let s=(0,S.E4)(a);if(s&&(o=t),s&&"number"==typeof l[e+1]&&(e+=1),!(null==(n=null==a?void 0:a.targetCollection)?void 0:n.getField))break}return o}isRowGridModel(e){var t,l;if(!e||"object"!=typeof e||(null==e||null==(t=e.subModels)?void 0:t.field)||!(null==e||null==(l=e.subModels)?void 0:l.items))return!1;let n=null==e?void 0:e.context;return!!this.getDeepestFieldIndexKey(n)}tryRegisterAssignRuleInstancesForModel(e,t){var l,n,o,r;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let i=(l,n)=>{if(n&&0!==n.length)for(let r of(null==t||t.add(l),n)){var o;this.removeAssignRuleBlockInstance(r.__key),(null==e||null==(o=e.subModels)?void 0:o.field)&&this.removeRowGridAssignRuleInstances(r.__key);let t=j(P(null==r?void 0:r.mode)),n=(null==r?void 0:r.enable)!==!1,i=this.getAssignRuleInstanceId(r.__key,e);this.rules.has(i)&&this.removeRule(i);let a={id:i,source:t,priority:10+(r.__order||0),debounceMs:0,getEnabled:()=>n&&!!l,getTarget:()=>l,getValue:()=>null==r?void 0:r.value,getCondition:()=>null==r?void 0:r.condition,getContext:()=>null==e?void 0:e.context};this.rules.set(i,{rule:a,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(i)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(l)for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&i(e,t)}return}if(!(null==e||null==(l=e.subModels)?void 0:l.field))return;let a=this.getModelTargetPath(e);if(!a)return;let s=this.assignTemplatesByTargetPath.get(a)||[];s.length&&i(a,s);let d=null==e||null==(n=e.subModels)?void 0:n.field,u=null==d||null==(o=d.context)?void 0:o.collectionField,c=!!(null==u||null==(r=u.isAssociationField)?void 0:r.call(u)),p=(0,S.E4)(u);if(c&&!p){let e=`${a}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&i(t,l)}}tryUnregisterAssignRuleInstancesForModel(e){var t,l,n,o;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let r=t=>{for(let l of t||[]){let t=this.getAssignRuleInstanceId(l.__key,e);this.rules.has(t)&&this.removeRule(t)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(!l)return;for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&r(t)}return}if(!(null==e||null==(t=e.subModels)?void 0:t.field))return;let i=this.getModelTargetPath(e);if(!i)return;let a=this.assignTemplatesByTargetPath.get(i)||[];a.length&&r(a);let s=null==e||null==(l=e.subModels)?void 0:l.field,d=null==s||null==(n=s.context)?void 0:n.collectionField,u=!!(null==d||null==(o=d.isAssociationField)?void 0:o.call(d)),c=(0,S.E4)(d);if(u&&!c){let e=`${i}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&r(l)}}tryUnregisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let t=this.getDefaultRuleId(e);this.rules.has(t)&&this.removeRule(t)}bindMasterInitialValue(e,t){let l=(null==e?void 0:e.uid)?String(e.uid):t,n=this.defaultRuleIdsByMasterUid.get(l)||new Set;if(n.add(t),this.defaultRuleIdsByMasterUid.set(l,n),this.defaultRuleMasterDisposers.has(l))return;let o=(0,f.reaction)(()=>{var t;let l=(null==e||null==(t=e.getProps)?void 0:t.call(e))??(null==e?void 0:e.props);return null==l?void 0:l.initialValue},(t,n)=>{var o;if(d().isEqual(t,n))return;let r=this.defaultRuleIdsByMasterUid.get(l);if(!r)return;let i=(null==e||null==(o=e.getProps)?void 0:o.call(e))??(null==e?void 0:e.props),a=void 0!==(null==i?void 0:i.initialValue)?A:0;for(let e of r){let t=this.rules.get(e);t&&(t.rule.priority=a),this.scheduleRule(e)}});this.defaultRuleMasterDisposers.set(l,o)}removeRule(e){let t=this.rules.get(e);if(!t)return;try{let e=t.rule.getContext(),l=t.rule.getTarget(),n=this.options.tryResolveNamePath(e,l);if(n){let e=(0,x.Qc)(n),l=this.options.observableBindings.get(e);l&&l.source===t.rule.source&&(l.dispose(),this.options.observableBindings.delete(e))}}catch{}t.state.depDisposers.forEach(e=>e()),this.rules.delete(e),this.pendingRuleIds.delete(e);let l=this.ruleDebounceTimersById.get(e);for(let[t,n]of(l&&clearTimeout(l),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e),this.defaultRuleIdsByMasterUid.entries())){if(!n.has(e)||(n.delete(e),n.size>0))continue;this.defaultRuleIdsByMasterUid.delete(t);let l=this.defaultRuleMasterDisposers.get(t);l&&l(),this.defaultRuleMasterDisposers.delete(t)}}rescheduleAllRules(){if(!this.options.isDisposed()){for(let e of(this.lastRuleWriteByTargetKey.clear(),this.rules.values()))e.state.runSeq+=1;for(let e of this.rules.keys())this.scheduleRule(e)}}scheduleRule(e){if(this.options.isDisposed())return;let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.scheduledAtWriteSeq=this.options.getWriteSeq();let o=(null==l?void 0:l.debounceMs)??0;if(this.pendingRuleIds.add(e),o>0){let t=Date.now()+o;t>(this.ruleDebounceUntilById.get(e)||0)&&this.ruleDebounceUntilById.set(e,t);let l=this.ruleDebounceTimersById.get(e);l&&clearTimeout(l);let n=setTimeout(()=>{this.ruleDebounceTimersById.delete(e),!this.rulesEnabled||this.runningRules||this.pendingRuleIds.has(e)&&this.flushRules()},o);this.ruleDebounceTimersById.set(e,n)}else{let t=this.ruleDebounceTimersById.get(e);t&&clearTimeout(t),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e)}!this.rulesEnabled||this.runningRules||this.flushRules()}async flushRules(){if(this.runningRules)return;this.runningRules=!0;let e=this.currentRuleTxId||(0,w.ao)();this.currentRuleTxId=e;try{for(;this.pendingRuleIds.size;){let e=Date.now(),t=[];for(let l of this.pendingRuleIds)(this.ruleDebounceUntilById.get(l)||0)>e||t.push(l);if(!t.length)break;for(let e of t)this.pendingRuleIds.delete(e),this.ruleDebounceUntilById.delete(e);for(let e of(t.sort((e,t)=>{var l,n;let o=null==(l=this.rules.get(e))?void 0:l.rule,r=null==(n=this.rules.get(t))?void 0:n.rule,i=(null==o?void 0:o.priority)??0,a=(null==r?void 0:r.priority)??0;return i!==a?i-a:e.localeCompare(t)}),t))await this.runRule(e)}}finally{this.runningRules=!1,this.currentRuleTxId=null,this.options.txWriteCounts.delete(e)}}async runRule(e){let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.runSeq+=1;let o=n.runSeq,r=n.scheduledAtWriteSeq,i=this.prepareRuleContext(l),{baseCtx:a,targetNamePath:s,targetKey:d,clearDeps:u,disposeBinding:c}=i;if(!this.shouldRunRule(l,s,d,a)||!s||!d){u(n),c();return}let p=s,m=d,{collector:h,evalCtx:f}=this.createRuleCollectorAndContext(l,i);if(l.getCondition&&!await this.evaluateRuleCondition(l,n,o,f,h))return;let g=await this.resolveRuleValue(l,n,o,f,h);if(g===F||o!==n.runSeq)return;this.commitRuleDeps(l,n,h);let v=this.getToManyAggregateSourceInfo(a,l.getValue()),y=this.normalizeUnresolvedToManyAggregateForScalarTarget(a,p,g,v);if(y.skip)return;let b=y.hasValue?y.value:g,w=this.normalizeResolvedValueForTarget(a,b),S=this.normalizeResolvedValueForAssociationTarget(a,p,w),C=this.normalizeAggregateArrayForScalarTarget(a,p,S,v);if(C===F||this.shouldSkipEmptyArrayAggregateForScalarTarget(a,p,C)||this.shouldSkipMultiValueAggregateForScalarTarget(a,p,C,v)||"default"===l.source&&!this.checkDefaultRuleCanApply(C,p,m,u,c,n))return;if("override"===l.source&&this.options.findUserEditedHit(m))return void c();if("default"===l.source){let e=this.lastRuleWriteByTargetKey.get(m);if((null==e?void 0:e.source)==="default"&&e.priority>l.priority&&e.writeSeq>=r)return void c()}if("system"===l.source||"override"===l.source){let e=this.options.lastWriteMetaByPathKey.get(m);if((null==e?void 0:e.source)==="linkage"&&e.writeSeq>=r)return void c()}if(this.shouldSkipAssociationNestedWrite(a,p)||this.shouldSkipToManyAssociationWriteWithoutIndex(a,p))return;let k=C;if(this.isAssociationTargetSemanticallyEqual(a,p,this.options.getFormValueAtPath(p),k))return;let A=this.collectUpdateAssociationInitPatches(a,p);if(null==A)return;if("system"===l.source||"default"===l.source||"override"===l.source){var P,j;let e=null==a?void 0:a.model,t=null==e||null==(P=e.subModels)?void 0:P.field;if(t){let l=this.getModelTargetNamePath(e);l&&(0,x.Qc)(l)===m&&(e.setProps({value:C}),null==(j=t.setProps)||j.call(t,{value:C}))}}let M=this.options.getWriteSeq(),I=[...A,{path:p,value:C}];await this.options.setFormValues(f,I,{source:l.source,txId:this.currentRuleTxId||void 0});let T=this.options.getWriteSeq();T!==M&&this.lastRuleWriteByTargetKey.set(m,{source:l.source,priority:l.priority,writeSeq:T})}isTzAwareTargetInterface(e){return"string"==typeof e&&["datetime","createdAt","updatedAt","unixTimestamp"].includes(e)}normalizeDateOnlyToStartOfDayIso(e){let t=String(e||"").trim();if(!t||!/^\d{4}-\d{2}-\d{2}$/.test(t))return e;let l=(0,b.dayjs)(t,"YYYY-MM-DD",!0);return l.isValid()?l.startOf("day").toISOString():e}normalizeResolvedValueForTarget(e,t){var l,n,o;let r=null==e||null==(o=e.model)||null==(n=o.context)||null==(l=n.collectionField)?void 0:l.interface;return this.isTzAwareTargetInterface(r)?"string"==typeof t?this.normalizeDateOnlyToStartOfDayIso(t):Array.isArray(t)?t.map(e=>"string"==typeof e?this.normalizeDateOnlyToStartOfDayIso(e):e):t:t}isPrimitiveAssociationTargetValue(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}extractAssociationIdentity(e,t){let l=this.getAssociationTargetKeyFields(e),n=1===l.length?l[0]:null,o=e=>{if(null==e)return e;if(this.isPrimitiveAssociationTargetValue(e))return n?e:k;if(!e||"object"!=typeof e)return k;if(n)return void 0===e[n]?k:e[n];let t={};for(let n of l){if(void 0===e[n])return k;t[n]=e[n]}return t};if((0,S.E4)(e)){let e=Array.isArray(t)?t:[t],l=[];for(let t of e){if(null==t)continue;let e=o(t);if(e===k)return k;l.push(e)}return l}let r=Array.isArray(t)?t.find(e=>null!=e):t;return null==r?r:o(r)}isAssociationTargetSemanticallyEqual(e,t,l,n){var o;let r=this.resolveCollectionFieldByNamePath(e,t);if(!(null==r||null==(o=r.isAssociationField)?void 0:o.call(r)))return d().isEqual(l,n);let i=this.extractAssociationIdentity(r,l),a=this.extractAssociationIdentity(r,n);return i===k||a===k?d().isEqual(l,n):d().isEqual(i,a)}resolveCollectionFieldByNamePath(e,t){if(!Array.isArray(t)||!t.length)return null;let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;for(let e=0;e<t.length;e++){var n,o;let r=t[e];if("string"!=typeof r||!r)break;let i=null==l||null==(n=l.getField)?void 0:n.call(l,r);if(!i)break;if(e===t.length-1)return i;if(!(null==i||null==(o=i.isAssociationField)?void 0:o.call(i))||!(null==i?void 0:i.targetCollection))break;if((0,S.E4)(i)){if("number"!=typeof t[e+1])return null;e+=1}if(!(null==(l=i.targetCollection)?void 0:l.getField))break}return null}normalizeResolvedValueForAssociationTarget(e,t,l){var n;let o=this.resolveCollectionFieldByNamePath(e,t);if(!(null==o||null==(n=o.isAssociationField)?void 0:n.call(o)))return l;let r=this.getAssociationTargetKeyFields(o),i=1===r.length?r[0]:null,a=e=>{if(null!=e)return i&&this.isPrimitiveAssociationTargetValue(e)?{[i]:e}:e};if((0,S.E4)(o))return(Array.isArray(l)?l:[l]).map(e=>a(e)).filter(e=>null!=e);let s=Array.isArray(l)?l.find(e=>null!=e):l;return null==s?s:a(s)}prepareRuleContext(e){let t=e.getContext(),l=e.getTarget(),n=this.options.tryResolveNamePath(t,l),o=n?(0,x.Qc)(n):null,r=()=>{if(!o)return;let t=this.options.observableBindings.get(o);t&&t.source===e.source&&(t.dispose(),this.options.observableBindings.delete(o))};return{baseCtx:t,targetNamePath:n,targetKey:o,clearDeps:e=>{e.depDisposers.forEach(e=>e()),e.depDisposers=[],e.deps=new Set},disposeBinding:r}}shouldApplyDefaultRuleInCurrentState(e){var t,l,n;return"update"!==(null==(t=(l=this.options).getActionName)?void 0:t.call(l))||(null==(n=this.getItemContext(e))?void 0:n.__is_new__)===!0}isStaleToManyItemContext(e){let t=this.getItemContext(e);return!!Number.isFinite(null==t?void 0:t.index)&&!!Number.isFinite(null==t?void 0:t.length)&&(t.index<0||t.index>=t.length)}getItemContext(e){try{return null==e?void 0:e.item}catch{return}}getRowTargetKey(e,t){var l,n,o,r;let i,a,s=this.getRootCollection()||this.getCollectionFromContext(e);for(let e of t)if("number"!=typeof e){if("string"!=typeof e||!e||!(null==s?void 0:s.getField)||(i=null==s||null==(o=s.getField)?void 0:o.call(s,e),!(null==i||null==(r=i.isAssociationField)?void 0:r.call(i))))break;a=i,s=null==i?void 0:i.targetCollection}let d=(null==a||null==(l=a.targetCollection)?void 0:l.filterTargetKey)??(null==a||null==(n=a.targetCollection)?void 0:n.filterByTk)??(null==a?void 0:a.targetKey);if(Array.isArray(d)){let e=d.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof d&&d?d:"id"}isMismatchedToManyItemContext(e,t){let l=this.getItemContext(e);if(!l)return!1;for(let n=t.length-1;n>=0;n--){if("number"!=typeof t[n])continue;let o=t.slice(0,n+1),r=this.getRowTargetKey(e,o),i=this.options.getFormValueAtPath(o),a=(0,C.r5)(i,r),s=(0,C.r5)(l.value,r);return!!a&&!!s&&a!==s}return!1}shouldRunRule(e,t,l,n){return!(!e.getEnabled()||!t||!l||this.isStaleToManyItemContext(n)||this.isMismatchedToManyItemContext(n,t)||"default"===e.source&&(!this.shouldApplyDefaultRuleInCurrentState(n)||this.options.findExplicitHit(l)))&&!("override"===e.source&&this.options.findUserEditedHit(l))}createRuleCollectorAndContext(e,t){let{baseCtx:l,targetNamePath:n}=t,o=e.getValue(),r=(0,i.isRunJSValue)(o),a={deps:new Set,wildcard:!1};if(e.getCondition&&(0,v.G)(e.getCondition(),a),r?(0,v.Wp)(o,a):(0,v.G)(o,a),n)for(let e of((0,v.Dd)(n,a),this.collectAssociationPrefixPaths(l,n)))(0,v.Dd)(e,a);let s=this.createRuleEvaluationContext(l,a,n);return{collector:a,evalCtx:s,rawValue:o,isRunJS:r}}async evaluateRuleCondition(e,t,l,n,o){let r=e.getCondition;if(!r)return!0;let i=r(),a=i;if(i)try{var s;a=await (null==n||null==(s=n.resolveJsonTemplate)?void 0:s.call(n,i))}catch{a=i}return l===t.runSeq&&(!i||!!(0,g.F)(n,a)||(this.commitRuleDeps(e,t,o),!1))}async resolveRuleValue(e,t,l,n,o){let r=e.getValue();return(0,i.isRunJSValue)(r)?this.resolveRunJSValue(r,t,l,n,o,e):this.resolveTemplateValue(r,t,l,n,o,e)}async resolveRunJSValue(e,t,l,n,o,r){try{let{code:a,version:s}=(0,i.normalizeRunJSValue)(e),d=await (0,i.runjsWithSafeGlobals)(n,a,{version:s});if(!(null==d?void 0:d.success)){if(l!==t.runSeq)return F;return this.commitRuleDeps(r,t,o),F}return d.value}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(r,t,o),F}}async resolveTemplateValue(e,t,l,n,o,r){try{var i;return await (null==n||null==(i=n.resolveJsonTemplate)?void 0:i.call(n,e))}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(r,t,o),F}}commitRuleDeps(e,t,l){let n=new Set(l.deps);l.wildcard&&n.add("fv:*"),this.updateRuleDeps(e,t,n)}isScalarValueTarget(e,t){var l;let n=this.resolveCollectionFieldByNamePath(e,t);return!((null==n||null==(l=n.isAssociationField)?void 0:l.call(n))&&(0,S.E4)(n)||this.isArrayValueCollectionField(n))&&(!!n||!Array.isArray(this.options.getFormValueAtPath(t)))}shouldSkipEmptyArrayAggregateForScalarTarget(e,t,l){return!!Array.isArray(l)&&!(l.length>0)&&this.isScalarValueTarget(e,t)}normalizeUnresolvedToManyAggregateForScalarTarget(e,t,l,n){return void 0===l&&n&&this.isScalarValueTarget(e,t)?Array.isArray(n.arrayValue)&&0===n.arrayValue.length?this.isUserClearedToManyAggregate(n)?{skip:!1,hasValue:!0,value:this.getClearedAggregateValueForScalarTarget(e,t)}:{skip:!0,hasValue:!1}:Array.isArray(n.arrayValue)&&n.arrayValue.length>0?{skip:!0,hasValue:!1}:{skip:!1,hasValue:!1}:{skip:!1,hasValue:!1}}isArrayValueCollectionField(e){var t,l;if(!e||"object"!=typeof e)return!1;let n=e;return!0===n.multiple||"array"===n.type||"array"===((null==(t=n.uiSchema)?void 0:t.type)??(null==(l=n.schema)?void 0:l.type))||["multipleSelect","checkboxGroup","json"].includes("string"==typeof n.interface?n.interface:"")}stringifyAggregateItem(e){if(e&&"object"==typeof e)try{return JSON.stringify(e)}catch{}return String(e)}normalizeAggregateArrayForScalarTarget(e,t,l,n){if(!Array.isArray(l)||!this.isScalarValueTarget(e,t)||!n)return l;let o=l.filter(e=>null!=e);return o.length?1===o.length?o[0]:this.isTextScalarTarget(e,t)?o.map(e=>this.stringifyAggregateItem(e)).join(", "):F:this.isUserClearedToManyAggregate(n)?this.getClearedAggregateValueForScalarTarget(e,t):F}shouldSkipMultiValueAggregateForScalarTarget(e,t,l,n){return!!n&&!!Array.isArray(l)&&!(l.length<=1)&&!!this.isScalarValueTarget(e,t)&&!this.isTextScalarTarget(e,t)}getClearedAggregateValueForScalarTarget(e,t){if(this.isTextScalarTarget(e,t))return""}isUserClearedToManyAggregate(e){var t;return(null==(t=e.lastWrite)?void 0:t.source)==="user"}isTextScalarTarget(e,t){var l,n,o;let r=this.resolveCollectionFieldByNamePath(e,t);if(!r){let e=this.options.getFormValueAtPath(t);return void 0===e||null==e||"string"==typeof e}if((null==r||null==(l=r.isAssociationField)?void 0:l.call(r))||this.isArrayValueCollectionField(r))return!1;let i=r,a=(null==(n=i.uiSchema)?void 0:n.type)??(null==(o=i.schema)?void 0:o.type);return"string"===i.type||"text"===i.type||"string"===a||["input","textarea","email","phone","url","uuid","nanoid","markdown","richText","vditor","password","color"].includes("string"==typeof i.interface?i.interface:"")}getLatestWriteMetaForPath(e){let t=(0,x.Qc)(e),l=this.options.lastWriteMetaByPathKey.get(t);for(let[e,n]of this.options.lastWriteMetaByPathKey.entries())(e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))&&(!l||n.writeSeq>l.writeSeq)&&(l=n);return l}getToManyAggregateSourceInfo(e,t){let l=this.extractSingleLocalFormValuesPath(t);if(!l)return null;let n=(0,x.EA)(l).filter(e=>"object"!=typeof e);if(n.length<2)return null;let o=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==o?void 0:o.getField))return null;let r=[];for(let t=0;t<n.length-1;t++){var i,a;let s=n[t];if("string"!=typeof s)break;let u=null==o||null==(i=o.getField)?void 0:i.call(o,s);if(!(null==u||null==(a=u.isAssociationField)?void 0:a.call(u)))break;if(r.push(s),(0,S.E4)(u)){let t=this.options.getFormValueAtPath(r),n=this.getLocalFormValuesSnapshot(e),o=n&&"object"==typeof n?d().get(n,r):void 0;return{subPath:l,arrayPath:[...r],arrayValue:void 0!==t?t:o,lastWrite:this.getLatestWriteMetaForPath(r)}}if(!(null==(o=u.targetCollection)?void 0:o.getField))break}return null}checkDefaultRuleCanApply(e,t,l,n,o,r){if(void 0===e)return!1;if(this.options.findExplicitHit(l))return n(r),o(),!1;let i=this.options.getFormValueAtPath(t),a=this.options.lastDefaultValueByPathKey.get(l),s=(0,w.Po)(i)||void 0!==a&&d().isEqual(i,a),u=(0,f.isObservable)(e)?(0,f.toJS)(e):e;return!s&&d().isEqual(i,u)?(this.options.lastDefaultValueByPathKey.set(l,u),!1):s}createRuleEvaluationContext(e,t,l){var n;let o,r=this.options.createTrackingFormValues(t),a=new i.FlowContext;try{a.delegate(e)}catch{}let s=null==e||null==(n=e.getPropertyOptions)?void 0:n.call(e,"formValues");s&&"object"==typeof s?a.defineProperty("formValues",{...s,get:()=>r,cache:!1}):a.defineProperty("formValues",{get:()=>r,cache:!1});let d="function"==typeof a.resolveJsonTemplate?a.resolveJsonTemplate.bind(a):void 0;a.defineMethod("resolveJsonTemplate",async l=>{let n=this.createLocalTemplateTokenStore(),o=this.resolveLocalFormValuesTemplates(e,l,t,n),r=o.matched?o.value:l,i=d?await d(r):r;return this.restoreLocalTemplateTokens(i,n)});let u=!1,c=()=>(u||(o=this.buildItemChainValue(e,r,l)??(null==e?void 0:e.item),u=!0),o);return a.defineProperty("item",{get:c,cache:!1}),a}getLocalFormValuesSnapshot(e){try{var t;let l=null==e||null==(t=e.getFormValues)?void 0:t.call(e);if(l&&"object"==typeof l)return l}catch{}let l=this.options.valuesMirror;return(0,f.isObservable)(l)?(0,f.toJS)(l):l}resolveLocalFormValuesPath(e,t){let l=this.getLocalFormValuesSnapshot(e);if(l&&"object"==typeof l)return(0,u.D)(l,t)}recordLocalFormValuesDep(e,t){let l=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(!l.length){t&&(t.wildcard=!0);return}(0,v.Dd)(l,t)}extractSingleLocalFormValuesPath(e){if("string"!=typeof e)return null;let t=e.match(/^\s*\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}\s*$/);return(null==t?void 0:t[1])??null}stringifyTemplateReplacement(e){if(void 0!==e)return e&&"object"==typeof e?JSON.stringify(e):String(e)}createLocalTemplateTokenStore(){let e=new Map,t=0;return{values:e,protect(l){let n=`__NOCObase_FORM_VALUE_LITERAL_${t}__`;return t+=1,e.set(n,l),n}}}restoreLocalTemplateTokens(e,t){if(!t.values.size)return e;if("string"==typeof e){if(t.values.has(e))return t.values.get(e);let l=e;for(let[e,n]of t.values.entries())l.includes(e)&&(l=l.split(e).join(this.stringifyTemplateReplacement(n)??""));return l}if(Array.isArray(e))return e.map(e=>this.restoreLocalTemplateTokens(e,t));if(d().isPlainObject(e)){let l={};for(let[n,o]of Object.entries(e))l[n]=this.restoreLocalTemplateTokens(o,t);return l}return e}resolveLocalFormValuesTemplates(e,t,l,n){if("string"==typeof t){let o=this.extractSingleLocalFormValuesPath(t);if(o){this.recordLocalFormValuesDep(o,l);let r=this.resolveLocalFormValuesPath(e,o);return void 0!==r?{matched:!0,value:n?n.protect(r):r}:{matched:!1,value:t}}let r=!1,i=t.replace(/\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}/g,(t,o)=>{this.recordLocalFormValuesDep(o,l);let i=this.resolveLocalFormValuesPath(e,o),a=this.stringifyTemplateReplacement(i);return void 0===a?t:(r=!0,n?n.protect(a):a)});return{matched:r,value:i}}if(Array.isArray(t)){let o=!1,r=t.map(t=>{let r=this.resolveLocalFormValuesTemplates(e,t,l,n);return r.matched&&(o=!0),r.value});return o?{matched:o,value:r}:{matched:!1,value:t}}if(d().isPlainObject(t)){let o=!1,r={};for(let[i,a]of Object.entries(t)){let t=this.resolveLocalFormValuesTemplates(e,a,l,n);t.matched&&(o=!0),r[i]=t.value}return o?{matched:o,value:r}:{matched:!1,value:t}}return{matched:!1,value:t}}buildItemChainValue(e,t,l){let n=this.getRootCollection()||this.getCollectionFromContext(e),o=(e,t,l,n)=>({index:t,length:l,__is_new__:null==e?void 0:e.__is_new__,__is_stored__:null==e?void 0:e.__is_stored__,value:e,parentItem:n}),r=this.options.getBlockContext(),i=(()=>{try{let e=null==r?void 0:r.item;if(!e||"object"!=typeof e)return;return e.value===(null==r?void 0:r.formValues)?e:void 0}catch{return}})(),a={...o(t,null==i?void 0:i.index,null==i?void 0:i.length,null==i?void 0:i.parentItem),__is_new__:(null==i?void 0:i.__is_new__)??(null==t?void 0:t.__is_new__),__is_stored__:(null==i?void 0:i.__is_stored__)??(null==t?void 0:t.__is_stored__)};if(!l||!Array.isArray(l)||!l.length||!(null==n?void 0:n.getField))return;let s=[],u=[],c=n;for(let e=0;e<l.length;e++){var p,m;let t=l[e];if("string"!=typeof t)break;let n=null==c||null==(p=c.getField)?void 0:p.call(c,t);if(!(null==n||null==(m=n.isAssociationField)?void 0:m.call(n)))break;let o=(0,S.E4)(n);if(u.push(t),o){let t=l[e+1];if("number"==typeof t)u.push(t),e+=1;else if(e!==l.length-1)break}let r=null==n?void 0:n.targetCollection;if(!r)break;s.push({path:[...u],toMany:o}),c=r}let h=e=>{if(e<0)return a;let l=s[e],n=d().get(t,l.path),r=l.path[l.path.length-1],i=l.toMany&&"number"==typeof r,u=i?r:void 0,c=(()=>{if(!l.toMany)return;if(!i)return Array.isArray(n)?n.length:void 0;let e=l.path.slice(0,-1),o=d().get(t,e);return Array.isArray(o)?o.length:void 0})();return o(n,u,c,h(e-1))};return s.length?h(s.length-1):void 0}getFieldIndexSignature(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex);return(Array.isArray(n)?n:[]).filter(e=>"string"==typeof e).join("|")}updateRuleDeps(e,t,l){var n,o;if(t.depDisposers.forEach(e=>e()),t.depDisposers=[],t.deps=l,l.has("fv:*")){let l=(0,f.reaction)(()=>this.options.changeTick.value,()=>this.scheduleRule(e.id));t.depDisposers.push(l)}let r=(()=>{try{return e.getContext()}catch{return}})(),i=(null==r||null==(o=r.model)||null==(n=o.context)?void 0:n.fieldIndex)??(null==r?void 0:r.fieldIndex);if(Array.isArray(i)&&i.some(e=>"string"==typeof e)){let l=(0,f.reaction)(()=>this.getFieldIndexSignature(r),()=>this.scheduleRule(e.id));t.depDisposers.push(l)}for(let n of l){if("fv:*"===n)continue;if(!n.startsWith("fv:")&&!n.startsWith("ctx:")){let l=(0,x.c1)(n),o=(0,f.reaction)(()=>d().get(this.options.valuesMirror,l),()=>this.scheduleRule(e.id));t.depDisposers.push(o);continue}if(n.startsWith("fv:")){let l=n.slice(3),o=(0,x.c1)(l),r=(0,f.reaction)(()=>d().get(this.options.valuesMirror,o),()=>this.scheduleRule(e.id));t.depDisposers.push(r);continue}let l=n.slice(4),o=l.indexOf(":"),i=o>=0?l.slice(0,o):l,a=o>=0?l.slice(o+1):"",s=a?(0,x.EA)(a).filter(e=>"object"!=typeof e):[];if("item"===i){if(s.length){let l=this.options.createTrackingFormValues({deps:new Set,wildcard:!1}),n=(0,f.reaction)(()=>{var t;let n=null==(t=e.getTarget)?void 0:t.call(e),o=n?this.options.tryResolveNamePath(r,n):null,i=this.buildItemChainValue(r,l,o)??(null==r?void 0:r.item);return d().get(i,s)},()=>this.scheduleRule(e.id));t.depDisposers.push(n)}continue}let u=(0,f.reaction)(()=>{let e=r?r[i]:void 0;return s.length?d().get(e,s):e},()=>this.scheduleRule(e.id));t.depDisposers.push(u)}}constructor(e){this.rules=new Map,this.lastRuleWriteByTargetKey=new Map,this.assignTemplatesByTargetPath=new Map,this.formItemTargetPaths=new Set,this.updateAssociationByTargetPath=new Map,this.pendingRuleIds=new Set,this.ruleDebounceUntilById=new Map,this.ruleDebounceTimersById=new Map,this.defaultRuleIdsByMasterUid=new Map,this.defaultRuleMasterDisposers=new Map,this.runningRules=!1,this.rulesEnabled=!1,this.currentRuleTxId=null,this.options=e}}class I{syncAssignRules(e){this.ruleEngine.syncAssignRules(e)}get formValues(){return this.disposed||this.formPatcher.patch(this.getForm()),this.formValuesProxy}getFormValuesSnapshot(){if(!this.disposed){let e=this.getForm();this.formPatcher.patch(e)}return this.getForm().getFieldsValue(!0)}toMirrorSnapshot(e){let t=e=>d().cloneDeepWith(e,e=>{if((0,f.isObservable)(e)){let l=(0,f.toJS)(e);if(l!==e)return t(l)}if(Array.isArray(e)&&"function"!=typeof e.constructor){let l=Array(e.length);for(let n=0;n<e.length;n++)Object.hasOwn(e,n)&&(l[n]=t(e[n]));return l}if(e&&"object"==typeof e&&!(Array.isArray(e)||d().isPlainObject(e)))return e});return t(e)}canApplyDefaultValuePatch(e,t){if(!(null==e?void 0:e.length)||void 0===t)return!1;let l=(0,x.Qc)(e),n=this.getFormValueAtPath(e),o=this.lastDefaultValueByPathKey.get(l),r=(0,f.isObservable)(t)?(0,f.toJS)(t):t,i=(0,f.isObservable)(n)?(0,f.toJS)(n):n,a=void 0!==o&&d().isEqual(i,o);if(this.findExplicitHit(l)&&!a)return!1;let s=(0,w.Po)(n)||a;return!s&&d().isEqual(n,r)?(this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(r)),!1):s}canApplyOverrideValuePatch(e){return!!(null==e?void 0:e.length)&&!this.findUserEditedHit((0,x.Qc)(e))}recordDefaultValuePatch(e,t){if(!(null==e?void 0:e.length))return;let l=(0,x.Qc)(e),n=arguments.length>=2?(0,f.isObservable)(t)?(0,f.toJS)(t):t:this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(n));let o=this.getFormValueAtPath(e),r=(0,f.isObservable)(o)?(0,f.toJS)(o):o;d().isEqual(r,n)&&this.clearExplicitForDefaultPatch(l)}getFormValueAtPath(e){var t,l;let n=null==(t=(l=this).getForm)?void 0:t.call(l);if(n&&"function"==typeof n.getFieldValue)return n.getFieldValue(e);if(n&&"function"==typeof n.getFieldsValue){let t=n.getFieldsValue(!0);return d().get(t,e)}}mount(e){var t,l;if(this.disposed)return;this.formPatcher.patch(this.getForm());let n=null==(l=this.model)||null==(t=l.flowEngine)?void 0:t.emitter;if(n&&(this.mountedListener||this.unmountedListener||(this.mountedListener=e=>{let{model:t}=e;this.indexMountedFieldModelTree(t),this.ruleEngine.onModelMounted(t)},this.unmountedListener=e=>{let{model:t}=e;this.unindexMountedFieldModelTree(t),this.ruleEngine.onModelUnmounted(t)},n.on("model:mounted",this.mountedListener),n.on("model:unmounted",this.unmountedListener)),this.rebuildMountedFieldModelIndex(),null==e?void 0:e.sync)){let e=this.getFormValuesSnapshot();e&&"object"==typeof e&&(d().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.bumpChangeTick()),this.ruleEngine.enable()}}dispose(){var e,t;if(this.disposed)return;this.disposed=!0,this.formPatcher.restore();let l=null==(t=this.model)||null==(e=t.flowEngine)?void 0:e.emitter;for(let e of(l&&this.mountedListener&&this.unmountedListener&&(l.off("model:mounted",this.mountedListener),l.off("model:unmounted",this.unmountedListener)),this.ruleEngine.dispose(),this.mountedFieldModelsByPathKey.clear(),this.observableBindings.values()))e.dispose();this.observableBindings.clear(),this.txWriteCounts.clear()}resetAfterFormReset(){if(this.disposed)return;for(let e of(this.explicitSet.clear(),this.userEditedSet.clear(),this.lastDefaultValueByPathKey.clear(),this.lastWriteMetaByPathKey.clear(),this.txWriteCounts.clear(),this.lastObservedChangedPaths=null,this.lastObservedSource=null,this.lastObservedToken+=1,this.observableBindings.values()))e.dispose();this.observableBindings.clear();let e=this.getFormValuesSnapshot();for(let e of Object.keys(this.valuesMirror))delete this.valuesMirror[e];e&&"object"==typeof e&&d().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.writeSeq+=1,this.bumpChangeTick(),this.ruleEngine.rescheduleAllRules()}resetUserEditedState(){this.disposed||(this.userEditedSet.clear(),this.ruleEngine.rescheduleAllRules())}isSuppressed(){return this.suppressFormCallbackDepth>0}handleFormFieldsChange(e){if(this.disposed)return;let t=this.getForm();if(!t.getFieldValue)return;let l=[],n=new Set,o=!1,r=!1;for(let i of e||[]){let e=null==i?void 0:i.name,a=this.normalizeObservedNamePath(e);if(!(null==a?void 0:a.length))continue;let s=t.getFieldValue(a),u=d().get(this.valuesMirror,a);if(!d().isEqual(s,u)&&(r||(this.writeSeq+=1,r=!0),d().set(this.valuesMirror,a,this.toMirrorSnapshot(s)),l.push(a),(null==i?void 0:i.touched)===!0&&!this.shouldIgnoreSyntheticTouchedInit(a,u,s))){let e=(0,x.Qc)(a);this.shouldKeepDefaultPathValueEnabled(a,s)||(n.add(e),o=!0)}}if(!l.length)return;let i=this.isSuppressed();if(!i&&n.size)for(let e of n)this.markExplicit(e),this.markUserEdited(e);if(this.bumpChangeTick(),i)return;let a=o?"user":"system",s=this.writeSeq;for(let e of l)this.lastWriteMetaByPathKey.set((0,x.Qc)(e),{source:a,writeSeq:s});this.lastObservedChangedPaths=l,this.lastObservedSource=a;let u=++this.lastObservedToken;queueMicrotask(()=>{this.disposed||this.lastObservedToken===u&&(this.lastObservedChangedPaths=null,this.lastObservedSource=null)})}shouldIgnoreSyntheticTouchedInit(e,t,l){if(!(null==e?void 0:e.length)||void 0!==t||!(0,w.Po)(l))return!1;for(let t=e.length-1;t>=0;t--){if("number"!=typeof e[t])continue;let l=e.slice(0,t+1),n=this.getFormValueAtPath(l);return!!(null==n?void 0:n.__is_new__)}return!1}isDeletedArrayItemPath(e,t){let l=Array.isArray(e)?e:(0,x.c1)(e);if(!(null==l?void 0:l.length))return!1;for(let e=l.length-1;e>=0;e--){if("number"!=typeof l[e])continue;let n=l.slice(0,e+1);return void 0===d().get(t,n)}return!1}pruneDeletedArrayItemState(e){for(let t of Array.from(this.explicitSet))this.isDeletedArrayItemPath(t,e)&&this.explicitSet.delete(t);for(let t of Array.from(this.userEditedSet))this.isDeletedArrayItemPath(t,e)&&this.userEditedSet.delete(t);for(let t of Array.from(this.lastDefaultValueByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastDefaultValueByPathKey.delete(t);for(let t of Array.from(this.lastWriteMetaByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastWriteMetaByPathKey.delete(t);for(let[t,l]of Array.from(this.observableBindings.entries()))this.isDeletedArrayItemPath(t,e)&&(l.dispose(),this.observableBindings.delete(t))}getArrayItemTargetKey(e){var t,l,n,o,r,i;let a,s,d=null==(l=this.model)||null==(t=l.context)?void 0:t.collection;for(let t of e||[])if("number"!=typeof t){if("string"!=typeof t||!(null==d?void 0:d.getField)||(a=null==d||null==(r=d.getField)?void 0:r.call(d,t),!(null==a||null==(i=a.isAssociationField)?void 0:i.call(a))))break;s=a,d=null==a?void 0:a.targetCollection}let u=(null==s||null==(n=s.targetCollection)?void 0:n.filterTargetKey)??(null==s||null==(o=s.targetCollection)?void 0:o.filterByTk)??(null==s?void 0:s.targetKey);if(Array.isArray(u)){let e=u.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof u&&u?u:"id"}getArrayItemIdentity(e,t){return(0,C.r5)(e,this.getArrayItemTargetKey(t))}reconcileArrayItemState(e,t,l){let n=new Set;for(let o of e||[]){if(!(null==o?void 0:o.length))continue;let e=(0,x.Qc)(o);if(n.has(e))continue;n.add(e);let r=d().get(this.valuesMirror,o),i=this.getObservedChangedValue(o,t,l);if(!Array.isArray(r)||!Array.isArray(i))continue;let a=new Map;i.forEach((e,t)=>{let l=this.getArrayItemIdentity(e,o);l&&a.set(l,t)}),a.size&&(this.reconcileArrayItemSet(this.explicitSet,o,r,a),this.reconcileArrayItemSet(this.userEditedSet,o,r,a),this.reconcileArrayItemMap(this.lastDefaultValueByPathKey,o,r,a),this.reconcileArrayItemMap(this.lastWriteMetaByPathKey,o,r,a),this.reconcileObservableBindings(o,r,a))}}getReconciledArrayItemPath(e,t,l,n){let o=(0,x.c1)(e);if(o.length<=t.length)return{action:"keep"};for(let e=0;e<t.length;e++)if(o[e]!==t[e])return{action:"keep"};let r=o[t.length];if("number"!=typeof r)return{action:"keep"};let i=this.getArrayItemIdentity(l[r],t);if(!i)return{action:"keep"};let a=n.get(i);if(null==a)return{action:"delete"};if(a===r)return{action:"keep"};let s=[...o];return s[t.length]=a,{action:"move",key:(0,x.Qc)(s)}}reconcileArrayItemSet(e,t,l,n){let o=new Set,r=!1;for(let i of e){let e=this.getReconciledArrayItemPath(i,t,l,n);if("delete"===e.action){r=!0;continue}if("move"===e.action){r=!0,o.add(e.key);continue}o.add(i)}if(r)for(let t of(e.clear(),o))e.add(t)}reconcileArrayItemMap(e,t,l,n){let o=new Map,r=!1;for(let[i,a]of e){let e=this.getReconciledArrayItemPath(i,t,l,n);if("delete"===e.action){r=!0;continue}if("move"===e.action){r=!0,o.set(e.key,a);continue}o.set(i,a)}if(r)for(let[t,l]of(e.clear(),o))e.set(t,l)}reconcileObservableBindings(e,t,l){let n=new Map,o=!1;for(let[r,i]of this.observableBindings){let a=this.getReconciledArrayItemPath(r,e,t,l);if("delete"===a.action){o=!0,i.dispose();continue}if("move"===a.action){o=!0,i.pathKey=a.key,n.set(a.key,i);continue}n.set(r,i)}if(o)for(let[e,t]of(this.observableBindings.clear(),n))this.observableBindings.set(e,t)}getObservedChangedValue(e,t,l){if(d().has(l,e))return d().get(l,e);if((null==e?void 0:e.length)===1){let l=e[0];if(("string"==typeof l||"number"==typeof l)&&t&&Object.prototype.hasOwnProperty.call(t,l))return t[l]}return d().get(l,e)}getObservedSnapshot(e,t){if(!e||"object"!=typeof e)return t;if(!t||"object"!=typeof t)return e;let l=t;for(let n of Object.keys(e))d().has(l,[n])||(l===t&&(l=Array.isArray(t)?[...t]:{...t}),d().set(l,[n],e[n]));return l}handleFormValuesChange(e,t){if(this.disposed||this.isSuppressed())return;let l=Object.keys(e||{}).map(e=>[e]),n=this.lastObservedChangedPaths&&this.lastObservedChangedPaths.length?this.lastObservedChangedPaths:l,o=this.lastObservedSource??"user";this.lastObservedChangedPaths=null,this.lastObservedSource=null;let r=this.getFormValuesSnapshot(),i=r&&"object"==typeof r?r:t&&"object"==typeof t?t:e,a=this.getObservedSnapshot(e,i);this.reconcileArrayItemState([...n,...l],e,a),this.pruneDeletedArrayItemState(a);let s=this.deriveExplicitPaths(n,e,a,this.valuesMirror).filter(e=>!this.isDeletedArrayItemPath(e,a)),u=!1,c=!1,p=[];for(let t of n){if(!(null==t?void 0:t.length))continue;let l=this.getObservedChangedValue(t,e,a),n=d().get(this.valuesMirror,t);d().isEqual(n,l)||(c||(this.writeSeq+=1,c=!0),d().set(this.valuesMirror,t,this.toMirrorSnapshot(l)),u=!0,p.push(t))}u&&this.bumpChangeTick();let m=[];for(let e of s)this.shouldKeepDefaultPathEnabled(e,a)||m.push(e);for(let e of m){let t=(0,x.Qc)(e);this.markExplicit(t),"user"===o&&this.markUserEdited(t)}if(u){let e=this.writeSeq;for(let t of p)(null==t?void 0:t.length)&&this.lastWriteMetaByPathKey.set((0,x.Qc)(t),{source:o,writeSeq:e})}let h=(0,w.ao)();this.emitFormValuesChange({source:o,txId:h,changedPaths:n,changedValues:e,allValues:a,allValuesSnapshot:a})}deriveExplicitPaths(e,t,l,n){let o=[],r=new Set;for(let i of e||[]){if(!(null==i?void 0:i.length))continue;let e=d().get(n,i),a=this.getObservedChangedValue(i,t,l);this.collectExplicitDiffPaths(e,a,i,o,r)}return o}collectExplicitDiffPaths(e,t,l,n,o){if(d().isEqual(e,t))return 0;let r=Array.isArray(e),i=Array.isArray(t);if(r||i){if(r&&i){let r=Math.min(e.length,t.length),i=0;for(let a=0;a<r;a++)i+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,o);return e.length!==t.length?i+ +!!this.pushExplicitPath(l,n,o):i}return+!!this.pushExplicitPath(l,n,o)}let a=this.isPlainObjectValue(e),s=this.isPlainObjectValue(t);if(a||s){if(a&&s){let r=new Set([...Object.keys(e),...Object.keys(t)]),i=0;for(let a of r)i+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,o);return 0===i&&this.isObjectCleared(e,t)?+!!this.pushExplicitPath(l,n,o):i}this.isObjectCleared(e,t)}return+!!this.pushExplicitPath(l,n,o)}pushExplicitPath(e,t,l){if(!(null==e?void 0:e.length))return!1;let n=(0,x.Qc)(e);return!(!n||l.has(n))&&(l.add(n),t.push([...e]),!0)}isPlainObjectValue(e){return d().isPlainObject(e)}isObjectCleared(e,t){return!!this.isPlainObjectValue(e)&&!!(null==t||this.isPlainObjectValue(t)&&0===Object.keys(t).length)}async setFormValues(e,t,l){var n,o,r,i;if(this.disposed)return;let a=null==(n=(o=this).getForm)?void 0:n.call(o);if(!a)return;let s=(null==l?void 0:l.source)??"system",u=(null==l?void 0:l.triggerEvent)!==!1,c=(null==l?void 0:l.txId)??(0,w.ao)(),p=(null==l?void 0:l.markExplicit)??("default"!==s&&"linkage"!==s),m=void 0===(null==l?void 0:l.txId),h="linkage"===s&&Number.isFinite(Number(null==l?void 0:l.linkageScopeDepth))?Number(null==l?void 0:l.linkageScopeDepth):0,v="linkage"===s&&"string"==typeof(null==l?void 0:l.linkageTxId)&&l.linkageTxId?String(l.linkageTxId):void 0,y=e=>{if("linkage"!==s||!v)return!1;let t=this.lastWriteMetaByPathKey.get(e);return!!t&&"linkage"===t.source&&!!t.linkageTxId&&t.linkageTxId===v&&(Number.isFinite(Number(t.linkageScopeDepth))?Number(t.linkageScopeDepth):0)>h},b=e=>"linkage"===s?{source:s,writeSeq:e,linkageScopeDepth:h,linkageTxId:v}:{source:s,writeSeq:e},S=e=>"linkage"===s&&v?{...e,linkageTxId:v}:e;try{let l=[];if(!Array.isArray(t)){let e=Object.entries(t||{}).map(e=>{let[t,l]=e;return[t,this.toMirrorSnapshot(l)]}).filter(e=>{let[t,l]=e;return!y(t)&&!d().isEqual(this.getFormValueAtPath([t]),l)}),l=Object.fromEntries(e),n=e.map(e=>{let[t]=e;return t});if(!n.length)return;n.length&&(this.writeSeq+=1),this.suppressFormCallbackDepth++;try{for(let[t,l]of e)"function"==typeof a.setFieldValue?a.setFieldValue(t,l):"function"==typeof a.setFields?a.setFields([{name:t,value:l}]):null==(r=a.setFieldsValue)||r.call(a,{[t]:l}),d().set(this.valuesMirror,[t],this.toMirrorSnapshot(l)),this.syncMountedFieldModelValue([t],l);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let o=this.writeSeq;for(let e of n)this.lastWriteMetaByPathKey.set(e,b(o));if(p)for(let e of n)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if(u){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(S({source:s,txId:c,changedPaths:n.map(e=>[e]),changedValues:l,allValues:e,allValuesSnapshot:e}))}return}let n=new Map,o=0;for(let l of t){let t=null==l?void 0:l.condition;if(t&&!(0,g.F)(e,t))continue;let r=this.resolveNamePath(e,l.path),i=(0,x.Qc)(r),a=l.value,s=this.toMirrorSnapshot(a);if(y(i))continue;let u=this.getFormValueAtPath(r);d().isEqual(u,s)||(o+=1,n.set(i,{order:o,namePath:r,value:s,rawValue:a,pathKey:i}))}let m=Array.from(n.values()).sort((e,t)=>e.order-t.order).map(e=>({namePath:e.namePath,value:e.value,rawValue:e.rawValue,pathKey:e.pathKey}));if(!m.length)return;let C=this.txWriteCounts.get(c)||new Map;this.txWriteCounts.set(c,C);let F=[];for(let e of m){let t=(C.get(e.pathKey)||0)+1;C.set(e.pathKey,t),t>w.li||F.push(e)}if(!F.length)return;this.writeSeq+=1;let k=this.writeSeq;for(let{pathKey:e,rawValue:t}of F)if(!(0,f.isObservable)(t)){let t=this.observableBindings.get(e);t&&(t.dispose(),this.observableBindings.delete(e))}this.suppressFormCallbackDepth++;try{for(let{namePath:e,value:t}of F)null==(i=a.setFieldValue)||i.call(a,e,t),d().set(this.valuesMirror,e,this.toMirrorSnapshot(t)),this.syncMountedFieldModelValue(e,t),l.push(e);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}for(let{pathKey:e}of F)this.lastWriteMetaByPathKey.set(e,b(k));if(p)for(let{pathKey:e}of F)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if("default"===s)for(let{namePath:e,pathKey:t}of F){let l=this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(t,this.toMirrorSnapshot(l))}for(let{rawValue:t,pathKey:l}of F){if(!(0,f.isObservable)(t))continue;let n=t,o={source:s,pathKey:l,dispose:()=>{}},r=(0,f.observe)(n,()=>{let t=o.pathKey;this.applyBoundValue(e,(0,x.c1)(t),t,(0,f.toJS)(n),s,h,v)});o.dispose=r;let i=this.observableBindings.get(l);i&&i.dispose(),this.observableBindings.set(l,o)}if(u){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(S({source:s,txId:c,changedPaths:l,changedValues:{},allValues:e,allValuesSnapshot:e}))}}finally{m&&this.txWriteCounts.delete(c)}}applyBoundValue(e,t,l,n,o,r,i){var a,s,u;if(this.disposed)return;let c=null==(a=(s=this).getForm)?void 0:a.call(s);if(!c||"override"===o&&this.findUserEditedHit(l))return;let p=this.toMirrorSnapshot(n),m=d().get(this.valuesMirror,t);if(d().isEqual(m,p))return;this.writeSeq+=1;let h=this.writeSeq;this.suppressFormCallbackDepth++;try{null==(u=c.setFieldValue)||u.call(c,t,p),d().set(this.valuesMirror,t,this.toMirrorSnapshot(p)),this.syncMountedFieldModelValue(t,p),this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let f="linkage"===o?{source:o,writeSeq:h,linkageScopeDepth:Number.isFinite(Number(r))?Number(r):0,linkageTxId:"string"==typeof i&&i?i:void 0}:{source:o,writeSeq:h};this.lastWriteMetaByPathKey.set(l,f);let g=(0,w.ao)(),v=this.getFormValuesSnapshot(),y={source:o,txId:g,changedPaths:[t],changedValues:{},allValues:v,allValuesSnapshot:v};if("linkage"===o&&i&&(y.linkageTxId=i),this.emitFormValuesChange(y),"default"===o&&this.isExplicit(l)||"override"===o&&this.findUserEditedHit(l)){let e=this.observableBindings.get(l);e&&(e.dispose(),this.observableBindings.delete(l))}"default"===o&&this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(this.getFormValueAtPath(t)))}resolveNamePath(e,t){let l=this.tryResolveNamePath(e,t);if(!l)throw Error(`Failed to resolve path '${String(t)}'`);return l}tryResolveNamePath(e,t){var l,n;let o=(null==e||null==(n=e.model)||null==(l=n.context)?void 0:l.fieldIndex)??(null==e?void 0:e.fieldIndex);return(0,x.IJ)(t,o)}bumpChangeTick(){this.changeTick.value+=1}emitFormValuesChange(e){var t,l,n,o;null==(t=(l=this.model).dispatchEvent)||t.call(l,"formValuesChange",e,{debounce:!0}),null==(o=this.model.emitter)||null==(n=o.emit)||n.call(o,"formValuesChange",e)}syncMountedFieldModelValue(e,t){let l=(0,x.Qc)(e);if(!l)return;let n=this.mountedFieldModelsByPathKey.get(l);if(!(null==n?void 0:n.size))return;let o=new Set;for(let e of Array.from(n))this.syncMountedFieldModelValueForModel(e,t,o)}syncMountedFieldModelValueForModel(e,t,l){var n,o,r;if(!e||l.has(e)||(l.add(e),!this.isMountedModelInThisForm(e)))return;let i={value:t};null==(n=e.setProps)||n.call(e,i);let a=null==(o=e.subModels)?void 0:o.field;null==a||null==(r=a.setProps)||r.call(a,i)}rebuildMountedFieldModelIndex(){var e,t;this.mountedFieldModelsByPathKey.clear();let l=null==(t=this.model)||null==(e=t.context)?void 0:e.engine;l&&"function"==typeof l.forEachModel&&l.forEachModel(e=>{this.indexMountedFieldModelTree(e)})}indexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.indexMountedFieldModel(e))}unindexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.unindexMountedFieldModel(e))}visitModelAndForks(e,t){if(!e)return;let l=new Set,n=e=>{var o;if(!e||l.has(e))return;l.add(e),t(e);let r=e.forks;null==r||null==(o=r.forEach)||o.call(r,e=>n(e))};n(e)}indexMountedFieldModel(e){if(!this.isMountedModelInThisForm(e))return;let t=new Set;for(let l of this.getMountedModelNamePaths(e)){let e=(0,x.Qc)(l);e&&t.add(e)}if(t.size)for(let l of(this.unindexMountedFieldModel(e),this.mountedFieldModelPathKeys.set(e,t),t)){let t=this.mountedFieldModelsByPathKey.get(l)||new Set;t.add(e),this.mountedFieldModelsByPathKey.set(l,t)}}unindexMountedFieldModel(e){let t=this.mountedFieldModelPathKeys.get(e);if(t){for(let l of t){let t=this.mountedFieldModelsByPathKey.get(l);t&&(t.delete(e),t.size||this.mountedFieldModelsByPathKey.delete(l))}this.mountedFieldModelPathKeys.delete(e)}}isMountedModelInThisForm(e){var t;let l=null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.model.uid)}getMountedModelNamePaths(e){var t,l;let n=[],o=e=>{let t=this.normalizeNamePathValue(e);(null==t?void 0:t.length)&&n.push(t)};o(null==(t=e.context)?void 0:t.fieldPathArray);let r="function"==typeof e.getProps?e.getProps():e.props;r&&"object"==typeof r&&o(r.name);try{let t=null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init");t&&"object"==typeof t&&o(t.fieldPath)}catch{}let i=new Set;return n.filter(e=>{let t=(0,x.Qc)(e);return!(!t||i.has(t))&&(i.add(t),!0)})}normalizeNamePathValue(e){if(Array.isArray(e)){let t=e.filter(e=>"string"==typeof e||"number"==typeof e);return t.length===e.length?t:null}return"number"==typeof e?[e]:"string"==typeof e&&e?(0,x.c1)(e):null}markExplicit(e){if(this.explicitSet.has(e))return;this.explicitSet.add(e);let t=this.shouldPreserveDescendantDefaultsOnExplicit(e);for(let l of Array.from(this.lastDefaultValueByPathKey.keys())){let n=l.startsWith(`${e}.`)||l.startsWith(`${e}[`);(l===e||!t&&n)&&this.lastDefaultValueByPathKey.delete(l)}for(let[e,t]of Array.from(this.observableBindings.entries()))"default"===t.source&&this.isExplicit(e)&&(t.dispose(),this.observableBindings.delete(e))}markUserEdited(e){if(!this.userEditedSet.has(e))for(let[t,l]of(this.userEditedSet.add(e),Array.from(this.observableBindings.entries())))"override"===l.source&&this.findUserEditedHit(t)&&(l.dispose(),this.observableBindings.delete(t))}normalizeObservedNamePath(e){if(Array.isArray(e))return e;if("number"==typeof e)return[e];if("string"!=typeof e||!e)return null;let t=(0,x.c1)(e);return t.length?t:[e]}clearExplicitForDefaultPatch(e){for(let t of Array.from(this.explicitSet))(t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`))&&this.explicitSet.delete(t)}shouldPreserveDescendantDefaultsOnExplicit(e){return Array.isArray(this.getFormValueAtPath((0,x.c1)(e)))}shouldKeepDefaultPathEnabled(e,t){return this.shouldKeepDefaultPathValueEnabled(e,d().get(t,e))}shouldKeepDefaultPathValueEnabled(e,t){let l=(0,x.Qc)(e),n=this.lastDefaultValueByPathKey.get(l);if(void 0===n)return!1;let o=(0,f.isObservable)(t)?(0,f.toJS)(t):t;return d().isEqual(o,n)}isExplicit(e){return!!this.findExplicitHit(e)}findExplicitHit(e){if(this.explicitSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.explicitSet.has(n)&&"number"!=typeof t[e+1])return n}return null}findUserEditedHit(e){if(this.userEditedSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.userEditedSet.has(n)&&"number"!=typeof t[e+1])return n}for(let t of this.userEditedSet)if(this.isDescendantPathKey(t,e))return t;return null}isDescendantPathKey(e,t){if(!e||!t||e===t)return!1;let l=(0,x.c1)(e),n=(0,x.c1)(t);return!(l.length<=n.length)&&n.every((e,t)=>l[t]===e)}constructor(e){this.valuesMirror=(0,f.observable)({}),this.explicitSet=new Set,this.userEditedSet=new Set,this.lastDefaultValueByPathKey=new Map,this.lastWriteMetaByPathKey=new Map,this.observableBindings=new Map,this.changeTick=f.observable.ref(0),this.txWriteCounts=new Map,this.writeSeq=0,this.disposed=!1,this.suppressFormCallbackDepth=0,this.lastObservedChangedPaths=null,this.lastObservedSource=null,this.lastObservedToken=0,this.mountedFieldModelsByPathKey=new Map,this.mountedFieldModelPathKeys=new WeakMap,this.model=e.model,this.getForm=e.getForm,this.formPatcher=y({isSuppressed:()=>this.isSuppressed(),getCallerContext:()=>{var e;return null==(e=this.model)?void 0:e.context},setFormValues:this.setFormValues.bind(this)}),this.ruleEngine=new M({getBlockModelUid:()=>{var e;return String(null==(e=this.model)?void 0:e.uid)},getActionName:()=>{var e,t,l,n;return(null==(t=this.model)||null==(e=t.getAclActionName)?void 0:e.call(t))??(null==(n=this.model)||null==(l=n.context)?void 0:l.actionName)},getBlockContext:()=>{var e;return null==(e=this.model)?void 0:e.context},getEngine:()=>{var e,t;return null==(t=this.model)||null==(e=t.context)?void 0:e.engine},getEngineModel:e=>{var t,l,n,o;return(null==(o=this.model)||null==(n=o.context)||null==(l=n.engine)||null==(t=l.getModel)?void 0:t.call(l,e))??null},isDisposed:()=>this.disposed,valuesMirror:this.valuesMirror,changeTick:this.changeTick,getWriteSeq:()=>this.writeSeq,txWriteCounts:this.txWriteCounts,createTrackingFormValues:e=>(0,v.x3)({valuesMirror:this.valuesMirror,basePath:[],collector:e,getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)}),tryResolveNamePath:(e,t)=>this.tryResolveNamePath(e,t),getFormValueAtPath:e=>this.getFormValueAtPath(e),setFormValues:(e,t,l)=>this.setFormValues(e,t,l),findExplicitHit:e=>this.findExplicitHit(e),findUserEditedHit:e=>this.findUserEditedHit(e),lastDefaultValueByPathKey:this.lastDefaultValueByPathKey,lastWriteMetaByPathKey:this.lastWriteMetaByPathKey,observableBindings:this.observableBindings}),this.formValuesProxy=(0,v.x3)({valuesMirror:this.valuesMirror,basePath:[],getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)})}}function T(e,t){let l=Array.isArray(e)?e:[],n=new Set,o=e=>{var l,n,o;if(!t||"function"!=typeof t.getField||"string"!=typeof e||!e.includes("."))return null;let r=e.split(".").filter(Boolean);if(r.length<2)return null;let i=t,a=[],s=null,d=null;for(let e=0;e<r.length-1;e++){let t=r[e],o=null==i||null==(l=i.getField)?void 0:l.call(i,t);if(!(null==o||null==(n=o.isAssociationField)?void 0:n.call(o))||!(null==o?void 0:o.targetCollection))break;a.push(t),s=a.join("."),d=o,i=o.targetCollection}if(s&&d){let e=r[r.length-1],t=(null==d?void 0:d.targetKey)??(null==d||null==(o=d.targetCollection)?void 0:o.filterTargetKey)??"id",l=Array.isArray(t)?t.filter(e=>"string"==typeof e&&!!e):"string"==typeof t&&t?[t]:["id"];if("string"==typeof e&&l.includes(e))return null}return s};for(let e of l){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=o(t);l&&n.add(l)}return Array.from(n)}var R=l(71712);let E={formModelSettings:new Set(["layout","assignRules"]),eventSettings:new Set(["linkageRules"])},N="nb-flow-keep-mobile-horizontal",D=(0,r.css)`
|
|
3124
|
+
`;return(0,n.jsxs)("div",{style:{maxHeight:300,overflowY:"auto"},children:[e.map(e=>(0,n.jsx)("div",{role:"option",onClick:()=>b(e.value),className:l,children:f(e.label)},e.value)),(0,n.jsx)(i.A,{style:{margin:"4px 0"}}),t.map(e=>(0,n.jsx)("div",{role:"option",className:l,onClick:()=>b(e.value),title:f(e.label),children:f(e.label)},e.value))]})};return(0,n.jsxs)(a.A.Compact,{style:{...m.style,width:"100%"},children:[(0,n.jsx)(s.A,{options:x,open:v,onDropdownVisibleChange:y,...m,allowClear:!1,style:{width:"100%",minWidth:100,maxWidth:["past","next","exact",void 0].includes(null==t?void 0:t.type)?100:null},value:(null==t?void 0:t.type)||"exact",onChange:b,dropdownRender:w}),["past","next"].includes(null==t?void 0:t.type)&&[(0,n.jsx)(d.A,{style:{flex:1},value:null==t?void 0:t.number,onChange:e=>{l({...t,number:e})}},"number"),(0,n.jsx)(s.A,{value:null==t?void 0:t.unit,style:{minWidth:130,maxWidth:140},onChange:e=>{l({...t,unit:e})},options:[{value:"day",label:f("Day")},{value:"week",label:f("Calendar week")},{value:"month",label:f("Calendar Month")},{value:"year",label:f("Calendar Year")}],popupMatchSelectWidth:!0},"unit")],((null==t?void 0:t.type)==="exact"||!(null==t?void 0:t.type))&&(0,n.jsx)(F,{...m,value:t,onChange:l})]})}},32644(e,t,l){"use strict";l.d(t,{S:()=>i});let n=new Set(["$match","$notMatch","$anyOf","$noneOf","$childIn","$childNotIn","$in","$notIn"]);function o(e){return!!e&&"object"==typeof e&&!Array.isArray(e)&&"type"in e}function r(e){return null==e||"string"==typeof e&&""===e.trim()}function i(e,t){if(!e)return t;if("$dateBetween"===e){if(null==t||o(t))return t;if(Array.isArray(t)){if(0===t.length)return t;let e=t[0],l=t.length>1?t[1]:void 0,n=r(e),o=r(l);return(1!==t.length||n)&&(n||!o)?n&&!o?[l,l]:t:[e,e]}return[t,t]}return n.has(e)?null==t||Array.isArray(t)?t:"string"==typeof t&&""===t.trim()?[]:[t]:t}},71616(e,t,l){"use strict";l.d(t,{EditFormModel:()=>c});var n=l(74848),o=l(11869),r=l(58929),i=l(84626),a=l(40098);l(96540);var s=l(15892),d=l(96491),u=l(84759);class c extends d.F4{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(o.SingleRecordResource);return e.isNewRecord=!1,e}let r=this.context.createResource(o.MultiRecordResource);return r.setPageSize(1),r}isMultiRecordResource(){return this.resource instanceof o.MultiRecordResource}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}getAclActionName(){return"update"}async submitHandler(e,t,n){let{submitHandler:o}=await Promise.resolve().then(l.bind(l,53831));await o(e,t,n)}async submit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,{submitHandler:n}=await Promise.resolve().then(l.bind(l,53831));await n(this.context,e,t)}renderComponent(){var e,t;let{colon:l,labelAlign:a,labelWidth:s,labelWrap:u,layout:c}=this.props,p=!!this.context.flowSettingsEnabled,m=this.hasAvailableData(),h=!p&&!m,{heightMode:f,height:g}=this.decoratorProps,v=this.resource.loading||m?this.isMultiRecordResource()&&this.resource.getMeta("count")>1?(0,n.jsx)("div",{style:{textAlign:"center",marginTop:16},children:(0,n.jsx)(r.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:this.resource.getPage(),total:this.resource.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})}):null:(0,n.jsx)("div",{style:{textAlign:"center",marginTop:16,color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")});return(0,n.jsx)(d.JU,{model:this,gridModel:this.subModels.grid,layoutProps:{colon:l,labelAlign:a,labelWidth:s,labelWrap:u,layout:c},heightMode:f,height:g,grid:(0,n.jsx)(o.FlowModelRenderer,{model:this.subModels.grid,showFlowSettings:!1}),actions:(0,n.jsx)("div",{style:h?{pointerEvents:"none",opacity:.45}:void 0,children:(0,n.jsx)(o.DndProvider,{children:(0,n.jsxs)(i.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||p)return(0,n.jsx)(o.Droppable,{model:e,children:(0,n.jsx)(o.MemoFlowModelRenderer,{model:e,showFlowSettings:!!this.context.flowSettingsEnabled&&this.actionFlowSettings,extraToolbarItems:this.actionExtraToolbarItems},e.uid)},e.uid)}),this.renderConfigureActions()]})})}),footer:v})}constructor(...e){super(...e),this.actionFlowSettings={showBackground:!1,showBorder:!1,toolbarPosition:"above"},this.actionExtraToolbarItems=[{key:"drag-handler",component:o.DragHandler,sort:1}],this.handlePageChange=async e=>{if(this.resource instanceof o.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await t.refresh(),await (0,u.Xi)(this,"paginationChange")}}}}c.scene=s.P.oam,c.blockCapabilityActionName="update",c.registerFlow({key:"formSettings",title:(0,o.tExpr)("Edit form settings"),steps:{init:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");e.resource.on("refresh",async()=>{var t,l,n,o,r,i,s,d;let u=e.resource.getMeta("currentFilterByTk"),c={...e.model.getCurrentRecord()};if(!c)return;let p=null==(t=e.association)?void 0:t.targetKey;if(p&&(null==(l=e.association)?void 0:l.interface)!=="m2m"?e.resource.setMeta({currentFilterByTk:null==c?void 0:c[p]}):e.resource.setMeta({currentFilterByTk:e.collection.getFilterByTK(c)}),!e.form)return;let m=e.resource.getMeta("currentFilterByTk"),h=!(0,a.isEqual)(u,m),f=null==(n=(o=e.model).getUserModifiedFields)?void 0:n.call(o),g=!!(null==f?void 0:f.size),v=()=>{if(!(null==f?void 0:f.size))return;let t=e=>null!==e&&"object"==typeof e;for(let l of Array.from(f)){let n=e.form.getFieldValue(l),o=null==c?void 0:c[l];(Object.is(n,o)||t(n)&&t(o)&&(0,a.isEqual)(n,o))&&f.delete(l)}};if(!h&&g){let t={...c};for(let l of f)t[l]=e.form.getFieldValue(l);e.form.setFieldsValue(t),v();return}h&&(null==(r=(i=e.model).resetUserModifiedFields)||r.call(i),null==(s=(d=e.model).resetRuntimeUserEditedState)||s.call(d)),e.form.setFieldsValue(c),v()})}},dataScope:{use:"dataScope"},refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized")}}}}),c.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldsLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"fieldLinkageRules",flowKey:"eventSettings",stepKey:"linkageRules"}}}}),c.define({label:(0,o.tExpr)("Form (Edit)"),searchable:!0,searchPlaceholder:(0,o.tExpr)("Search"),createModelOptions:{use:"EditFormModel",subModels:{grid:{use:"FormGridModel"}}},sort:340})},96491(e,t,l){"use strict";l.d(t,{JU:()=>V,s2:()=>O,F4:()=>$,mO:()=>z});var n=l(74848),o=l(49655),r=l(22803),i=l(11869),a=l(89013),s=l(40098),d=l.n(s),u=l(40542),c=l(96540),p=l(2117),m=l(25359),h=l(52175),f=l(95243),g=l(29676),v=l(47632);function y(e){let t,l,n,o=()=>{let e=t;e&&(l&&(e.setFieldValue=l),n&&(e.setFieldsValue=n),t=void 0,l=void 0,n=void 0)};return{patch:r=>{if(t===r)return;o();let i="function"==typeof(null==r?void 0:r.setFieldValue)?r.setFieldValue.bind(r):void 0,a="function"==typeof(null==r?void 0:r.setFieldsValue)?r.setFieldsValue.bind(r):void 0;t=r,l=i,n=a,i&&(r.setFieldValue=(t,l)=>{e.isSuppressed()?i(t,l):e.setFormValues(e.getCallerContext(),[{path:t,value:l}],{source:"system"}).catch(()=>void 0)}),a&&(r.setFieldsValue=t=>{e.isSuppressed()?a(t):e.setFormValues(e.getCallerContext(),t,{source:"system"}).catch(()=>void 0)})},restore:o}}var x=l(12197),b=l(13939),w=l(65421),S=l(13940),C=l(26866);let F=Symbol("SKIP_RULE_VALUE"),k=Symbol("UNRESOLVED_ASSOCIATION_IDENTITY"),A=1e3;function P(e){return"default"===e?"default":"override"===e?"override":"assign"}function j(e){return"default"===e?"default":"override"===e?"override":"system"}class M{getAssignRuleBlockId(e){return`form-assign:${e}:block`}removeAssignRuleBlockInstance(e){let t=this.getAssignRuleBlockId(e);this.rules.has(t)&&this.removeRule(t)}removeRowGridAssignRuleInstances(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e),n=[];for(let[e,i]of this.rules.entries()){var o,r;if(!e.startsWith(t)||e===l)continue;let a=null==i||null==(r=i.rule)||null==(o=r.getContext)?void 0:o.call(r),s=null==a?void 0:a.model;s&&this.isRowGridModel(s)&&n.push(e)}for(let e of n)this.removeRule(e)}hasAnyNonBlockAssignRuleInstance(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e);for(let e of this.rules.keys())if(e.startsWith(t)&&e!==l)return!0;return!1}ensureBlockAssignRuleInstancesForTargetPath(e){if(this.options.isDisposed()||!e||!this.shouldCreateBlockLevelAssignRule(e))return;let t=this.assignTemplatesByTargetPath.get(e)||[];if(t.length)for(let l of t){let t=(null==l?void 0:l.__key)?String(l.__key):"";if(!t||this.hasAnyNonBlockAssignRuleInstance(t))continue;let n=j(P(null==l?void 0:l.mode)),o=(null==l?void 0:l.enable)!==!1,r=this.getAssignRuleBlockId(t);if(this.rules.has(r))continue;let i={id:r,source:n,priority:10+(l.__order||0),debounceMs:0,getEnabled:()=>o&&!!e,getTarget:()=>e,getValue:()=>null==l?void 0:l.value,getCondition:()=>null==l?void 0:l.condition,getContext:()=>this.options.getBlockContext(),getContractModelUid:this.options.getAssignRulesModelUid};this.rules.set(r,{rule:i,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(r)}}getCollectionFromContext(e){var t,l;return(null==e?void 0:e.collection)??(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.collection)}getRootCollection(){let e=this.options.getBlockContext();return this.getCollectionFromContext(e)}shouldCreateBlockLevelAssignRule(e){let t=this.options.getBlockContext(),l=this.getCollectionFromContext(t);if(!(null==l?void 0:l.getField))return!0;let n=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(n.length<=1)return!0;for(let e=0;e<n.length-1;e++){var o,r;let t=n[e];if("string"!=typeof t)continue;let i=null==l||null==(o=l.getField)?void 0:o.call(l,t);if(!(null==i||null==(r=i.isAssociationField)?void 0:r.call(i)))break;if((0,S.E4)(i)){if("number"!=typeof n[e+1])return!1;e+=1}if(!(null==(l=null==i?void 0:i.targetCollection)?void 0:l.getField))break}return!0}collectAssociationPrefixPaths(e,t){let l=[],n=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==n?void 0:n.getField))return l;let o=[];for(let e=0;e<t.length-1;e++){var r,i;let a=t[e];if("string"!=typeof a)break;let s=null==n||null==(r=n.getField)?void 0:r.call(n,a);if(!(null==s||null==(i=s.isAssociationField)?void 0:i.call(s)))break;if(o.push(a),(0,S.E4)(s)){let l=t[e+1];if("number"!=typeof l)break;o.push(l),e+=1}if(l.push([...o]),!(null==(n=null==s?void 0:s.targetCollection)?void 0:n.getField))break}return l}shouldSkipToManyAssociationWriteWithoutIndex(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return!1;for(let e=0;e<t.length-1;e++){var n,o;let r=t[e];if("string"!=typeof r)continue;let i=null==l||null==(n=l.getField)?void 0:n.call(l,r);if(!(null==i||null==(o=i.isAssociationField)?void 0:o.call(i)))break;if((0,S.E4)(i)){if("number"!=typeof t[e+1])return!0;e+=1}if(!(null==(l=null==i?void 0:i.targetCollection)?void 0:l.getField))break}return!1}shouldSkipAssociationNestedWrite(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return!1;for(let n of l){let l=this.options.getFormValueAtPath(n);if(null==l){let l=n.filter(e=>"string"==typeof e).join(".");if(l&&this.getUpdateAssociationForTargetPath(l)||this.isAssociationTargetKeyWrite(e,t,n))continue;return!0}if("object"!=typeof l)return!0}return!1}getAssociationTargetKeyFields(e){var t,l;let n=(null==e?void 0:e.targetKey)??(null==e||null==(t=e.targetCollection)?void 0:t.filterTargetKey)??(null==e||null==(l=e.targetCollection)?void 0:l.filterByTk)??"id";return Array.isArray(n)?n.filter(e=>"string"==typeof e&&!!e):"string"==typeof n&&n?[n]:["id"]}resolveAssociationFieldByPrefixPath(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;let n=null;for(let e of t){var o,r;if("number"==typeof e)continue;if("string"!=typeof e||!e)break;let t=null==l||null==(o=l.getField)?void 0:o.call(l,e);if(!(null==t||null==(r=t.isAssociationField)?void 0:r.call(t))||(n=t,!(null==(l=null==t?void 0:t.targetCollection)?void 0:l.getField)))break}return n}isAssociationTargetKeyWrite(e,t,l){var n;if(!Array.isArray(t)||!Array.isArray(l)||t.length!==l.length+1)return!1;let o=t[l.length];if("string"!=typeof o||!o)return!1;let r=this.resolveAssociationFieldByPrefixPath(e,l);return!(!(null==r||null==(n=r.isAssociationField)?void 0:n.call(r))||(0,S.E4)(r))&&this.getAssociationTargetKeyFields(r).includes(o)}collectUpdateAssociationInitPatches(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return[];let n=[];for(let o of l){let l=this.options.getFormValueAtPath(o);if(null==l){let l=o.filter(e=>"string"==typeof e).join(".");if(!l)return null;if(this.getUpdateAssociationForTargetPath(l)){n.push({path:[...o,"__is_new__"],value:!0});continue}if(this.isAssociationTargetKeyWrite(e,t,o)){n.push({path:[...o],value:{}});continue}return null}if("object"!=typeof l)return null}let o=new Map;for(let e of n){let t=(0,x.Qc)(e.path);o.has(t)||o.set(t,e)}return Array.from(o.values())}dispose(){for(let{state:e}of this.rules.values())e.depDisposers.forEach(e=>e());for(let e of(this.rules.clear(),this.pendingRuleIds.clear(),this.assignTemplatesByTargetPath.clear(),this.defaultRuleMasterDisposers.values()))e();for(let e of(this.defaultRuleMasterDisposers.clear(),this.defaultRuleIdsByMasterUid.clear(),this.ruleDebounceTimersById.values()))clearTimeout(e);this.ruleDebounceTimersById.clear(),this.ruleDebounceUntilById.clear()}enable(){this.rulesEnabled=!0,this.pendingRuleIds.size&&!this.runningRules&&this.flushRules()}syncAssignRules(e){if(this.options.isDisposed())return;let t=(Array.isArray(e)?e:[]).map((e,t)=>({...e,key:(null==e?void 0:e.key)?String(e.key):`idx:${t}`})),l="form-assign:";for(let e of Array.from(this.rules.keys()))e.startsWith(l)&&this.removeRule(e);this.assignTemplatesByTargetPath.clear(),this.formItemTargetPaths.clear(),this.updateAssociationByTargetPath.clear();let n=0;for(let e of t){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=this.assignTemplatesByTargetPath.get(t)||[];n+=1,l.push({...e,__key:String(e.key),__order:n}),this.assignTemplatesByTargetPath.set(t,l)}let o=this.options.getEngine(),r=new Set;if(null==o?void 0:o.forEachModel){o.forEachModel(e=>{var t;if(!this.isModelInThisForm(e)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let l=this.getModelTargetPath(e);l&&this.formItemTargetPaths.add(l),this.cacheUpdateAssociationForModel(e)});let e=e=>{this.cacheUpdateAssociationForModel(e),this.tryRegisterAssignRuleInstancesForModel(e,r);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e,r)})};o.forEachModel(t=>{e(t)})}for(let[e,t]of this.assignTemplatesByTargetPath.entries())if(!r.has(e)&&this.shouldCreateBlockLevelAssignRule(e))for(let n of t){let t=j(P(null==n?void 0:n.mode)),o=(null==n?void 0:n.enable)!==!1,r=`${l}${n.__key}:block`;this.rules.has(r)&&this.removeRule(r);let i={id:r,source:t,priority:10+(n.__order||0),debounceMs:0,getEnabled:()=>o&&!!e,getTarget:()=>e,getValue:()=>null==n?void 0:n.value,getCondition:()=>null==n?void 0:n.condition,getContext:()=>this.options.getBlockContext(),getContractModelUid:this.options.getAssignRulesModelUid};this.rules.set(r,{rule:i,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(r)}for(let e of Array.from(this.rules.keys()))e.startsWith("default:")&&this.scheduleRule(e)}onModelMounted(e){var t;if(this.isModelInThisForm(e)&&!(null==e?void 0:e.isFork)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);t&&this.formItemTargetPaths.add(t),this.cacheUpdateAssociationForModel(e)}this.tryRegisterDefaultRuleInstance(e),this.tryRegisterAssignRuleInstancesForModel(e)}onModelUnmounted(e){var t;if(this.tryUnregisterDefaultRuleInstance(e),this.tryUnregisterAssignRuleInstancesForModel(e),this.isModelInThisForm(e)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);if(t&&(this.ensureBlockAssignRuleInstancesForTargetPath(t),!(null==e?void 0:e.isFork))){this.updateAssociationByTargetPath.delete(t),this.formItemTargetPaths.delete(t);let e=`${t}.`;for(let t of this.assignTemplatesByTargetPath.keys())t.startsWith(e)&&this.ensureBlockAssignRuleInstancesForTargetPath(t);let l=this.options.getEngine();if(null==l?void 0:l.forEachModel){let e=e=>{this.tryRegisterAssignRuleInstancesForModel(e);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e)})};l.forEachModel(t=>e(t))}}}}isModelInThisForm(e){var t;let l=null==e||null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.options.getBlockModelUid())}cacheUpdateAssociationForModel(e){var t,l;if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e||(null==e?void 0:e.isFork)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let n=this.getModelTargetPath(e);if(!n)return;let o=null==e||null==(l=e.subModels)?void 0:l.field,r=!!(null==o?void 0:o.updateAssociation);!0!==this.updateAssociationByTargetPath.get(n)&&this.updateAssociationByTargetPath.set(n,r)}getUpdateAssociationForTargetPath(e){let t=String(e||"");if(!t)return!1;if(this.updateAssociationByTargetPath.has(t))return!!this.updateAssociationByTargetPath.get(t);let l=this.options.getEngine();return((null==l?void 0:l.forEachModel)&&l.forEachModel(e=>{this.cacheUpdateAssociationForModel(e)}),this.updateAssociationByTargetPath.has(t))?!!this.updateAssociationByTargetPath.get(t):(this.updateAssociationByTargetPath.set(t,!1),!1)}getDefaultRuleId(e){let t=(null==e?void 0:e.isFork)?String((null==e?void 0:e.forkId)??"fork"):"master",l=(null==e?void 0:e.uid)?String(e.uid):String(e);return`default:${l}:${t}`}getModelTargetNamePath(e){var t;let l=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(l)&&l.length)return l;let n="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,o=null==n?void 0:n.name;return Array.isArray(o)?o:"string"==typeof o?o.includes(".")?o.split("."):[o]:null}getAssignTemplateTargetPathForModel(e){let t=this.getModelTargetPath(e);if(t)return t;let l=this.getModelTargetNamePath(e);if(!(null==l?void 0:l.length))return"";let n=l.filter(e=>"number"!=typeof e);return n.length?(0,x.Qc)(n):""}hasAssignTemplateForTargetPath(e){let t=String(e||"");return!!t&&this.assignTemplatesByTargetPath.has(t)}tryRegisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(!t||"object"!=typeof t)return;let l=this.getModelTargetNamePath(e);if(!l)return;let n=this.getDefaultRuleId(e);if(this.rules.has(n))return;let o=e.master||e,r=this.getAssignTemplateTargetPathForModel(e);this.bindMasterInitialValue(o,n);let i=()=>{var e;let t=(null==o||null==(e=o.getProps)?void 0:e.call(o))??(null==o?void 0:o.props);return null==t?void 0:t.initialValue},a=i(),s=!1,u=()=>{let e=i();if(s||d().isEqual(e,a)||(s=!0),!this.hasAssignTemplateForTargetPath(r)||s||void 0===a)return e},c=()=>{if(!this.hasAssignTemplateForTargetPath(r))try{var e,t,l,n;let r=null==o||null==(t=o.getStepParams)||null==(e=t.call(o,"editItemSettings","initialValue"))?void 0:e.defaultValue;if(void 0!==r)return r;let i=null==o||null==(n=o.getStepParams)||null==(l=n.call(o,"formItemSettings","initialValue"))?void 0:l.defaultValue;if(void 0!==i)return i}catch{}},p={id:n,source:"default",priority:void 0!==u()?A:0,debounceMs:0,getEnabled:()=>void 0!==u()||void 0!==c(),getTarget:()=>this.getModelTargetNamePath(e)||l,getValue:()=>{let e=u();return void 0!==e?e:c()},getContext:()=>null==e?void 0:e.context};this.rules.set(n,{rule:p,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(n)}getModelTargetPath(e){try{var t;let l=null==e||null==(t=e.getStepParams)?void 0:t.call(e,"fieldSettings","init"),n=null==l?void 0:l.fieldPath;if(n)return String(n)}catch{}let l=null==e?void 0:e.fieldPath;if(l)return String(l);let n=this.getModelTargetNamePath(e);return(null==n?void 0:n.length)&&n.filter(e=>"string"==typeof e).join(".")||null}getAssignRuleInstanceId(e,t){let l=(null==t?void 0:t.isFork)?String((null==t?void 0:t.forkId)??"fork"):"master",n=(null==t?void 0:t.uid)?String(t.uid):String(t);return`form-assign:${e}:${n}:${l}`}getDeepestFieldIndexKey(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex),o=Array.isArray(n)?n:[];if(!o.length)return null;let r=o[o.length-1];if("string"!=typeof r)return null;let[i,a]=r.split(":");return!i||Number.isNaN(Number(a))?null:i}getDeepestToManyAssociationKey(e){let t=this.getRootCollection();if(!(null==t?void 0:t.getField))return null;let l=(0,x.EA)(String(e||"")).filter(e=>"object"!=typeof e);if(l.length<2)return null;let n=t,o=null;for(let e=0;e<l.length-1;e++){var r,i;let t=l[e];if("string"!=typeof t)continue;let a=null==n||null==(r=n.getField)?void 0:r.call(n,t);if(!(null==a||null==(i=a.isAssociationField)?void 0:i.call(a)))break;let s=(0,S.E4)(a);if(s&&(o=t),s&&"number"==typeof l[e+1]&&(e+=1),!(null==(n=null==a?void 0:a.targetCollection)?void 0:n.getField))break}return o}isRowGridModel(e){var t,l;if(!e||"object"!=typeof e||(null==e||null==(t=e.subModels)?void 0:t.field)||!(null==e||null==(l=e.subModels)?void 0:l.items))return!1;let n=null==e?void 0:e.context;return!!this.getDeepestFieldIndexKey(n)}tryRegisterAssignRuleInstancesForModel(e,t){var l,n,o,r;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let i=(l,n)=>{if(n&&0!==n.length)for(let r of(null==t||t.add(l),n)){var o;this.removeAssignRuleBlockInstance(r.__key),(null==e||null==(o=e.subModels)?void 0:o.field)&&this.removeRowGridAssignRuleInstances(r.__key);let t=j(P(null==r?void 0:r.mode)),n=(null==r?void 0:r.enable)!==!1,i=this.getAssignRuleInstanceId(r.__key,e);this.rules.has(i)&&this.removeRule(i);let a={id:i,source:t,priority:10+(r.__order||0),debounceMs:0,getEnabled:()=>n&&!!l,getTarget:()=>l,getValue:()=>null==r?void 0:r.value,getCondition:()=>null==r?void 0:r.condition,getContext:()=>null==e?void 0:e.context,getContractModelUid:this.options.getAssignRulesModelUid};this.rules.set(i,{rule:a,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(i)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(l)for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&i(e,t)}return}if(!(null==e||null==(l=e.subModels)?void 0:l.field))return;let a=this.getModelTargetPath(e);if(!a)return;let s=this.assignTemplatesByTargetPath.get(a)||[];s.length&&i(a,s);let d=null==e||null==(n=e.subModels)?void 0:n.field,u=null==d||null==(o=d.context)?void 0:o.collectionField,c=!!(null==u||null==(r=u.isAssociationField)?void 0:r.call(u)),p=(0,S.E4)(u);if(c&&!p){let e=`${a}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&i(t,l)}}tryUnregisterAssignRuleInstancesForModel(e){var t,l,n,o;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let r=t=>{for(let l of t||[]){let t=this.getAssignRuleInstanceId(l.__key,e);this.rules.has(t)&&this.removeRule(t)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(!l)return;for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&r(t)}return}if(!(null==e||null==(t=e.subModels)?void 0:t.field))return;let i=this.getModelTargetPath(e);if(!i)return;let a=this.assignTemplatesByTargetPath.get(i)||[];a.length&&r(a);let s=null==e||null==(l=e.subModels)?void 0:l.field,d=null==s||null==(n=s.context)?void 0:n.collectionField,u=!!(null==d||null==(o=d.isAssociationField)?void 0:o.call(d)),c=(0,S.E4)(d);if(u&&!c){let e=`${i}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&r(l)}}tryUnregisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let t=this.getDefaultRuleId(e);this.rules.has(t)&&this.removeRule(t)}bindMasterInitialValue(e,t){let l=(null==e?void 0:e.uid)?String(e.uid):t,n=this.defaultRuleIdsByMasterUid.get(l)||new Set;if(n.add(t),this.defaultRuleIdsByMasterUid.set(l,n),this.defaultRuleMasterDisposers.has(l))return;let o=(0,f.reaction)(()=>{var t;let l=(null==e||null==(t=e.getProps)?void 0:t.call(e))??(null==e?void 0:e.props);return null==l?void 0:l.initialValue},(t,n)=>{var o;if(d().isEqual(t,n))return;let r=this.defaultRuleIdsByMasterUid.get(l);if(!r)return;let i=(null==e||null==(o=e.getProps)?void 0:o.call(e))??(null==e?void 0:e.props),a=void 0!==(null==i?void 0:i.initialValue)?A:0;for(let e of r){let t=this.rules.get(e);t&&(t.rule.priority=a),this.scheduleRule(e)}});this.defaultRuleMasterDisposers.set(l,o)}removeRule(e){let t=this.rules.get(e);if(!t)return;try{let e=t.rule.getContext(),l=t.rule.getTarget(),n=this.options.tryResolveNamePath(e,l);if(n){let e=(0,x.Qc)(n),l=this.options.observableBindings.get(e);l&&l.source===t.rule.source&&(l.dispose(),this.options.observableBindings.delete(e))}}catch{}t.state.depDisposers.forEach(e=>e()),this.rules.delete(e),this.pendingRuleIds.delete(e);let l=this.ruleDebounceTimersById.get(e);for(let[t,n]of(l&&clearTimeout(l),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e),this.defaultRuleIdsByMasterUid.entries())){if(!n.has(e)||(n.delete(e),n.size>0))continue;this.defaultRuleIdsByMasterUid.delete(t);let l=this.defaultRuleMasterDisposers.get(t);l&&l(),this.defaultRuleMasterDisposers.delete(t)}}rescheduleAllRules(){if(!this.options.isDisposed()){for(let e of(this.lastRuleWriteByTargetKey.clear(),this.rules.values()))e.state.runSeq+=1;for(let e of this.rules.keys())this.scheduleRule(e)}}scheduleRule(e){if(this.options.isDisposed())return;let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.scheduledAtWriteSeq=this.options.getWriteSeq();let o=(null==l?void 0:l.debounceMs)??0;if(this.pendingRuleIds.add(e),o>0){let t=Date.now()+o;t>(this.ruleDebounceUntilById.get(e)||0)&&this.ruleDebounceUntilById.set(e,t);let l=this.ruleDebounceTimersById.get(e);l&&clearTimeout(l);let n=setTimeout(()=>{this.ruleDebounceTimersById.delete(e),!this.rulesEnabled||this.runningRules||this.pendingRuleIds.has(e)&&this.flushRules()},o);this.ruleDebounceTimersById.set(e,n)}else{let t=this.ruleDebounceTimersById.get(e);t&&clearTimeout(t),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e)}!this.rulesEnabled||this.runningRules||this.flushRules()}async flushRules(){if(this.runningRules)return;this.runningRules=!0;let e=this.currentRuleTxId||(0,w.ao)();this.currentRuleTxId=e;try{for(;this.pendingRuleIds.size;){let e=Date.now(),t=[];for(let l of this.pendingRuleIds)(this.ruleDebounceUntilById.get(l)||0)>e||t.push(l);if(!t.length)break;for(let e of t)this.pendingRuleIds.delete(e),this.ruleDebounceUntilById.delete(e);for(let e of(t.sort((e,t)=>{var l,n;let o=null==(l=this.rules.get(e))?void 0:l.rule,r=null==(n=this.rules.get(t))?void 0:n.rule,i=(null==o?void 0:o.priority)??0,a=(null==r?void 0:r.priority)??0;return i!==a?i-a:e.localeCompare(t)}),t))await this.runRule(e)}}finally{this.runningRules=!1,this.currentRuleTxId=null,this.options.txWriteCounts.delete(e)}}async runRule(e){let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.runSeq+=1;let o=n.runSeq,r=n.scheduledAtWriteSeq,i=this.prepareRuleContext(l),{baseCtx:a,targetNamePath:s,targetKey:d,clearDeps:u,disposeBinding:c}=i;if(!this.shouldRunRule(l,s,d,a)||!s||!d){u(n),c();return}let p=s,m=d,{collector:h,evalCtx:f}=this.createRuleCollectorAndContext(l,i);if(l.getCondition&&!await this.evaluateRuleCondition(l,n,o,f,h))return;let g=await this.resolveRuleValue(l,n,o,f,h);if(g===F||o!==n.runSeq)return;this.commitRuleDeps(l,n,h);let v=this.getToManyAggregateSourceInfo(a,l.getValue()),y=this.normalizeUnresolvedToManyAggregateForScalarTarget(a,p,g,v);if(y.skip)return;let b=y.hasValue?y.value:g,w=this.normalizeResolvedValueForTarget(a,b),S=this.normalizeResolvedValueForAssociationTarget(a,p,w),C=this.normalizeAggregateArrayForScalarTarget(a,p,S,v);if(C===F||this.shouldSkipEmptyArrayAggregateForScalarTarget(a,p,C)||this.shouldSkipMultiValueAggregateForScalarTarget(a,p,C,v)||"default"===l.source&&!this.checkDefaultRuleCanApply(C,p,m,u,c,n))return;if("override"===l.source&&this.options.findUserEditedHit(m))return void c();if("default"===l.source){let e=this.lastRuleWriteByTargetKey.get(m);if((null==e?void 0:e.source)==="default"&&e.priority>l.priority&&e.writeSeq>=r)return void c()}if("system"===l.source||"override"===l.source){let e=this.options.lastWriteMetaByPathKey.get(m);if((null==e?void 0:e.source)==="linkage"&&e.writeSeq>=r)return void c()}if(this.shouldSkipAssociationNestedWrite(a,p)||this.shouldSkipToManyAssociationWriteWithoutIndex(a,p))return;let k=C;if(this.isAssociationTargetSemanticallyEqual(a,p,this.options.getFormValueAtPath(p),k))return;let A=this.collectUpdateAssociationInitPatches(a,p);if(null==A)return;if("system"===l.source||"default"===l.source||"override"===l.source){var P,j;let e=null==a?void 0:a.model,t=null==e||null==(P=e.subModels)?void 0:P.field;if(t){let l=this.getModelTargetNamePath(e);l&&(0,x.Qc)(l)===m&&(e.setProps({value:C}),null==(j=t.setProps)||j.call(t,{value:C}))}}let M=this.options.getWriteSeq(),I=[...A,{path:p,value:C}];await this.options.setFormValues(f,I,{source:l.source,txId:this.currentRuleTxId||void 0});let T=this.options.getWriteSeq();T!==M&&this.lastRuleWriteByTargetKey.set(m,{source:l.source,priority:l.priority,writeSeq:T})}isTzAwareTargetInterface(e){return"string"==typeof e&&["datetime","createdAt","updatedAt","unixTimestamp"].includes(e)}normalizeDateOnlyToStartOfDayIso(e){let t=String(e||"").trim();if(!t||!/^\d{4}-\d{2}-\d{2}$/.test(t))return e;let l=(0,b.dayjs)(t,"YYYY-MM-DD",!0);return l.isValid()?l.startOf("day").toISOString():e}normalizeResolvedValueForTarget(e,t){var l,n,o;let r=null==e||null==(o=e.model)||null==(n=o.context)||null==(l=n.collectionField)?void 0:l.interface;return this.isTzAwareTargetInterface(r)?"string"==typeof t?this.normalizeDateOnlyToStartOfDayIso(t):Array.isArray(t)?t.map(e=>"string"==typeof e?this.normalizeDateOnlyToStartOfDayIso(e):e):t:t}isPrimitiveAssociationTargetValue(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}extractAssociationIdentity(e,t){let l=this.getAssociationTargetKeyFields(e),n=1===l.length?l[0]:null,o=e=>{if(null==e)return e;if(this.isPrimitiveAssociationTargetValue(e))return n?e:k;if(!e||"object"!=typeof e)return k;if(n)return void 0===e[n]?k:e[n];let t={};for(let n of l){if(void 0===e[n])return k;t[n]=e[n]}return t};if((0,S.E4)(e)){let e=Array.isArray(t)?t:[t],l=[];for(let t of e){if(null==t)continue;let e=o(t);if(e===k)return k;l.push(e)}return l}let r=Array.isArray(t)?t.find(e=>null!=e):t;return null==r?r:o(r)}isAssociationTargetSemanticallyEqual(e,t,l,n){var o;let r=this.resolveCollectionFieldByNamePath(e,t);if(!(null==r||null==(o=r.isAssociationField)?void 0:o.call(r)))return d().isEqual(l,n);let i=this.extractAssociationIdentity(r,l),a=this.extractAssociationIdentity(r,n);return i===k||a===k?d().isEqual(l,n):d().isEqual(i,a)}resolveCollectionFieldByNamePath(e,t){if(!Array.isArray(t)||!t.length)return null;let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;for(let e=0;e<t.length;e++){var n,o;let r=t[e];if("string"!=typeof r||!r)break;let i=null==l||null==(n=l.getField)?void 0:n.call(l,r);if(!i)break;if(e===t.length-1)return i;if(!(null==i||null==(o=i.isAssociationField)?void 0:o.call(i))||!(null==i?void 0:i.targetCollection))break;if((0,S.E4)(i)){if("number"!=typeof t[e+1])return null;e+=1}if(!(null==(l=i.targetCollection)?void 0:l.getField))break}return null}normalizeResolvedValueForAssociationTarget(e,t,l){var n;let o=this.resolveCollectionFieldByNamePath(e,t);if(!(null==o||null==(n=o.isAssociationField)?void 0:n.call(o)))return l;let r=this.getAssociationTargetKeyFields(o),i=1===r.length?r[0]:null,a=e=>{if(null!=e)return i&&this.isPrimitiveAssociationTargetValue(e)?{[i]:e}:e};if((0,S.E4)(o))return(Array.isArray(l)?l:[l]).map(e=>a(e)).filter(e=>null!=e);let s=Array.isArray(l)?l.find(e=>null!=e):l;return null==s?s:a(s)}prepareRuleContext(e){let t=e.getContext(),l=e.getTarget(),n=this.options.tryResolveNamePath(t,l),o=n?(0,x.Qc)(n):null,r=()=>{if(!o)return;let t=this.options.observableBindings.get(o);t&&t.source===e.source&&(t.dispose(),this.options.observableBindings.delete(o))};return{baseCtx:t,targetNamePath:n,targetKey:o,clearDeps:e=>{e.depDisposers.forEach(e=>e()),e.depDisposers=[],e.deps=new Set},disposeBinding:r}}shouldApplyDefaultRuleInCurrentState(e){var t,l,n;return"update"!==(null==(t=(l=this.options).getActionName)?void 0:t.call(l))||(null==(n=this.getItemContext(e))?void 0:n.__is_new__)===!0}isStaleToManyItemContext(e){let t=this.getItemContext(e);return!!Number.isFinite(null==t?void 0:t.index)&&!!Number.isFinite(null==t?void 0:t.length)&&(t.index<0||t.index>=t.length)}getItemContext(e){try{return null==e?void 0:e.item}catch{return}}getRowTargetKey(e,t){var l,n,o,r;let i,a,s=this.getRootCollection()||this.getCollectionFromContext(e);for(let e of t)if("number"!=typeof e){if("string"!=typeof e||!e||!(null==s?void 0:s.getField)||(i=null==s||null==(o=s.getField)?void 0:o.call(s,e),!(null==i||null==(r=i.isAssociationField)?void 0:r.call(i))))break;a=i,s=null==i?void 0:i.targetCollection}let d=(null==a||null==(l=a.targetCollection)?void 0:l.filterTargetKey)??(null==a||null==(n=a.targetCollection)?void 0:n.filterByTk)??(null==a?void 0:a.targetKey);if(Array.isArray(d)){let e=d.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof d&&d?d:"id"}isMismatchedToManyItemContext(e,t){let l=this.getItemContext(e);if(!l)return!1;for(let n=t.length-1;n>=0;n--){if("number"!=typeof t[n])continue;let o=t.slice(0,n+1),r=this.getRowTargetKey(e,o),i=this.options.getFormValueAtPath(o),a=(0,C.r5)(i,r),s=(0,C.r5)(l.value,r);return!!a&&!!s&&a!==s}return!1}shouldRunRule(e,t,l,n){return!(!e.getEnabled()||!t||!l||this.isStaleToManyItemContext(n)||this.isMismatchedToManyItemContext(n,t)||"default"===e.source&&(!this.shouldApplyDefaultRuleInCurrentState(n)||this.options.findExplicitHit(l)))&&!("override"===e.source&&this.options.findUserEditedHit(l))}createRuleCollectorAndContext(e,t){var l;let{baseCtx:n,targetNamePath:o}=t,r=e.getValue(),a=(0,i.isRunJSValue)(r),s={deps:new Set,wildcard:!1};if(e.getCondition&&(0,v.G)(e.getCondition(),s),a?(0,v.Wp)(r,s):(0,v.G)(r,s),o)for(let e of((0,v.Dd)(o,s),this.collectAssociationPrefixPaths(n,o)))(0,v.Dd)(e,s);let d=this.createRuleEvaluationContext(n,s,o,null==(l=e.getContractModelUid)?void 0:l.call(e));return{collector:s,evalCtx:d,rawValue:r,isRunJS:a}}async evaluateRuleCondition(e,t,l,n,o){let r=e.getCondition;if(!r)return!0;let i=r(),a=i;if(i)try{var s;a=await (null==n||null==(s=n.resolveJsonTemplate)?void 0:s.call(n,i))}catch{a=i}return l===t.runSeq&&(!i||!!(0,g.F)(n,a)||(this.commitRuleDeps(e,t,o),!1))}async resolveRuleValue(e,t,l,n,o){let r=e.getValue();return(0,i.isRunJSValue)(r)?this.resolveRunJSValue(r,t,l,n,o,e):this.resolveTemplateValue(r,t,l,n,o,e)}async resolveRunJSValue(e,t,l,n,o,r){try{let{code:a,version:s}=(0,i.normalizeRunJSValue)(e),d=await (0,i.runjsWithSafeGlobals)(n,a,{version:s});if(!(null==d?void 0:d.success)){if(l!==t.runSeq)return F;return this.commitRuleDeps(r,t,o),F}return d.value}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(r,t,o),F}}async resolveTemplateValue(e,t,l,n,o,r){try{var i;return await (null==n||null==(i=n.resolveJsonTemplate)?void 0:i.call(n,e))}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(r,t,o),F}}commitRuleDeps(e,t,l){let n=new Set(l.deps);l.wildcard&&n.add("fv:*"),this.updateRuleDeps(e,t,n)}isScalarValueTarget(e,t){var l;let n=this.resolveCollectionFieldByNamePath(e,t);return!((null==n||null==(l=n.isAssociationField)?void 0:l.call(n))&&(0,S.E4)(n)||this.isArrayValueCollectionField(n))&&(!!n||!Array.isArray(this.options.getFormValueAtPath(t)))}shouldSkipEmptyArrayAggregateForScalarTarget(e,t,l){return!!Array.isArray(l)&&!(l.length>0)&&this.isScalarValueTarget(e,t)}normalizeUnresolvedToManyAggregateForScalarTarget(e,t,l,n){return void 0===l&&n&&this.isScalarValueTarget(e,t)?Array.isArray(n.arrayValue)&&0===n.arrayValue.length?this.isUserClearedToManyAggregate(n)?{skip:!1,hasValue:!0,value:this.getClearedAggregateValueForScalarTarget(e,t)}:{skip:!0,hasValue:!1}:Array.isArray(n.arrayValue)&&n.arrayValue.length>0?{skip:!0,hasValue:!1}:{skip:!1,hasValue:!1}:{skip:!1,hasValue:!1}}isArrayValueCollectionField(e){var t,l;if(!e||"object"!=typeof e)return!1;let n=e;return!0===n.multiple||"array"===n.type||"array"===((null==(t=n.uiSchema)?void 0:t.type)??(null==(l=n.schema)?void 0:l.type))||["multipleSelect","checkboxGroup","json"].includes("string"==typeof n.interface?n.interface:"")}stringifyAggregateItem(e){if(e&&"object"==typeof e)try{return JSON.stringify(e)}catch{}return String(e)}normalizeAggregateArrayForScalarTarget(e,t,l,n){if(!Array.isArray(l)||!this.isScalarValueTarget(e,t)||!n)return l;let o=l.filter(e=>null!=e);return o.length?1===o.length?o[0]:this.isTextScalarTarget(e,t)?o.map(e=>this.stringifyAggregateItem(e)).join(", "):F:this.isUserClearedToManyAggregate(n)?this.getClearedAggregateValueForScalarTarget(e,t):F}shouldSkipMultiValueAggregateForScalarTarget(e,t,l,n){return!!n&&!!Array.isArray(l)&&!(l.length<=1)&&!!this.isScalarValueTarget(e,t)&&!this.isTextScalarTarget(e,t)}getClearedAggregateValueForScalarTarget(e,t){if(this.isTextScalarTarget(e,t))return""}isUserClearedToManyAggregate(e){var t;return(null==(t=e.lastWrite)?void 0:t.source)==="user"}isTextScalarTarget(e,t){var l,n,o;let r=this.resolveCollectionFieldByNamePath(e,t);if(!r){let e=this.options.getFormValueAtPath(t);return void 0===e||null==e||"string"==typeof e}if((null==r||null==(l=r.isAssociationField)?void 0:l.call(r))||this.isArrayValueCollectionField(r))return!1;let i=r,a=(null==(n=i.uiSchema)?void 0:n.type)??(null==(o=i.schema)?void 0:o.type);return"string"===i.type||"text"===i.type||"string"===a||["input","textarea","email","phone","url","uuid","nanoid","markdown","richText","vditor","password","color"].includes("string"==typeof i.interface?i.interface:"")}getLatestWriteMetaForPath(e){let t=(0,x.Qc)(e),l=this.options.lastWriteMetaByPathKey.get(t);for(let[e,n]of this.options.lastWriteMetaByPathKey.entries())(e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))&&(!l||n.writeSeq>l.writeSeq)&&(l=n);return l}getToManyAggregateSourceInfo(e,t){let l=this.extractSingleLocalFormValuesPath(t);if(!l)return null;let n=(0,x.EA)(l).filter(e=>"object"!=typeof e);if(n.length<2)return null;let o=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==o?void 0:o.getField))return null;let r=[];for(let t=0;t<n.length-1;t++){var i,a;let s=n[t];if("string"!=typeof s)break;let u=null==o||null==(i=o.getField)?void 0:i.call(o,s);if(!(null==u||null==(a=u.isAssociationField)?void 0:a.call(u)))break;if(r.push(s),(0,S.E4)(u)){let t=this.options.getFormValueAtPath(r),n=this.getLocalFormValuesSnapshot(e),o=n&&"object"==typeof n?d().get(n,r):void 0;return{subPath:l,arrayPath:[...r],arrayValue:void 0!==t?t:o,lastWrite:this.getLatestWriteMetaForPath(r)}}if(!(null==(o=u.targetCollection)?void 0:o.getField))break}return null}checkDefaultRuleCanApply(e,t,l,n,o,r){if(void 0===e)return!1;if(this.options.findExplicitHit(l))return n(r),o(),!1;let i=this.options.getFormValueAtPath(t),a=this.options.lastDefaultValueByPathKey.get(l),s=(0,w.Po)(i)||void 0!==a&&d().isEqual(i,a),u=(0,f.isObservable)(e)?(0,f.toJS)(e):e;return!s&&d().isEqual(i,u)?(this.options.lastDefaultValueByPathKey.set(l,u),!1):s}createRuleEvaluationContext(e,t,l,n){var o;let r,a=this.options.createTrackingFormValues(t),s=new i.FlowContext;try{s.delegate(e)}catch{}let d=null==e||null==(o=e.getPropertyOptions)?void 0:o.call(e,"formValues");d&&"object"==typeof d?s.defineProperty("formValues",{...d,get:()=>a,cache:!1}):s.defineProperty("formValues",{get:()=>a,cache:!1});let u="function"==typeof s.resolveJsonTemplate?s.resolveJsonTemplate.bind(s):void 0;s.defineMethod("resolveJsonTemplate",async l=>{let o=this.createLocalTemplateTokenStore(),r=this.resolveLocalFormValuesTemplates(e,l,t,o),i=r.matched?r.value:l,a=u?await u(i,n?{contractModelUid:n}:void 0):i;return this.restoreLocalTemplateTokens(a,o)});let c=!1,p=()=>(c||(r=this.buildItemChainValue(e,a,l)??(null==e?void 0:e.item),c=!0),r);return s.defineProperty("item",{get:p,cache:!1}),s}getLocalFormValuesSnapshot(e){try{var t;let l=null==e||null==(t=e.getFormValues)?void 0:t.call(e);if(l&&"object"==typeof l)return l}catch{}let l=this.options.valuesMirror;return(0,f.isObservable)(l)?(0,f.toJS)(l):l}resolveLocalFormValuesPath(e,t){let l=this.getLocalFormValuesSnapshot(e);if(l&&"object"==typeof l)return(0,u.D)(l,t)}recordLocalFormValuesDep(e,t){let l=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(!l.length){t&&(t.wildcard=!0);return}(0,v.Dd)(l,t)}extractSingleLocalFormValuesPath(e){if("string"!=typeof e)return null;let t=e.match(/^\s*\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}\s*$/);return(null==t?void 0:t[1])??null}stringifyTemplateReplacement(e){if(void 0!==e)return e&&"object"==typeof e?JSON.stringify(e):String(e)}createLocalTemplateTokenStore(){let e=new Map,t=0;return{values:e,protect(l){let n=`__NOCObase_FORM_VALUE_LITERAL_${t}__`;return t+=1,e.set(n,l),n}}}restoreLocalTemplateTokens(e,t){if(!t.values.size)return e;if("string"==typeof e){if(t.values.has(e))return t.values.get(e);let l=e;for(let[e,n]of t.values.entries())l.includes(e)&&(l=l.split(e).join(this.stringifyTemplateReplacement(n)??""));return l}if(Array.isArray(e))return e.map(e=>this.restoreLocalTemplateTokens(e,t));if(d().isPlainObject(e)){let l={};for(let[n,o]of Object.entries(e))l[n]=this.restoreLocalTemplateTokens(o,t);return l}return e}resolveLocalFormValuesTemplates(e,t,l,n){if("string"==typeof t){let o=this.extractSingleLocalFormValuesPath(t);if(o){this.recordLocalFormValuesDep(o,l);let r=this.resolveLocalFormValuesPath(e,o);return void 0!==r?{matched:!0,value:n?n.protect(r):r}:{matched:!1,value:t}}let r=!1,i=t.replace(/\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}/g,(t,o)=>{this.recordLocalFormValuesDep(o,l);let i=this.resolveLocalFormValuesPath(e,o),a=this.stringifyTemplateReplacement(i);return void 0===a?t:(r=!0,n?n.protect(a):a)});return{matched:r,value:i}}if(Array.isArray(t)){let o=!1,r=t.map(t=>{let r=this.resolveLocalFormValuesTemplates(e,t,l,n);return r.matched&&(o=!0),r.value});return o?{matched:o,value:r}:{matched:!1,value:t}}if(d().isPlainObject(t)){let o=!1,r={};for(let[i,a]of Object.entries(t)){let t=this.resolveLocalFormValuesTemplates(e,a,l,n);t.matched&&(o=!0),r[i]=t.value}return o?{matched:o,value:r}:{matched:!1,value:t}}return{matched:!1,value:t}}buildItemChainValue(e,t,l){let n=this.getRootCollection()||this.getCollectionFromContext(e),o=(e,t,l,n)=>({index:t,length:l,__is_new__:null==e?void 0:e.__is_new__,__is_stored__:null==e?void 0:e.__is_stored__,value:e,parentItem:n}),r=this.options.getBlockContext(),i=(()=>{try{let e=null==r?void 0:r.item;if(!e||"object"!=typeof e)return;return e.value===(null==r?void 0:r.formValues)?e:void 0}catch{return}})(),a={...o(t,null==i?void 0:i.index,null==i?void 0:i.length,null==i?void 0:i.parentItem),__is_new__:(null==i?void 0:i.__is_new__)??(null==t?void 0:t.__is_new__),__is_stored__:(null==i?void 0:i.__is_stored__)??(null==t?void 0:t.__is_stored__)};if(!l||!Array.isArray(l)||!l.length||!(null==n?void 0:n.getField))return;let s=[],u=[],c=n;for(let e=0;e<l.length;e++){var p,m;let t=l[e];if("string"!=typeof t)break;let n=null==c||null==(p=c.getField)?void 0:p.call(c,t);if(!(null==n||null==(m=n.isAssociationField)?void 0:m.call(n)))break;let o=(0,S.E4)(n);if(u.push(t),o){let t=l[e+1];if("number"==typeof t)u.push(t),e+=1;else if(e!==l.length-1)break}let r=null==n?void 0:n.targetCollection;if(!r)break;s.push({path:[...u],toMany:o}),c=r}let h=e=>{if(e<0)return a;let l=s[e],n=d().get(t,l.path),r=l.path[l.path.length-1],i=l.toMany&&"number"==typeof r,u=i?r:void 0,c=(()=>{if(!l.toMany)return;if(!i)return Array.isArray(n)?n.length:void 0;let e=l.path.slice(0,-1),o=d().get(t,e);return Array.isArray(o)?o.length:void 0})();return o(n,u,c,h(e-1))};return s.length?h(s.length-1):void 0}getFieldIndexSignature(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex);return(Array.isArray(n)?n:[]).filter(e=>"string"==typeof e).join("|")}updateRuleDeps(e,t,l){var n,o;if(t.depDisposers.forEach(e=>e()),t.depDisposers=[],t.deps=l,l.has("fv:*")){let l=(0,f.reaction)(()=>this.options.changeTick.value,()=>this.scheduleRule(e.id));t.depDisposers.push(l)}let r=(()=>{try{return e.getContext()}catch{return}})(),i=(null==r||null==(o=r.model)||null==(n=o.context)?void 0:n.fieldIndex)??(null==r?void 0:r.fieldIndex);if(Array.isArray(i)&&i.some(e=>"string"==typeof e)){let l=(0,f.reaction)(()=>this.getFieldIndexSignature(r),()=>this.scheduleRule(e.id));t.depDisposers.push(l)}for(let n of l){if("fv:*"===n)continue;if(!n.startsWith("fv:")&&!n.startsWith("ctx:")){let l=(0,x.c1)(n),o=(0,f.reaction)(()=>d().get(this.options.valuesMirror,l),()=>this.scheduleRule(e.id));t.depDisposers.push(o);continue}if(n.startsWith("fv:")){let l=n.slice(3),o=(0,x.c1)(l),r=(0,f.reaction)(()=>d().get(this.options.valuesMirror,o),()=>this.scheduleRule(e.id));t.depDisposers.push(r);continue}let l=n.slice(4),o=l.indexOf(":"),i=o>=0?l.slice(0,o):l,a=o>=0?l.slice(o+1):"",s=a?(0,x.EA)(a).filter(e=>"object"!=typeof e):[];if("item"===i){if(s.length){let l=this.options.createTrackingFormValues({deps:new Set,wildcard:!1}),n=(0,f.reaction)(()=>{var t;let n=null==(t=e.getTarget)?void 0:t.call(e),o=n?this.options.tryResolveNamePath(r,n):null,i=this.buildItemChainValue(r,l,o)??(null==r?void 0:r.item);return d().get(i,s)},()=>this.scheduleRule(e.id));t.depDisposers.push(n)}continue}let u=(0,f.reaction)(()=>{let e=r?r[i]:void 0;return s.length?d().get(e,s):e},()=>this.scheduleRule(e.id));t.depDisposers.push(u)}}constructor(e){this.rules=new Map,this.lastRuleWriteByTargetKey=new Map,this.assignTemplatesByTargetPath=new Map,this.formItemTargetPaths=new Set,this.updateAssociationByTargetPath=new Map,this.pendingRuleIds=new Set,this.ruleDebounceUntilById=new Map,this.ruleDebounceTimersById=new Map,this.defaultRuleIdsByMasterUid=new Map,this.defaultRuleMasterDisposers=new Map,this.runningRules=!1,this.rulesEnabled=!1,this.currentRuleTxId=null,this.options=e}}class I{syncAssignRules(e){this.ruleEngine.syncAssignRules(e)}get formValues(){return this.disposed||this.formPatcher.patch(this.getForm()),this.formValuesProxy}getFormValuesSnapshot(){if(!this.disposed){let e=this.getForm();this.formPatcher.patch(e)}return this.getForm().getFieldsValue(!0)}toMirrorSnapshot(e){let t=e=>d().cloneDeepWith(e,e=>{if((0,f.isObservable)(e)){let l=(0,f.toJS)(e);if(l!==e)return t(l)}if(Array.isArray(e)&&"function"!=typeof e.constructor){let l=Array(e.length);for(let n=0;n<e.length;n++)Object.hasOwn(e,n)&&(l[n]=t(e[n]));return l}if(e&&"object"==typeof e&&!(Array.isArray(e)||d().isPlainObject(e)))return e});return t(e)}canApplyDefaultValuePatch(e,t){if(!(null==e?void 0:e.length)||void 0===t)return!1;let l=(0,x.Qc)(e),n=this.getFormValueAtPath(e),o=this.lastDefaultValueByPathKey.get(l),r=(0,f.isObservable)(t)?(0,f.toJS)(t):t,i=(0,f.isObservable)(n)?(0,f.toJS)(n):n,a=void 0!==o&&d().isEqual(i,o);if(this.findExplicitHit(l)&&!a)return!1;let s=(0,w.Po)(n)||a;return!s&&d().isEqual(n,r)?(this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(r)),!1):s}canApplyOverrideValuePatch(e){return!!(null==e?void 0:e.length)&&!this.findUserEditedHit((0,x.Qc)(e))}recordDefaultValuePatch(e,t){if(!(null==e?void 0:e.length))return;let l=(0,x.Qc)(e),n=arguments.length>=2?(0,f.isObservable)(t)?(0,f.toJS)(t):t:this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(n));let o=this.getFormValueAtPath(e),r=(0,f.isObservable)(o)?(0,f.toJS)(o):o;d().isEqual(r,n)&&this.clearExplicitForDefaultPatch(l)}getFormValueAtPath(e){var t,l;let n=null==(t=(l=this).getForm)?void 0:t.call(l);if(n&&"function"==typeof n.getFieldValue)return n.getFieldValue(e);if(n&&"function"==typeof n.getFieldsValue){let t=n.getFieldsValue(!0);return d().get(t,e)}}mount(e){var t,l;if(this.disposed)return;this.formPatcher.patch(this.getForm());let n=null==(l=this.model)||null==(t=l.flowEngine)?void 0:t.emitter;if(n&&(this.mountedListener||this.unmountedListener||(this.mountedListener=e=>{let{model:t}=e;this.indexMountedFieldModelTree(t),this.ruleEngine.onModelMounted(t)},this.unmountedListener=e=>{let{model:t}=e;this.unindexMountedFieldModelTree(t),this.ruleEngine.onModelUnmounted(t)},n.on("model:mounted",this.mountedListener),n.on("model:unmounted",this.unmountedListener)),this.rebuildMountedFieldModelIndex(),null==e?void 0:e.sync)){let e=this.getFormValuesSnapshot();e&&"object"==typeof e&&(d().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.bumpChangeTick()),this.ruleEngine.enable()}}dispose(){var e,t;if(this.disposed)return;this.disposed=!0,this.formPatcher.restore();let l=null==(t=this.model)||null==(e=t.flowEngine)?void 0:e.emitter;for(let e of(l&&this.mountedListener&&this.unmountedListener&&(l.off("model:mounted",this.mountedListener),l.off("model:unmounted",this.unmountedListener)),this.ruleEngine.dispose(),this.mountedFieldModelsByPathKey.clear(),this.observableBindings.values()))e.dispose();this.observableBindings.clear(),this.txWriteCounts.clear()}resetAfterFormReset(){if(this.disposed)return;for(let e of(this.explicitSet.clear(),this.userEditedSet.clear(),this.lastDefaultValueByPathKey.clear(),this.lastWriteMetaByPathKey.clear(),this.txWriteCounts.clear(),this.lastObservedChangedPaths=null,this.lastObservedSource=null,this.lastObservedToken+=1,this.observableBindings.values()))e.dispose();this.observableBindings.clear();let e=this.getFormValuesSnapshot();for(let e of Object.keys(this.valuesMirror))delete this.valuesMirror[e];e&&"object"==typeof e&&d().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.writeSeq+=1,this.bumpChangeTick(),this.ruleEngine.rescheduleAllRules()}resetUserEditedState(){this.disposed||(this.userEditedSet.clear(),this.ruleEngine.rescheduleAllRules())}isSuppressed(){return this.suppressFormCallbackDepth>0}handleFormFieldsChange(e){if(this.disposed)return;let t=this.getForm();if(!t.getFieldValue)return;let l=[],n=new Set,o=!1,r=!1;for(let i of e||[]){let e=null==i?void 0:i.name,a=this.normalizeObservedNamePath(e);if(!(null==a?void 0:a.length))continue;let s=t.getFieldValue(a),u=d().get(this.valuesMirror,a);if(!d().isEqual(s,u)&&(r||(this.writeSeq+=1,r=!0),d().set(this.valuesMirror,a,this.toMirrorSnapshot(s)),l.push(a),(null==i?void 0:i.touched)===!0&&!this.shouldIgnoreSyntheticTouchedInit(a,u,s))){let e=(0,x.Qc)(a);this.shouldKeepDefaultPathValueEnabled(a,s)||(n.add(e),o=!0)}}if(!l.length)return;let i=this.isSuppressed();if(!i&&n.size)for(let e of n)this.markExplicit(e),this.markUserEdited(e);if(this.bumpChangeTick(),i)return;let a=o?"user":"system",s=this.writeSeq;for(let e of l)this.lastWriteMetaByPathKey.set((0,x.Qc)(e),{source:a,writeSeq:s});this.lastObservedChangedPaths=l,this.lastObservedSource=a;let u=++this.lastObservedToken;queueMicrotask(()=>{this.disposed||this.lastObservedToken===u&&(this.lastObservedChangedPaths=null,this.lastObservedSource=null)})}shouldIgnoreSyntheticTouchedInit(e,t,l){if(!(null==e?void 0:e.length)||void 0!==t||!(0,w.Po)(l))return!1;for(let t=e.length-1;t>=0;t--){if("number"!=typeof e[t])continue;let l=e.slice(0,t+1),n=this.getFormValueAtPath(l);return!!(null==n?void 0:n.__is_new__)}return!1}isDeletedArrayItemPath(e,t){let l=Array.isArray(e)?e:(0,x.c1)(e);if(!(null==l?void 0:l.length))return!1;for(let e=l.length-1;e>=0;e--){if("number"!=typeof l[e])continue;let n=l.slice(0,e+1);return void 0===d().get(t,n)}return!1}pruneDeletedArrayItemState(e){for(let t of Array.from(this.explicitSet))this.isDeletedArrayItemPath(t,e)&&this.explicitSet.delete(t);for(let t of Array.from(this.userEditedSet))this.isDeletedArrayItemPath(t,e)&&this.userEditedSet.delete(t);for(let t of Array.from(this.lastDefaultValueByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastDefaultValueByPathKey.delete(t);for(let t of Array.from(this.lastWriteMetaByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastWriteMetaByPathKey.delete(t);for(let[t,l]of Array.from(this.observableBindings.entries()))this.isDeletedArrayItemPath(t,e)&&(l.dispose(),this.observableBindings.delete(t))}getArrayItemTargetKey(e){var t,l,n,o,r,i;let a,s,d=null==(l=this.model)||null==(t=l.context)?void 0:t.collection;for(let t of e||[])if("number"!=typeof t){if("string"!=typeof t||!(null==d?void 0:d.getField)||(a=null==d||null==(r=d.getField)?void 0:r.call(d,t),!(null==a||null==(i=a.isAssociationField)?void 0:i.call(a))))break;s=a,d=null==a?void 0:a.targetCollection}let u=(null==s||null==(n=s.targetCollection)?void 0:n.filterTargetKey)??(null==s||null==(o=s.targetCollection)?void 0:o.filterByTk)??(null==s?void 0:s.targetKey);if(Array.isArray(u)){let e=u.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof u&&u?u:"id"}getArrayItemIdentity(e,t){return(0,C.r5)(e,this.getArrayItemTargetKey(t))}reconcileArrayItemState(e,t,l){let n=new Set;for(let o of e||[]){if(!(null==o?void 0:o.length))continue;let e=(0,x.Qc)(o);if(n.has(e))continue;n.add(e);let r=d().get(this.valuesMirror,o),i=this.getObservedChangedValue(o,t,l);if(!Array.isArray(r)||!Array.isArray(i))continue;let a=new Map;i.forEach((e,t)=>{let l=this.getArrayItemIdentity(e,o);l&&a.set(l,t)}),a.size&&(this.reconcileArrayItemSet(this.explicitSet,o,r,a),this.reconcileArrayItemSet(this.userEditedSet,o,r,a),this.reconcileArrayItemMap(this.lastDefaultValueByPathKey,o,r,a),this.reconcileArrayItemMap(this.lastWriteMetaByPathKey,o,r,a),this.reconcileObservableBindings(o,r,a))}}getReconciledArrayItemPath(e,t,l,n){let o=(0,x.c1)(e);if(o.length<=t.length)return{action:"keep"};for(let e=0;e<t.length;e++)if(o[e]!==t[e])return{action:"keep"};let r=o[t.length];if("number"!=typeof r)return{action:"keep"};let i=this.getArrayItemIdentity(l[r],t);if(!i)return{action:"keep"};let a=n.get(i);if(null==a)return{action:"delete"};if(a===r)return{action:"keep"};let s=[...o];return s[t.length]=a,{action:"move",key:(0,x.Qc)(s)}}reconcileArrayItemSet(e,t,l,n){let o=new Set,r=!1;for(let i of e){let e=this.getReconciledArrayItemPath(i,t,l,n);if("delete"===e.action){r=!0;continue}if("move"===e.action){r=!0,o.add(e.key);continue}o.add(i)}if(r)for(let t of(e.clear(),o))e.add(t)}reconcileArrayItemMap(e,t,l,n){let o=new Map,r=!1;for(let[i,a]of e){let e=this.getReconciledArrayItemPath(i,t,l,n);if("delete"===e.action){r=!0;continue}if("move"===e.action){r=!0,o.set(e.key,a);continue}o.set(i,a)}if(r)for(let[t,l]of(e.clear(),o))e.set(t,l)}reconcileObservableBindings(e,t,l){let n=new Map,o=!1;for(let[r,i]of this.observableBindings){let a=this.getReconciledArrayItemPath(r,e,t,l);if("delete"===a.action){o=!0,i.dispose();continue}if("move"===a.action){o=!0,i.pathKey=a.key,n.set(a.key,i);continue}n.set(r,i)}if(o)for(let[e,t]of(this.observableBindings.clear(),n))this.observableBindings.set(e,t)}getObservedChangedValue(e,t,l){if(d().has(l,e))return d().get(l,e);if((null==e?void 0:e.length)===1){let l=e[0];if(("string"==typeof l||"number"==typeof l)&&t&&Object.prototype.hasOwnProperty.call(t,l))return t[l]}return d().get(l,e)}getObservedSnapshot(e,t){if(!e||"object"!=typeof e)return t;if(!t||"object"!=typeof t)return e;let l=t;for(let n of Object.keys(e))d().has(l,[n])||(l===t&&(l=Array.isArray(t)?[...t]:{...t}),d().set(l,[n],e[n]));return l}handleFormValuesChange(e,t){if(this.disposed||this.isSuppressed())return;let l=Object.keys(e||{}).map(e=>[e]),n=this.lastObservedChangedPaths&&this.lastObservedChangedPaths.length?this.lastObservedChangedPaths:l,o=this.lastObservedSource??"user";this.lastObservedChangedPaths=null,this.lastObservedSource=null;let r=this.getFormValuesSnapshot(),i=r&&"object"==typeof r?r:t&&"object"==typeof t?t:e,a=this.getObservedSnapshot(e,i);this.reconcileArrayItemState([...n,...l],e,a),this.pruneDeletedArrayItemState(a);let s=this.deriveExplicitPaths(n,e,a,this.valuesMirror).filter(e=>!this.isDeletedArrayItemPath(e,a)),u=!1,c=!1,p=[];for(let t of n){if(!(null==t?void 0:t.length))continue;let l=this.getObservedChangedValue(t,e,a),n=d().get(this.valuesMirror,t);d().isEqual(n,l)||(c||(this.writeSeq+=1,c=!0),d().set(this.valuesMirror,t,this.toMirrorSnapshot(l)),u=!0,p.push(t))}u&&this.bumpChangeTick();let m=[];for(let e of s)this.shouldKeepDefaultPathEnabled(e,a)||m.push(e);for(let e of m){let t=(0,x.Qc)(e);this.markExplicit(t),"user"===o&&this.markUserEdited(t)}if(u){let e=this.writeSeq;for(let t of p)(null==t?void 0:t.length)&&this.lastWriteMetaByPathKey.set((0,x.Qc)(t),{source:o,writeSeq:e})}let h=(0,w.ao)();this.emitFormValuesChange({source:o,txId:h,changedPaths:n,changedValues:e,allValues:a,allValuesSnapshot:a})}deriveExplicitPaths(e,t,l,n){let o=[],r=new Set;for(let i of e||[]){if(!(null==i?void 0:i.length))continue;let e=d().get(n,i),a=this.getObservedChangedValue(i,t,l);this.collectExplicitDiffPaths(e,a,i,o,r)}return o}collectExplicitDiffPaths(e,t,l,n,o){if(d().isEqual(e,t))return 0;let r=Array.isArray(e),i=Array.isArray(t);if(r||i){if(r&&i){let r=Math.min(e.length,t.length),i=0;for(let a=0;a<r;a++)i+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,o);return e.length!==t.length?i+ +!!this.pushExplicitPath(l,n,o):i}return+!!this.pushExplicitPath(l,n,o)}let a=this.isPlainObjectValue(e),s=this.isPlainObjectValue(t);if(a||s){if(a&&s){let r=new Set([...Object.keys(e),...Object.keys(t)]),i=0;for(let a of r)i+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,o);return 0===i&&this.isObjectCleared(e,t)?+!!this.pushExplicitPath(l,n,o):i}this.isObjectCleared(e,t)}return+!!this.pushExplicitPath(l,n,o)}pushExplicitPath(e,t,l){if(!(null==e?void 0:e.length))return!1;let n=(0,x.Qc)(e);return!(!n||l.has(n))&&(l.add(n),t.push([...e]),!0)}isPlainObjectValue(e){return d().isPlainObject(e)}isObjectCleared(e,t){return!!this.isPlainObjectValue(e)&&!!(null==t||this.isPlainObjectValue(t)&&0===Object.keys(t).length)}async setFormValues(e,t,l){var n,o,r,i;if(this.disposed)return;let a=null==(n=(o=this).getForm)?void 0:n.call(o);if(!a)return;let s=(null==l?void 0:l.source)??"system",u=(null==l?void 0:l.triggerEvent)!==!1,c=(null==l?void 0:l.txId)??(0,w.ao)(),p=(null==l?void 0:l.markExplicit)??("default"!==s&&"linkage"!==s),m=void 0===(null==l?void 0:l.txId),h="linkage"===s&&Number.isFinite(Number(null==l?void 0:l.linkageScopeDepth))?Number(null==l?void 0:l.linkageScopeDepth):0,v="linkage"===s&&"string"==typeof(null==l?void 0:l.linkageTxId)&&l.linkageTxId?String(l.linkageTxId):void 0,y=e=>{if("linkage"!==s||!v)return!1;let t=this.lastWriteMetaByPathKey.get(e);return!!t&&"linkage"===t.source&&!!t.linkageTxId&&t.linkageTxId===v&&(Number.isFinite(Number(t.linkageScopeDepth))?Number(t.linkageScopeDepth):0)>h},b=e=>"linkage"===s?{source:s,writeSeq:e,linkageScopeDepth:h,linkageTxId:v}:{source:s,writeSeq:e},S=e=>"linkage"===s&&v?{...e,linkageTxId:v}:e;try{let l=[];if(!Array.isArray(t)){let e=Object.entries(t||{}).map(e=>{let[t,l]=e;return[t,this.toMirrorSnapshot(l)]}).filter(e=>{let[t,l]=e;return!y(t)&&!d().isEqual(this.getFormValueAtPath([t]),l)}),l=Object.fromEntries(e),n=e.map(e=>{let[t]=e;return t});if(!n.length)return;n.length&&(this.writeSeq+=1),this.suppressFormCallbackDepth++;try{for(let[t,l]of e)"function"==typeof a.setFieldValue?a.setFieldValue(t,l):"function"==typeof a.setFields?a.setFields([{name:t,value:l}]):null==(r=a.setFieldsValue)||r.call(a,{[t]:l}),d().set(this.valuesMirror,[t],this.toMirrorSnapshot(l)),this.syncMountedFieldModelValue([t],l);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let o=this.writeSeq;for(let e of n)this.lastWriteMetaByPathKey.set(e,b(o));if(p)for(let e of n)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if(u){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(S({source:s,txId:c,changedPaths:n.map(e=>[e]),changedValues:l,allValues:e,allValuesSnapshot:e}))}return}let n=new Map,o=0;for(let l of t){let t=null==l?void 0:l.condition;if(t&&!(0,g.F)(e,t))continue;let r=this.resolveNamePath(e,l.path),i=(0,x.Qc)(r),a=l.value,s=this.toMirrorSnapshot(a);if(y(i))continue;let u=this.getFormValueAtPath(r);d().isEqual(u,s)||(o+=1,n.set(i,{order:o,namePath:r,value:s,rawValue:a,pathKey:i}))}let m=Array.from(n.values()).sort((e,t)=>e.order-t.order).map(e=>({namePath:e.namePath,value:e.value,rawValue:e.rawValue,pathKey:e.pathKey}));if(!m.length)return;let C=this.txWriteCounts.get(c)||new Map;this.txWriteCounts.set(c,C);let F=[];for(let e of m){let t=(C.get(e.pathKey)||0)+1;C.set(e.pathKey,t),t>w.li||F.push(e)}if(!F.length)return;this.writeSeq+=1;let k=this.writeSeq;for(let{pathKey:e,rawValue:t}of F)if(!(0,f.isObservable)(t)){let t=this.observableBindings.get(e);t&&(t.dispose(),this.observableBindings.delete(e))}this.suppressFormCallbackDepth++;try{for(let{namePath:e,value:t}of F)null==(i=a.setFieldValue)||i.call(a,e,t),d().set(this.valuesMirror,e,this.toMirrorSnapshot(t)),this.syncMountedFieldModelValue(e,t),l.push(e);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}for(let{pathKey:e}of F)this.lastWriteMetaByPathKey.set(e,b(k));if(p)for(let{pathKey:e}of F)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if("default"===s)for(let{namePath:e,pathKey:t}of F){let l=this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(t,this.toMirrorSnapshot(l))}for(let{rawValue:t,pathKey:l}of F){if(!(0,f.isObservable)(t))continue;let n=t,o={source:s,pathKey:l,dispose:()=>{}},r=(0,f.observe)(n,()=>{let t=o.pathKey;this.applyBoundValue(e,(0,x.c1)(t),t,(0,f.toJS)(n),s,h,v)});o.dispose=r;let i=this.observableBindings.get(l);i&&i.dispose(),this.observableBindings.set(l,o)}if(u){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(S({source:s,txId:c,changedPaths:l,changedValues:{},allValues:e,allValuesSnapshot:e}))}}finally{m&&this.txWriteCounts.delete(c)}}applyBoundValue(e,t,l,n,o,r,i){var a,s,u;if(this.disposed)return;let c=null==(a=(s=this).getForm)?void 0:a.call(s);if(!c||"override"===o&&this.findUserEditedHit(l))return;let p=this.toMirrorSnapshot(n),m=d().get(this.valuesMirror,t);if(d().isEqual(m,p))return;this.writeSeq+=1;let h=this.writeSeq;this.suppressFormCallbackDepth++;try{null==(u=c.setFieldValue)||u.call(c,t,p),d().set(this.valuesMirror,t,this.toMirrorSnapshot(p)),this.syncMountedFieldModelValue(t,p),this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let f="linkage"===o?{source:o,writeSeq:h,linkageScopeDepth:Number.isFinite(Number(r))?Number(r):0,linkageTxId:"string"==typeof i&&i?i:void 0}:{source:o,writeSeq:h};this.lastWriteMetaByPathKey.set(l,f);let g=(0,w.ao)(),v=this.getFormValuesSnapshot(),y={source:o,txId:g,changedPaths:[t],changedValues:{},allValues:v,allValuesSnapshot:v};if("linkage"===o&&i&&(y.linkageTxId=i),this.emitFormValuesChange(y),"default"===o&&this.isExplicit(l)||"override"===o&&this.findUserEditedHit(l)){let e=this.observableBindings.get(l);e&&(e.dispose(),this.observableBindings.delete(l))}"default"===o&&this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(this.getFormValueAtPath(t)))}resolveNamePath(e,t){let l=this.tryResolveNamePath(e,t);if(!l)throw Error(`Failed to resolve path '${String(t)}'`);return l}tryResolveNamePath(e,t){var l,n;let o=(null==e||null==(n=e.model)||null==(l=n.context)?void 0:l.fieldIndex)??(null==e?void 0:e.fieldIndex);return(0,x.IJ)(t,o)}bumpChangeTick(){this.changeTick.value+=1}emitFormValuesChange(e){var t,l,n,o;null==(t=(l=this.model).dispatchEvent)||t.call(l,"formValuesChange",e,{debounce:!0}),null==(o=this.model.emitter)||null==(n=o.emit)||n.call(o,"formValuesChange",e)}syncMountedFieldModelValue(e,t){let l=(0,x.Qc)(e);if(!l)return;let n=this.mountedFieldModelsByPathKey.get(l);if(!(null==n?void 0:n.size))return;let o=new Set;for(let e of Array.from(n))this.syncMountedFieldModelValueForModel(e,t,o)}syncMountedFieldModelValueForModel(e,t,l){var n,o,r;if(!e||l.has(e)||(l.add(e),!this.isMountedModelInThisForm(e)))return;let i={value:t};null==(n=e.setProps)||n.call(e,i);let a=null==(o=e.subModels)?void 0:o.field;null==a||null==(r=a.setProps)||r.call(a,i)}rebuildMountedFieldModelIndex(){var e,t;this.mountedFieldModelsByPathKey.clear();let l=null==(t=this.model)||null==(e=t.context)?void 0:e.engine;l&&"function"==typeof l.forEachModel&&l.forEachModel(e=>{this.indexMountedFieldModelTree(e)})}indexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.indexMountedFieldModel(e))}unindexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.unindexMountedFieldModel(e))}visitModelAndForks(e,t){if(!e)return;let l=new Set,n=e=>{var o;if(!e||l.has(e))return;l.add(e),t(e);let r=e.forks;null==r||null==(o=r.forEach)||o.call(r,e=>n(e))};n(e)}indexMountedFieldModel(e){if(!this.isMountedModelInThisForm(e))return;let t=new Set;for(let l of this.getMountedModelNamePaths(e)){let e=(0,x.Qc)(l);e&&t.add(e)}if(t.size)for(let l of(this.unindexMountedFieldModel(e),this.mountedFieldModelPathKeys.set(e,t),t)){let t=this.mountedFieldModelsByPathKey.get(l)||new Set;t.add(e),this.mountedFieldModelsByPathKey.set(l,t)}}unindexMountedFieldModel(e){let t=this.mountedFieldModelPathKeys.get(e);if(t){for(let l of t){let t=this.mountedFieldModelsByPathKey.get(l);t&&(t.delete(e),t.size||this.mountedFieldModelsByPathKey.delete(l))}this.mountedFieldModelPathKeys.delete(e)}}isMountedModelInThisForm(e){var t;let l=null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.model.uid)}getMountedModelNamePaths(e){var t,l;let n=[],o=e=>{let t=this.normalizeNamePathValue(e);(null==t?void 0:t.length)&&n.push(t)};o(null==(t=e.context)?void 0:t.fieldPathArray);let r="function"==typeof e.getProps?e.getProps():e.props;r&&"object"==typeof r&&o(r.name);try{let t=null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init");t&&"object"==typeof t&&o(t.fieldPath)}catch{}let i=new Set;return n.filter(e=>{let t=(0,x.Qc)(e);return!(!t||i.has(t))&&(i.add(t),!0)})}normalizeNamePathValue(e){if(Array.isArray(e)){let t=e.filter(e=>"string"==typeof e||"number"==typeof e);return t.length===e.length?t:null}return"number"==typeof e?[e]:"string"==typeof e&&e?(0,x.c1)(e):null}markExplicit(e){if(this.explicitSet.has(e))return;this.explicitSet.add(e);let t=this.shouldPreserveDescendantDefaultsOnExplicit(e);for(let l of Array.from(this.lastDefaultValueByPathKey.keys())){let n=l.startsWith(`${e}.`)||l.startsWith(`${e}[`);(l===e||!t&&n)&&this.lastDefaultValueByPathKey.delete(l)}for(let[e,t]of Array.from(this.observableBindings.entries()))"default"===t.source&&this.isExplicit(e)&&(t.dispose(),this.observableBindings.delete(e))}markUserEdited(e){if(!this.userEditedSet.has(e))for(let[t,l]of(this.userEditedSet.add(e),Array.from(this.observableBindings.entries())))"override"===l.source&&this.findUserEditedHit(t)&&(l.dispose(),this.observableBindings.delete(t))}normalizeObservedNamePath(e){if(Array.isArray(e))return e;if("number"==typeof e)return[e];if("string"!=typeof e||!e)return null;let t=(0,x.c1)(e);return t.length?t:[e]}clearExplicitForDefaultPatch(e){for(let t of Array.from(this.explicitSet))(t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`))&&this.explicitSet.delete(t)}shouldPreserveDescendantDefaultsOnExplicit(e){return Array.isArray(this.getFormValueAtPath((0,x.c1)(e)))}shouldKeepDefaultPathEnabled(e,t){return this.shouldKeepDefaultPathValueEnabled(e,d().get(t,e))}shouldKeepDefaultPathValueEnabled(e,t){let l=(0,x.Qc)(e),n=this.lastDefaultValueByPathKey.get(l);if(void 0===n)return!1;let o=(0,f.isObservable)(t)?(0,f.toJS)(t):t;return d().isEqual(o,n)}isExplicit(e){return!!this.findExplicitHit(e)}findExplicitHit(e){if(this.explicitSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.explicitSet.has(n)&&"number"!=typeof t[e+1])return n}return null}findUserEditedHit(e){if(this.userEditedSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.userEditedSet.has(n)&&"number"!=typeof t[e+1])return n}for(let t of this.userEditedSet)if(this.isDescendantPathKey(t,e))return t;return null}isDescendantPathKey(e,t){if(!e||!t||e===t)return!1;let l=(0,x.c1)(e),n=(0,x.c1)(t);return!(l.length<=n.length)&&n.every((e,t)=>l[t]===e)}constructor(e){this.valuesMirror=(0,f.observable)({}),this.explicitSet=new Set,this.userEditedSet=new Set,this.lastDefaultValueByPathKey=new Map,this.lastWriteMetaByPathKey=new Map,this.observableBindings=new Map,this.changeTick=f.observable.ref(0),this.txWriteCounts=new Map,this.writeSeq=0,this.disposed=!1,this.suppressFormCallbackDepth=0,this.lastObservedChangedPaths=null,this.lastObservedSource=null,this.lastObservedToken=0,this.mountedFieldModelsByPathKey=new Map,this.mountedFieldModelPathKeys=new WeakMap,this.model=e.model,this.getForm=e.getForm,this.formPatcher=y({isSuppressed:()=>this.isSuppressed(),getCallerContext:()=>{var e;return null==(e=this.model)?void 0:e.context},setFormValues:this.setFormValues.bind(this)}),this.ruleEngine=new M({getBlockModelUid:()=>{var e;return String(null==(e=this.model)?void 0:e.uid)},getAssignRulesModelUid:()=>{var e,t;let l=null==(t=this.model)||null==(e=t.subModels)?void 0:e.grid;return!Array.isArray(l)&&(null==l?void 0:l.uid)?String(l.uid):void 0},getActionName:()=>{var e,t,l,n;return(null==(t=this.model)||null==(e=t.getAclActionName)?void 0:e.call(t))??(null==(n=this.model)||null==(l=n.context)?void 0:l.actionName)},getBlockContext:()=>{var e;return null==(e=this.model)?void 0:e.context},getEngine:()=>{var e,t;return null==(t=this.model)||null==(e=t.context)?void 0:e.engine},getEngineModel:e=>{var t,l,n,o;return(null==(o=this.model)||null==(n=o.context)||null==(l=n.engine)||null==(t=l.getModel)?void 0:t.call(l,e))??null},isDisposed:()=>this.disposed,valuesMirror:this.valuesMirror,changeTick:this.changeTick,getWriteSeq:()=>this.writeSeq,txWriteCounts:this.txWriteCounts,createTrackingFormValues:e=>(0,v.x3)({valuesMirror:this.valuesMirror,basePath:[],collector:e,getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)}),tryResolveNamePath:(e,t)=>this.tryResolveNamePath(e,t),getFormValueAtPath:e=>this.getFormValueAtPath(e),setFormValues:(e,t,l)=>this.setFormValues(e,t,l),findExplicitHit:e=>this.findExplicitHit(e),findUserEditedHit:e=>this.findUserEditedHit(e),lastDefaultValueByPathKey:this.lastDefaultValueByPathKey,lastWriteMetaByPathKey:this.lastWriteMetaByPathKey,observableBindings:this.observableBindings}),this.formValuesProxy=(0,v.x3)({valuesMirror:this.valuesMirror,basePath:[],getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)})}}function T(e,t){let l=Array.isArray(e)?e:[],n=new Set,o=e=>{var l,n,o;if(!t||"function"!=typeof t.getField||"string"!=typeof e||!e.includes("."))return null;let r=e.split(".").filter(Boolean);if(r.length<2)return null;let i=t,a=[],s=null,d=null;for(let e=0;e<r.length-1;e++){let t=r[e],o=null==i||null==(l=i.getField)?void 0:l.call(i,t);if(!(null==o||null==(n=o.isAssociationField)?void 0:n.call(o))||!(null==o?void 0:o.targetCollection))break;a.push(t),s=a.join("."),d=o,i=o.targetCollection}if(s&&d){let e=r[r.length-1],t=(null==d?void 0:d.targetKey)??(null==d||null==(o=d.targetCollection)?void 0:o.filterTargetKey)??"id",l=Array.isArray(t)?t.filter(e=>"string"==typeof e&&!!e):"string"==typeof t&&t?[t]:["id"];if("string"==typeof e&&l.includes(e))return null}return s};for(let e of l){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=o(t);l&&n.add(l)}return Array.from(n)}var R=l(71712);let E={formModelSettings:new Set(["layout","assignRules"]),eventSettings:new Set(["linkageRules"])},N="nb-flow-keep-mobile-horizontal",D=(0,r.css)`
|
|
3125
3125
|
&.${N} {
|
|
3126
3126
|
@media (max-width: 575px) {
|
|
3127
3127
|
.ant-form-item {
|
|
@@ -3140,7 +3140,7 @@ ${o}`,c)}}let n=T(e.issues.filter(e=>"runtime"===e.type)),o=n?`Key runtime issue
|
|
|
3140
3140
|
}
|
|
3141
3141
|
}
|
|
3142
3142
|
}
|
|
3143
|
-
`;function B(e,t){var l;return!!(null==(l=E[e])?void 0:l.has(t))}class $ extends h.t{get form(){return this.context.form}syncRuntimeAssignRules(){var e,t,l;arguments.length>0&&void 0!==arguments[0]&&arguments[0];let n=this.getStepParams("formModelSettings","assignRules"),o=(null==n?void 0:n.value)||[];null==(t=this.formValueRuntime)||null==(e=t.syncAssignRules)||e.call(t,Array.isArray(o)?o:[]);let r=null==(l=this.context)?void 0:l.resource,i=T(o,this.collection);(null==r?void 0:r.addUpdateAssociationValues)&&i.length&&r.addUpdateAssociationValues(i)}renderConfigureActions(){return(0,n.jsx)(i.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("FormActionGroupModel"),children:(0,n.jsx)(i.FlowSettingsButton,{icon:(0,n.jsx)(o.A,{}),children:this.translate("Actions")})})}setFieldsValue(e){let t=this.context;"function"==typeof t.setFormValues?t.setFormValues(e,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form values via ctx.setFormValues",e)}):this.form.setFieldsValue(e)}setFieldValue(e,t){let l=this.context;"function"==typeof l.setFormValue?l.setFormValue(e,t,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form value via ctx.setFormValue",e)}):this.form.setFieldValue(e,t)}markUserModifiedFields(e){if(e&&"object"==typeof e&&!Array.isArray(e))for(let t of Object.keys(e))t&&this.userModifiedTopLevelFields.add(t)}getUserModifiedFields(){return this.userModifiedTopLevelFields}resetUserModifiedFields(){this.userModifiedTopLevelFields.clear()}resetRuntimeUserEditedState(){var e,t;null==(t=this.formValueRuntime)||null==(e=t.resetUserEditedState)||e.call(t)}async onDispatchEventStart(e,t,l){var n;if("beforeRender"===e){let e=this.subModels.grid;e&&await e.dispatchEvent("beforeRender",l,{useCache:null==t?void 0:t.useCache})}await (null==(n=super.onDispatchEventStart)?void 0:n.call(this,e,t,l))}getStepParams(e,t){let l=this.subModels.grid;if(e&&t&&B(e,t)&&l){let n=l.getStepParams(e,t);return void 0!==n?n:super.getStepParams(e,t)}if(e&&!t&&E[e]&&l){let t=super.getStepParams(e)||{},n=l.getStepParams(e)||{};for(let l of E[e])Object.prototype.hasOwnProperty.call(n,l)&&void 0!==n[l]&&(t[l]=n[l]);return t}return super.getStepParams(e,t)}setStepParams(e,t,l){let n=this.subModels.grid,o=(e,t)=>{let l=E[e];if(!l||!n)return t;let o={};for(let[r,i]of Object.entries(t))l.has(r)?n.setStepParams(e,r,i):o[r]=i;return o};if("string"==typeof e&&"string"==typeof t&&void 0!==l)return void(B(e,t)&&n?n.setStepParams(e,t,l):super.setStepParams(e,t,l));if("string"==typeof e&&"object"==typeof t&&null!==t){let l=o(e,t);Object.keys(l).length>0&&super.setStepParams(e,l);return}if("object"==typeof e&&null!==e){let t={};for(let[l,n]of Object.entries(e)){if("object"!=typeof n||null===n){t[l]=n;continue}let e=o(l,n);Object.keys(e).length>0&&(t[l]=e)}Object.keys(t).length>0&&super.setStepParams(t)}}async saveStepParams(){return await (0,m.ON)(this,async()=>{let e=await super.saveStepParams(),t=this.subModels.grid;return await (null==t?void 0:t.saveStepParams()),e})}createFormValuesMetaFactory(){return(0,i.createAssociationAwareObjectMetaFactory)(()=>this.collection,this.translate("Current form"),()=>{var e,t;return(null==(t=this.form)||null==(e=t.getFieldsValue)?void 0:e.call(t))||{}})}useHooksBeforeRender(){let[e]=a.A.useForm();this.context.defineProperty("form",{get:()=>e}),this.formValueRuntime||(this.formValueRuntime=new I({model:this,getForm:()=>this.context.form}));let t=this.formValueRuntime;t.mount();let l=this.createFormValuesMetaFactory();this.context.defineProperty("formValues",{get:()=>t.formValues,cache:!1,meta:l,resolveOnServer:e=>{var l,n,o,r,a,s,d,c,p,m,h,f,g;if(!e)return!1;let v=(e=>{let t=String(e||"").match(/^([^.[]+)/);return null==t?void 0:t[1]})(e);if(!v||!(null==(n=this.collection)||null==(l=n.getField)?void 0:l.call(n,v)))return!1;if((()=>{var e,t,l,n;let o=(null==(t=this.subModels.grid)||null==(e=t.subModels)?void 0:e.items)??[],r=new Set;for(let e of o){let t=null==e||null==(n=e.getStepParams)||null==(l=n.call(e,"fieldSettings","init"))?void 0:l.fieldPath,o=null==t?void 0:t.toString().split(".")[0];o&&r.add(o)}return r})().has(v)){let l=null==(r=this.form)||null==(o=r.getFieldValue)?void 0:o.call(r,v);if(null==l||Array.isArray(l)&&0===l.length)return!1;let n=t.getFormValuesSnapshot();return(!n||"object"!=typeof n||void 0===(0,u.D)(n,e))&&(0,i.createAssociationSubpathResolver)(()=>this.collection,()=>t.getFormValuesSnapshot())(e)}try{let e=(null==(d=this.context)||null==(s=d.resource)||null==(a=s.getMeta)?void 0:a.call(s,"currentFilterByTk"))??(null==(m=this.context)||null==(p=m.resource)||null==(c=p.getFilterByTk)?void 0:c.call(p))??(null==(g=this.collection)||null==(f=g.getFilterByTK)?void 0:f.call(g,null==(h=this.context)?void 0:h.record));if(null==e)return!1}catch(e){return!1}return!0},serverOnlyWhenContextParams:!0}),this.context.defineMethod("getFormValues",function(){return t.getFormValuesSnapshot()}),this.context.defineMethod("setFormValues",function(e,l){return t.setFormValues(this,e,l)}),this.context.defineMethod("setFormValue",function(e,l,n){return t.setFormValues(this,[{path:e,value:l}],n)})}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{e===this.subModels.grid&&queueMicrotask(()=>this.syncRuntimeAssignRules("onSubModelAdded:grid"))}),this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1}),this.context.resource.on("saved",()=>{this.dispatchEvent("formSubmitSuccess",{})})}onMount(){var e;super.onMount(),null==(e=this.formValueRuntime)||e.mount({sync:!0}),this.syncRuntimeAssignRules("onMount"),setTimeout(()=>{this.applyFlow("eventSettings")},100)}onUnmount(){var e;null==(e=this.formValueRuntime)||e.dispose(),this.formValueRuntime=void 0,super.onUnmount()}getCurrentRecord(){return{}}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of FormModel")}constructor(...e){super(...e),this.userModifiedTopLevelFields=new Set,this._defaultCustomModelClasses={FormActionGroupModel:"FormActionGroupModel",FormItemModel:"FormItemModel",FormAssociationFieldGroupModel:"FormAssociationFieldGroupModel"},this.customModelClasses={}}}function O(e){var t,l,o,r;let{model:i,children:d,layoutProps:u={},initialValues:c,...p}=e,m=!!((null==i||null==(t=i.context)?void 0:t.isMobileLayout)&&(null==u?void 0:u.layout)==="horizontal"),h=[p.className,m?N:"",m?D:""].filter(Boolean).join(" ");return(0,n.jsx)(a.A,{form:i.form,initialValues:(null==(r=i.context)||null==(o=r.view)||null==(l=o.inputArgs)?void 0:l.formData)||i.context.record||c,...(0,s.omit)(u,"labelWidth"),labelCol:{style:{width:null==u?void 0:u.labelWidth}},onFieldsChange:e=>{let t=i.formValueRuntime;t&&t.handleFormFieldsChange(e)},onValuesChange:(e,t)=>{var l;null==(l=i.markUserModifiedFields)||l.call(i,e);let n=i.formValueRuntime;n?n.handleFormValuesChange(e,t):(i.dispatchEvent("formValuesChange",{changedValues:e,allValues:t},{debounce:!0}),i.emitter.emit("formValuesChange",{changedValues:e,allValues:t}))},...p,className:h||void 0,children:d})}let q=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,o=parseFloat(l.marginBottom)||0;return t.height+n+o},L=e=>{if(null!=e&&""!==e)return"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?`${e}px`:e},_=e=>{let{heightMode:t,containerRef:l,actionsRef:n,footerRef:o,deps:r=[]}=e,[i,a]=(0,c.useState)(),s=(0,c.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let r=e.getBoundingClientRect().height;if(!r)return;let i=Math.max(0,Math.floor(r-q((null==n?void 0:n.current)||null)-q((null==o?void 0:o.current)||null)));a(e=>e===i?e:i)},[t,l,n,o]);return(0,c.useLayoutEffect)(()=>{s()},[s,...r]),(0,c.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=(null==n?void 0:n.current)||null,r=(null==o?void 0:o.current)||null,i=new ResizeObserver(()=>s());return i.observe(e),t&&i.observe(t),r&&i.observe(r),()=>i.disconnect()},[s,l,n,o,...r]),i},V=e=>{var t,l;let{model:o,gridModel:r,layoutProps:i,onFinish:a,grid:s,actions:d,footer:u,heightMode:p,height:m}=e,h=(0,c.useRef)(null),f=(0,c.useRef)(null),g=(0,c.useRef)(null),v="specifyValue"===p||"fullHeight"===p,y={paddingTop:null==(l=o.context)||null==(t=l.themeToken)?void 0:t.padding},x=(null==i?void 0:i.layout)==="horizontal"?L(null==i?void 0:i.labelWidth):void 0;x&&(y.marginInlineStart=x);let b=_({heightMode:p,containerRef:h,actionsRef:d?f:void 0,footerRef:u?g:void 0,deps:[m]});(0,c.useEffect)(()=>{var e;if(!r)return;let t=v?b:void 0;(null==(e=r.props)?void 0:e.height)!==t&&r.setProps({height:t})},[r,b,v]);let w=v?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,S=v?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,n.jsx)(O,{model:o,layoutProps:i,onFinish:a,style:w,children:(0,n.jsxs)("div",{ref:h,style:S,children:[s,d?(0,n.jsx)("div",{style:y,ref:f,children:d}):null,u?(0,n.jsx)("div",{ref:g,children:u}):null]})})};$.define({hide:!0}),$.registerFlow({key:"formModelSettings",title:(0,i.tExpr)("Form settings"),steps:{layout:{use:"layout",title:(0,i.tExpr)("Layout")},assignRules:{use:"formAssignRules",title:(0,i.tExpr)("Field values"),beforeParamsSave(e){let t=(0,R.Fp)(e.model);Array.isArray(t)&&t.length&&(0,m.jI)(e.model)},afterParamsSave(e){var t,l,n,o,r,i;let a=e.model.getStepParams("formModelSettings","assignRules"),s=(null==a?void 0:a.value)||[];null==(n=e.model)||null==(l=n.formValueRuntime)||null==(t=l.syncAssignRules)||t.call(l,Array.isArray(s)?s:[]);let d=null==(r=e.model)||null==(o=r.context)?void 0:o.resource,u=T(s,null==(i=e.model)?void 0:i.collection);(null==d?void 0:d.addUpdateAssociationValues)&&u.length&&d.addUpdateAssociationValues(u)}}}}),$.registerFlow({key:"eventSettings",title:(0,i.tExpr)("Event settings"),on:"formValuesChange",steps:{linkageRules:{use:"fieldLinkageRules",afterParamsSave(e){setTimeout(()=>{var t;e.model.applyFlow("eventSettings",{changedValues:{},allValues:null==(t=e.form)?void 0:t.getFieldsValue(!0)})},0)}}}}),$.registerEvents({formValuesChange:{title:(0,i.tExpr)("Form values change"),name:"formValuesChange",uiSchema:{condition:{type:"object",title:(0,i.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":p.H}},handler:p.b}});class z extends ${}z.define({hide:!0})},71712(e,t,l){"use strict";l.d(t,{Fp:()=>s,K7:()=>a,S2:()=>n.S2});var n=l(50314);let o=["editItemSettings","formItemSettings"],r=(0,n.li)(o),i=(0,n.u4)(o);function a(e){return(0,n.TE)(e,r)}function s(e){return(0,n.Co)(e,r,i)}},53831(e,t,l){"use strict";l.d(t,{submitHandler:()=>a});var n=l(11869),o=l(58428),r=l(18357);function i(e){return e&&"object"==typeof e&&"data"in e?e.data:e}async function a(e,t,a){var s,d,u,c,p,m,h,f;let g=e.resource,v=e.blockModel,{EditFormModel:y}=await Promise.resolve().then(l.bind(l,71616)),x=v instanceof y;await (0,r.D9)({form:null==v?void 0:v.form,blockModel:v,flowSettingsEnabled:null==e?void 0:e.flowSettingsEnabled,skipValidator:(0,r.go)(null==e?void 0:e.model)});let b=v.form.getFieldsValue(!0),w=(0,r.xT)(b,v),S=await (0,o.eu)(e,null==t?void 0:t.assignedValues,"FormSubmitAction");if(!S){null==(s=e.exit)||s.call(e);return}let C=(0,o.GO)(w,S);if(g instanceof n.SingleRecordResource){if(x){let e=g.getMeta("currentFilterByTk");e?g.setFilterByTk(e):g.isNewRecord=!0}let l=i(a?await a(C):await g.save(C,t.requestConfig));return x?(g.isNewRecord=!1,null==(d=v.resetUserModifiedFields)||d.call(v),await g.refresh(),l=l??(null==(u=g.getData)?void 0:u.call(g))):(v.form.resetFields(),v.emitter.emit("onFieldReset"),null==(c=v.resetUserModifiedFields)||c.call(v),null==(m=v.formValueRuntime)||null==(p=m.resetAfterFormReset)||p.call(m),e.view.inputArgs.collectionName===v.collection.name&&e.view.inputArgs.onChange&&e.view.inputArgs.onChange(l)),l}if(g instanceof n.MultiRecordResource){let l=g.getMeta("currentFilterByTk");if(!l)return void e.message.error(e.t("No filterByTk found for multi-record resource."));let n=a?await a(C,l):await g.update(l,C,t.requestConfig);return null==(h=v.resetUserModifiedFields)||h.call(v),i(n)??(null==(f=v.getCurrentRecord)?void 0:f.call(v))}}},18357(e,t,l){"use strict";l.d(t,{D9:()=>v,go:()=>g,xT:()=>y});var n=l(40098),o=l.n(n),r=l(12197);function i(e,t){var l,n;let o=null==e||null==(n=e.context)||null==(l=n.blockModel)?void 0:l.uid,r=null==t?void 0:t.uid;return!!o&&!!r&&String(o)===String(r)}function a(e){var t,l;let n=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(n)&&n.length)return n;try{let t=null==e||null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init"),n=null==t?void 0:t.fieldPath;if("string"==typeof n&&n)return n}catch{}let o=null==e?void 0:e.fieldPath;if("string"==typeof o&&o)return o;let r="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,i=null==r?void 0:r.name;return"string"==typeof i&&i||Array.isArray(i)&&i.length?i:null}function s(e){return Array.isArray(e)&&e.length&&"string"==typeof e[0]?e:null}function d(e){var t;let l=a(e);return l?s((0,r.IJ)(l,null==e||null==(t=e.context)?void 0:t.fieldIndex)):null}function u(e,t){if(e&&"object"==typeof e&&Array.isArray(t)&&!(t.length<2))for(let l=t.length-1;l>=1;l--){let n=t.slice(0,l);if("number"==typeof n[n.length-1])continue;let r=o().get(e,n);o().isPlainObject(r)&&0===Object.keys(r).length&&o().unset(e,n)}}function c(e,t){(null==e?void 0:e.forEachModel)&&e.forEachModel(e=>{t(e);let l=null==e?void 0:e.forks;l&&"function"==typeof l.forEach&&l.forEach(e=>{e&&!e.disposed&&t(e)})})}function p(e){let t=null==e?void 0:e.flowEngine;if(!(null==t?void 0:t.forEachModel))return[];let l=[],n=new Set;return c(t,t=>{if(!t||"object"!=typeof t||!t.hidden||!i(t,e))return;let o=d(t);if(!o)return;let r=JSON.stringify(o);n.has(r)||(n.add(r),l.push(o))}),l}function m(e){return"string"==typeof e?e?[e]:null:Array.isArray(e)?s(e):null}function h(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length>t.length)return!1;for(let l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}function f(e){let t=null==e?void 0:e.form;if(!t||"function"!=typeof t.getFieldsError)return null;let l=t.getFieldsError();if(!Array.isArray(l))return null;let n=[],o=new Set;for(let e of l){let t=m(null==e?void 0:e.name);if(!t)continue;let l=JSON.stringify(t);o.has(l)||(o.add(l),n.push(t))}if(!n.length)return null;let r=p(e);return r.length?n.filter(e=>!r.some(t=>h(t,e))):n}function g(e){var t,l;return(null==e||null==(l=e.getStepParams)||null==(t=l.call(e,"submitSettings","skipRequiredValidation"))?void 0:t.skipValidator)===!0}async function v(e){let{form:t,blockModel:l,flowSettingsEnabled:n,skipValidator:o}=e;if(o||!t||"function"!=typeof t.validateFields)return;let r=n&&l?f(l):null;if(Array.isArray(r)){r.length&&await t.validateFields(r);return}await t.validateFields()}function y(e,t){if(!e||"object"!=typeof e)return e;let l=p(t);if(!l.length)return e;let n=o().cloneDeep(e);for(let e of l)o().unset(n,e),u(n,e);return n}},29676(e,t,l){"use strict";l.d(t,{F:()=>o});var n=l(13939);function o(e,t){let l=(t,l,n)=>{var o,r,i;return!l||(null==e||null==(i=e.app)||null==(r=i.jsonLogic)||null==(o=r.apply)?void 0:o.call(r,{[l]:[t,n]}))};try{return(0,n.evaluateConditions)((0,n.removeInvalidFilterItems)(t),l)}catch{return!1}}},47632(e,t,l){"use strict";l.d(t,{Dd:()=>d,G:()=>c,Wp:()=>p,x3:()=>u});var n=l(95243),o=l(11869),r=l(40098),i=l.n(r),a=l(12197);function s(e){return!!e&&"object"==typeof e&&(Array.isArray(e)||i().isPlainObject(e))}function d(e,t){if(t)for(let l of(0,a.ef)(e))t.deps.add(`fv:${l}`)}function u(e){let{valuesMirror:t,collector:l,basePath:o,getFormValuesSnapshot:r,getFormValueAtPath:a}=e,c=()=>o.length?i().get(t,o):t,p=c(),m=p&&("object"==typeof p||"function"==typeof p)?p:Array.isArray(p)?[]:{},h=e=>u({valuesMirror:t,basePath:e,collector:l,getFormValuesSnapshot:r,getFormValueAtPath:a});return new Proxy(m,{get(e,u){if("toJSON"===u)return(l&&(l.wildcard=!0),0===o.length)?()=>r():()=>(0,n.toJS)(c());if("symbol"==typeof u){l&&(l.wildcard=!0);let e=c();return null==e?void 0:e[u]}let p=c();if(null==p)return;if("__raw"===u)return p;if("__proto__"===u||"prototype"===u||"constructor"===u){l&&(l.wildcard=!0);return}let m=Array.isArray(p),f=m&&("number"==typeof u&&Number.isInteger(u)||"string"==typeof u&&/^\d+$/.test(u));if(m&&!f){l&&(l.wildcard=!0);let e=p[u];return"function"==typeof e?e.bind(p):e}let g=[...o,f?Number(u):u];d(g,l);let v=p[u];if(void 0===v){let e=a(g);i().isEqual(e,v)||(i().set(t,g,e),v=e)}return null==v||"object"!=typeof v?v:s(v)?h(g):v},ownKeys(){l&&(l.wildcard=!0);let e=c();return e?Reflect.ownKeys(e):[]},getOwnPropertyDescriptor(e,t){let l=c();if(l)return Object.getOwnPropertyDescriptor(l,t)},has(e,t){let l=c();return!!l&&t in l}})}function c(e,t){try{let l=(0,o.extractUsedVariablePaths)(e)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}function p(e,t){if((0,o.isRunJSValue)(e))try{let l=(0,o.extractUsedVariablePathsFromRunJS)(e.code)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}},12197(e,t,l){"use strict";function n(e){let t=[],l=0,n=e.length,o=()=>{let o=l;for(;l<n&&"."!==e[l]&&"["!==e[l];)l++;let r=e.slice(o,l);r&&t.push(r)};for(;l<n;){let r=e[l];if("."===r){l++;continue}if("["===r){let o=++l;for(;l<n&&"]"!==e[l];)l++;let r=e.slice(o,l);l++,/^\d+$/.test(r)?t.push(Number(r)):r&&t.push({placeholder:r});continue}o()}return t}function o(e){let t=Array.isArray(e)?e:[],l=[];for(let e of t){if("string"!=typeof e)continue;let[t,n]=e.split(":"),o=Number(n);!t||Number.isNaN(o)||l.push({name:t,index:o})}return l}function r(e,t){let l=Array.isArray(e)?[...e]:n(e),r=o(t),i=[],a=0;for(let e=0;e<l.length;e++){let t=l[e];if("object"==typeof t&&t&&"placeholder"in t){let e=i[i.length-1],t="string"==typeof e?e:void 0;if(!t)return null;for(;a<r.length&&r[a].name!==t;)a++;if(a>=r.length)return null;i.push(r[a].index),a++;continue}if(i.push(t),"string"==typeof t&&a<r.length&&r[a].name===t){let t=l[e+1];"number"==typeof t?a++:"object"==typeof t&&t&&"placeholder"in t||(i.push(r[a].index),a++)}}return i}function i(e){let t="";for(let l of e){if("number"==typeof l){t+=`[${l}]`;continue}t?t+=`.${l}`:t=l}return t}function a(e){return n(e).filter(e=>"object"!=typeof e)}function s(e){let t=[],l=[];for(let n of e)l.push(n),t.push(i(l));return t}l.d(t,{EA:()=>n,IJ:()=>r,Qc:()=>i,c1:()=>a,ef:()=>s})},65421(e,t,l){"use strict";l.d(t,{Po:()=>i,ao:()=>a,li:()=>r});var n=l(40098),o=l.n(n);let r=20;function i(e){return null==e||("string"==typeof e||Array.isArray(e)?0===e.length:!!o().isPlainObject(e)&&0===Object.keys(e).length)}function a(){return`${Date.now()}-${Math.random().toString(16).slice(2)}`}},50314(e,t,l){"use strict";l.d(t,{Co:()=>f,PP:()=>i,S2:()=>h,TE:()=>m,li:()=>d,u4:()=>p});var n=l(40098),o=l.n(n);function r(){return{logic:"$and",items:[]}}function i(e,t,l){var n;let o=null==e||null==(n=e.getStepParams)?void 0:n.call(e,t,l);return!!o&&Object.prototype.hasOwnProperty.call(o,"value")}function a(e){if(!e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(t&&void 0!==t.initialValue)return t.initialValue}function s(e,t){var l,n;if(e)return null==(n=e.getStepParams)||null==(l=n.call(e,t,"initialValue"))?void 0:l.defaultValue}function d(e){return t=>{if(!t)return;let l=a(t);if(void 0!==l)return l;for(let l of e){let e=s(t,l);if(void 0!==e)return e}}}function u(e,t,l){var n,r,i;if(!(null==e||null==(n=e.stepParams)?void 0:n[t]))return;let a=e.stepParams[t];!a||"object"!=typeof a||Object.prototype.hasOwnProperty.call(a,l)&&(delete a[l],o().isEmpty(a)&&delete e.stepParams[t],null==(i=e.emitter)||null==(r=i.emit)||r.call(i,"onStepParamsChanged"))}function c(e){var t,l;if(!e)return;null==(t=e.setProps)||t.call(e,{initialValue:void 0}),e.props&&Object.prototype.hasOwnProperty.call(e.props,"initialValue")&&delete e.props.initialValue;let n=null==(l=e._options)?void 0:l.props;n&&Object.prototype.hasOwnProperty.call(n,"initialValue")&&delete n.initialValue}function p(e){return t=>{if(t)for(let l of(c(t),e))u(t,l,"initialValue")}}function m(e,t){var l,n,o,i,a;let s=null==e||null==(o=e.subModels)||null==(n=o.grid)||null==(l=n.subModels)?void 0:l.items,d=Array.isArray(s)?s:[],u=[];for(let e of d){let l=(null==e||null==(a=e.getStepParams)||null==(i=a.call(e,"fieldSettings","init"))?void 0:i.fieldPath)||(null==e?void 0:e.fieldPath),n=l?String(l):"";if(!n)continue;let o=t(e);void 0!==o&&u.push({key:`legacy-default:${n}`,enable:!0,targetPath:n,mode:"default",condition:r(),value:o})}return u}function h(e,t){let l=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[];if(!n.length)return l;let o=new Set;for(let e of l){if(!e||"object"!=typeof e)continue;let t=e.targetPath?String(e.targetPath):"";if(t){if("default"===e.mode){o.add(t);continue}String(e.key??"").startsWith("legacy-default:")&&o.add(t)}}let r=new Set(l.map(e=>String(e.key??""))),i=[];for(let e of n){let t=e.targetPath?String(e.targetPath):"";if(!t||o.has(t))continue;let l={...e},n=String(l.key??"");n&&r.has(n)&&(l.key=`${n}:${t}`),i.push(l)}return i.length?[...l,...i]:l}function f(e,t,l){var n,o,r;let i=null==e||null==(r=e.subModels)||null==(o=r.grid)||null==(n=o.subModels)?void 0:n.items,a=Array.isArray(i)?i:[],s=[];for(let e of a)void 0!==t(e)&&(l(e),s.push(e));return s}},26866(e,t,l){"use strict";l.d(t,{$4:()=>a,r5:()=>i});var n=l(41893);let o="__index__";function r(e,t){if(!t)return null;if(Array.isArray(t)){let l=t.map(t=>null==e?void 0:e[t]);return l.some(e=>null==e)?null:l.map(e=>String(e)).join("__")}let l=null==e?void 0:e[t];return null==l?null:String(l)}function i(e,t){let l=null==e?void 0:e[o];if((null==e?void 0:e.__is_new__)&&null!=l&&""!==l)return`tmp:${String(l)}`;let n=r(e,t);return null!=n?`pk:${n}`:null!=l&&""!==l?`tmp:${String(l)}`:null}function a(e){if(!e.length)return e;let t=!1,l=e.map(e=>{let l=null==e?void 0:e[o];return e.__is_new__&&(null==l||""===l)?(t=!0,{...e,[o]:(0,n.uid)()}):e});return t?l:e}},69586(e,t,l){"use strict";l.d(t,{m:()=>p});var n=l(74848),o=l(11869),r=l(95725),i=l(96540),a=l(44329),s=l(81486),d=l(16860);function u(e){let{value:t,onChange:l,onCompositionStart:o,onCompositionEnd:a,...s}=e,[d,u]=(0,i.useState)(()=>c(t));(0,i.useEffect)(()=>{u(c(t))},[t]);let p=e=>e.currentTarget.value;return(0,n.jsx)(r.A,{...s,value:d,onChange:e=>{u(p(e)),null==l||l(e)},onCompositionStart:e=>{u(p(e)),null==o||o(e)},onCompositionEnd:e=>{u(p(e)),null==a||a(e)}})}function c(e){return"bigint"==typeof e?String(e):null==e?"":e}class p extends s.o{render(){if(this.props.enableScan)return(0,n.jsx)(d.E,{...this.props});let{enableScan:e,disableManualInput:t,...l}=this.props;return(0,n.jsx)(u,{...l})}}p.registerFlow({key:"defaultValueForNanoid",steps:{generateNanoid:{handler(e,t){var l,n;null==(n=e.blockModel)||null==(l=n.emitter)||l.on("onFieldReset",()=>{if("nanoid"===e.collectionField.interface&&!1!==e.collectionField.options.autoFill){let{size:t,customAlphabet:l}=e.collectionField.options||{size:21};e.model.props.onChange((0,a.d_)(l,t)())}})}}}}),p.registerFlow({key:"scanInputSettings",sort:800,title:(0,o.tExpr)("Scan input settings"),steps:{enableScan:{title:(0,o.tExpr)("Enable Scan"),uiMode:{type:"switch",key:"enableScan"},hideInSettings:e=>"readPretty"===e.model.getProps().pattern||e.model.getProps().disabled,defaultParams:e=>({enableScan:!!e.model.props.enableScan}),handler(e,t){e.model.setProps({enableScan:!!t.enableScan,disableManualInput:!!t.enableScan&&e.model.props.disableManualInput})}},disableManualInput:{title:(0,o.tExpr)("Disable manual input"),uiMode:{type:"switch",key:"disableManualInput"},hideInSettings(e){var t,l;let n=null==(t=(l=e.model).getStepParams)?void 0:t.call(l,"scanInputSettings","enableScan");return!(Object.prototype.hasOwnProperty.call(n||{},"enableScan")?!!(null==n?void 0:n.enableScan):!!e.model.props.enableScan)||"readPretty"===e.model.getProps().pattern||!!e.model.getProps().disabled},defaultParams:e=>({disableManualInput:!!e.model.props.disableManualInput}),handler(e,t){e.model.setProps({disableManualInput:!!e.model.props.enableScan&&!!t.disableManualInput})}}}}),p.define({label:(0,o.tExpr)("Input")}),o.EditableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid"],{isDefault:!0}),o.FilterableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid","textarea","markdown","vditor","richText","password","color"],{isDefault:!0})},95267(e,t,l){"use strict";l.d(t,{o:()=>n,e:()=>s});class n{subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async load(){return this.data&&!this.error?this.data:(this.pending||(this.loading=!0,this.notify(),this.pending=this.apiClient.request({url:"systemSettings:get"}).then(e=>(this.data=e.data,this.error=void 0,this.data)).catch(e=>{throw this.error=e,e}).finally(()=>{this.loading=!1,this.pending=void 0,this.notify()})),this.pending)}async refresh(){return this.pending=void 0,this.data=void 0,this.load()}setData(e){this.data=e,this.error=void 0,this.loading=!1,this.notify()}setError(e){this.error=e,this.loading=!1,this.notify()}notify(){for(let e of this.listeners)e()}constructor(e){this.apiClient=e,this.loading=!1,this.listeners=new Set}}var o=l(11869),r=l(2077),i=l(84256),a=l(96540);let s=()=>{var e,t;let l=(0,r.nm)().systemSettings,n=(0,o.useFlowEngine)({throwError:!1}),[,s]=(0,a.useState)(0),d=null==(t=l.data)||null==(e=t.data)?void 0:e.enabledLanguages,u=(0,a.useMemo)(()=>(Array.isArray(d)?d:[]).filter(e=>i.A[e]).map(e=>({label:i.A[e].label,value:e})),[d]);return(0,a.useEffect)(()=>(l.load(),l.subscribe(()=>{s(e=>e+1)})),[l]),(0,a.useEffect)(()=>{n&&n.context.defineProperty("locale",{get:e=>{var t,l,n;return(null==(l=e.api)||null==(t=l.auth)?void 0:t.locale)||(null==(n=e.i18n)?void 0:n.language)},cache:!1,meta:{type:"string",title:'{{t("Current language")}}',sort:970,interface:"select",uiSchema:{enum:u,"x-component":"Select"}}})},[n,u]),{loading:l.loading,data:l.data,error:l.error,refresh:()=>l.refresh(),mutate:e=>{Object.prototype.hasOwnProperty.call(e||{},"data")&&l.setData(null==e?void 0:e.data),Object.prototype.hasOwnProperty.call(e||{},"error")&&l.setError(null==e?void 0:e.error)}}}},94130(e,t,l){"use strict";l.d(t,{F3:()=>a,GX:()=>s,b1:()=>d});let n={view:"get"},o=e=>e?n[e]||e:null,r=(e,t)=>{for(let l of t){if(!(l in e))continue;let t=e[l];if(null==t)return null;return(Array.isArray(t)?t:[t]).map(e=>o(e)).filter(Boolean)}},i=(e,t)=>{let l=o(t);if(!l||!(null==e?void 0:e.options))return!0;let{availableActions:n,unavailableActions:r}=e.options;return Array.isArray(n)?n.includes(l):!Array.isArray(r)||!r.includes(l)},a=(e,t)=>null==t||!t.length||t.every(t=>i(e,t)),s=e=>{var t;let l=r(e,["capabilityActionNames","capabilityActionName"]);if(void 0!==l)return l;let n=null==e||null==(t=e.prototype)?void 0:t.getAclActionName;if("function"!=typeof n)return null;try{let e=n.call({}),t=o(e);return t?[t]:null}catch{return null}},d=e=>r(e,["blockCapabilityActionNames","blockCapabilityActionName"])??null},42632(e,t,l){"use strict";function n(e){let{blockLabel:t,dsName:l,dsCount:n,collectionTitle:o,sourceCollectionTitle:r,associationTitle:i}=e,a=n>1&&!!l,s=o;if(r&&i){let e=`${r} > ${i} (${o})`;s=`${a?`${l} > `:""}${e}`}else s=`${a?`${l} > `:""}${o}`;return`
|
|
3143
|
+
`;function B(e,t){var l;return!!(null==(l=E[e])?void 0:l.has(t))}class $ extends h.t{serialize(){return{...super.serialize(),variableContractType:{type:"form",use:this.use}}}get form(){return this.context.form}syncRuntimeAssignRules(){var e,t,l;arguments.length>0&&void 0!==arguments[0]&&arguments[0];let n=this.getStepParams("formModelSettings","assignRules"),o=(null==n?void 0:n.value)||[];null==(t=this.formValueRuntime)||null==(e=t.syncAssignRules)||e.call(t,Array.isArray(o)?o:[]);let r=null==(l=this.context)?void 0:l.resource,i=T(o,this.collection);(null==r?void 0:r.addUpdateAssociationValues)&&i.length&&r.addUpdateAssociationValues(i)}renderConfigureActions(){return(0,n.jsx)(i.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("FormActionGroupModel"),children:(0,n.jsx)(i.FlowSettingsButton,{icon:(0,n.jsx)(o.A,{}),children:this.translate("Actions")})})}setFieldsValue(e){let t=this.context;"function"==typeof t.setFormValues?t.setFormValues(e,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form values via ctx.setFormValues",e)}):this.form.setFieldsValue(e)}setFieldValue(e,t){let l=this.context;"function"==typeof l.setFormValue?l.setFormValue(e,t,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form value via ctx.setFormValue",e)}):this.form.setFieldValue(e,t)}markUserModifiedFields(e){if(e&&"object"==typeof e&&!Array.isArray(e))for(let t of Object.keys(e))t&&this.userModifiedTopLevelFields.add(t)}getUserModifiedFields(){return this.userModifiedTopLevelFields}resetUserModifiedFields(){this.userModifiedTopLevelFields.clear()}resetRuntimeUserEditedState(){var e,t;null==(t=this.formValueRuntime)||null==(e=t.resetUserEditedState)||e.call(t)}async onDispatchEventStart(e,t,l){var n;if("beforeRender"===e){let e=this.subModels.grid;e&&await e.dispatchEvent("beforeRender",l,{useCache:null==t?void 0:t.useCache})}await (null==(n=super.onDispatchEventStart)?void 0:n.call(this,e,t,l))}getStepParams(e,t){let l=this.subModels.grid;if(e&&t&&B(e,t)&&l){let n=l.getStepParams(e,t);return void 0!==n?n:super.getStepParams(e,t)}if(e&&!t&&E[e]&&l){let t=super.getStepParams(e)||{},n=l.getStepParams(e)||{};for(let l of E[e])Object.prototype.hasOwnProperty.call(n,l)&&void 0!==n[l]&&(t[l]=n[l]);return t}return super.getStepParams(e,t)}setStepParams(e,t,l){let n=this.subModels.grid,o=(e,t)=>{let l=E[e];if(!l||!n)return t;let o={};for(let[r,i]of Object.entries(t))l.has(r)?n.setStepParams(e,r,i):o[r]=i;return o};if("string"==typeof e&&"string"==typeof t&&void 0!==l)return void(B(e,t)&&n?n.setStepParams(e,t,l):super.setStepParams(e,t,l));if("string"==typeof e&&"object"==typeof t&&null!==t){let l=o(e,t);Object.keys(l).length>0&&super.setStepParams(e,l);return}if("object"==typeof e&&null!==e){let t={};for(let[l,n]of Object.entries(e)){if("object"!=typeof n||null===n){t[l]=n;continue}let e=o(l,n);Object.keys(e).length>0&&(t[l]=e)}Object.keys(t).length>0&&super.setStepParams(t)}}async saveStepParams(){return await (0,m.ON)(this,async()=>{let e=await super.saveStepParams(),t=this.subModels.grid;return await (null==t?void 0:t.saveStepParams()),e})}createFormValuesMetaFactory(){return(0,i.createAssociationAwareObjectMetaFactory)(()=>this.collection,this.translate("Current form"),()=>{var e,t;return(null==(t=this.form)||null==(e=t.getFieldsValue)?void 0:e.call(t))||{}})}useHooksBeforeRender(){let[e]=a.A.useForm();this.context.defineProperty("form",{get:()=>e}),this.formValueRuntime||(this.formValueRuntime=new I({model:this,getForm:()=>this.context.form}));let t=this.formValueRuntime;t.mount();let l=this.createFormValuesMetaFactory();this.context.defineProperty("formValues",{get:()=>t.formValues,cache:!1,meta:l,resolveOnServer:e=>{var l,n,o,r,a,s,d,c,p,m,h,f,g;if(!e)return!1;let v=(e=>{let t=String(e||"").match(/^([^.[]+)/);return null==t?void 0:t[1]})(e);if(!v||!(null==(n=this.collection)||null==(l=n.getField)?void 0:l.call(n,v)))return!1;if((()=>{var e,t,l,n;let o=(null==(t=this.subModels.grid)||null==(e=t.subModels)?void 0:e.items)??[],r=new Set;for(let e of o){let t=null==e||null==(n=e.getStepParams)||null==(l=n.call(e,"fieldSettings","init"))?void 0:l.fieldPath,o=null==t?void 0:t.toString().split(".")[0];o&&r.add(o)}return r})().has(v)){let l=null==(r=this.form)||null==(o=r.getFieldValue)?void 0:o.call(r,v);if(null==l||Array.isArray(l)&&0===l.length)return!1;let n=t.getFormValuesSnapshot();return(!n||"object"!=typeof n||void 0===(0,u.D)(n,e))&&(0,i.createAssociationSubpathResolver)(()=>this.collection,()=>t.getFormValuesSnapshot())(e)}try{let e=(null==(d=this.context)||null==(s=d.resource)||null==(a=s.getMeta)?void 0:a.call(s,"currentFilterByTk"))??(null==(m=this.context)||null==(p=m.resource)||null==(c=p.getFilterByTk)?void 0:c.call(p))??(null==(g=this.collection)||null==(f=g.getFilterByTK)?void 0:f.call(g,null==(h=this.context)?void 0:h.record));if(null==e)return!1}catch(e){return!1}return!0},serverOnlyWhenContextParams:!0}),this.context.defineMethod("getFormValues",function(){return t.getFormValuesSnapshot()}),this.context.defineMethod("setFormValues",function(e,l){return t.setFormValues(this,e,l)}),this.context.defineMethod("setFormValue",function(e,l,n){return t.setFormValues(this,[{path:e,value:l}],n)})}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{e===this.subModels.grid&&queueMicrotask(()=>this.syncRuntimeAssignRules("onSubModelAdded:grid"))}),this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1}),this.context.resource.on("saved",()=>{this.dispatchEvent("formSubmitSuccess",{})})}onMount(){var e;super.onMount(),null==(e=this.formValueRuntime)||e.mount({sync:!0}),this.syncRuntimeAssignRules("onMount"),setTimeout(()=>{this.applyFlow("eventSettings")},100)}onUnmount(){var e;null==(e=this.formValueRuntime)||e.dispose(),this.formValueRuntime=void 0,super.onUnmount()}getCurrentRecord(){return{}}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of FormModel")}constructor(...e){super(...e),this.userModifiedTopLevelFields=new Set,this._defaultCustomModelClasses={FormActionGroupModel:"FormActionGroupModel",FormItemModel:"FormItemModel",FormAssociationFieldGroupModel:"FormAssociationFieldGroupModel"},this.customModelClasses={}}}function O(e){var t,l,o,r;let{model:i,children:d,layoutProps:u={},initialValues:c,...p}=e,m=!!((null==i||null==(t=i.context)?void 0:t.isMobileLayout)&&(null==u?void 0:u.layout)==="horizontal"),h=[p.className,m?N:"",m?D:""].filter(Boolean).join(" ");return(0,n.jsx)(a.A,{form:i.form,initialValues:(null==(r=i.context)||null==(o=r.view)||null==(l=o.inputArgs)?void 0:l.formData)||i.context.record||c,...(0,s.omit)(u,"labelWidth"),labelCol:{style:{width:null==u?void 0:u.labelWidth}},onFieldsChange:e=>{let t=i.formValueRuntime;t&&t.handleFormFieldsChange(e)},onValuesChange:(e,t)=>{var l;null==(l=i.markUserModifiedFields)||l.call(i,e);let n=i.formValueRuntime;n?n.handleFormValuesChange(e,t):(i.dispatchEvent("formValuesChange",{changedValues:e,allValues:t},{debounce:!0}),i.emitter.emit("formValuesChange",{changedValues:e,allValues:t}))},...p,className:h||void 0,children:d})}let q=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,o=parseFloat(l.marginBottom)||0;return t.height+n+o},L=e=>{if(null!=e&&""!==e)return"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?`${e}px`:e},_=e=>{let{heightMode:t,containerRef:l,actionsRef:n,footerRef:o,deps:r=[]}=e,[i,a]=(0,c.useState)(),s=(0,c.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let r=e.getBoundingClientRect().height;if(!r)return;let i=Math.max(0,Math.floor(r-q((null==n?void 0:n.current)||null)-q((null==o?void 0:o.current)||null)));a(e=>e===i?e:i)},[t,l,n,o]);return(0,c.useLayoutEffect)(()=>{s()},[s,...r]),(0,c.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=(null==n?void 0:n.current)||null,r=(null==o?void 0:o.current)||null,i=new ResizeObserver(()=>s());return i.observe(e),t&&i.observe(t),r&&i.observe(r),()=>i.disconnect()},[s,l,n,o,...r]),i},V=e=>{var t,l;let{model:o,gridModel:r,layoutProps:i,onFinish:a,grid:s,actions:d,footer:u,heightMode:p,height:m}=e,h=(0,c.useRef)(null),f=(0,c.useRef)(null),g=(0,c.useRef)(null),v="specifyValue"===p||"fullHeight"===p,y={paddingTop:null==(l=o.context)||null==(t=l.themeToken)?void 0:t.padding},x=(null==i?void 0:i.layout)==="horizontal"?L(null==i?void 0:i.labelWidth):void 0;x&&(y.marginInlineStart=x);let b=_({heightMode:p,containerRef:h,actionsRef:d?f:void 0,footerRef:u?g:void 0,deps:[m]});(0,c.useEffect)(()=>{var e;if(!r)return;let t=v?b:void 0;(null==(e=r.props)?void 0:e.height)!==t&&r.setProps({height:t})},[r,b,v]);let w=v?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,S=v?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,n.jsx)(O,{model:o,layoutProps:i,onFinish:a,style:w,children:(0,n.jsxs)("div",{ref:h,style:S,children:[s,d?(0,n.jsx)("div",{style:y,ref:f,children:d}):null,u?(0,n.jsx)("div",{ref:g,children:u}):null]})})};$.define({hide:!0}),$.registerFlow({key:"formModelSettings",title:(0,i.tExpr)("Form settings"),steps:{layout:{use:"layout",title:(0,i.tExpr)("Layout")},assignRules:{use:"formAssignRules",title:(0,i.tExpr)("Field values"),beforeParamsSave(e){let t=(0,R.Fp)(e.model);Array.isArray(t)&&t.length&&(0,m.jI)(e.model)},afterParamsSave(e){var t,l,n,o,r,i;let a=e.model.getStepParams("formModelSettings","assignRules"),s=(null==a?void 0:a.value)||[];null==(n=e.model)||null==(l=n.formValueRuntime)||null==(t=l.syncAssignRules)||t.call(l,Array.isArray(s)?s:[]);let d=null==(r=e.model)||null==(o=r.context)?void 0:o.resource,u=T(s,null==(i=e.model)?void 0:i.collection);(null==d?void 0:d.addUpdateAssociationValues)&&u.length&&d.addUpdateAssociationValues(u)}}}}),$.registerFlow({key:"eventSettings",title:(0,i.tExpr)("Event settings"),on:"formValuesChange",steps:{linkageRules:{use:"fieldLinkageRules",afterParamsSave(e){setTimeout(()=>{var t;e.model.applyFlow("eventSettings",{changedValues:{},allValues:null==(t=e.form)?void 0:t.getFieldsValue(!0)})},0)}}}}),$.registerEvents({formValuesChange:{title:(0,i.tExpr)("Form values change"),name:"formValuesChange",uiSchema:{condition:{type:"object",title:(0,i.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":p.H}},handler:p.b}});class z extends ${}z.define({hide:!0})},71712(e,t,l){"use strict";l.d(t,{Fp:()=>s,K7:()=>a,S2:()=>n.S2});var n=l(50314);let o=["editItemSettings","formItemSettings"],r=(0,n.li)(o),i=(0,n.u4)(o);function a(e){return(0,n.TE)(e,r)}function s(e){return(0,n.Co)(e,r,i)}},53831(e,t,l){"use strict";l.d(t,{submitHandler:()=>a});var n=l(11869),o=l(58428),r=l(18357);function i(e){return e&&"object"==typeof e&&"data"in e?e.data:e}async function a(e,t,a){var s,d,u,c,p,m,h,f;let g=e.resource,v=e.blockModel,{EditFormModel:y}=await Promise.resolve().then(l.bind(l,71616)),x=v instanceof y;await (0,r.D9)({form:null==v?void 0:v.form,blockModel:v,flowSettingsEnabled:null==e?void 0:e.flowSettingsEnabled,skipValidator:(0,r.go)(null==e?void 0:e.model)});let b=v.form.getFieldsValue(!0),w=(0,r.xT)(b,v),S=await (0,o.eu)(e,null==t?void 0:t.assignedValues,"FormSubmitAction");if(!S){null==(s=e.exit)||s.call(e);return}let C=(0,o.GO)(w,S);if(g instanceof n.SingleRecordResource){if(x){let e=g.getMeta("currentFilterByTk");e?g.setFilterByTk(e):g.isNewRecord=!0}let l=i(a?await a(C):await g.save(C,t.requestConfig));return x?(g.isNewRecord=!1,null==(d=v.resetUserModifiedFields)||d.call(v),await g.refresh(),l=l??(null==(u=g.getData)?void 0:u.call(g))):(v.form.resetFields(),v.emitter.emit("onFieldReset"),null==(c=v.resetUserModifiedFields)||c.call(v),null==(m=v.formValueRuntime)||null==(p=m.resetAfterFormReset)||p.call(m),e.view.inputArgs.collectionName===v.collection.name&&e.view.inputArgs.onChange&&e.view.inputArgs.onChange(l)),l}if(g instanceof n.MultiRecordResource){let l=g.getMeta("currentFilterByTk");if(!l)return void e.message.error(e.t("No filterByTk found for multi-record resource."));let n=a?await a(C,l):await g.update(l,C,t.requestConfig);return null==(h=v.resetUserModifiedFields)||h.call(v),i(n)??(null==(f=v.getCurrentRecord)?void 0:f.call(v))}}},18357(e,t,l){"use strict";l.d(t,{D9:()=>v,go:()=>g,xT:()=>y});var n=l(40098),o=l.n(n),r=l(12197);function i(e,t){var l,n;let o=null==e||null==(n=e.context)||null==(l=n.blockModel)?void 0:l.uid,r=null==t?void 0:t.uid;return!!o&&!!r&&String(o)===String(r)}function a(e){var t,l;let n=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(n)&&n.length)return n;try{let t=null==e||null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init"),n=null==t?void 0:t.fieldPath;if("string"==typeof n&&n)return n}catch{}let o=null==e?void 0:e.fieldPath;if("string"==typeof o&&o)return o;let r="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,i=null==r?void 0:r.name;return"string"==typeof i&&i||Array.isArray(i)&&i.length?i:null}function s(e){return Array.isArray(e)&&e.length&&"string"==typeof e[0]?e:null}function d(e){var t;let l=a(e);return l?s((0,r.IJ)(l,null==e||null==(t=e.context)?void 0:t.fieldIndex)):null}function u(e,t){if(e&&"object"==typeof e&&Array.isArray(t)&&!(t.length<2))for(let l=t.length-1;l>=1;l--){let n=t.slice(0,l);if("number"==typeof n[n.length-1])continue;let r=o().get(e,n);o().isPlainObject(r)&&0===Object.keys(r).length&&o().unset(e,n)}}function c(e,t){(null==e?void 0:e.forEachModel)&&e.forEachModel(e=>{t(e);let l=null==e?void 0:e.forks;l&&"function"==typeof l.forEach&&l.forEach(e=>{e&&!e.disposed&&t(e)})})}function p(e){let t=null==e?void 0:e.flowEngine;if(!(null==t?void 0:t.forEachModel))return[];let l=[],n=new Set;return c(t,t=>{if(!t||"object"!=typeof t||!t.hidden||!i(t,e))return;let o=d(t);if(!o)return;let r=JSON.stringify(o);n.has(r)||(n.add(r),l.push(o))}),l}function m(e){return"string"==typeof e?e?[e]:null:Array.isArray(e)?s(e):null}function h(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length>t.length)return!1;for(let l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}function f(e){let t=null==e?void 0:e.form;if(!t||"function"!=typeof t.getFieldsError)return null;let l=t.getFieldsError();if(!Array.isArray(l))return null;let n=[],o=new Set;for(let e of l){let t=m(null==e?void 0:e.name);if(!t)continue;let l=JSON.stringify(t);o.has(l)||(o.add(l),n.push(t))}if(!n.length)return null;let r=p(e);return r.length?n.filter(e=>!r.some(t=>h(t,e))):n}function g(e){var t,l;return(null==e||null==(l=e.getStepParams)||null==(t=l.call(e,"submitSettings","skipRequiredValidation"))?void 0:t.skipValidator)===!0}async function v(e){let{form:t,blockModel:l,flowSettingsEnabled:n,skipValidator:o}=e;if(o||!t||"function"!=typeof t.validateFields)return;let r=n&&l?f(l):null;if(Array.isArray(r)){r.length&&await t.validateFields(r);return}await t.validateFields()}function y(e,t){if(!e||"object"!=typeof e)return e;let l=p(t);if(!l.length)return e;let n=o().cloneDeep(e);for(let e of l)o().unset(n,e),u(n,e);return n}},29676(e,t,l){"use strict";l.d(t,{F:()=>o});var n=l(13939);function o(e,t){let l=(t,l,n)=>{var o,r,i;return!l||(null==e||null==(i=e.app)||null==(r=i.jsonLogic)||null==(o=r.apply)?void 0:o.call(r,{[l]:[t,n]}))};try{return(0,n.evaluateConditions)((0,n.removeInvalidFilterItems)(t),l)}catch{return!1}}},47632(e,t,l){"use strict";l.d(t,{Dd:()=>d,G:()=>c,Wp:()=>p,x3:()=>u});var n=l(95243),o=l(11869),r=l(40098),i=l.n(r),a=l(12197);function s(e){return!!e&&"object"==typeof e&&(Array.isArray(e)||i().isPlainObject(e))}function d(e,t){if(t)for(let l of(0,a.ef)(e))t.deps.add(`fv:${l}`)}function u(e){let{valuesMirror:t,collector:l,basePath:o,getFormValuesSnapshot:r,getFormValueAtPath:a}=e,c=()=>o.length?i().get(t,o):t,p=c(),m=p&&("object"==typeof p||"function"==typeof p)?p:Array.isArray(p)?[]:{},h=e=>u({valuesMirror:t,basePath:e,collector:l,getFormValuesSnapshot:r,getFormValueAtPath:a});return new Proxy(m,{get(e,u){if("toJSON"===u)return(l&&(l.wildcard=!0),0===o.length)?()=>r():()=>(0,n.toJS)(c());if("symbol"==typeof u){l&&(l.wildcard=!0);let e=c();return null==e?void 0:e[u]}let p=c();if(null==p)return;if("__raw"===u)return p;if("__proto__"===u||"prototype"===u||"constructor"===u){l&&(l.wildcard=!0);return}let m=Array.isArray(p),f=m&&("number"==typeof u&&Number.isInteger(u)||"string"==typeof u&&/^\d+$/.test(u));if(m&&!f){l&&(l.wildcard=!0);let e=p[u];return"function"==typeof e?e.bind(p):e}let g=[...o,f?Number(u):u];d(g,l);let v=p[u];if(void 0===v){let e=a(g);i().isEqual(e,v)||(i().set(t,g,e),v=e)}return null==v||"object"!=typeof v?v:s(v)?h(g):v},ownKeys(){l&&(l.wildcard=!0);let e=c();return e?Reflect.ownKeys(e):[]},getOwnPropertyDescriptor(e,t){let l=c();if(l)return Object.getOwnPropertyDescriptor(l,t)},has(e,t){let l=c();return!!l&&t in l}})}function c(e,t){try{let l=(0,o.extractUsedVariablePaths)(e)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}function p(e,t){if((0,o.isRunJSValue)(e))try{let l=(0,o.extractUsedVariablePathsFromRunJS)(e.code)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}},12197(e,t,l){"use strict";function n(e){let t=[],l=0,n=e.length,o=()=>{let o=l;for(;l<n&&"."!==e[l]&&"["!==e[l];)l++;let r=e.slice(o,l);r&&t.push(r)};for(;l<n;){let r=e[l];if("."===r){l++;continue}if("["===r){let o=++l;for(;l<n&&"]"!==e[l];)l++;let r=e.slice(o,l);l++,/^\d+$/.test(r)?t.push(Number(r)):r&&t.push({placeholder:r});continue}o()}return t}function o(e){let t=Array.isArray(e)?e:[],l=[];for(let e of t){if("string"!=typeof e)continue;let[t,n]=e.split(":"),o=Number(n);!t||Number.isNaN(o)||l.push({name:t,index:o})}return l}function r(e,t){let l=Array.isArray(e)?[...e]:n(e),r=o(t),i=[],a=0;for(let e=0;e<l.length;e++){let t=l[e];if("object"==typeof t&&t&&"placeholder"in t){let e=i[i.length-1],t="string"==typeof e?e:void 0;if(!t)return null;for(;a<r.length&&r[a].name!==t;)a++;if(a>=r.length)return null;i.push(r[a].index),a++;continue}if(i.push(t),"string"==typeof t&&a<r.length&&r[a].name===t){let t=l[e+1];"number"==typeof t?a++:"object"==typeof t&&t&&"placeholder"in t||(i.push(r[a].index),a++)}}return i}function i(e){let t="";for(let l of e){if("number"==typeof l){t+=`[${l}]`;continue}t?t+=`.${l}`:t=l}return t}function a(e){return n(e).filter(e=>"object"!=typeof e)}function s(e){let t=[],l=[];for(let n of e)l.push(n),t.push(i(l));return t}l.d(t,{EA:()=>n,IJ:()=>r,Qc:()=>i,c1:()=>a,ef:()=>s})},65421(e,t,l){"use strict";l.d(t,{Po:()=>i,ao:()=>a,li:()=>r});var n=l(40098),o=l.n(n);let r=20;function i(e){return null==e||("string"==typeof e||Array.isArray(e)?0===e.length:!!o().isPlainObject(e)&&0===Object.keys(e).length)}function a(){return`${Date.now()}-${Math.random().toString(16).slice(2)}`}},50314(e,t,l){"use strict";l.d(t,{Co:()=>f,PP:()=>i,S2:()=>h,TE:()=>m,li:()=>d,u4:()=>p});var n=l(40098),o=l.n(n);function r(){return{logic:"$and",items:[]}}function i(e,t,l){var n;let o=null==e||null==(n=e.getStepParams)?void 0:n.call(e,t,l);return!!o&&Object.prototype.hasOwnProperty.call(o,"value")}function a(e){if(!e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(t&&void 0!==t.initialValue)return t.initialValue}function s(e,t){var l,n;if(e)return null==(n=e.getStepParams)||null==(l=n.call(e,t,"initialValue"))?void 0:l.defaultValue}function d(e){return t=>{if(!t)return;let l=a(t);if(void 0!==l)return l;for(let l of e){let e=s(t,l);if(void 0!==e)return e}}}function u(e,t,l){var n,r,i;if(!(null==e||null==(n=e.stepParams)?void 0:n[t]))return;let a=e.stepParams[t];!a||"object"!=typeof a||Object.prototype.hasOwnProperty.call(a,l)&&(delete a[l],o().isEmpty(a)&&delete e.stepParams[t],null==(i=e.emitter)||null==(r=i.emit)||r.call(i,"onStepParamsChanged"))}function c(e){var t,l;if(!e)return;null==(t=e.setProps)||t.call(e,{initialValue:void 0}),e.props&&Object.prototype.hasOwnProperty.call(e.props,"initialValue")&&delete e.props.initialValue;let n=null==(l=e._options)?void 0:l.props;n&&Object.prototype.hasOwnProperty.call(n,"initialValue")&&delete n.initialValue}function p(e){return t=>{if(t)for(let l of(c(t),e))u(t,l,"initialValue")}}function m(e,t){var l,n,o,i,a;let s=null==e||null==(o=e.subModels)||null==(n=o.grid)||null==(l=n.subModels)?void 0:l.items,d=Array.isArray(s)?s:[],u=[];for(let e of d){let l=(null==e||null==(a=e.getStepParams)||null==(i=a.call(e,"fieldSettings","init"))?void 0:i.fieldPath)||(null==e?void 0:e.fieldPath),n=l?String(l):"";if(!n)continue;let o=t(e);void 0!==o&&u.push({key:`legacy-default:${n}`,enable:!0,targetPath:n,mode:"default",condition:r(),value:o})}return u}function h(e,t){let l=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[];if(!n.length)return l;let o=new Set;for(let e of l){if(!e||"object"!=typeof e)continue;let t=e.targetPath?String(e.targetPath):"";if(t){if("default"===e.mode){o.add(t);continue}String(e.key??"").startsWith("legacy-default:")&&o.add(t)}}let r=new Set(l.map(e=>String(e.key??""))),i=[];for(let e of n){let t=e.targetPath?String(e.targetPath):"";if(!t||o.has(t))continue;let l={...e},n=String(l.key??"");n&&r.has(n)&&(l.key=`${n}:${t}`),i.push(l)}return i.length?[...l,...i]:l}function f(e,t,l){var n,o,r;let i=null==e||null==(r=e.subModels)||null==(o=r.grid)||null==(n=o.subModels)?void 0:n.items,a=Array.isArray(i)?i:[],s=[];for(let e of a)void 0!==t(e)&&(l(e),s.push(e));return s}},26866(e,t,l){"use strict";l.d(t,{$4:()=>a,r5:()=>i});var n=l(41893);let o="__index__";function r(e,t){if(!t)return null;if(Array.isArray(t)){let l=t.map(t=>null==e?void 0:e[t]);return l.some(e=>null==e)?null:l.map(e=>String(e)).join("__")}let l=null==e?void 0:e[t];return null==l?null:String(l)}function i(e,t){let l=null==e?void 0:e[o];if((null==e?void 0:e.__is_new__)&&null!=l&&""!==l)return`tmp:${String(l)}`;let n=r(e,t);return null!=n?`pk:${n}`:null!=l&&""!==l?`tmp:${String(l)}`:null}function a(e){if(!e.length)return e;let t=!1,l=e.map(e=>{let l=null==e?void 0:e[o];return e.__is_new__&&(null==l||""===l)?(t=!0,{...e,[o]:(0,n.uid)()}):e});return t?l:e}},69586(e,t,l){"use strict";l.d(t,{m:()=>p});var n=l(74848),o=l(11869),r=l(95725),i=l(96540),a=l(44329),s=l(81486),d=l(16860);function u(e){let{value:t,onChange:l,onCompositionStart:o,onCompositionEnd:a,...s}=e,[d,u]=(0,i.useState)(()=>c(t));(0,i.useEffect)(()=>{u(c(t))},[t]);let p=e=>e.currentTarget.value;return(0,n.jsx)(r.A,{...s,value:d,onChange:e=>{u(p(e)),null==l||l(e)},onCompositionStart:e=>{u(p(e)),null==o||o(e)},onCompositionEnd:e=>{u(p(e)),null==a||a(e)}})}function c(e){return"bigint"==typeof e?String(e):null==e?"":e}class p extends s.o{render(){if(this.props.enableScan)return(0,n.jsx)(d.E,{...this.props});let{enableScan:e,disableManualInput:t,...l}=this.props;return(0,n.jsx)(u,{...l})}}p.registerFlow({key:"defaultValueForNanoid",steps:{generateNanoid:{handler(e,t){var l,n;null==(n=e.blockModel)||null==(l=n.emitter)||l.on("onFieldReset",()=>{if("nanoid"===e.collectionField.interface&&!1!==e.collectionField.options.autoFill){let{size:t,customAlphabet:l}=e.collectionField.options||{size:21};e.model.props.onChange((0,a.d_)(l,t)())}})}}}}),p.registerFlow({key:"scanInputSettings",sort:800,title:(0,o.tExpr)("Scan input settings"),steps:{enableScan:{title:(0,o.tExpr)("Enable Scan"),uiMode:{type:"switch",key:"enableScan"},hideInSettings:e=>"readPretty"===e.model.getProps().pattern||e.model.getProps().disabled,defaultParams:e=>({enableScan:!!e.model.props.enableScan}),handler(e,t){e.model.setProps({enableScan:!!t.enableScan,disableManualInput:!!t.enableScan&&e.model.props.disableManualInput})}},disableManualInput:{title:(0,o.tExpr)("Disable manual input"),uiMode:{type:"switch",key:"disableManualInput"},hideInSettings(e){var t,l;let n=null==(t=(l=e.model).getStepParams)?void 0:t.call(l,"scanInputSettings","enableScan");return!(Object.prototype.hasOwnProperty.call(n||{},"enableScan")?!!(null==n?void 0:n.enableScan):!!e.model.props.enableScan)||"readPretty"===e.model.getProps().pattern||!!e.model.getProps().disabled},defaultParams:e=>({disableManualInput:!!e.model.props.disableManualInput}),handler(e,t){e.model.setProps({disableManualInput:!!e.model.props.enableScan&&!!t.disableManualInput})}}}}),p.define({label:(0,o.tExpr)("Input")}),o.EditableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid"],{isDefault:!0}),o.FilterableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid","textarea","markdown","vditor","richText","password","color"],{isDefault:!0})},95267(e,t,l){"use strict";l.d(t,{o:()=>n,e:()=>s});class n{subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async load(){return this.data&&!this.error?this.data:(this.pending||(this.loading=!0,this.notify(),this.pending=this.apiClient.request({url:"systemSettings:get"}).then(e=>(this.data=e.data,this.error=void 0,this.data)).catch(e=>{throw this.error=e,e}).finally(()=>{this.loading=!1,this.pending=void 0,this.notify()})),this.pending)}async refresh(){return this.pending=void 0,this.data=void 0,this.load()}setData(e){this.data=e,this.error=void 0,this.loading=!1,this.notify()}setError(e){this.error=e,this.loading=!1,this.notify()}notify(){for(let e of this.listeners)e()}constructor(e){this.apiClient=e,this.loading=!1,this.listeners=new Set}}var o=l(11869),r=l(2077),i=l(84256),a=l(96540);let s=()=>{var e,t;let l=(0,r.nm)().systemSettings,n=(0,o.useFlowEngine)({throwError:!1}),[,s]=(0,a.useState)(0),d=null==(t=l.data)||null==(e=t.data)?void 0:e.enabledLanguages,u=(0,a.useMemo)(()=>(Array.isArray(d)?d:[]).filter(e=>i.A[e]).map(e=>({label:i.A[e].label,value:e})),[d]);return(0,a.useEffect)(()=>(l.load(),l.subscribe(()=>{s(e=>e+1)})),[l]),(0,a.useEffect)(()=>{n&&n.context.defineProperty("locale",{get:e=>{var t,l,n;return(null==(l=e.api)||null==(t=l.auth)?void 0:t.locale)||(null==(n=e.i18n)?void 0:n.language)},cache:!1,meta:{type:"string",title:'{{t("Current language")}}',sort:970,interface:"select",uiSchema:{enum:u,"x-component":"Select"}}})},[n,u]),{loading:l.loading,data:l.data,error:l.error,refresh:()=>l.refresh(),mutate:e=>{Object.prototype.hasOwnProperty.call(e||{},"data")&&l.setData(null==e?void 0:e.data),Object.prototype.hasOwnProperty.call(e||{},"error")&&l.setError(null==e?void 0:e.error)}}}},94130(e,t,l){"use strict";l.d(t,{F3:()=>a,GX:()=>s,b1:()=>d});let n={view:"get"},o=e=>e?n[e]||e:null,r=(e,t)=>{for(let l of t){if(!(l in e))continue;let t=e[l];if(null==t)return null;return(Array.isArray(t)?t:[t]).map(e=>o(e)).filter(Boolean)}},i=(e,t)=>{let l=o(t);if(!l||!(null==e?void 0:e.options))return!0;let{availableActions:n,unavailableActions:r}=e.options;return Array.isArray(n)?n.includes(l):!Array.isArray(r)||!r.includes(l)},a=(e,t)=>null==t||!t.length||t.every(t=>i(e,t)),s=e=>{var t;let l=r(e,["capabilityActionNames","capabilityActionName"]);if(void 0!==l)return l;let n=null==e||null==(t=e.prototype)?void 0:t.getAclActionName;if("function"!=typeof n)return null;try{let e=n.call({}),t=o(e);return t?[t]:null}catch{return null}},d=e=>r(e,["blockCapabilityActionNames","blockCapabilityActionName"])??null},42632(e,t,l){"use strict";function n(e){let{blockLabel:t,dsName:l,dsCount:n,collectionTitle:o,sourceCollectionTitle:r,associationTitle:i}=e,a=n>1&&!!l,s=o;if(r&&i){let e=`${r} > ${i} (${o})`;s=`${a?`${l} > `:""}${e}`}else s=`${a?`${l} > `:""}${o}`;return`
|
|
3144
3144
|
${t}:
|
|
3145
3145
|
${s}`}l.d(t,{l:()=>n})},84759(e,t,l){"use strict";l.d(t,{SM:()=>s,M6:()=>p,Xi:()=>r,hH:()=>m,NY:()=>c,hO:()=>h,lr:()=>n.l,HZ:()=>d});var n=l(42632),o=l(11869);async function r(e,t,l,n,r){let i=(null==r?void 0:r.includeSelf)??!0,a=(null==r?void 0:r.includeForks)??!0,s=new Set,d=[e],u=[],c=e=>{e&&"function"==typeof e.dispatchEvent&&u.push(e.dispatchEvent(t,l,n))};for(;d.length;){let t=d.pop();if(!t||s.has(t))continue;if(s.add(t),i||t!==e){var p;c(t),a&&(null==(p=t.forks)?void 0:p.size)&&t.forks.forEach(e=>{null!=e&&e.disposed||c(e)})}let l=t.subModels;if(l)for(let e of Object.values(l))if(Array.isArray(e))for(let t of e)t instanceof o.FlowModel&&d.push(t);else e instanceof o.FlowModel&&d.push(e)}await Promise.all(u)}var i=l(22803),a=l(96540);let s=e=>{let t=e.dataLength||0,l=e.pageSize||10,n=e.current||1;return t<l||!e.hasNext?l*n:l*n+1},d=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,i.css)`
|
|
3146
3146
|
.ant-pagination-simple-pager {
|
|
@@ -3211,7 +3211,7 @@ ${o}`,c)}}let n=T(e.issues.filter(e=>"runtime"===e.type)),o=n?`Key runtime issue
|
|
|
3211
3211
|
throw e;
|
|
3212
3212
|
}
|
|
3213
3213
|
})()`,o=new Compartment(this.globals);try{let e=o.evaluate(l),t=new Promise((e,t)=>setTimeout(()=>t(Error("Execution timed out")),this.timeoutMs)),n=await Promise.race([e,t]);return{success:!0,value:n}}catch(o){if(o instanceof n.sy||o instanceof n.zz)throw o;let t=i(e),l=a(o,t)&&t?s(o,t):o;return console.error(l),{success:!1,error:l,timeout:(null==l?void 0:l.message)==="Execution timed out"}}}constructor(e={}){var t,l;const n=e=>{if("u">typeof window&&"function"==typeof window[e])return window[e].bind(window);let t=globalThis[e];return"function"==typeof t?t.bind(globalThis):t},o=e.globals||{},r={};if(!Object.prototype.hasOwnProperty.call(o,"Blob"))try{const e=null==(t=o.window)?void 0:t.Blob;void 0!==e&&(r.Blob=e)}catch{}if(!Object.prototype.hasOwnProperty.call(o,"URL"))try{const e=null==(l=o.window)?void 0:l.URL;void 0!==e&&(r.URL=e)}catch{}this.globals={console,setTimeout:n("setTimeout"),clearTimeout:n("clearTimeout"),setInterval:n("setInterval"),clearInterval:n("clearInterval"),...r,...o},this.timeoutMs=e.timeoutMs??5e3}}},47451(e,t,l){"use strict";l.d(t,{_:()=>r});var n=l(48910),o=l(16639);function r(e){let t=new n.$;Object.defineProperty(t,o.i6,{value:"view",configurable:!0}),e.modelRepository&&t.setModelRepository(e.modelRepository),t.context.addDelegate(e.context);let l=t.unlinkFromStack.bind(t);t.unlinkFromStack=function(){var e;return null==(e=t.disposeScheduler)||e.call(t),l()};let r=new Set(["_modelInstances","_applyFlowCache","executor","context",o.i6,"previousEngine","nextEngine","emitter","_modelOperationScheduler","getScheduler","scheduleModelOperation","disposeScheduler","unlinkFromStack","linkAfter","_previousEngine","_nextEngine","getModel","_destroyView","setDestroyView","destroyView"]),i={get(t,l,n){if(r.has(l))return Reflect.get(t,l,n);let o=Reflect.get(e,l,n);return"registerModels"===l&&"function"==typeof o?o.bind(e):o},set:(t,l,n)=>r.has(l)?Reflect.set(t,l,n):Reflect.set(e,l,n),has:(t,l)=>l in t||l in e};return t.linkAfter(e),new Proxy(t,i)}},64171(e,t,l){"use strict";l.d(t,{Z:()=>n});class n{onActionRegistered(){}registerActions(e){for(let[,t]of Object.entries(e||{}))this.registerAction(t)}registerAction(e){if(!(null==e?void 0:e.name))throw Error("Action must have a name.");this.actions.has(e.name)&&console.warn(`Action '${e.name}' is already registered. It will be overwritten.`),this.actions.set(e.name,e),this.onActionRegistered()}constructor(){this.actions=new Map}}},31102(e,t,l){"use strict";l.d(t,{FC:()=>a,eI:()=>u,jP:()=>s});var n=l(74848),o=l(96540),r=l(42443),i=l(89013);let a={paddingBottom:0},s={marginBottom:12},d=["colon","dependencies","extra","getValueFromEvent","getValueProps","hasFeedback","help","htmlFor","initialValue","label","labelAlign","labelCol","messageVariables","name","normalize","noStyle","preserve","rules","tooltip","trigger","validateStatus","validateTrigger","valuePropName","wrapperCol","labelWidth","labelWrap","layout","required","showLabel"],u=e=>{let{children:t,showLabel:l=!0,labelWidth:u,...c}=e,p=Object.fromEntries(Object.entries(c).filter(e=>{let[t]=e;return!d.includes(t)})),m="function"==typeof t?t:o.Children.map(t,e=>o.isValidElement(e)?o.cloneElement(e,{...p}):e),{label:h,labelWrap:f,colon:g=!0,layout:v}=c,y=!v||"vertical"===v||f,x="vertical"===v?{width:u,...a}:{width:u},b=()=>l?y?(0,n.jsxs)("div",{style:{width:"100%",whiteSpace:"normal",wordBreak:"break-word",display:"flex",alignItems:"center",justifyContent:"flex-start",fontWeight:600},children:[(0,n.jsx)("span",{style:{flex:1},children:h}),g&&(0,n.jsx)("span",{style:{marginLeft:4,flexShrink:0},children:":"})]}):(0,n.jsx)(r.A,{title:h,children:(0,n.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",maxWidth:("number"==typeof u?u:120)-20,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"middle",fontWeight:600},children:[(0,n.jsx)("span",{style:{flexShrink:1,overflow:"hidden",textOverflow:"ellipsis"},children:h}),g&&(0,n.jsx)("span",{style:{marginLeft:4,flexShrink:0},children:":"})]})}):null;return(0,n.jsx)(i.A.Item,{...c,style:{...s,...c.style},labelCol:{style:x},layout:v,label:b(),colon:!1,extra:c.extra&&(0,n.jsx)("span",{style:{whiteSpace:"pre-wrap"},children:c.extra}),tooltip:c.tooltip&&{title:c.tooltip,overlayInnerStyle:{whiteSpace:"pre-line"}},children:m})}},61793(e,t,l){"use strict";let n,o;l.d(t,{D:()=>S});var r=l(74848),i=l(4888),a=l(96540),s=l(42524),d=l(41893),u=l(35710);let c=(e,t)=>{let{getPrefixCls:l}=(0,a.useContext)(i.Ay.ConfigContext)||{};if("ConfigContext"in i.Ay)return(null==l?void 0:l(e,null==t?void 0:t.prefixCls))||"";{let l=(null==t?void 0:t.prefixCls)??"ant-";return`${l}${e??""}`}},{ConfigContext:p}=i.Ay,m=()=>(0,a.useContext)(p),h=u.A.useToken,f=(e,t)=>{let{fontFamily:l,fontSize:n}=e,o=`[class^="${t}"], [class*=" ${t}"]`;return{[o]:{fontFamily:l,fontSize:n,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[o]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}},g=(n="nb-mobile-action-drawer",o=e=>{let{componentCls:t}=e;return{[t]:{".nb-mobile-action-drawer-header":{height:"var(--nb-mobile-page-header-height)",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${e.colorSplit}`,position:"sticky",top:0,backgroundColor:e.colorBgContainer,zIndex:1e3,"& + .nb-grid-container > .nb-grid > .nb-grid-warp > .ant-btn":{margin:12}},".nb-mobile-action-drawer-placeholder":{display:"inline-block",padding:12,flex:"0 0 auto",visibility:"hidden"},".nb-mobile-action-drawer-title":{flex:"1 1 auto",minWidth:0,overflow:"hidden",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap"},".nb-mobile-action-drawer-close-icon":{display:"inline-block",padding:12,flex:"0 0 auto",cursor:"pointer"},".nb-mobile-action-drawer-body":{borderTopLeftRadius:8,borderTopRightRadius:8,maxHeight:"calc(100% - var(--nb-mobile-page-header-height))",overflowY:"auto",overflowX:"hidden",backgroundColor:e.colorBgLayout,"& > .nb-grid-container":{padding:`${e.paddingPageVertical}px ${e.paddingPageHorizontal}px`},".ant-tabs-nav":{marginBottom:"0px !important",padding:`0 ${e.paddingPageHorizontal+e.borderRadiusBlock/2}px`,backgroundColor:e.colorBgContainer},"& > .nb-grid-container > .nb-grid > .nb-grid-warp > .nb-grid-row:nth-last-child(2) .noco-card-item":{marginBottom:0,"& > .ant-card":{marginBottom:"0 !important"}}},".nb-mobile-action-drawer-footer":{padding:"8px var(--nb-mobile-page-tabs-content-padding)",display:"flex",alignItems:"center",justifyContent:"flex-end",position:"sticky",bottom:0,left:0,right:0,zIndex:1e3,borderTop:`1px solid ${e.colorSplit}`,backgroundColor:e.colorBgLayout,".ant-btn":{marginLeft:8}}}}},e=>{let{theme:t,token:l,hashId:r}=h(),{getPrefixCls:i,iconPrefixCls:u}=m(),p=c(n),g=i(),v=(0,s.useStyleRegister)({theme:t,token:l,hashId:r,path:["formily-antd",n,p,u]},()=>{let t=`.${p}`,n=o((0,d.merge)(l,{componentCls:t,prefixCls:p,iconCls:`.${u}`,antCls:`.${g}`}),e,{hashId:r,prefixCls:p,rootPrefixCls:g,iconPrefixCls:u});return[f(l,p),n]});return{wrapSSR:(0,a.useMemo)(()=>v,[v]),hashId:r,componentCls:p,rootPrefixCls:g}});var v=l(18492),y=l(22505);let{Popup:x}=(0,y.R)(()=>Promise.resolve().then(l.bind(l,33022)),"Popup"),{CloseOutline:b}=(0,y.R)(()=>l.e("9200").then(l.bind(l,38370)),"CloseOutline"),w=()=>{var e,t;return"u">typeof CSS&&(null==(e=(t=CSS).supports)?void 0:e.call(t,"height","100dvh"))?"calc(100dvh - var(--nb-mobile-page-header-height, 46px))":"calc(100vh - var(--nb-mobile-page-header-height, 46px))"},S=e=>{var t;let{title:l,visible:n,onClose:o,children:s,minHeight:d,className:u,footer:c}=e,{t:p}=(0,v.B)(),{componentCls:m,hashId:h}=g(),f=null==(t=e.styles)?void 0:t.body,y=w(),S=(0,a.useMemo)(()=>({minHeight:(null==f?void 0:f.minHeight)??d,height:null==f?void 0:f.height,maxHeight:(null==f?void 0:f.maxHeight)??y}),[null==f?void 0:f.height,null==f?void 0:f.maxHeight,null==f?void 0:f.minHeight,y,d]),C=(0,a.useMemo)(()=>({padding:0,maxHeight:y,overflowY:"auto",overflowX:"hidden",...f}),[f,y]),F=(0,a.useCallback)(e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),o())},[o]),k=(0,a.useMemo)(()=>({token:{paddingPageHorizontal:8,paddingPageVertical:8,marginBlock:12,borderRadiusBlock:8,fontSize:14}}),[]);return(0,r.jsx)(i.Ay,{theme:k,children:(0,r.jsxs)(x,{className:`${m} ${h} ${u||""}`,visible:n,onClose:o,onMaskClick:o,bodyClassName:"nb-mobile-action-drawer-body",bodyStyle:C,style:S,destroyOnClose:!0,children:[(0,r.jsxs)("div",{className:"nb-mobile-action-drawer-header",children:[(0,r.jsx)("span",{className:"nb-mobile-action-drawer-placeholder",children:(0,r.jsx)(b,{})}),(0,r.jsx)("span",{className:"nb-mobile-action-drawer-title",children:l}),(0,r.jsx)("span",{className:"nb-mobile-action-drawer-close-icon",onClick:o,role:"button",tabIndex:0,"aria-label":p("Close"),onKeyDown:F,children:(0,r.jsx)(b,{})})]}),s,c&&(0,r.jsx)("div",{className:"nb-mobile-action-drawer-footer",children:c})]})})}},96332(e,t,l){"use strict";l.d(t,{openRequiredParamsStepFormDialog:()=>h});var n=l(74848),o=l(18220),r=l(95243),i=l(87959),a=l(71021),s=l(96540),d=l(29007),u=l(16296),c=l(60182);let p=(0,o.createSchemaField)(),m=e=>{let{model:t,requiredSteps:l,formStep:o,children:r}=e,i=l[(null==o?void 0:o.current)??0],a=s.useMemo(()=>{let{flowKey:e,step:l}=i,n=t.getFlow(e),o=new d.W5(t,e,"settings");return(0,c.wx)(o,(null==n?void 0:n.steps)||{},t,e),o.defineProperty("currentStep",{value:l}),o},[t,i]);return(0,n.jsx)(u.u,{value:a,children:r})},h=async e=>{let{model:t,dialogWidth:s=800,dialogTitle:h}=e,f=(0,c.lW)(t);if(h||f("Step parameter configuration"),!t)throw i.Ay.error(f("Invalid model provided")),Error(f("Invalid model provided"));return new Promise((e,i)=>{(async()=>{try{var g,v,y;let i=t.getFlows(),x=[];for(let[e,l]of i)for(let n in l.steps){let o=l.steps[n];if(o.paramsRequired||o.preset){let r=await (0,c.o7)(t,l,o);if(r){t.getStepParams(e,n);let i=!1;console.log(`Flow: ${e}, Step: ${n}, hasAllRequiredParams:`,i),i||x.push({flowKey:e,stepKey:n,step:o,uiSchema:r,title:o.title||n,flowTitle:l.title||e})}}}if(console.log("Required steps:",x),0===x.length)return void e({});let b={};for(let{flowKey:e,stepKey:l,step:n}of x){let o=t.getStepParams(e,l)||{},i={};n.use&&(i=(null==(y=t.flowEngine)||null==(v=y.getAction)?void 0:v.call(y,n.use)).defaultParams||{});let a=new d.W5(t,e,"settings"),s=t.getFlow(e);s&&(0,c.wx)(a,s.steps,t,e),a.defineProperty("currentStep",{value:n});let u=await (0,c.gG)(i,a),p=await (0,c.gG)(n.defaultParams,a),m={...(0,r.toJS)(u),...(0,r.toJS)(p),...(0,r.toJS)(o)};Object.keys(m).length>0&&(b[e]||(b[e]={}),b[e][l]=m)}let w={};x.forEach(e=>{let{flowKey:t,stepKey:l,uiSchema:n,title:o,flowTitle:r}=e;w[`${t}_${l}`]={type:"void","x-component":"FormStep.StepPane","x-component-props":{title:`${o}`,description:`Flow: ${r}`},properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{layout:"vertical"},properties:{[t]:{type:"object",properties:{[l]:{type:"object",properties:n}}}}}}}});let S=1===x.length?{type:"object",properties:{...Object.values(w)[0].properties}}:{type:"object",properties:{step:{type:"void","x-component":"FormStep","x-component-props":{formStep:"{{formStep}}"},properties:w}}},{FormDialog:C,FormStep:F}=await Promise.resolve().then(l.bind(l,20419)),k=x.length>1?F.createFormStep(0):null,A=t.flowEngine,P={formStep:k,totalSteps:x.length,requiredSteps:x,useFlowSettingsContext:u.s,...null==(g=A.flowSettings)?void 0:g.scopes},j=C({title:h||f("Step parameter configuration"),width:s,footer:null,destroyOnClose:!0},l=>{var r;let i=async()=>{try{await l.submit();let n=l.values;x.forEach(e=>{var l;let{flowKey:o,stepKey:r}=e,i=null==(l=n[o])?void 0:l[r];i&&t.setStepParams(o,r,i)}),await t.saveStepParams(),e(n),j.close()}catch(e){console.error(f("Error submitting form"),":",e)}},s=()=>{j.close(),e({})},d={...P,closeDialog:s,handleNext:()=>{l.validate().then(()=>{k&&k.next()}).catch(e=>{console.log(f("Form validation failed"),":",e)})}},u=(0,c.ln)(d,S);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(m,{model:t,requiredSteps:x,formStep:k,children:(0,n.jsx)(p,{schema:u,components:{FormStep:F,...null==(r=A.flowSettings)?void 0:r.components},scope:d})}),(0,n.jsx)(o.FormConsumer,{children:()=>(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:24,paddingTop:16,borderTop:"1px solid #f0f0f0"},children:1===x.length?(0,n.jsx)(a.Ay,{type:"primary",onClick:i,children:f("Complete configuration")}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.Ay,{disabled:!(null==k?void 0:k.allowBack),onClick:()=>{k&&k.back()},children:f("Previous step")}),(0,n.jsx)(a.Ay,{disabled:!(null==k?void 0:k.allowNext),type:"primary",onClick:()=>{l.validate().then(()=>{k&&k.next()}).catch(e=>{console.log(f("Form validation failed"),":",e)})},style:{display:((null==k?void 0:k.current)??0)<x.length-1?"inline-block":"none"},children:f("Next step")}),(0,n.jsx)(a.Ay,{disabled:null==k?void 0:k.allowNext,type:"primary",onClick:i,style:{display:((null==k?void 0:k.current)??0)>=x.length-1?"inline-block":"none"},children:f("Complete configuration")})]})})})]})});j.open({initialValues:(0,c.ln)(P,b)})}catch(e){i(Error(`${f("Failed to import FormDialog or FormStep")}: ${e.message}`))}})()}).catch(e=>{console.error(e)})}},23183(e,t,l){"use strict";l.d(t,{openStepSettingsDialog:()=>f});var n=l(74848),o=l(67838),r=l(18220),i=l(95243),a=l(84626),s=l(71021),d=l(96540),u=l(16296),c=l(60182),p=l(31108),m=l(52847);let h=(0,r.createSchemaField)(),f=async e=>{var t,l,f,g,v,y,x,b;let{model:w,flowKey:S,stepKey:C,dialogWidth:F=600,dialogTitle:k,mode:A="dialog",ctx:P,uiModeProps:j,cleanup:M}=e,I=(0,c.lW)(w),T=w.context.message;if(!w)throw T.error(I("Invalid model provided")),Error(I("Invalid model provided"));let R=w.getFlow(S),E=null==R||null==(t=R.steps)?void 0:t[C];if(!R)throw T.error(I("Flow with key {{flowKey}} not found",{flowKey:S})),Error(I("Flow with key {{flowKey}} not found",{flowKey:S}));if(!E)throw T.error(I("Step with key {{stepKey}} not found",{stepKey:C})),Error(I("Step with key {{stepKey}} not found",{stepKey:C}));let N=E.title,D=E.beforeParamsSave,B=E.afterParamsSave,$={};if(E.use){let e=null==(b=w.flowEngine)||null==(x=b.getAction)?void 0:x.call(b,E.use);e&&($=e.defaultParams||{},N=N||e.title,D=D||e.beforeParamsSave,B=B||e.afterParamsSave)}let O=w.getFlow(S),q=await (0,c.o7)(w,O,E);if(!q)return T.info(I("This step has no configurable parameters")),{};let L=P;L.currentStep&&L.currentStep===E||L.defineProperty("currentStep",{value:E});let _=w.flowEngine,V={useFlowSettingsContext:u.s,...null==(l=_.flowSettings)?void 0:l.scopes},z=w.getStepParams(S,C)||{},K=await (0,c.gG)(E.defaultParams,L),U=await (0,c.gG)($,L),W={...(0,i.toJS)(U),...(0,i.toJS)(K),...(0,i.toJS)(z)},H={...(0,i.toJS)(z)},G={type:"object",properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{layout:"vertical"},properties:q}}},Y=w.context.viewer[A].bind(w.context.viewer),{zIndex:J,...X}=(0,i.toJS)(j)||{},Q=e=>{var t,l;return Math.max("function"==typeof(null==(t=w.context.viewer)?void 0:t.getNextZIndex)?w.context.viewer.getNextZIndex():((null==(l=w.context.themeToken)?void 0:l.zIndexPopupBase)||1e3)+1,Number(e)||0)},Z=Q(J),ee=(0,o.createForm)({initialValues:(0,c.ln)(V,W)}),et=(null==(f=w.context.view)?void 0:f.inputArgs)||{},el=(null==P||null==(g=P.view)?void 0:g.navigation)??(null==(v=w.context.view)?void 0:v.navigation),en={...et,...el?{navigation:el}:{},...(null==(y=(0,i.toJS)(j))?void 0:y.inputArgs)||{},__isSettingsPopup:!0};Y({title:k||I(N),width:F,destroyOnClose:!0,...X,zIndex:Z,inputArgs:en,onClose:()=>{M&&M()},content:e=>{let t=(0,m.PA)(()=>{var t;(0,d.useEffect)(()=>(0,i.autorun)(()=>{let{zIndex:t,...l}=(0,i.toJS)(j)||{};e.update({...l,zIndex:Q(t)})}),[]);let l=(0,c.ln)(V,G);return(0,n.jsx)(r.FormProvider,{form:ee,children:(0,n.jsxs)(u.u,{value:L,children:[(0,n.jsx)(h,{schema:l,components:{...null==(t=_.flowSettings)?void 0:t.components},scope:V}),(0,n.jsx)(e.Footer,{children:(0,n.jsxs)(a.A,{align:"end",children:[(0,n.jsx)(s.Ay,{type:"default",onClick:()=>{e.close()},children:I("Cancel")}),(0,n.jsx)(s.Ay,{type:"primary",onClick:async()=>{try{await ee.submit();let t=ee.values;w.setStepParams(S,C,t),D&&await D(L,t,H),e.close(),await w.saveStepParams(),T.success(I("Configuration saved")),B&&await B(L,t,H)}catch(t){if(t instanceof c.VD)return;if(t instanceof c.sy||t instanceof p.zz)return void e.close();console.error(I("Error saving configuration"),":",t),T.error(I("Error saving configuration, please check console"))}},children:I("OK")})]})})]})})});return(0,n.jsx)(t,{})}})}},41594(e,t,l){"use strict";l.d(t,{Ls:()=>a,Qp:()=>c,jx:()=>p,yG:()=>u,z5:()=>d});var n=l(2543),o=l.n(n),r=l(60182);async function i(e,t){return"function"==typeof e?await e(t):e}async function a(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.meta??{};if(await i(n.hide,t)&&!l)return;let o={key:e.name,label:n.label||e.name,searchable:!!n.searchable,searchPlaceholder:n.searchPlaceholder,toggleable:n.toggleable,useModel:e.name,sort:n.sort||1e3,children:s(e,t)};return o.createModelOptions=n.createModelOptions||{use:e.name},o}function s(e,t){let l,n=e.meta??{};if(!1===n.children)return!1;if(n.children&&(l=n.children),e.defineChildren&&(l=e.defineChildren.bind(e)),"function"==typeof l){let e=l;l=async()=>{let l=await e(t),i=e=>null==e?void 0:e.map(e=>{let l={...e};if(l.children)l.children=Array.isArray(l.children)?i(l.children):l.children;else if(l.createModelOptions){let e=l.createModelOptions;l.createModelOptions=async function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];let s=i&&i.length>0?i[i.length-1]:void 0,d=await (0,r.mv)(null==n?void 0:n.createModelOptions,t,s),u=await (0,r.mv)(e,t,s);return o().merge({},o().cloneDeep(d),u)}}return l});return i(l)}}return l}function d(e){return async t=>{let l=await c([e])(t);if(0===l.length)return[];let n=l.shift().children;return"function"==typeof n?n(t):n}}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return async l=>{var n,o;let s=l.engine.getSubclassesOf(e),d=[];for(let e of Array.from(s.values()))await i(null==(n=e.meta)?void 0:n.hide,l)||d.push(e);if(0===(d=d.filter(e=>{for(let l of t)if("string"==typeof l){if(e.name===l)return!1}else if(e===l||(0,r.FA)(e,l))return!1;return!0}).sort((e,t)=>{var l,n;return((null==(l=e.meta)?void 0:l.sort)??1e3)-((null==(n=t.meta)?void 0:n.sort)??1e3)})).length){let t="string"==typeof e?l.engine.getModelClass(e):e;t&&!await i(null==(o=t.meta)?void 0:o.hide,l)&&(d=[t])}let u=[];for(let e of d){let t=await a(e,l);t&&u.push(t)}return u}}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return async t=>{let l=[],n=[];for(let c of e){var o,r,i,a,d;let e="string"==typeof c?t.engine.getModelClass(c):c;if(!e)continue;let p=s(e,t);p||(p=await u(c,n)(t)),n.push(e);let m=!1;if("function"==typeof p)try{let e=await p(t);m=Array.isArray(e)?e.length>0:!!e}catch(e){m=!1}else m=Array.isArray(p)?p.length>0:!!p;if(!m)continue;let h=(null==e||null==(o=e.meta)?void 0:o.label)||("string"==typeof c?c:e.name),f="string"==typeof c?c:e.name,g=(null==e||null==(r=e.meta)?void 0:r.menuType)||"group",v=(null==e||null==(i=e.meta)?void 0:i.sort)??1e3,y=!!(null==e||null==(a=e.meta)?void 0:a.searchable),x=null==e||null==(d=e.meta)?void 0:d.searchPlaceholder;"submenu"===g?l.push({key:f,label:h,sort:v,searchable:y,searchPlaceholder:x,children:p}):l.push({key:f,type:"group",label:h,sort:v,searchable:y,searchPlaceholder:x,children:p})}return l.sort((e,t)=>((null==e?void 0:e.sort)??1e3)-((null==t?void 0:t.sort)??1e3))}}function p(e,t){let{useModel:l,fieldUseModel:n,associationPathName:o,refreshTargets:r,maxAssociationFieldDepth:i=2}=t,a=t.collection||e.model.collection||e.collection,s=a.getFields(),d=[],u=o?o.split(".").filter(Boolean).length:0;for(let e of s){var c,p;if(!(null==e||null==(c=e.options)?void 0:c.interface)||u>=i&&((null==(p=e.isAssociationField)?void 0:p.call(e))||e.target||e.targetCollection))continue;let t=o?`${o}.${e.name}`:e.name,s="function"==typeof n?n(e):n??"FieldModel";if(s){let n={dataSourceKey:a.dataSourceKey,collectionName:a.name,fieldPath:e.name,associationPathName:o};d.push({key:t,label:e.title,toggleable:e=>{let{associationPathName:l,fieldPath:n}=e.getStepParams("fieldSettings","init")||{};return(l?`${l}.${n}`:n)===t},useModel:l,refreshTargets:r,createModelOptions:()=>({use:l,stepParams:{fieldSettings:{init:n}},subModels:{field:{use:s,stepParams:{fieldSettings:{init:n}}}}})})}}return[{key:`addField_${a.name}`,label:"",type:"group",searchable:!0,searchPlaceholder:e.t("Search fields"),children:d.filter(Boolean)}]}},76546(e,t,l){"use strict";l.d(t,{pM:()=>g,qG:()=>f,qS:()=>h,Ns:()=>s,zA:()=>u,U1:()=>c,JL:()=>v,Xk:()=>y});var n=l(95243),o=l(2543),r=l.n(o),i=l(16075),a=l.n(i);function s(e){var t;let l;switch(e.type){case"string":l=a().string();break;case"number":l=a().number();break;case"array":l=a().array();break;case"boolean":l=a().boolean();break;default:l=a().any()}let n=(e,t)=>{if(!t||0===Object.keys(t).length)return[];if(Array.isArray(t))return t;if("email"===e){var l;let e={...t};return(null==(l=e.tlds)?void 0:l.allow)===!0?e.tlds.allow=!1:e.tlds||(e.tlds={allow:!1}),[e]}if(["length","min","max"].includes(e))return[t.limit];if("pattern"===e){let e=null==t?void 0:t.regex;return e instanceof RegExp?[e]:[new RegExp(e)]}let n=Object.values(t);return n.length?n:[]},o=!1;return null==(t=e.rules)||t.forEach(e=>{let{name:t,args:r}=e;if("required"===t&&(o=!0),"function"==typeof l[t])try{l=l[t](...n(t,r))}catch(e){console.warn(`调用 Joi 方法 ${t} 失败:`,e)}else console.warn(`Joi schema 上不存在方法: ${t}`)}),o||(l=(l=l.optional().allow("")).optional().allow(null)),l}function d(e){let t=[],l=new Set,n=new Set,o=new Map;e.forEach(e=>{o.set(e.name,e)});let r=e=>{if(n.has(e.name))throw Error(`Circular dependency detected: ${e.name} inherits from itself through a chain`);if(!l.has(e.name)){for(let t of(n.add(e.name),e.inherits||[])){let l=o.get(t);if(!l){console.warn(`Warning: Collection ${t}, inherited by ${e.name}, not found.`);continue}r(l)}n.delete(e.name),l.add(e.name),t.push(e)}};for(let t of e)r(t);return t}class u{setFlowEngine(e){this.flowEngine=e}setRequester(e){this.requester=e}setCollectionFieldInterfaceManager(e){this.collectionFieldInterfaceManager=e}addFieldInterfaces(){var e,t;let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];null==(t=this.collectionFieldInterfaceManager)||null==(e=t.addFieldInterfaces)||e.call(t,l)}addFieldInterfaceGroups(e){var t,l;null==(l=this.collectionFieldInterfaceManager)||null==(t=l.addFieldInterfaceGroups)||t.call(l,e)}addFieldInterfaceComponentOption(e,t){var l,n;null==(n=this.collectionFieldInterfaceManager)||null==(l=n.addFieldInterfaceComponentOption)||l.call(n,e,t)}addFieldInterfaceOperator(e,t){var l,n;null==(n=this.collectionFieldInterfaceManager)||null==(l=n.addFieldInterfaceOperator)||l.call(n,e,t)}registerFieldFilterOperator(e){var t,l;null==(l=this.collectionFieldInterfaceManager)||null==(t=l.registerFieldFilterOperator)||t.call(l,e)}registerFieldFilterOperatorGroup(e){var t,l;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];null==(l=this.collectionFieldInterfaceManager)||null==(t=l.registerFieldFilterOperatorGroup)||t.call(l,e,n)}addFieldFilterOperatorsToGroup(e){var t,l;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];null==(l=this.collectionFieldInterfaceManager)||null==(t=l.addFieldFilterOperatorsToGroup)||t.call(l,e,n)}registerLoader(e,t){this.loaders.set(e,t)}removeLoader(e){this.loaders.delete(e)}addDataSource(e){if(this.dataSources.has(e.key))throw Error(`DataSource with name ${e.key} already exists`);e instanceof h||(e=new(e.use||h)(e)),this.dataSources.set(e.key,e),e.setDataSourceManager(this)}upsertDataSource(e){if(this.dataSources.has(e.key)){var t;null==(t=this.dataSources.get(e.key))||t.patchOptions(e)}else this.addDataSource(e)}removeDataSource(e){this.dataSources.delete(e)}clearDataSources(){this.dataSources.clear()}getDataSources(){return Array.from(this.dataSources.values())}getDataSource(e){return this.dataSources.get(e)}getCollection(e,t){let l=this.getDataSource(e);if(l)return l.collectionManager.getCollection(t)}getCollectionField(e){let[t,...l]=e.split("."),n=this.getDataSource(t);if(n)return n.getCollectionField(l.join("."))}async ensureLoaded(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{force:t=!1}=e,l=this.resolveLoadKeys(e.keys),n=t?l:l.filter(e=>!this.loadedKeys.has(e));if(n.length)return this.loadingPromise||(this.loadingPromise=(async()=>{try{for(let e of n)await this.loadKey(e,{initial:!this.loadedKeys.has(e),force:t})}finally{this.loadingPromise=null}})()),this.loadingPromise}async reload(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.resolveLoadKeys(e.keys);if(t.length)return this.loadingPromise||(this.loadingPromise=(async()=>{try{for(let e of t)await this.loadKey(e,{initial:!1,force:!0})}finally{this.loadingPromise=null}})()),this.loadingPromise}async reloadDataSource(e){return this.loadingKeys.has(e)&&this.loadingPromise?this.loadingPromise:!this.loaders.has(e)&&this.loaders.has("*")?this.reload({keys:["*"]}):this.reload({keys:[e]})}resolveLoadKeys(e){let t=(null==e?void 0:e.length)?e:["main"],l=t.filter(e=>this.loaders.has(e));return this.loaders.has("*")?r().uniq(["*",...l]):l.length?l:t}getApp(){var e,t;return null==(t=this.flowEngine)||null==(e=t.context)?void 0:e.app}dispatchDataSourceEvent(e,t){var l,n;null==(n=this.getApp())||null==(l=n.eventBus)||l.dispatchEvent(new CustomEvent(e,{detail:t}))}setDataSourceState(e,t){let l=this.getDataSource(e);l&&l.patchOptions(t)}applyDataSourceLoadResult(e,t){if("*"===e)return void((null==t?void 0:t.dataSources)||[]).forEach(e=>{let{collections:t,...l}=e;if(this.upsertDataSource(l),t){var n;null==(n=this.getDataSource(l.key))||n.setCollections(t,{clearFields:!0})}});let l=this.getDataSource(e);l&&l.setCollections((null==t?void 0:t.collections)||[],{clearFields:!0})}async loadKey(e,t){let l=this.loaders.get(e);if(!l)return;this.getDataSource(e)||"*"===e||this.addDataSource({key:e});let{initial:n}=t;this.loadingKeys.add(e),"*"!==e&&this.setDataSourceState(e,{status:n?"loading":"reloading",errorMessage:void 0}),this.loadErrors.set(e,null);try{let t=await l({key:e,manager:this})||{};this.applyDataSourceLoadResult(e,t),this.loadedKeys.add(e),"*"!==e&&this.setDataSourceState(e,{status:"loaded",errorMessage:void 0}),this.dispatchDataSourceEvent("dataSource:loaded",{dataSourceKey:e,initial:n})}catch(l){let t=l instanceof Error?l:Error(String(l));throw this.loadErrors.set(e,t),"*"!==e&&this.setDataSourceState(e,{status:n?"loading-failed":"reloading-failed",errorMessage:t.message}),this.dispatchDataSourceEvent("dataSource:loadFailed",{dataSourceKey:e,initial:n,error:t}),t}finally{this.loadingKeys.delete(e)}}constructor(){this.loaders=new Map,this.loadedKeys=new Set,this.loadingKeys=new Set,this.loadErrors=new Map,this.loadingPromise=null,this.dataSources=n.observable.shallow(new Map)}}function c(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(e)for(let t of l){let l=null==t?void 0:t.collectionFieldInterfaceManager,n=null==l?void 0:l.getFieldInterface;if("function"==typeof n)return n.call(l,e)}}function p(e){return"string"==typeof e&&/\{\{\s*t\s*\(/.test(e)}function m(e,t,l){return p(t)?e.translate(t,l):t}class h{get flowEngine(){return this.dataSourceManager.flowEngine}get displayName(){return this.flowEngine.translate(this.options.displayName,{ns:"lm-collections"})||this.key}get key(){return this.options.key}get name(){return this.options.key}get status(){return this.options.status}get errorMessage(){return this.options.errorMessage}setDataSourceManager(e){this.dataSourceManager=e}getCollections(){return this.collectionManager.getCollections()}getCollection(e){return this.collectionManager.getCollection(e)}getAssocation(e){return this.getAssociation(e)}getAssociation(e){return this.collectionManager.getAssociation(e)}addCollection(e){return this.collectionManager.addCollection(e)}updateCollection(e){return this.collectionManager.updateCollection(e)}upsertCollection(e){return this.collectionManager.upsertCollection(e)}upsertCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.collectionManager.upsertCollections(e,t)}setCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.collectionManager.setCollections(e,t)}removeCollection(e){return this.collectionManager.removeCollection(e)}clearCollections(){this.collectionManager.clearCollections()}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(this.options).forEach(e=>delete this.options[e]),Object.assign(this.options,e)}patchOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this.options,e)}reload(){return this.dataSourceManager.reloadDataSource(this.key)}getCollectionField(e){let[t,...l]=e.split("."),n=l.join("."),o=this.getCollection(t);if(!o)return;let r=o.getFieldByPath(n);if(r)return r}constructor(e={}){this.options=(0,n.observable)({...e}),this.collectionManager=new f(this)}}class f{resetCaches(){this.childrenCollectionsName={},this.allCollectionsInheritChain=void 0}get flowEngine(){return this.dataSource.flowEngine}addCollection(e){let t;(t=e instanceof g?e:new g(e)).setDataSource(this.dataSource),t.initInherits(),this.collections.set(t.name,t),this.resetCaches()}removeCollection(e){this.collections.delete(e),this.resetCaches()}updateCollection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=this.getCollection(e.name);if(!l)throw Error(`Collection ${e.name} not found`);l.setOptions(e,t),this.resetCaches()}upsertCollection(e){return this.collections.has(e.name)?this.updateCollection(e):this.addCollection(e),this.getCollection(e.name)}upsertCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(let l of d(e))this.collections.has(l.name)?this.updateCollection(l,t):this.addCollection(l);this.resetCaches()}setCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.clearCollections(),this.upsertCollections(e,t)}sortCollectionsByInherits(e){let t=new Map;for(let l of e)t.set(l.name,l);let l={},n={};for(let t of e)l[t.name]=new Set,n[t.name]=0;for(let t of e)for(let e of t.inherits||[])l[e]||(l[e]=new Set),l[e].add(t.name),n[t.name]=(n[t.name]||0)+1;let o=[];for(let e in n)0===n[e]&&o.push(e);let r=[];for(;o.length;){let e=o.shift();for(let i of(t.has(e)&&r.push(t.get(e)),l[e]||[]))n[i]--,0===n[i]&&o.push(i)}if(r.length!==e.length)throw Error("Collection inherits has circular dependency!");return r}getCollection(e){if(e.includes(".")){let[t,l]=e.split("."),n=this.getCollection(t);if(!n)throw Error(`Collection ${t} not found in data source ${this.dataSource.key}`);let o=n.getField(l);if(!o)throw Error(`Field ${l} not found in collection ${t}`);return o.targetCollection}return this.collections.get(e)}getCollections(){return r().sortBy(Array.from(this.collections.values()).filter(e=>!e.hidden),"sort")}clearCollections(){this.collections.clear(),this.resetCaches()}getAssociation(e){let[t,l]=e.split("."),n=this.getCollection(t);if(!n)throw Error(`Collection ${t} not found in data source ${this.dataSource.key}`);return n.getField(l)}getChildrenCollections(e){let t=[],l=Array.from(this.collections.values()),n=e=>(l.filter(t=>{var l;return null==(l=t.options.inherits)?void 0:l.includes(e)}).forEach(e=>{let l=e.name;return t.push(e),n(l)}),t);return n(e)}getChildrenCollectionsName(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=t?"supportView":"notSupportView";if(this.childrenCollectionsName[l])return this.childrenCollectionsName[l].slice();let n=[],o=[...this.getCollections()],i=e=>(o.filter(t=>{var l;return l=[...t.inherits],l.includes(e)}).forEach(e=>{let t=e.name;return n.push(t),i(t)}),t&&o.filter(t=>{var l;return l=[...t.sources],l.length===1&&(null==t?void 0:t.sources[0])===e}).forEach(e=>{let t=e.name;return n.push(e.name),i(t)}),r().uniq(n));return this.childrenCollectionsName[l]=i(e),this.childrenCollectionsName[l]}getAllCollectionsInheritChain(e){if(this.allCollectionsInheritChain)return this.allCollectionsInheritChain.slice();let t=[e],l=e=>{let n=this.getCollection(e);if(n){let{inherits:o}=n,r=this.getChildrenCollectionsName(e);if(o)for(let e=0;e<o.length;e++){let n=o[e];t.includes(n)||(t.push(n),l(n))}if(r)for(let e=0;e<r.length;e++){let n=this.getCollection(r[e]).name;t.includes(n)||(t.push(n),l(n))}}return t};return this.allCollectionsInheritChain=l(e),this.allCollectionsInheritChain||[]}constructor(e){this.dataSource=e,this.childrenCollectionsName={},this.collections=n.observable.shallow(new Map)}}class g{clone(){let e=new g(r().cloneDeep(this.options));return e.setDataSource(this.dataSource),e}getFilterByTK(e){if(!e)throw Error("Record is required to get filterByTk");if(Array.isArray(e))return e.map(e=>this.getFilterByTK(e));if(!this.filterTargetKey)throw Error(`filterTargetKey is not defined for collection ${this.name}`);return"string"==typeof this.filterTargetKey?e[this.filterTargetKey]:Array.isArray(this.filterTargetKey)&&1===this.filterTargetKey.length?e[this.filterTargetKey[0]]:r().pick(e,this.filterTargetKey)}get titleableFields(){return this.getFields().filter(e=>e.titleable)}get hidden(){return this.options.hidden||!1}get flowEngine(){return this.dataSource.flowEngine}get collectionManager(){return this.dataSource.collectionManager}get sort(){return this.options.sort||0}get filterTargetKey(){return this.options.filterTargetKey}get dataSourceKey(){return this.dataSource.key}get name(){return this.options.name}get template(){return this.options.template}get storage(){return this.options.storage||"local"}get title(){return this.flowEngine.translate(this.options.title,{ns:"lm-collections"})||this.name}get titleCollectionField(){let e=this.options.titleField||this.filterTargetKey;if(Array.isArray(e)){if(1!==e.length)return;return this.getField(e[0])}return this.getField(e)}initInherits(){for(let e of(this.inherits.clear(),this.options.inherits||[])){let t=this.collectionManager.getCollection(e);if(!t){console.warn(`Warning: Collection ${e} not found for collection ${this.name}`);continue}this.inherits.set(e,t)}}setDataSource(e){this.dataSource=e}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(this.options).forEach(e=>delete this.options[e]),Object.assign(this.options,e),this.initInherits(),t.clearFields&&this.clearFields(),this.upsertFields(this.options.fields||[])}setOption(e,t){this.options[e]=t}getFields(){let e=new Map;for(let t of this.inherits.values())if(t&&"function"==typeof t.getFields)for(let l of t.getFields())e.set(l.name,l);for(let[t,l]of this.fields.entries())e.set(t,l);return Array.from(e.values())}getToOneAssociationFields(){return this.getAssociationFields(["one"])}getAssociationFields(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.includes("new")?this.getFields().filter(e=>["hasMany","belongsToMany","belongsToArray"].includes(e.type)):e.includes("many")&&e.includes("one")?this.getFields().filter(e=>e.isAssociationField()):e.includes("many")?this.getFields().filter(e=>["hasMany","belongsToMany","belongsToArray"].includes(e.type)):e.includes("one")?this.getFields().filter(e=>["hasOne","belongsTo"].includes(e.type)):this.getFields().filter(e=>e.isAssociationField())}mapFields(e){return this.getFields().map(e)}setFields(e){for(let t of(this.fields.clear(),e))this.addField(t)}upsertFields(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(let t of e)this.fields.has(t.name)?this.fields.get(t.name).setOptions(t):this.addField(t)}getFieldByPath(e){let[t,...l]=e.split("."),n=this.getField(t);return 0===l.length?n:(null==n?void 0:n.targetCollection)?n.targetCollection.getFieldByPath(l.join(".")):null}getField(e){return this.fields.get(e)}getFullFieldPath(e){return this.dataSource.key+"."+this.name+"."+e}addField(e){if(e.name&&this.fields.has(e.name))throw Error(`Field with name ${e.name} already exists in collection ${this.name}`);if(e instanceof v)e.setCollection(this),this.fields.set(e.name,e);else{let t=new v(e);t.setCollection(this),this.fields.set(t.name,t)}}removeField(e){return this.fields.delete(e)}clearFields(){return this.fields.clear()}refresh(){}getRelationshipFields(){let e=["o2o","oho","obo","m2o","createdBy","updatedBy","o2m","m2m","linkTo","chinaRegion","mbm"];return this.getFields().filter(t=>e.includes(t.interface))}getRelatedCollections(){let e=this.getRelationshipFields(),t=[],l=new Set;for(let n of e)if(n.target&&!l.has(n.target)){let e=this.collectionManager.getCollection(n.target);e&&e.name!==this.name&&(t.push(e),l.add(n.target))}return t}hasRelationshipFields(){return this.getRelationshipFields().length>0}constructor(e={}){this.options=(0,n.observable)({...e}),this.fields=n.observable.shallow(new Map),this.inherits=n.observable.shallow(new Map),this.setFields(e.fields||[])}}class v{setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(this.options).forEach(e=>delete this.options[e]),Object.assign(this.options,e)}setCollection(e){this.collection=e}get targetCollectionTitleFieldName(){var e,t;return null==(t=this.targetCollection)||null==(e=t.titleCollectionField)?void 0:e.name}get targetCollectionTitleField(){var e;return null==(e=this.targetCollection)?void 0:e.titleCollectionField}get flowEngine(){return this.collection.flowEngine}get dataSourceKey(){var e;return null==(e=this.collection)?void 0:e.dataSourceKey}get resourceName(){return`${this.collection.name}.${this.name}`}get collectionName(){var e;return(null==(e=this.collection)?void 0:e.name)||this.options.collectionName}get readonly(){var e;return this.options.readonly||(null==(e=this.options.uiSchema)?void 0:e["x-read-pretty"])||!1}get titleable(){return!!(this.options.titleable??this.options.titleUsable)}get fullpath(){return this.collection.dataSource.key+"."+this.collection.name+"."+this.name}get name(){return this.options.name}get type(){return this.options.type}get dataType(){return this.options.dataType}get foreignKey(){return this.options.foreignKey}get targetKey(){return this.options.targetKey||this.targetCollection.filterTargetKey}get sourceKey(){return this.options.sourceKey}get target(){return this.options.target}get title(){var e,t,l;let n=(null==(t=this.options)||null==(e=t.uiSchema)?void 0:e.title)||(null==(l=this.options)?void 0:l.title);return this.flowEngine.translate(n,{ns:"lm-collections"})||this.options.name}set title(e){this.options.title=e}get enum(){var e;let t=(null==(e=this.options.uiSchema)?void 0:e.enum)||[];return"integer"===this.type?t.map(e=>"object"!=typeof e||null===e.value||void 0===e.value?e:{...e,label:m(this.flowEngine,e.label,{ns:"lm-collections"}),value:Number(e.value)}):t.map(e=>({...e,label:m(this.flowEngine,e.label,{ns:"lm-collections"})}))}get defaultValue(){return null==this.options.defaultValue?void 0:this.options.defaultValue}get interface(){return this.options.interface}get filterable(){var e;return this.options.filterable||(null==(e=this.getInterfaceOptions())?void 0:e.filterable)}get inputable(){return this.options.inputable}get uiSchema(){return this.options.uiSchema||{}}get targetCollection(){var e;return this.options.target&&(null==(e=this.collection)?void 0:e.collectionManager.getCollection(this.options.target))}get validation(){return this.options.validation}getComponentProps(){var e,t;let{type:l,target:n}=this.options,o=r().omitBy({...r().omit((null==(e=this.options.uiSchema)?void 0:e["x-component-props"])||{},"fieldNames"),options:this.enum.length?this.enum:void 0,mode:"multipleSelect"===this.interface?"multiple":void 0,multiple:n?["belongsToMany","hasMany","belongsToArray"].includes(l):void 0,maxCount:n&&!["belongsToMany","hasMany","belongsToArray"].includes(l)?1:void 0,target:n,template:null==(t=this.targetCollection)?void 0:t.template},r().isUndefined);if(this.validation){let e=[],t=s(this.validation),l=this.title;e.push({validator:(e,n)=>{let{error:o}=t.validate(n,{context:{label:l},abortEarly:!1});return o?Promise.reject(o.details.map(e=>{let t=this.flowEngine.translate(e.type,{...e.context,ns:"data-source-main",label:l});return t&&t!==e.type?t:e.message.replace(/"value"/g,`"${l}"`)}).join(", ")):Promise.resolve()}}),o.rules=e}return o}getFields(){if(!this.options.target)return[];if(!this.targetCollection)throw Error(`Target collection ${this.options.target} not found for field ${this.name}`);return this.targetCollection.getFields()}getInterfaceOptions(){var e,t,l;let n=this.flowEngine.context;return c(this.interface,null==(t=this.collection)||null==(e=t.dataSource)?void 0:e.dataSourceManager,n.dataSourceManager,null==(l=n.app)?void 0:l.dataSourceManager)}getFilterOperators(){var e;let t=this.getInterfaceOptions();return(null==t||null==(e=t.filterable)?void 0:e.operators)||[]}getSubclassesOf(e){return this.flowEngine.getSubclassesOf(e,(e,t)=>y(e.supportedFieldInterfaces,this.interface))}getFirstSubclassNameOf(e){for(let[t,l]of this.getSubclassesOf(e))if("*"!==l.supportedFieldInterfaces)return t}isAssociationField(){return["belongsToMany","belongsTo","hasMany","hasOne","belongsToArray"].includes(this.type)}isRelationshipField(){return["o2o","oho","obo","m2o","createdBy","updatedBy","o2m","m2m","linkTo","chinaRegion","mbm"].includes(this.interface)}constructor(e){this.options=(0,n.observable)({...e})}}function y(e,t){return!!e&&("*"===e||("string"==typeof e?e===t:!!Array.isArray(e)&&(e.includes("*")||e.includes(t))))}},48036(e,t,l){"use strict";l.d(t,{v:()=>n});class n{setPaused(e){this.paused=e}on(e,t){var l,n;((l=this.events)[n=e]||(l[n]=[])).push(t)}off(e,t){this.events[e]=(this.events[e]||[]).filter(e=>e!==t)}emit(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];this.paused||(this.events[e]||[]).forEach(e=>e(...l))}async emitAsync(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(!this.paused)for(let t of(this.events[e]||[]).slice())await t(...l)}constructor(){this.events={},this.paused=!1}}},26955(e,t,l){"use strict";l.d(t,{L:()=>n});class n{onEventRegistered(){}registerEvents(e){for(let[,t]of Object.entries(e||{}))this.registerEvent(t)}registerEvent(e){if(!(null==e?void 0:e.name))throw Error("Event must have a name.");this.events.has(e.name)&&console.warn(`Event '${e.name}' is already registered. It will be overwritten.`),this.events.set(e.name,e),this.onEventRegistered()}constructor(){this.events=new Map}}},84471(e,t,l){"use strict";l.d(t,{j:()=>r});var n=l(68161),o=l(95243);class r{addFlows(e){for(let[t,l]of Object.entries(e||{}))this.addFlow(t,l)}addFlow(e,t){let l=new n.G({...t,key:e},this);return this.flows.set(e,l),l}hasFlow(e){return!!this.flows.get(e)}getFlow(e){return this.flows.get(e)}getFlows(){return this.flows}removeFlow(e){this.flows.delete(e)}mapFlows(e){return[...this.getFlows().values()].map(t=>e(t))}moveStep(e,t,l){let n=this.getFlow(e);if(!n)throw Error(`Flow '${e}' not found`);n.moveStep(t,l)}constructor(){this.flows=o.observable.shallow(new Map)}}},98837(e,t,l){"use strict";l.d(t,{r:()=>r});var n=l(33954),o=l(84471);class r extends o.j{removeFlow(e){console.warn(`GlobalFlowRegistry.removeFlow: removing static flow '${e}' is not supported.`)}getFlow(e){if(this.flows.has(e))return this.flows.get(e);let t=Object.getPrototypeOf(this.target);if(t!==Function.prototype&&t!==Object.prototype&&(null==t?void 0:t.globalFlowRegistry))return t.globalFlowRegistry.getFlow(e)}getFlows(){let e=new Map(this.flows),t=Object.getPrototypeOf(this.target);if(t!==Function.prototype&&t!==Object.prototype&&(null==t?void 0:t.globalFlowRegistry))for(let[l,n]of t.globalFlowRegistry.getFlows().entries())e.has(l)||e.set(l,n);let l=e=>{let t=0,l=e;for(;l&&l!==n.WD&&l!==Function.prototype&&l!==Object.prototype;)l=Object.getPrototypeOf(l),t+=1;return t};return new Map(Array.from(e.entries()).sort((e,t)=>{let[,n]=e,[,o]=t,r=n.sort??0,i=o.sort??0;if(r!==i)return r-i;let a=n.flowRegistry,s=o.flowRegistry,d=l(a.target),u=l(s.target);return d!==u?d-u:0}))}saveFlow(e){}destroyFlow(e){}constructor(e){super(),this.target=e}}r._type="global"},96321(e,t,l){"use strict";l.d(t,{R:()=>o});var n=l(84471);class o extends n.j{async save(){await this.model.saveStepParams()}async saveFlow(e){await this.model.saveStepParams()}async destroyFlow(e){this.removeFlow(e),await this.model.saveStepParams()}async moveStep(e,t,l){super.moveStep(e,t,l),await this.model.saveStepParams()}constructor(e){super(),this.model=e}}o._type="instance"},29007(e,t,l){"use strict";l.d(t,{W5:()=>eR,uk:()=>eY,Hl:()=>eT,o0:()=>eM,d6:()=>eI,cB:()=>ef,Bt:()=>eK});var n=l(58587),o=l(18150),r=l(68238),i=l(88243),a=l(16213),s=l(95243),d=l(88909),u=l(25782),c=l(2543),p=l.n(c),m=l(55373),h=l.n(m),f=l(96540),g=l(5338),v=l.t(g,2),y=l(63128);class x{setData(e){this.data=p().cloneDeep(e)}setMeta(e){this.meta=p().cloneDeep(e)}async load(){var e,t,l,n;let o=(null==(n=this.flowEngine)||null==(l=n.context)||null==(t=l.api)||null==(e=t.auth)?void 0:e.token)||"";this.loaded&&this.lastToken!==o&&(this.loaded=!1,this.loadingPromise=null,this.data={},this.meta={});let{data:r}=await this.flowEngine.context.api.request({url:"roles:check"});this.data=(null==r?void 0:r.data)||{},this.meta=(null==r?void 0:r.meta)||{},this.loaded=!0,this.lastToken=o,await this.loadingPromise}getActionAlias(e){var t;return(null==(t=this.data.actionAlias)?void 0:t[e])||e}inResources(e,t){var l,n,o;let{dataSources:r}=(null==(l=this)?void 0:l.meta)||{};return null==(o=({...this.data,...(0,c.omit)(null==r?void 0:r[t],"snippets")}).resources)||null==(n=o.includes)?void 0:n.call(o,e)}getResourceActionParams(e,t,l){var n,o,r;let i=this.getActionAlias(t),{dataSources:a}=(null==(n=this)?void 0:n.meta)||{},s={...this.data,...(0,c.omit)(null==a?void 0:a[l],"snippets")};return(null==(o=s.actions)?void 0:o[`${e}:${i}`])||(null==(r=s.actions)?void 0:r[t])}getStrategyActionParams(e,t){var l,n,o;let r=this.getActionAlias(e),{dataSources:i}=(null==(l=this)?void 0:l.meta)||{},a={...this.data,...(0,c.omit)(null==i?void 0:i[t],"snippets")};return(null==a||null==(o=a.strategy)||null==(n=o.actions)?void 0:n.find(e=>{let[t]=e.split(":");return t===r}))?{}:null}parseAction(e){var t;let{resourceName:l,actionName:n,dataSourceKey:o="main",recordPkValue:r,allowedActions:i}=e,a=(null==l?void 0:l.includes("."))&&(null==(t=this.flowEngine.context.dataSourceManager.getDataSource(o).collectionManager.getAssociation(l))?void 0:t.target);return this.getIgnoreScope(e)||this.verifyScope(n,r,i)?this.inResources(a,o)?this.getResourceActionParams(a,n,o):this.inResources(l,o)?this.getResourceActionParams(l,n,o):this.getStrategyActionParams(n,o):null}parseField(e){let{fields:t}=e,l=this.parseAction(e),n=[].concat((null==l?void 0:l.whitelist)||[]).concat((null==l?void 0:l.fields)||[]).concat((null==l?void 0:l.appends)||[]);return!!l&&!Object.keys(l).length||n.includes(t[0])}can(e){var t;let{allowAll:l}=this.data;if(l)return!0;let{actionName:n,allowedActions:o,recordPkValue:r}=e,i=null!=r,a=i&&o?this.verifyScope(n,r,o):null;if(i&&o&&!0!==a)return!1;let s=this.parseAction(e);if(!s||!p().isEmpty(s.filter)&&!0!==a)return!1;if(!(null==(t=e.fields)?void 0:t.length))return!0;let d=[].concat(s.whitelist||[]).concat(s.fields||[]).concat(s.appends||[]);return!d.length||e.fields.every(e=>d.includes(e))}async aclCheck(e){let{allowAll:t}=this.data;return!!t||(e.fields?this.parseField(e):this.parseAction(e))}constructor(e){this.flowEngine=e,this.data={},this.meta={},this.loaded=!1,this.loadingPromise=null,this.lastToken=null,this.getIgnoreScope=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{recordPkValue:t,allowedActions:l,actionName:n}=e,o=!1;return e.ignoreScope&&(o=!0),"create"===n&&(o=!0),t&&l||(o=!0),o},this.verifyScope=(e,t,l)=>{let n=this.getActionAlias(e),o=null==l?void 0:l[n];return Array.isArray(o)?o.map(e=>String(e)).includes(String(t)):null}}}class b{toString(){return`{{${this.path.join(".")}}}`}valueOf(){return this.toString()}[Symbol.toPrimitive](){return this.toString()}static create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["ctx"];return new Proxy(new b(e),{get(t,l,n){if("symbol"==typeof l)return;if(l in t){let e=t[l];return"function"==typeof e?e.bind(t):e}let o=[...e,l.toString()];return b.create(o)}})}constructor(e){this.path=e}}var w=l(76546),S=l(48910);class C{translate(e,t){return!e||"string"!=typeof e||(null==t?void 0:t.compareWith)&&e===t.compareWith?e:this.isTemplate(e)?this.compileTemplate(e):this.translateKey(e,t)}translateKey(e,t){var l,n;if(null==(n=this.context)||null==(l=n.i18n)?void 0:l.t){let l=this.context.i18n.t(e,t);return null==l||""===l?e:l}return e}isTemplate(e){return/\{\{\s*t\s*\(\s*["'`].*?["'`]\s*(?:,\s*.*?)?\s*\)\s*\}\}/g.test(e)}compileTemplate(e){return e.replace(/\{\{\s*t\s*\(\s*["'`](.*?)["'`]\s*(?:,\s*((?:[^{}]|\{[^}]*\})*?))?\s*\)\s*\}\}/g,(e,t,l)=>{try{let n={};if(l&&(l=l.trim()).startsWith("{")&&l.endsWith("}"))try{n=Function("$root",`with($root) { return (${l}); }`)({})}catch(t){return e}return this.translateKey(t,n)}catch(t){return console.warn(`FlowEngine: Failed to compile template "${e}":`,t),e}})}constructor(e){this.context=e}}var F=l(91013),k=l(27667),A=l(60182),P=l(31108),j=l(81982),M=l(22928),I=l(9297),T=l(73398),R=l(37966),E=l(62572),N=l(74353),D=l.n(N),B=l(98192),$=l(47684),O=l(51143);function q(e){try{if(!e||"object"!=typeof e&&"function"!=typeof e)return[];return Object.getOwnPropertyNames(e)}catch(e){return[]}}function L(e,t){if(!e.length)return[];if(!t.length)return[...e];let l=new Set(t),n=[];for(let t of e)l.has(t)||n.push(t);return n}async function _(e){let t,l=globalThis;l.__nocobaseRunjsModuleLoadLock=(l.__nocobaseRunjsModuleLoadLock||Promise.resolve()).catch(()=>{});let n=l.__nocobaseRunjsModuleLoadLock,o=new Promise(e=>{t=e});l.__nocobaseRunjsModuleLoadLock=n.then(()=>o),await n;try{return await e()}finally{null==t||t()}}function V(){let e=globalThis,t=null==e?void 0:e.define,l=null==t?void 0:t.amd;if(!t||!l)return()=>{};let n=Object.getOwnPropertyDescriptor(t,"amd"),o=!!n,r=l;try{(null==n?void 0:n.writable)?t.amd=void 0:(null==n?void 0:n.configurable)?delete t.amd:t.amd=void 0}catch(e){}return()=>{try{if(o&&n)return void Object.defineProperty(t,"amd",n);t.amd=r}catch(e){}}}function z(){var e,t;let l=globalThis,n=null==l||null==(e=l.requirejs)?void 0:e.requirejs,o=null==n||null==(t=n.s)?void 0:t.contexts;if(!o||"object"!=typeof o)return!1;for(let e of Object.keys(o)){let t=o[e],l=null==t?void 0:t.registry;if(l&&"object"==typeof l)for(let e of Object.keys(l)){let t=l[e];if(!t||"object"!=typeof t||!t.enabled||t.error)continue;let n=t.map;if(n&&"object"==typeof n&&!t.inited&&t.fetched&&n.isDefine)return!0}}return!1}async function K(e){let t=Math.max(0,(null==e?void 0:e.timeoutMs)??1500),l=Math.max(10,(null==e?void 0:e.pollMs)??30);if(0===t)return;let n=Date.now();for(;z();){if(Date.now()-n>=t)return;await new Promise(e=>setTimeout(e,l))}}async function U(e,t){let l="string"==typeof e?e.trim():"";if(!l)return;let n=globalThis;n.__nocobaseImportAsyncPrefetchCache=n.__nocobaseImportAsyncPrefetchCache||new Map;let o=n.__nocobaseImportAsyncPrefetchCache;if(o.has(l))return await o.get(l);let r=Math.max(0,(null==t?void 0:t.timeoutMs)??5e3),i=(async()=>{try{var e,t,n;if("u">typeof document&&(null==(e=document)?void 0:e.createElement)){let e=new URL(l,(null==(n=globalThis)||null==(t=n.location)?void 0:t.href)||void 0).toString(),o=document.head||document.getElementsByTagName("head")[0];if(o){let t=`link[rel="modulepreload"][href="${e}"]`;if(!document.querySelector(t)){let t=document.createElement("link");return t.rel="modulepreload",t.href=e,t.crossOrigin="anonymous",await new Promise(e=>{let l=!1,n=()=>{l||(l=!0,t.onload=null,t.onerror=null,e())},i=r>0?setTimeout(()=>{n()},r):void 0;t.onload=()=>{i&&clearTimeout(i),n()},t.onerror=()=>{i&&clearTimeout(i),n()},o.appendChild(t)})}}}}catch(e){}try{if("function"!=typeof fetch)return;let e="function"==typeof AbortController?new AbortController:void 0,t=e&&r>0?setTimeout(()=>{try{e.abort()}catch(e){}},r):void 0,n=await fetch(l,{method:"GET",mode:"cors",credentials:"omit",cache:"force-cache",signal:null==e?void 0:e.signal});if(t&&clearTimeout(t),n&&n.ok&&"function"==typeof n.arrayBuffer)try{await n.arrayBuffer()}catch(e){}}catch(e){}})().catch(()=>{});return o.set(l,i),await i}async function W(e,t){return await _(async()=>{let l,n,o="u">typeof window?q(window):[],r="u">typeof document?q(document):[];try{l=await new Promise((l,n)=>{e?e([t],function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];l(t[0])},n):n(Error("requirejs is not available"))})}catch(e){n=e}finally{let e="u">typeof window?q(window):[],t="u">typeof document?q(document):[],l=L(e,o),n=L(t,r);(0,O.Vm)(l),(0,O.yz)(n)}if(n)throw n;return l})}async function H(e){var t,l;if(!e||"string"!=typeof e)throw Error("invalid url");let n=e.trim(),o=!!(null==(l=globalThis)||null==(t=l.define)?void 0:t.amd);return o&&await U(n),await _(async()=>{await K();let e=o?V():()=>{};try{let e=()=>import(n),t=()=>(0,eval)("u => import(u)")(n);try{return await e()}catch(e){try{return await t()}catch(t){throw t||e}}}finally{e()}})}function G(e){let t=e.indexOf("?"),l=e.indexOf("#"),n=t>=0&&l>=0?Math.min(t,l):t>=0?t:l;return n>=0?e.slice(0,n):e}function Y(e){if(!e||"string"!=typeof e)return null;let t=G(e).trim();if(!t||t.startsWith("http://")||t.startsWith("https://"))return null;let l=t.replace(/^\//,"");if(!l)return null;if(l.startsWith("@")){let e=l.match(/^(@[^/]+\/[^/]+?)(?:@([^/]+))?(?:\/(.*))?$/);return e?{name:e[1],version:e[2],subpath:e[3]}:null}let n=l.match(/^([^/]+?)(?:@([^/]+))?(?:\/(.*))?$/);return n?{name:n[1],version:n[2],subpath:n[3]}:null}function J(e,t){if(!e||"string"!=typeof e)return e;let l=e.trim(),n=l.indexOf("#"),o=n>=0?l.slice(0,n):l,r=n>=0?l.slice(n):"",i=o.indexOf("?"),a=i>=0?o.slice(0,i):o,s=new URLSearchParams(i>=0?o.slice(i+1):"");for(let[e,l]of Object.entries(t))e&&(s.has(e)||s.set(e,l));let d=s.toString();return d?`${a}?${d}${r}`:`${a}${r}`}function X(){let e=globalThis;if("string"==typeof(null==e?void 0:e.__esm_cdn_base_url__))return e.__esm_cdn_base_url__;let t="u">typeof window?window:null==e?void 0:e.window;return"string"==typeof(null==t?void 0:t.__esm_cdn_base_url__)?t.__esm_cdn_base_url__:"https://esm.sh"}function Q(e){if(e&&"object"==typeof e&&"default"in e){let t=Object.keys(e);if(1===t.length&&"default"===t[0])return e.default}return e}async function Z(e,t,l){if(!t||"string"!=typeof t)throw Error("invalid url");let n=t,o=Y(t);if((null==o?void 0:o.name)==="antd"&&!o.subpath&&"string"==typeof X()){let t={bundle:"1"},l=null==e?void 0:e.__runjsExternalReact,o=null==l?void 0:l.version;o&&"string"==typeof o&&(t.deps=`react@${o},react-dom@${o}`),n=J(n,t)}let r=(0,$.i)(n,{addSuffix:(null==l?void 0:l.addSuffix)??!0}),i=(null==l?void 0:l.importer)||H,a=globalThis;a.__nocobaseImportAsyncCache=a.__nocobaseImportAsyncCache||new Map;let s=a.__nocobaseImportAsyncCache,d=s.get(r)||(async()=>Q(await i(r)))();s.set(r,d);let u=await d,c=null==e?void 0:e.libs;if(!c||"object"!=typeof c)return u;let p=Y(n);if(!p)return u;let m=p.subpath||"";if("react"!==p.name||m)"react-dom"===p.name&&("client"===m||m.startsWith("client/"))?((0,B.qf)(e,"ReactDOM",u),e.__runjsExternalReactDOM={specifier:t,version:p.version,url:r}):"antd"!==p.name||m?"@ant-design/icons"!==p.name||m||((0,B.qf)(e,"antdIcons",u,{topLevelKey:!1}),e.__runjsExternalAntdIcons={specifier:t,version:p.version,url:r}):((0,B.qf)(e,"antd",u),e.__runjsExternalAntd={specifier:t,version:p.version,url:r});else{(0,B.qf)(e,"React",u),e.__runjsExternalReact={specifier:t,version:p.version,url:r};let l=p.version?`react-dom@${p.version}/client`:"react-dom/client";try{await e.importAsync(l)}catch(n){let e=Error(`External React has been loaded via ctx.importAsync("${t}"), but auto-loading "${l}" failed.
|
|
3214
|
-
Please run: await ctx.importAsync("${l}") to ensure ctx.render uses a matching ReactDOM.`);throw e.cause=n,e}}return u}function ee(e){return e.endsWith("/")?e:`${e}/`}function et(e,t){try{let l=new URL(e);if(!["http:","https:"].includes(l.protocol))return!1;if(!(null==t?void 0:t.getApiUrl))return!0;let n=new URL(t.getApiUrl()),o=ee(n.pathname),r=ee(l.pathname);return l.origin!==n.origin||!r.startsWith(o)}catch{return!1}}function el(e){return!!(e&&"object"==typeof e&&"collection"in e&&"filterByTk"in e)}function en(e,t){if(t&&0!==t.length){if(el(e))return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l={};for(let[n,o]of Object.entries(e))t.some(e=>e===n||e.startsWith(`${n}.`)||e.startsWith(`${n}[`))&&(l[n]=o);return l}}}function eo(e){if(!e)return;let t=String(e).match(/^([^.[]+)/);return null==t?void 0:t[1]}function er(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!Array.isArray(e)||0===e.length)return{generatedAppends:void 0,generatedFields:void 0};let t=new Set,l=new Set,n=e=>{if(!e)return"";let t=String(e);return(t=(t=(t=t.replace(/\[(?:\d+)\]/g,"")).replace(/\[(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)')\]/g,(e,t,l)=>`.${t||l}`)).replace(/\.\.+/g,".")).replace(/^\./,"").replace(/\.$/,"")};for(let o of e){if(!o)continue;for(;/^\[(\d+)\](\.|$)/.test(o);)o=o.replace(/^\[(\d+)\]\.?/,"");let e=n(o);if(!e)continue;let r=e.split(".").filter(Boolean);if(0!==r.length){if(1===r.length){l.add(r[0]);continue}for(let e=0;e<r.length-1;e++)t.add(r.slice(0,e+1).join("."));l.add(r.join("."))}}return{generatedAppends:t.size?Array.from(t):void 0,generatedFields:l.size?Array.from(l):void 0}}var ei=new WeakMap,ea=new WeakSet,es=new WeakSet,ed=new WeakSet,eu=new WeakSet,ec=new WeakSet,ep=new WeakSet,em=new WeakSet,eh=new WeakSet;class ef{createProxy(){return(0,n._)(this,ei)||(0,r._)(this,ei,new Proxy(this,{get:(e,t,l)=>{if("string"==typeof t){if(Reflect.has(e,t)){let n=Reflect.get(e,t,l);return"function"==typeof n?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e._props,t))return e._getOwnProperty(t,this.createProxy());if(Object.prototype.hasOwnProperty.call(e._methods,t))return e._getOwnMethod(t,this.createProxy());let n=this._findInDelegates(e._delegates,t);return void 0!==n?n.result:void 0}return Reflect.get(e,t,l)},has:(e,t)=>!!("string"==typeof t&&(Reflect.has(e,t)||Object.prototype.hasOwnProperty.call(e._props,t)||Object.prototype.hasOwnProperty.call(e._methods,t)||this._hasInDelegates(e._delegates,t)))||Reflect.has(e,t)})),(0,n._)(this,ei)}defineProperty(e,t){var l;if(this._props[e]&&(null==(l=this._props[e])?void 0:l.once))return;let n=this._props[e];(null==n?void 0:n.meta)&&this._clearMetaNodeCacheFor(n.meta),this._props[e]=t,delete this._observableCache[e],delete this._cache[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:()=>this._getOwnProperty(e,this.createProxy())})}defineMethod(e,t,l){this._methods[e]=t,"string"==typeof l?this._methodInfos[e]={description:l}:l&&"object"==typeof l?this._methodInfos[e]=l:delete this._methodInfos[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!1,writable:!1,value:t.bind(this.createProxy())})}removeCache(e){if(e in this._observableCache)return delete this._observableCache[e],!0;if(e in this._cache)return delete this._cache[e],!0;if(e in this._pending)return delete this._pending[e],!0;for(let t of this._delegates)if(t.removeCache(e))return!0}delegate(e){if(!(e instanceof ef))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)?console.warn(`[FlowContext] delegate - skip duplicate delegate: ${this._delegates.length}`):this._delegates.unshift(e)}addDelegate(e){if(!(e instanceof ef))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)||this._delegates.unshift(e)}clearDelegates(){this._delegates=[],this._metaNodeCache=new WeakMap}removeDelegate(e){if(!(e instanceof ef))throw Error("Delegate must be an instance of FlowContext");let t=this._delegates.indexOf(e);-1!==t&&this._delegates.splice(t,1)}_clearMetaNodeCacheFor(e){this._metaNodeCache.delete(e)}has(e){return!!this._props[e]}getPropertyMetaTree(e,t){let l=this._getPropertiesMeta();if(e){let l=(0,A.YB)(e);if(l&&l.length>0){let e=async(e,t,l)=>{try{let l="function"==typeof e?await e():e;if(!(null==l?void 0:l.properties))return[];let n=l.properties;if("function"==typeof n){let e=await n();l.properties=e,n=e}let o=(0,i._)(this,ea,eg).call(this,n,t,[],l);return Array.isArray(o)?o:await o()}catch(e){return console.warn(`Failed to load meta for ${l}:`,e),[]}},n=(0,i._)(this,es,ev).call(this,l);if(n){let[o,r,a]=n;if(1===l.length){if("function"==typeof r)return()=>e(r,a,o);if(r.properties){if("function"==typeof r.properties)return()=>e(r,a,o);let t=(0,i._)(this,ea,eg).call(this,r.properties,a,[],r);return Array.isArray(t)?t:[]}return[]}if("function"==typeof r){if(null==t?void 0:t.flatten)return()=>e(r,a,o);let l=(0,i._)(this,em,ew).call(this,a);return[(0,i._)(this,eh,eS).call(this,o,r,a,l)]}if(r.properties){let e=[...(0,i._)(this,em,ew).call(this,a),r.title],t=(0,i._)(this,ea,eg).call(this,r.properties,a,e,r);return Array.isArray(t)?t:[]}}return[]}if(null===l)return console.warn(`[FlowContext] getPropertyMetaTree - unsupported value format: "${e}". Only "{{ ctx.propertyName }}" format is supported. Returning empty meta tree.`),[]}return Object.entries(l).sort((e,t)=>{let[,l]=e,[,n]=t,o=("function"==typeof l?l.sort:null==l?void 0:l.sort)??0;return(("function"==typeof n?n.sort:null==n?void 0:n.sort)??0)-o}).map(e=>{let[t,l]=e;return(0,i._)(this,eh,eS).call(this,t,l,[t],[])})}async getApiInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.version||"v1",l=!!e.includeCompletion,n=this.createProxy(),o=e=>"string"==typeof e&&e.startsWith("_"),r=e=>"record"===e||"formValues"===e||"popup"===e,i=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=(()=>{var e,l,n,o,r,i,a,s;let d=(0,R.B)(this),u=R.F.resolve(t,d)||R.F.resolve(t,"*");if(!u)return{};let c=(null==(n=this)||null==(l=n.api)||null==(e=l.auth)?void 0:e.locale)||(null==(r=this)||null==(o=r.i18n)?void 0:o.language)||(null==(i=this)?void 0:i.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})(),s=e$(null==a?void 0:a.methods)?a.methods:{},d=e$(null==a?void 0:a.properties)?a.properties:{},u=e=>"string"==typeof e?{description:e}:e$(e)?e:void 0,c=(e,t)=>{let l="string"==typeof t?t:e$(t)&&"string"==typeof t.description?String(t.description):void 0;return l&&l.includes(`ctx.libs.${e}`)?`libs.${e}`:e},p=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},m=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["title","type","interface","description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},h=e=>{let t=new WeakSet,l=n=>{if(!n||"object"!=typeof n||t.has(n))return;if(t.add(n),Object.prototype.hasOwnProperty.call(n._methodInfos||{},e)){var o;return null==(o=n._methodInfos)?void 0:o[e]}let r=n._delegates;if(Array.isArray(r))for(let e of r){let t=l(e);if(t)return t}};return l(this)},f=async e=>{let t=this.getPropertyOptions(e);if(null==t?void 0:t.info)try{let e="function"==typeof t.info?t.info.call(n,n):t.info;return(i(e)?await e:e)??void 0}catch(e){return}},g=new Set,v=new Set;for(let e of Object.keys(d))g.add(e);for(let e of Object.keys(s))v.add(e);let y=(e,t)=>{if(e&&"object"==typeof e&&!t.has(e)){t.add(e);try{let t=e._props;if(t&&"object"==typeof t)for(let[e,l]of Object.entries(t))(null==l?void 0:l.info)&&g.add(e)}catch(e){}try{let t=e._methodInfos;if(t&&"object"==typeof t)for(let e of Object.keys(t))v.add(e)}catch(e){}try{let l=e._delegates;if(Array.isArray(l))for(let e of l)y(e,t)}catch(e){}}};y(this,new WeakSet);let x={};for(let e of g){if(o(e)||r(e))continue;let t=d[e],n=await f(e);if(void 0===t&&void 0===n)continue;let i=u(t),a=u(n),s={};if(s={...s={...s,...m(i)},...m(a)},delete s.properties,l||delete s.completion,!Object.keys(s).length)continue;let p=c(e,t);x[p]=x[p]?{...x[p]||{},...s||{}}:s}for(let e of v){if(o(e))continue;let t=s[e],n=h(e);if(void 0===t&&void 0===n)continue;let r=u(t),i={};i={...i={...i,...p(r)},...p(n)},delete i.properties,l||delete i.completion,Object.keys(i).length&&(i.type="function",x[e]?x[e]={...x[e]||{},...i||{}}:x[e]=i)}let b=u(d.libs),w=e$(null==b?void 0:b.properties)?b.properties:void 0;if(w)for(let[e,t]of Object.entries(w)){if(o(e))continue;let n=`libs.${e}`;if(x[n])continue;let r=u(t),i={};i={...i,...m(r)},delete i.properties,l||delete i.completion,i.description&&String(i.description).trim()&&(x[n]=i)}return x}async getEnvInfos(){var e,t,l;let n=this.createProxy(),o=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,r={},i=e=>{try{return e()}catch(e){return}},a=e=>null!=e&&("string"==typeof e?e.trim().length>0:!Array.isArray(e)||e.length>0),s=e=>{var t,l,n,o,r;let i={};if(!e)return i;let s=e;for(let e of["dataSourceKey","collectionName","associationName","filterByTk","sourceId"]){let t=null==s?void 0:s[e];a(t)&&(i[e]=t)}if(!("dataSourceKey"in i)){let e=null==(t=s.getDataSourceKey)?void 0:t.call(s);a(e)&&(i.dataSourceKey=e)}if(!("filterByTk"in i)){let e=null==(l=s.getFilterByTk)?void 0:l.call(s);a(e)&&(i.filterByTk=e)}if(!("filterByTk"in i)){let e=null==(n=s.getMeta)?void 0:n.call(s,"currentFilterByTk");a(e)&&(i.filterByTk=e)}if(!("sourceId"in i)){let e=null==(o=s.getSourceId)?void 0:o.call(s);a(e)&&(i.sourceId=e)}if(!("collectionName"in i)||!("associationName"in i)){let e=null==(r=s.getResourceName)?void 0:r.call(s),t="string"==typeof e?e.trim():"";if(t){let e=t.split(".").map(e=>e.trim()).filter(Boolean);1===e.length?"collectionName"in i||(i.collectionName=e[0]):e.length>=2&&("collectionName"in i||(i.collectionName=e[0]),"associationName"in i||(i.associationName=e.slice(1).join(".")))}}return i},d=await (async()=>{try{let e=n.popup;return o(e)?await e:e}catch(e){return}})(),u=i(()=>n.model),c=i(()=>n.blockModel),p=i(()=>{var e;return null==(e=n.view)?void 0:e.inputArgs}),m=i(()=>n.resource),h=s(null==d?void 0:d.resource),f=c,g=c?"ctx.blockModel":void 0,v=g?`${g}.resource`:void 0,y=s(null==f?void 0:f.resource),x=s(p),b=s(m),w=e=>{for(let t of e)if(a(t.value))return{value:t.value,getVar:t.getVar}},S=e=>a(e.collectionName)||a(e.dataSourceKey)||a(e.associationName),C=S(h)?"ctx.popup.resource":S(y)?v:S(x)?"ctx.view.inputArgs":S(b)?"ctx.resource":void 0,F=w([{value:null==h?void 0:h.collectionName,getVar:"ctx.popup.resource.collectionName"},{value:null==y?void 0:y.collectionName,getVar:`${v}.collectionName`},{value:null==x?void 0:x.collectionName,getVar:"ctx.view.inputArgs.collectionName"},{value:null==b?void 0:b.collectionName,getVar:"ctx.resource.collectionName"}]),k=w([{value:null==h?void 0:h.dataSourceKey,getVar:"ctx.popup.resource.dataSourceKey"},{value:null==y?void 0:y.dataSourceKey,getVar:`${v}.dataSourceKey`},{value:null==x?void 0:x.dataSourceKey,getVar:"ctx.view.inputArgs.dataSourceKey"},{value:null==b?void 0:b.dataSourceKey,getVar:"ctx.resource.dataSourceKey"}]),A=w([{value:null==h?void 0:h.associationName,getVar:"ctx.popup.resource.associationName"},{value:null==y?void 0:y.associationName,getVar:`${v}.associationName`},{value:null==x?void 0:x.associationName,getVar:"ctx.view.inputArgs.associationName"},{value:null==b?void 0:b.associationName,getVar:"ctx.resource.associationName"}]),P=w([{value:null==h?void 0:h.filterByTk,getVar:"ctx.popup.resource.filterByTk"},{value:null==y?void 0:y.filterByTk,getVar:`${v}.filterByTk`},{value:null==x?void 0:x.filterByTk,getVar:"ctx.view.inputArgs.filterByTk"},{value:null==b?void 0:b.filterByTk,getVar:"ctx.resource.filterByTk"}]),j=w([{value:null==h?void 0:h.sourceId,getVar:"ctx.popup.resource.sourceId"},{value:null==y?void 0:y.sourceId,getVar:`${v}.sourceId`},{value:null==x?void 0:x.sourceId,getVar:"ctx.view.inputArgs.sourceId"},{value:null==b?void 0:b.sourceId,getVar:"ctx.resource.sourceId"}]),M={},I=!1,T=null==F?void 0:F.value;a(T)&&(M.collectionName={description:"Collection name",getVar:(null==F?void 0:F.getVar)||(C?`${C}.collectionName`:void 0),value:T},I=!0);let R=null==k?void 0:k.value;a(R)&&(M.dataSourceKey={description:"Data source key",getVar:(null==k?void 0:k.getVar)||(C?`${C}.dataSourceKey`:void 0),value:R},I=!0);let E=null==A?void 0:A.value;a(E)&&(M.associationName={description:"Association name",getVar:(null==A?void 0:A.getVar)||(C?`${C}.associationName`:void 0),value:E},I=!0),I&&(a(null==P?void 0:P.value)&&(M.filterByTk={description:"Record filterByTk",getVar:(null==P?void 0:P.getVar)||(C?`${C}.filterByTk`:void 0)}),a(null==j?void 0:j.value)&&(M.sourceId={description:"Source record ID (sourceId)",getVar:(null==j?void 0:j.getVar)||(C?`${C}.sourceId`:void 0)}),r.resource={description:"Resource information",getVar:C,properties:M}),a(null==P?void 0:P.value)&&(r.record={description:"Current record",getVar:"ctx.record"});let N=e=>{try{let t=null==e?void 0:e.title;if("string"==typeof t&&t.trim())return t}catch(e){}try{var t,l;let n=null==e||null==(l=e.constructor)||null==(t=l.meta)?void 0:t.label;if("string"==typeof n&&n.trim())return n}catch(e){}};if(u){let t=N(u),l=u.uid,n=null==(e=u.constructor)?void 0:e.name,o=s(u.resource),i={},d=!1,c=o.collectionName;a(c)&&(i.collectionName={description:"Collection name",getVar:"ctx.model.resource.collectionName",value:c},d=!0);let p=o.dataSourceKey;a(p)&&(i.dataSourceKey={description:"Data source key",getVar:"ctx.model.resource.dataSourceKey",value:p},d=!0);let m=o.associationName;a(m)&&(i.associationName={description:"Association name",getVar:"ctx.model.resource.associationName",value:m},d=!0),r.flowModel={description:"Current FlowModel information",getVar:"ctx.model",properties:{...a(t)?{label:{description:"Flow model label",value:t}}:{},...a(n)?{modelClass:{description:"Flow model class name",value:n}}:{},...a(l)?{uid:{description:"Flow model uid",getVar:"ctx.model.uid",value:l}}:{},...d?{resource:{description:"Flow model resource",getVar:"ctx.model.resource",properties:i}}:{}}}}if((null==d?void 0:d.uid)&&(r.popup={description:"Current popup information",getVar:"ctx.popup",properties:{uid:{description:"Popup uid",getVar:"ctx.popup.uid",value:d.uid},...(null==d?void 0:d.record)?{record:{description:"Popup record",getVar:"ctx.popup.record"}}:{},...(null==d?void 0:d.sourceRecord)?{sourceRecord:{description:"Popup source record",getVar:"ctx.popup.sourceRecord"}}:{}}}),f){let e=N(f),l=f.uid,n=null==(t=f.constructor)?void 0:t.name,o={},i=!1,s=y.collectionName;a(s)&&(o.collectionName={description:"Collection name",getVar:`${v}.collectionName`,value:s},i=!0);let d=y.dataSourceKey;a(d)&&(o.dataSourceKey={description:"Data source key",getVar:`${v}.dataSourceKey`,value:d},i=!0);let u=y.associationName;a(u)&&(o.associationName={description:"Association name",getVar:`${v}.associationName`,value:u},i=!0),r.block={description:"Current block information",getVar:g,properties:{...a(e)?{label:{description:"Block label",value:e}}:{},...a(n)?{modelClass:{description:"Block model class name",value:n}}:{},...a(l)?{uid:{description:"Block uid",getVar:`${g}.uid`,value:l}}:{},...i?{resource:{description:"Block resource",getVar:v,properties:o}}:{}}}}let D=(()=>{let e=null==d?void 0:d.uid;if(a(e))return String(e).trim();let t=null==p?void 0:p.viewUid;if(a(t))return String(t).trim()})(),B=i(()=>n.engine),$=D?null==B?void 0:B.getModel(D,!0):void 0,O=e=>{var t;return(null==(t=e.context)?void 0:t.blockModel)===e};if($){let e=[$],t=[];for(let n=0;n<e.length;n++){let o=e[n];if(O(o)){let e=(null==(l=o.constructor)?void 0:l.name)||o.uid,n=N(o)||e||o.uid,r=s(o.resource),i={};a(r.dataSourceKey)&&(i.dataSourceKey=r.dataSourceKey),a(r.collectionName)&&(i.collectionName=r.collectionName),a(r.associationName)&&(i.associationName=r.associationName);let d={uid:o.uid,label:n,modelClass:e,...Object.keys(i).length>0?{resource:i}:{}};t.push(d)}let r=o.subModels;if(r&&"object"==typeof r)for(let t of Object.values(r))t&&(Array.isArray(t)?e.push(...t):e.push(t))}t.length&&(r.currentViewBlocks={description:"Current view blocks",value:t})}return r}async getVarInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxDepth??3,l=Number.isFinite(t)?Math.max(1,Math.floor(t)):3,n="v1",o=this.createProxy(),r=e=>"string"==typeof e&&e.startsWith("_"),i=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=new WeakMap,s=async e=>{if(!e)return;if("function"!=typeof e)return e;let t=a.get(e);return t||(t=(async()=>{let t=e.call(o,o);return(i(t)?await t:t)||null})(),a.set(e,t)),await t||void 0},d=e=>{if("string"!=typeof e)return;let t=e.trim();if(!t)return;let l=(0,A.YB)(t);return Array.isArray(l)&&l.length>0?l.join("."):"ctx"===t?"":t.startsWith("ctx.")?t.slice(4).trim():t},u=(()=>{let t=e.path;return("string"==typeof t?[t]:Array.isArray(t)?t:[]).map(e=>d(String(e))).filter(e=>"string"==typeof e&&e.length>0)})(),c=(()=>{let t=e.path;return"string"==typeof t?""===d(t):!!Array.isArray(t)&&t.some(e=>""===d(String(e)))})(),p=(()=>{var e,t,l,o,r,i,a,s;let d=(0,R.B)(this),u=R.F.resolve(n,d)||R.F.resolve(n,"*");if(!u)return{};let c=(null==(l=this)||null==(t=l.api)||null==(e=t.auth)?void 0:e.locale)||(null==(r=this)||null==(o=r.i18n)?void 0:o.language)||(null==(i=this)?void 0:i.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})();e$(null==p?void 0:p.methods)&&p.methods,e$(null==p?void 0:p.properties)&&p.properties;let m=e=>"string"==typeof e?{description:e}:e$(e)?e:void 0,h=async(e,t)=>{if(void 0!==e){if("boolean"==typeof e)return e;if("function"==typeof e)try{let l=t(e);return i(l)?!!await l:!!l}catch(e){return!1}return!!e}},f=async(e,t)=>{if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)try{let l=t(e),n=i(l)?await l:l;if("string"==typeof n)return n;return null==n?void 0:String(n)}catch(e){return}return String(e)}},g=async e=>{let t=!1,l=[];try{if("boolean"==typeof e)t=e;else if(Array.isArray(e))l=e;else if("function"==typeof e){let n=e(o),r=i(n)?await n:n;"boolean"==typeof r?t=r:Array.isArray(r)&&(l=r)}}catch(e){t=!1,l=[]}let n=[];if(Array.isArray(l))for(let e of l){if("string"!=typeof e)continue;let t=e.trim();!(!t||"ctx"===t||t.startsWith("ctx."))&&(/\s/.test(t)||n.push(t))}return{hideSelf:!!t,hideSubpaths:n}},v=(e,t)=>{if(!e)return!1;let l=e.split(".").filter(Boolean);for(;l.length;){if(t.has(l.join(".")))return!0;l.pop()}return!1},y=e=>{let t=m(e);if(!t)return{};let l={};for(let e of["title","type","interface","description","examples","completion","ref","params","returns"]){let n=t[e];void 0!==n&&(l[e]=n)}return Array.isArray(l.examples)&&(l.examples=l.examples.filter(e=>"string"==typeof e&&e.trim())),l},x=async e=>{let t,n,{docNode:i,metaNode:a,infoNode:d,depth:u,pathFromRoot:c,hiddenPrefixes:p}=e,b=c.join(".");if(v(b,p))return;let w=m(i),S=m(d),C=await g(null==w?void 0:w.hidden);if(C.hideSelf)return;let F=await g(null==S?void 0:S.hidden);if(F.hideSelf)return;let k=await s(a);if(await h(null==k?void 0:k.hidden,e=>e.call(k,o)))return;let A=new Set(p);for(let e of[...C.hideSubpaths,...F.hideSubpaths]){let t=e.trim();if(!t)continue;let l="ctx"===t?"":t.startsWith("ctx.")?t.slice(4):t;if(!l)continue;let n=b?`${b}.${l}`:l;A.add(n)}let P=await h(null==w?void 0:w.disabled,e=>e(o)),j=await f(null==w?void 0:w.disabledReason,e=>e(o)),M=await h(null==k?void 0:k.disabled,e=>e.call(k,o)),I=await f(null==k?void 0:k.disabledReason,e=>e.call(k,o)),T=await h(null==S?void 0:S.disabled,e=>e(o)),R=await f(null==S?void 0:S.disabledReason,e=>e(o)),E=void 0!==T?T:void 0!==M?M:P,N=void 0!==R?R:void 0!==I?I:j,D={};if(D={...D={...D={...D,...y(w)},...y(k)},...y(S)},void 0!==E&&(D.disabled=!!E),void 0!==N&&(D.disabledReason=N),u>=l)return Object.keys(D).length?D:void 0;let B=e$(null==w?void 0:w.properties)?w.properties:void 0;if(null==k?void 0:k.properties)try{let e=k.properties;if("function"==typeof e){let l=await e.call(k,o);k.properties=l,t=l}else e$(e)&&(t=e)}catch(e){t=void 0}if(e$(S)&&(null==S?void 0:S.properties))try{let e=S.properties;if("function"==typeof e){let t=await e.call(S,o);S.properties=t,n=t}else e$(e)&&(n=e)}catch(e){n=void 0}let $=new Set;if(B)for(let e of Object.keys(B))$.add(e);if(t)for(let e of Object.keys(t))$.add(e);if(n)for(let e of Object.keys(n))$.add(e);if(!$.size)return Object.keys(D).length?D:void 0;let O={};for(let e of $){if(r(e))continue;let l=await x({docNode:null==B?void 0:B[e],metaNode:null==t?void 0:t[e],infoNode:null==n?void 0:n[e],depth:u+1,pathFromRoot:[...c,e],hiddenPrefixes:A});l&&(O[e]=l)}if(Object.keys(O).length&&(D.properties=O),Object.keys(D).length)return D},b=async e=>{if(!e.length)return;let[t,...l]=e,n=this.getPropertyOptions(t);if(null==n?void 0:n.meta)try{if(!l.length)return n.meta;let e=await s(n.meta);if(!e)return;for(let t=0;t<l.length;t++){let n=l[t],r=null==e?void 0:e.properties;if(!r)break;if("function"==typeof r){let t=await r.call(e,o);e.properties=t,r=t}if(!r||"object"!=typeof r)break;let i=null==r?void 0:r[n];if(!i)break;if(t===l.length-1)return i;let a=await s(i);if(!a)break;e=a}return}catch(e){return}};if(!c&&u.length){let e={};for(let t of u){let l=t.split(".").map(e=>e.trim()).filter(Boolean);if(l.some(e=>r(e))||!l.length)continue;let n=await b(l),o=await x({docNode:void 0,metaNode:n,infoNode:void 0,depth:1,pathFromRoot:[],hiddenPrefixes:new Set});o&&(e[t]=o)}return e}let w=this._getPropertiesMeta(),S={};for(let[e,t]of Object.entries(w)){if(r(e))continue;let l=await x({docNode:void 0,metaNode:t,infoNode:void 0,depth:1,pathFromRoot:[e],hiddenPrefixes:new Set});l&&(S[e]=l)}return S}_getPropertiesMeta(){let e={};for(let t of this._delegates)Object.assign(e,t._getPropertiesMeta());for(let[t,l]of Object.entries(this._props))l.meta&&(e[t]=(l.meta,l.meta));return e}_getOwnProperty(e,t){let l=this._props[e];if(l){if("value"in l)return"api"===e?(0,I.k)(l.value,t):l.value;if(l.get){if(!1===l.cache){let n=l.get(t);return"api"===e?(0,I.k)(n,t):n}let n=l.observable?"_observableCache":"_cache";if(e in this[n])return"api"===e?(0,I.k)(this[n][e],t):this[n][e];if(this._pending[e])return this._pending[e];let o=l.get(this.createProxy());return"object"==typeof o&&null!==o&&"function"==typeof o.then||"function"==typeof o&&"function"==typeof o.then?(this._pending[e]=o.then(l=>(this[n][e]=l,delete this._pending[e],"api"===e?(0,I.k)(l,t):l),t=>{throw delete this._pending[e],t}),this._pending[e]):(this[n][e]=o,"api"===e?(0,I.k)(o,t):o)}}}_getOwnMethod(e,t){let l=this._methods[e];return"function"==typeof l?l.bind(t):l}_findPropertyInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return l._props[t];let e=this._findPropertyInDelegates(l._delegates,t);if(void 0!==e)return e}}_findInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return{result:l._getOwnProperty(t,this.createProxy())};if(Object.prototype.hasOwnProperty.call(l._methods,t))return{result:l._getOwnMethod(t,this.createProxy())};let e=this._findInDelegates(l._delegates,t);if(void 0!==e)return e}}_hasInDelegates(e,t){for(let l of e)if(Object.prototype.hasOwnProperty.call(l._props,t)||Object.prototype.hasOwnProperty.call(l._methods,t)||this._hasInDelegates(l._delegates,t))return!0;return!1}getPropertyOptions(e){return Object.prototype.hasOwnProperty.call(this._props,e)?this._props[e]:this._findPropertyInDelegates(this._delegates,e)}constructor(){return(0,a._)(this,ea),(0,a._)(this,es),(0,a._)(this,ed),(0,a._)(this,eu),(0,a._)(this,ec),(0,a._)(this,ep),(0,a._)(this,em),(0,a._)(this,eh),(0,o._)(this,ei,{writable:!0,value:void 0}),this._props={},this._methods={},this._methodInfos={},this._cache={},this._observableCache=s.observable.shallow({}),this._delegates=[],this._pending={},(0,r._)(this,ei,null),this._metaNodeCache=new WeakMap,this.createProxy()}}function eg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0;return"function"==typeof e?async()=>{let o=await e();n&&(n.properties=o);let r=Object.entries(o);return r.sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}),r.map(e=>{let[n,o]=e;return(0,i._)(this,eh,eS).call(this,n,o,[...t,n],l)})}:Object.entries(e).sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}).map(e=>{let[n,o]=e;return(0,i._)(this,eh,eS).call(this,n,o,[...t,n],l)})}function ev(e){if(0===e.length)return null;let[t,...l]=e,n=this._props[t];if(null==n?void 0:n.meta)return(0,i._)(this,eu,ex).call(this,t,n.meta,l,[t]);let o=(0,i._)(this,ed,ey).call(this,this._delegates,t);return o?(0,i._)(this,eu,ex).call(this,t,o,l,[t]):null}function ey(e,t){for(let l of e){let e=l._props[t];if(null==e?void 0:e.meta)return e.meta;let n=(0,i._)(this,ed,ey).call(this,l._delegates,t);if(n)return n}return null}function ex(e,t,l,n){if(0===l.length)return[e,t,n];if("function"==typeof t)return[l[l.length-1],async()=>{let e=await t();return await (0,i._)(this,ep,eb).call(this,e,l)},[...n,...l]];if(t.properties){let[e,...o]=l,r=[...n,e];if("function"==typeof t.properties)return[l[l.length-1],async()=>{let l=t.properties,n=await l();t.properties=n;let r=n[e];if(!r)throw Error(`Property ${e} not found in resolved properties`);return await (0,i._)(this,ep,eb).call(this,r,o)},[...n,...l]];let a=t.properties[e];if(a)return(0,i._)(this,eu,ex).call(this,e,a,o,r)}return null}async function eb(e,t){if(0===t.length)return e;let l=e;for(let e of t){let n=p().get(l,"properties");if(!n)throw Error(`Property path not found: ${t.join(".")}`);if("function"==typeof n){let e=await n();l.properties=e,n=e}let o=n[e];if(!o)throw Error(`Property ${e} not found while resolving path: ${t.join(".")}`);l=o}return l}function ew(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(0===e.length)return[];let l=t?e.slice(0,-1):e;if(0===l.length)return[];let n=[],o=this._getPropertiesMeta();for(let e=0;e<l.length;e++){let t=l[e],r=o[t];if(!r||"function"==typeof r){n.push(t);break}if(n.push(r.title||t),e<l.length-1&&r.properties&&"function"!=typeof r.properties)o=r.properties;else if(e<l.length-1){for(let t=e+1;t<l.length;t++)n.push(l[t]);break}}return n}function eS(e,t){let l,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[e],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=this._metaNodeCache.get(t);if(r)return r.paths=n,r.parentTitles=o.length>0?o:void 0,r;let a=e=>{if(!e)return{disabled:!1,hidden:!1};let t="function"==typeof e.disabled?e.disabled():e.disabled,l="function"==typeof e.disabledReason?e.disabledReason():e.disabledReason,n="function"==typeof e.hidden?e.hidden():e.hidden;return{disabled:!(t&&"function"==typeof t.then)&&!!t,reason:l&&"function"==typeof l.then?void 0:l,hidden:!(n&&"function"==typeof n.then)&&!!n}};if("function"==typeof t){let r=e,s=t.hasChildren;l={name:e,title:t.title||r,type:"object",interface:void 0,options:void 0,uiSchema:void 0,paths:n,parentTitles:o.length>0?o:void 0,disabled:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).disabled},disabledReason:()=>{let e=t();if(!e||"function"!=typeof e.then)return a(e).reason},hidden:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).hidden},children:!1===s?void 0:async()=>{try{let r=await t(),a=(null==r?void 0:r.title)||e;if(l.title=a,l.type=null==r?void 0:r.type,l.interface=null==r?void 0:r.interface,l.options=null==r?void 0:r.options,l.uiSchema=null==r?void 0:r.uiSchema,!(null==r?void 0:r.properties))return[];let s=(0,i._)(this,ea,eg).call(this,r.properties,n,[...o,a],r),d=Array.isArray(s)?s:await s();return l.children=d,d}catch(t){return console.warn(`Failed to load meta for ${e}:`,t),[]}}}}else{let r=t.title,{disabled:s,reason:d,hidden:u}=a(t);l={name:e,title:r,type:t.type,interface:t.interface,options:t.options,uiSchema:t.uiSchema,paths:n,parentTitles:o.length>0?o:void 0,disabled:s,disabledReason:d,hidden:u,children:t.properties?(0,i._)(this,ea,eg).call(this,t.properties,n,[...o,r],t):void 0}}return this._metaNodeCache.set(t,l),l}class eC extends ef{constructor(){super(),this.defineMethod("getModel",(e,t)=>this.engine.getModel(e,t)),this.defineMethod("request",function(e){let t=this.app;return"string"==typeof(null==e?void 0:e.url)&&et(e.url,t)?d.A.request(e):this.api.request(e)}),this.defineMethod("runjs",async function(e,t,l){let{preprocessTemplates:n,...o}=l||{},r={...(null==o?void 0:o.globals)||{},...t||{}},i=await this.createJSRunner({...o||{},globals:r}),a=(0,F.R)({version:null==o?void 0:o.version,preprocessTemplates:n}),s=await (0,A.ji)(String(e??""),{preprocessTemplates:a});return i.run(s)},{description:"Execute a RunJS code string in the current Flow context.",detail:"(code: string, variables?: Record<string, any>, options?: JSRunnerOptions) => Promise<RunJSResult>",params:[{name:"code",type:"string",description:"RunJS code to execute."},{name:"variables",type:"Record<string, any>",optional:!0,description:"Additional globals."},{name:"options",type:"JSRunnerOptions",optional:!0,description:"Runner options."}],returns:{type:"Promise<{ success: boolean; value?: any; error?: any; timeout?: boolean }>"},completion:{insertText:"await ctx.runjs('return 1')"}})}}class eF extends eC{}let ek=["dataSourceKey","collectionName","associationName","filterByTk","sourceId","tabUid"];function eA(e,t){let l={};for(let n of t)void 0!==(null==e?void 0:e[n])&&(l[n]=e[n]);return l}function eP(e){return eA(e,ek)}function ej(e,t){for(let[l,n]of Object.entries(t))void 0===e[l]&&(e[l]=n)}class eM extends eC{constructor(e){if(!(e instanceof S.$))throw Error("Invalid FlowEngine instance");super(),this.engine=e,this.engine=e;const t=new w.zA;t.setFlowEngine(this.engine);const n=new w.qS({key:"main",displayName:"Main"});t.addDataSource(n),this.defineProperty("engine",{value:this.engine,info:{description:"FlowEngine instance.",detail:"FlowEngine"}}),this.defineProperty("sql",{get:e=>new k.tP(e),cache:!1,info:{description:"SQL helper (FlowSQLRepository).",detail:"FlowSQLRepository"}}),this.defineProperty("dataSourceManager",{value:t,info:{description:"DataSourceManager instance.",detail:"DataSourceManager"}});const o=new C(this);this.defineMethod("t",(e,t)=>o.translate(e,t)),this.defineProperty("locale",{get:()=>{var e,t,l;return(null==(t=this.api)||null==(e=t.auth)?void 0:e.locale)||(null==(l=this.i18n)?void 0:l.language)},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current language"),sort:970}),{title:(0,A.MI)("Current language"),sort:970,hasChildren:!1})}),this.defineMethod("renderJson",function(e){return this.resolveJsonTemplate(e)}),this.defineMethod("resolveJsonTemplate",async function(e){let t=(0,A.nN)(e),l=Object.keys(t||{});if(!l.length)return(0,A.M)(e,this);let n={};for(let e of l){let l=t[e]||[],o=this.getPropertyOptions(e),r=null==o?void 0:o.resolveOnServer;if(!0===r)n[e]=l;else if("function"==typeof r){let t=l.filter(e=>{try{return!!r(e)}catch(e){return!1}});t.length&&(n[e]=t)}}let o=Object.keys(n).length>0,r=e;if(o){let t=e=>{let t=(0,T.XU)(e);if(t)return t;try{var l,n,o,r,i,a,s,d,u,c,p,m,h;let t=null==e||null==(n=e.resource)||null==(l=n.getMeta)?void 0:l.call(n,"currentFilterByTk");if(null==t)return;let f=(null==e||null==(o=e.collection)?void 0:o.name)||(null==e||null==(c=e.resource)||null==(u=c.getResourceName)||null==(d=u.call(c))||null==(s=d.split)||null==(a=s.call(d,"."))||null==(i=a.slice)||null==(r=i.call(a,-1))?void 0:r[0]);if(!f)return;let g=(null==e||null==(p=e.collection)?void 0:p.dataSourceKey)||(null==e||null==(h=e.resource)||null==(m=h.getDataSourceKey)?void 0:m.call(h));return{collection:f,dataSourceKey:g,filterByTk:t}}catch(e){return}},l=async()=>{let e={};try{var t,l;let o=null==(t=(l=this)._getPropertiesMeta)?void 0:t.call(l);if(!o||"object"!=typeof o)return e;for(let[t,l]of Object.entries(o))if(n[t])try{let o;if("function"==typeof l){let e=l;o=await e()}else o=l;if(!o||"object"!=typeof o)continue;let r=o.buildVariablesParams;if("function"!=typeof r)continue;let i=await r(this);if(!i)continue;let a=n[t]||[],s=en(i,a);s&&("object"!=typeof s||Object.keys(s).length)&&(e[t]=s)}catch(e){}}catch(e){}return e},o=await l(),d={...o},u=n.view||[];if(!d.view&&u.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let e=(0,T.Cg)(this);e&&(d.view={record:e})}try{let e="formValues",l=n[e]||[];if(l.length){let n=new Set;for(let e of l){let t=eo(e);t&&n.add(t)}let r=null==o?void 0:o[e],i=new Set;if(!r||"object"!=typeof r||Array.isArray(r)||el(r)||Object.keys(r).forEach(e=>i.add(e)),[...n].filter(e=>!i.has(e)).length){let n=t(this);if(n){let{generatedFields:t,generatedAppends:o}=er(l),r={...n,fields:t,appends:o},i=d[e];if(i&&"object"==typeof i&&!Array.isArray(i)&&!el(i)){for(let[t,l]of Object.entries(i))d[`${e}.${t}`]=l;delete d[e]}d[e]=r}}}}catch(e){}let c=Object.keys(d).length?(0,M.d)(this,d):void 0;if(!c){let t=Object.keys(n);if(t.length>0&&t.every(e=>{var t;return null==(t=this.getPropertyOptions(e))?void 0:t.serverOnlyWhenContextParams}))return(0,A.M)(e,this)}if(this.api){var i,a,s;try{r=await (0,j.o4)(this,{rd:(0,j.pk)(this,null==(i=this.model)?void 0:i.uid),template:e,contextParams:c||{}})}catch(t){null==(s=this.logger)||null==(a=s.warn)||a.call(s,{err:t},"variables:resolve failed, fallback to client-only"),r=e}}}return(0,A.M)(r,this)}),this.defineMethod("getVar",async function(e){let t=("string"==typeof e?e:String(e??"")).trim();if(t){if("ctx"!==t&&!t.startsWith("ctx."))throw Error(`ctx.getVar(path) expects an expression starting with "ctx.", got: "${t}"`);return this.resolveJsonTemplate(`{{ ${t} }}`)}},'Resolve a ctx expression value by path (expression starts with "ctx.").'),this.defineProperty("requirejs",{get:()=>{var e,t;return null==(t=this.app)||null==(e=t.requirejs)?void 0:e.requirejs}}),this.defineProperty("token",{get:()=>{var e,t;return null==(t=this.api)||null==(e=t.auth)?void 0:e.token},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("API Token"),sort:980}),{title:"API Token",sort:980,hasChildren:!1})}),this.defineProperty("role",{get:()=>{var e,t,l;let n=null==(t=this.api)||null==(e=t.auth)?void 0:e.role;if("__union__"!==n)return n;let o=null==(l=this.user)?void 0:l.roles;return Array.isArray(o)?o.map(e=>null==e?void 0:e.name).filter(e=>!!e):[]},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current role"),sort:990}),{title:(0,A.MI)("Current role"),sort:990,hasChildren:!1})}),this.defineProperty("urlSearchParams",{cache:!1,get:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return h().parse(l)||{}},meta:Object.assign(()=>({type:"object",title:this.t("URL search params"),sort:970,disabled:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return 0===Object.keys(h().parse(l)||{}).length},disabledReason:()=>this.t("The value of this variable is derived from the query string of the page URL. This variable can only be used normally when the page has a query string."),properties:async()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t,n=h().parse(l)||{},o={};for(let e of Object.keys(n))o[e]={type:"string",title:e};return o}}),{title:(0,A.MI)("URL search params"),sort:970,hasChildren:!0})}),this.defineProperty("logger",{get:()=>this.engine.logger.child({module:"flow-engine"})}),this.defineProperty("auth",{get:()=>{var e,t,l,n,o,r;return{roleName:null==(t=this.api)||null==(e=t.auth)?void 0:e.role,locale:null==(n=this.api)||null==(l=n.auth)?void 0:l.locale,token:null==(r=this.api)||null==(o=r.auth)?void 0:o.token,user:this.user}},cache:!1}),this.defineProperty("date",{get:()=>{let e=t=>new Proxy({},{get:(l,n)=>{if("string"!=typeof n)return;let o=[...t,n];if(!(0,A.JE)(o))return;let r=(0,A.Vv)(o);return void 0!==r?r:e(o)}});return e(["date"])},cache:!1}),this.defineMethod("loadCSS",async e=>{let t=(0,A.i)(e);return new Promise((e,l)=>{if(document.querySelector(`link[href="${t}"]`))return void e(null);let n=document.createElement("link");n.rel="stylesheet",n.href=t,n.onload=()=>e(null),n.onerror=()=>l(Error(`Failed to load CSS: ${t}`)),document.head.appendChild(n)})},{description:"Load a CSS file by URL (browser only).",params:[{name:"href",type:"string",description:"CSS URL."}],returns:{type:"Promise<void>"},completion:{insertText:"await ctx.loadCSS('https://example.com/style.css')"},examples:["await ctx.loadCSS('https://example.com/style.css');"]}),this.defineMethod("requireAsync",async e=>{if((0,A.yp)(e))return this.loadCSS(e);let t=(0,A.i)(e,{raw:!0});return await W(this.requirejs,t)}),this.defineMethod("importAsync",async function(e){return(0,A.yp)(e)?this.loadCSS(e):await Z(this,e,{importer:H})}),this.defineMethod("createJSRunner",async function(e){try{let e=await Promise.resolve().then(l.bind(l,88828));"function"==typeof(null==e?void 0:e.setupRunJSContexts)&&await e.setupRunJSContexts()}catch(e){}let t=(null==e?void 0:e.version)||"v1",n=(0,R.B)(this),o=R.F.resolve(t,n)||eY,r=new o(this);r.defineMethod("t",(e,t)=>this.t(e,{ns:"runjs",...t}));let i={};try{var a,s,d,u,c,p,m,h;let e=(null==(d=this)||null==(s=d.api)||null==(a=s.auth)?void 0:a.locale)||(null==(c=this)||null==(u=c.i18n)?void 0:u.language)||(null==(p=this)?void 0:p.locale);i=(null==o||null==(m=o.getDoc)?void 0:m.length)?o.getDoc(e)||{}:(null==o||null==(h=o.getDoc)?void 0:h.call(o))||{}}catch(e){i={}}let f={ctx:eK(r,{doc:i}),...(null==e?void 0:e.globals)||{}},{timeoutMs:g}=e||{};return new F.I({globals:f,timeoutMs:g})}),this.defineMethod("buildServerContextParams",function(e){return(0,M.d)(this,e)}),this.defineMethod("getAction",function(e){return this.engine.getAction(e)}),this.defineMethod("getActions",function(){return this.engine.getActions()}),this.defineMethod("getEvents",function(){return this.engine.getEvents()}),this.defineMethod("runAction",async function(e,t){let l=this.engine.getAction(e),n=await (0,E.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let o={...await (0,A.gG)(l.defaultParams,n)||{},...t||{}},r=l.useRawParams;if("function"==typeof r&&(r=await r(n)),r||(o=await n.resolveJsonTemplate(o)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,o)}),this.defineProperty("acl",{get:()=>new x(this.engine)}),this.defineMethod("aclCheck",function(e){return!!this.skipAclCheck||this.acl.aclCheck(e)}),this.defineMethod("createResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("makeResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("initResource",function(e){return this.has("resource")||this.defineProperty("resource",{get:()=>this.createResource(e)}),this.resource}),this.defineMethod("useResource",function(e){return this.initResource(e)})}}class eI extends eF{constructor(e){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),this.addDelegate(e.flowEngine.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{value:e,info:{description:"Current FlowModel instance.",detail:"FlowModel"}});const t=(0,f.createRef)();this.defineProperty("ref",{get:()=>(this.model._refCreated=!0,t),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}}),this.defineMethod("openView",async function(e,t){var l,n,o,r;let i={..."function"==typeof(null==(l=this.model)?void 0:l.getInputArgs)?eP(this.model.getInputArgs()):{},...eP(this.inputArgs)},a={...t||{}};ej(a,i),(a.defineProperties||a.defineMethods)&&(a.navigation=!1);let s=null;(s=await this.engine.loadModel({uid:e}))||(s=this.engine.createModel({uid:e,use:"PopupActionModel",parentId:this.model.uid,subType:"object",subKey:e,stepParams:{popupSettings:{openView:{...eA(a,["dataSourceKey","collectionName","associationName","mode","size"])}}}}),await s.save()),s.setParent(this.model);let d=(null==a?void 0:a.routeViewUid)??(null==a?void 0:a.viewUid)??((null==(o=s.stepParams)||null==(n=o.popupSettings)?void 0:n.openView)?s.uid:this.model.uid),u=this.view,c={type:(null==a?void 0:a.isMobileLayout)?"embed":(null==a?void 0:a.mode)||"drawer",inputArgs:{...a,viewUid:d,navigation:a.navigation},navigation:null==u?void 0:u.navigation,preventClose:!!(null==a?void 0:a.preventClose),engineCtx:this.engine.context};s.context.defineProperty("view",{value:c});let p=null==(r=s.getFlow)?void 0:r.call(s,"popupSettings"),m=null==p?void 0:p.on,h="click";"string"==typeof m&&m?h=m:m&&"object"==typeof m&&"string"==typeof m.eventName&&m.eventName&&(h=m.eventName),await s.dispatchEvent(h,{...a})}),this.defineMethod("getEvents",function(){return this.model.getEvents()}),this.defineMethod("getAction",function(e){return this.model.getAction(e)}),this.defineMethod("getActions",function(){return this.model.getActions()}),this.defineMethod("runAction",async function(e,t){let l=this.model.getAction(e),n=await (0,E.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let o={...await (0,A.gG)(l.defaultParams,n)||{},...t||{}},r=l.useRawParams;if("function"==typeof r&&(r=await r(n)),r||(o=await n.resolveJsonTemplate(o)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,o)})}}class eT extends eF{constructor(e,t){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),this.master=e,this.fork=t,this.addDelegate(this.master.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{get:()=>this.fork,info:{description:"Current ForkFlowModel instance (as model).",detail:"ForkFlowModel"}});const l=(0,f.createRef)();this.defineProperty("ref",{get:()=>(this.fork._refCreated=!0,l),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}})}}class eR extends eF{_getOwnProperty(e){if("runtime"===this.mode)return super._getOwnProperty(e,this.createProxy());let t=this._props[e];if(t){if("value"in t)return b.create()[e];if(t.get){if(!1===t.cache)return b.create()[e];let l=t.observable?"_observableCache":"_cache";return e in this[l]||(this[l][e]=b.create()[e]),this[l][e]}}}exit(){throw new P.zz(this.flowKey,this.model.uid)}exitAll(){throw new P.zz(this.flowKey,this.model.uid)}get mode(){return this._mode}constructor(e,t,l="runtime"){super(),this.model=e,this.flowKey=t,this._mode=l,this.stepResults={},this.addDelegate(this.model.context),this.defineMethod("getStepParams",l=>e.getStepParams(t,l)||{}),this.defineMethod("setStepParams",(l,n)=>e.setStepParams(t,l,n)),this.defineMethod("getStepResults",e=>p().get(this.steps,[e,"result"])),this.defineMethod("initResource",t=>{e.context.has("resource")?console.log(`[FlowRuntimeContext] useResource - resource already defined in context: ${t}`):(e.context.defineProperty("resource",{get:()=>this.makeResource(t)}),e.resource||(e.resource=e.context.resource))}),this.defineMethod("useResource",e=>this.initResource(e)),this.defineProperty("resource",{get:()=>e.resource||e.context.resource,cache:!1}),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)})}}let eE=new WeakMap,eN=new WeakMap,eD=new WeakMap;function eB(e,t){if(null===t)return;if(Array.isArray(e)||Array.isArray(t)||"object"!=typeof e||"object"!=typeof t)return t??e;let l={...e};for(let n of Object.keys(t)){let o=eB(null==e?void 0:e[n],t[n]);void 0===o?delete l[n]:l[n]=o}return l}function e$(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function eO(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function eq(e){return!0===e||(e&&e$(e)?e:void 0)}function eL(e,t,l){if(!Array.isArray(t)||!t.length)return;let n=e;for(let e of t){if(!e)return;n.children=n.children||{},n.children[e]=n.children[e]||{},n=n.children[e]}n.deprecated=l}function e_(e,t){void 0!==t.deprecated&&(e.deprecated=t.deprecated);let l=t.children||{},n=Object.keys(l);if(n.length)for(let t of(e.children=e.children||{},n))e.children[t]=e.children[t]||{},e_(e.children[t],l[t])}function eV(e){let t={};if(!e)return t;let l=(e,n)=>{if(e$(e))for(let[o,r]of Object.entries(e)){if(!o||!r||"object"!=typeof r||Array.isArray(r))continue;let e=r,i=eq(e.deprecated);i&&eL(t,[...n,o],i),e$(e.properties)&&l(e.properties,[...n,o])}},n=e=>{if(e$(e))for(let[l,n]of Object.entries(e)){if(!l||!n||"object"!=typeof n||Array.isArray(n))continue;let e=eq(n.deprecated);e&&eL(t,[l],e)}};return l(e.properties,[]),n(e.methods),t}function ez(e){let t={},l=new WeakSet,n=(e,l)=>{if(e$(l))for(let[o,r]of Object.entries(l)){if(!o||"string"==typeof r||!r||"object"!=typeof r||Array.isArray(r))continue;let l=r,i=eq(l.deprecated);i&&eL(t,[...e,o],i),e$(l.properties)&&n([...e,o],l.properties)}},o=e=>{if(!e||"object"!=typeof e&&"function"!=typeof e||l.has(e))return;l.add(e);let r=e._methodInfos;if(e$(r))for(let[e,l]of Object.entries(r)){if(!e||!l||"object"!=typeof l||Array.isArray(l))continue;let n=eq(l.deprecated);n&&eL(t,[e],n)}let i=e._props;if(e$(i))for(let[e,l]of Object.entries(i)){if(!e)continue;let o=null==l?void 0:l.info;if(!o||"object"!=typeof o||Array.isArray(o))continue;let r=eq(o.deprecated);r&&eL(t,[e],r),e$(o.properties)&&n([e],o.properties)}let a=e._delegates;if(Array.isArray(a))for(let e of a)o(e)};return o(e),t}function eK(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=eV(t.doc);e_(l,ez(e));let n=new Set,o=new WeakMap,r=new WeakMap,i=new WeakMap,a=e=>{if(!e||"string"!=typeof e)return{};let t=2;for(let l of e.split("\n")){if(!l)continue;let e=l.match(/<anonymous>:(\d+):(\d+)/);if(!e)continue;let n=Number(e[1]),o=Number(e[2]);return{line:Number.isFinite(n)&&n>t?n-t:n,column:Number.isFinite(o)?o:void 0,rawLine:n,rawColumn:o}}return{}},s=(e,t)=>{if(e$(t))for(let[n,o]of Object.entries(t)){if(!n||"string"==typeof o||!o||"object"!=typeof o||Array.isArray(o))continue;let t=o,r=eq(t.deprecated);r&&eL(l,[...e,n],r),e$(t.properties)&&s([...e,n],t.properties)}},d=(e,t)=>{if(!e)return;let n=null==t?void 0:t.info;if(!n||"object"!=typeof n||Array.isArray(n))return;let o=eq(n.deprecated);o&&eL(l,[e],o),e$(n.properties)&&s([e],n.properties)},u=(e,t)=>{if(!e||!t||"object"!=typeof t||Array.isArray(t))return;let n=eq(t.deprecated);n&&eL(l,[e],n)},c=e=>{let t=e;for(;t&&("object"==typeof t||"function"==typeof t);){let e=o.get(t);if(!e)break;t=e}return t},p=e=>{if(e){if("string"==typeof e)return e.trim()||void 0;if(Array.isArray(e)){let t=e.map(e=>"string"==typeof e?e.trim():"").filter(Boolean);return t.length?t.join(", "):void 0}}},m=(t,l,o)=>{if(!t||n.has(t))return;n.add(t);let r=null==e?void 0:e.logger,i="function"==typeof(null==e?void 0:e.t)?(t,l)=>e.t(t,{ns:[A.u4,"client"],nsMode:"fallback",...l}):(e,t)=>{let l=(null==t?void 0:t.defaultValue)??e;return"string"==typeof l&&t?l.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(e,l)=>{let n=null==t?void 0:t[l];return"string"==typeof n||"number"==typeof n?String(n):""}):l},s="object"==typeof l&&l?l:{},d=p(s.replacedBy),u="string"==typeof s.since?String(s.since):void 0,c="string"==typeof s.removedIn?String(s.removedIn):void 0,m="string"==typeof s.message?String(s.message):"",h=a(o),f=h.line?`(line ${h.line}${h.column?`:${h.column}`:""})`:"",g=m.trim(),v=g?i("RunJS deprecated warning with message",{defaultValue:"[RunJS][Deprecated] {{api}} {{message}}{{location}}",api:t,message:g,location:f}):i("RunJS deprecated warning",{defaultValue:"[RunJS][Deprecated] {{api}} is deprecated{{location}}",api:t,location:f}),y=i("RunJS deprecated separator",{defaultValue:"; "}),x=[v];d&&x.push(i("RunJS deprecated replacedBy",{defaultValue:"Use {{replacedBy}} instead",replacedBy:d})),u&&x.push(i("RunJS deprecated since",{defaultValue:"since {{since}}",since:u})),c&&x.push(i("RunJS deprecated removedIn",{defaultValue:"will be removed in {{removedIn}}",removedIn:c}));let b=x.filter(Boolean).join(y);try{r&&"function"==typeof r.warn?r.warn(b):console.warn(b)}catch(e){}},h=(e,t,l)=>{let o=t.deprecated;if(!o)return e;let r=i.get(e)||new Map;if(i.set(e,r),r.has(l))return r.get(l);let a=new Proxy(e,{apply(e,t,r){let i=n.has(l)?void 0:Error().stack;return m(l,o,i),Reflect.apply(e,c(t),r)},get:(e,t,l)=>Reflect.get(e,t,l)});return r.set(l,a),a},f=(e,t,l)=>{if(!e||"object"!=typeof e&&"function"!=typeof e||eO(e)||!(t.children&&Object.keys(t.children).length>0)&&"ctx"!==l)return e;let i=r.get(e)||new Map;if(r.set(e,i),i.has(l))return i.get(l);let a=new Proxy(e,{get(e,o,r){var i;if("symbol"==typeof o)return Reflect.get(e,o,c(r));let a=String(o),s=Reflect.get(e,o,c(r));if("ctx"===l&&"defineProperty"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{d(String((null==t?void 0:t[0])??""),null==t?void 0:t[1])}catch(e){}return n};if("ctx"===l&&"defineMethod"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{u(String((null==t?void 0:t[0])??""),null==t?void 0:t[2])}catch(e){}return n};let p=null==(i=t.children)?void 0:i[a];if(!p)return s;let g=`${l}.${a}`;if("function"==typeof s&&p.deprecated)return h(s,p,g);if(p.deprecated){let e=n.has(g)?void 0:Error().stack;m(g,p.deprecated,e)}return s&&("object"==typeof s||"function"==typeof s)&&p.children?f(s,p,g):s},has:(e,t)=>Reflect.has(e,t)});return o.set(a,e),i.set(l,a),a};return f(e,l,"ctx")}function eU(e,t,l){if(!e$(t))return e;if(!e$(e))return t;let n={...e};for(let o of Object.keys(t)){let r=t[o];if(null===r){delete n[o];continue}let i=l(e$(e)?e[o]:void 0,r);void 0===i?delete n[o]:n[o]=i}return n}function eW(e,t){if(null===t)return;let l=e$(e),n=e$(t),o="string"==typeof e;if("string"==typeof t)return l?eW(e,{description:t}):t;if(n){let n=l?e:o?{description:e}:void 0,r={...n||{}};for(let e of Object.keys(t)){if("properties"===e){let e=t.properties;if(null===e){delete r.properties;continue}let l=eU(null==n?void 0:n.properties,e,eW);void 0===l?delete r.properties:r.properties=l;continue}let l=eB(null==n?void 0:n[e],t[e]);void 0===l?delete r[e]:r[e]=l}return r}return t??e}function eH(e,t){if(null===t)return;let l=e$(e),n=e$(t),o="string"==typeof e;if("string"==typeof t)return l?eH(e,{description:t}):t;if(n){let n=l?e:o?{description:e}:void 0,r={...n||{}};for(let e of Object.keys(t)){let l=eB(null==n?void 0:n[e],t[e]);void 0===l?delete r[e]:r[e]=l}return r}return t??e}function eG(e,t){let l=e$(e)?e:{},n=e$(t)?t:{},o={...l};for(let e of Object.keys(n)){if("properties"===e){let e=eU(l.properties,n.properties,eW);void 0===e?delete o.properties:o.properties=e;continue}if("methods"===e){let e=eU(l.methods,n.methods,eH);void 0===e?delete o.methods:o.methods=e;continue}let t=eB(l[e],n[e]);void 0===t?delete o[e]:o[e]=t}return o}class eY extends ef{exit(){var e;throw new P.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}exitAll(){var e;throw new P.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}static define(e,t){let l=null==t?void 0:t.locale;if(l){let t=eN.get(this)||new Map,n=t.get(l)||{};t.set(l,eG(n,e)),eN.set(this,t)}else{let t=eE.get(this)||{};eE.set(this,eG(t,e))}eD.delete(this)}static getDoc(e){let t=this,l=eD.get(t),n=String(e||"default");if(l&&l.has(n))return l.get(n);let o=[],r=t;for(;r&&r.prototype;)o.unshift(r),r=Object.getPrototypeOf(r);let i={};for(let e of o)i=eG(i,eE.get(e)||{});if(e)for(let t of o){let l=eN.get(t);l&&l.has(e)&&(i=eG(i,l.get(e)))}return l||(l=new Map,eD.set(t,l)),l.set(n,i),i}constructor(e){super(),this.addDelegate(e),this.defineProperty("React",{value:f}),this.defineProperty("antd",{value:u}),this.defineProperty("dayjs",{value:D()});const t={...v,createRoot:(e,t)=>{let l=(null==e?void 0:e.__el)||e;return this.engine.reactView.createRoot(l,t)}};t.__nbRunjsInternalShim=!0,this.defineProperty("ReactDOM",{value:t}),(0,B.oJ)(this),this.defineMethod("openView",async function(t,l){let n=e.openView;if("function"!=typeof n)throw Error("ctx.openView is not available in current context.");let o=(0,A.cg)(l);return n(t,o?{...l||{},[A.sU]:o}:l)}),this.defineMethod("render",function(e,t){let l=t||this.element;if(!l)throw Error("ctx.render: container not provided and ctx.element is not available");let n=(null==l?void 0:l.__el)||l,o=globalThis;o.__nbRunjsRoots=o.__nbRunjsRoots||new WeakMap;let r=o.__nbRunjsRoots,i=e=>{if(!e)return;if(e.disposeTheme&&"function"==typeof e.disposeTheme){try{e.disposeTheme()}catch(e){}e.disposeTheme=void 0}let t=e.root||e;if(t&&"function"==typeof t.unmount)try{t.unmount()}catch(e){}},a=()=>{let e=r.get(n);e&&(i(e),r.delete(n))};if("string"==typeof e)return a(),new y.x(n).innerHTML=String(e??""),null;if(e&&e.nodeType&&(1===e.nodeType||3===e.nodeType||11===e.nodeType)){for(a();n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(e),null}let s=this.ReactDOM,d=this,c=r.get(n);return c&&c.rendererKey===s&&c.ownerKey===d||(c&&(i(c),r.delete(n)),c={rendererKey:s,ownerKey:d,root:this.ReactDOM.createRoot(n),disposeTheme:void 0,lastVnode:void 0},r.set(n,c)),(0,B.$B)({ctx:this,entry:c,vnode:e,containerEl:n,rootMap:r,unmountContainerRoot:a,internalReact:f,internalAntd:u})})}}},48910(e,t,l){"use strict";l.d(t,{$:()=>eN});var n=l(88243),o=l(16213),r=l(95243),i=l(2543),a=l.n(i),s=l(81318),d=l.n(s),u=l(64171);class c extends u.Z{getAction(e){return this.actions.get(e)}getActions(){return new Map(this.actions)}}var p=l(26955);class m extends p.L{getEvent(e){return this.events.get(e)}getEvents(){return new Map(this.events)}}var h=l(29007),f=l(60182),g=l(31108),v=l(88439),y=l(62572);class x{async emitModelEventIf(e,t,l){e&&await this.engine.emitter.emitAsync(`model:event:${e}:${t}`,l)}async withApplyFlowCache(e,t){if(!e||!this.engine)return await t();let l=this.engine.applyFlowCache.get(e);if(l){if("resolved"===l.status)return l.data;if("rejected"===l.status)throw l.error;if("pending"===l.status)return await l.promise}let n=t().then(t=>(this.engine.applyFlowCache.set(e,{status:"resolved",data:t,promise:Promise.resolve(t)}),t)).catch(t=>{throw this.engine.applyFlowCache.set(e,{status:"rejected",error:t,promise:Promise.reject(t)}),t});return this.engine.applyFlowCache.set(e,{status:"pending",promise:n}),await n}async runFlow(e,t,l,n,o){var r;let i,s=e.getFlow(t);if(!s)return e.context.logger.error(`BaseModel.applyFlow: Flow with key '${t}' not found.`),Promise.reject(Error(`Flow '${t}' not found.`));let d=new h.W5(e,t);d.defineProperty("reactView",{value:e.reactView}),d.defineProperty("inputArgs",{value:{...l}}),d.defineProperty("runId",{value:n||`run-${Date.now()}`});let u=d.stepResults,c=e.getEvent("string"==typeof s.on?s.on:null==(r=s.on)?void 0:r.eventName);c&&((c={...c}).defaultParams={...a().get(s,"on.defaultParams",{}),...c.defaultParams});let p=c?{eventStep:c,...s.steps}:s.steps;(0,v.w)(d,p,e,t);let m=d.steps,x={uid:e.uid,model:e,runId:d.runId,inputArgs:l,flowKey:t};for(let[l,n]of(await this.emitModelEventIf(o,`flow:${t}:start`,x),Object.entries(p))){let r,a,s={},c=n.useRawParams;if(n.use){let o=e.getAction(n.use);if(!o){d.logger.error(`BaseModel.applyFlow: Action '${n.use}' not found for step '${l}' in flow '${t}'. Skipping.`);continue}a=await (0,y.v)(d,{...o,...n}),r=n.handler||o.handler,c=c??o.useRawParams;let i=await (0,f.gG)(o.defaultParams,a),u=await (0,f.gG)(n.defaultParams,a);s={...i,...u}}else{if(!n.handler)continue;a=await (0,y.v)(d,n),r=n.handler,s={...await (0,f.gG)(n.defaultParams,a)}}let p=e.getStepParams(t,l);void 0!==p&&(s={...s,...p}),"function"==typeof c&&(c=await c(a)),c||(s=await a.resolveJsonTemplate(s));try{if(!r){d.logger.error(`BaseModel.applyFlow: No handler available for step '${l}' in flow '${t}'. Skipping.`);continue}await this.emitModelEventIf(o,`flow:${t}:step:${l}:start`,{...x,stepKey:l});let e=r(a,s);i=!1!==n.isAwait?await e:e,u[l]=i,m[l].result=u[l],await this.emitModelEventIf(o,`flow:${t}:step:${l}:end`,{...x,result:i,stepKey:l})}catch(e){if(e instanceof f.sy||e instanceof g.zz||await this.emitModelEventIf(o,`flow:${t}:step:${l}:error`,{...x,error:e,stepKey:l}),e instanceof f.sy)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(o,`flow:${t}:step:${l}:end`,{...x,stepKey:l}),await this.emitModelEventIf(o,`flow:${t}:end`,{...x,result:u}),Promise.resolve(u);if(e instanceof g.zz)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(o,`flow:${t}:step:${l}:end`,{...x,stepKey:l,aborted:!0}),await this.emitModelEventIf(o,`flow:${t}:end`,{...x,result:e,aborted:!0}),Promise.resolve(e);return await this.emitModelEventIf(o,`flow:${t}:error`,{...x,error:e}),d.logger.error({err:e},`BaseModel.applyFlow: Error executing step '${l}' in flow '${t}':`),Promise.reject(e)}}return await this.emitModelEventIf(o,`flow:${t}:end`,{...x,result:u}),Promise.resolve(u)}async dispatchEvent(e,t,l,n){var o,r,i,a;let s="beforeRender"===t,d=!!(null==n?void 0:n.sequential),u=!!(null==n?void 0:n.useCache),c=s,p=`${e.uid}-${t}-${Date.now()}`,m=e.context.logger,h={uid:e.uid,model:e,runId:p,inputArgs:l};try{await this.emitModelEventIf(t,"start",h),await (null==(o=e.onDispatchEventStart)?void 0:o.call(e,t,n,l))}catch(o){if(s&&o instanceof f.sy)return m.debug(`[FlowModel.dispatchEvent] ${o.message}`),[];try{await (null==(r=e.onDispatchEventError)?void 0:r.call(e,t,n,l,o))}finally{m.error({err:o},`BaseModel.dispatchEvent: Start hook error for event '${t}'`)}if(c)throw o;return}let v=s?e.getEventFlows("beforeRender"):Array.from(e.getFlows().values()).filter(e=>{let l=e.on;return!!l&&("string"==typeof l?l===t:"object"==typeof l&&l.eventName===t)}),y="click"===t&&(null==l?void 0:l.triggerByRouter)===!0?v.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}):v,x=[],b=async()=>{let n=!1;if(d){let o=y.map((e,t)=>({f:e,i:t})).slice().sort((e,t)=>{var l,n;let o=e.f.flowRegistry,r=t.f.flowRegistry,i=null==o||null==(l=o.constructor)?void 0:l._type,a=null==r||null==(n=r.constructor)?void 0:n._type,s=+("instance"!==i),d=+("instance"!==a);if(s!==d)return s-d;let u=e.f.sort??0,c=t.f.sort??0;return u!==c?u-c:e.i-t.i}).map(e=>e.f),r=[],i=new Map(o.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}).map(e=>[e.key,e])),a=new Set,s=new Map;for(let[n,d]of(o.forEach((e,l)=>{let n=e.on,o="object"==typeof n?n:void 0;if(!o)return;let r=o.phase,d=o.flowKey,u=o.stepKey;if(!r||"beforeAllFlows"===r)return;let c=null;if("afterAllFlows"===r)c=`event:${t}:end`;else if("beforeFlow"===r||"afterFlow"===r)if(d)if(i.get(String(d))){let e="beforeFlow"===r?"start":"end";c=`event:${t}:flow:${String(d)}:${e}`}else c=`event:${t}:end`;else c=`event:${t}:end`;else if("beforeStep"!==r&&"afterStep"!==r)return;else if(d&&u){var p;let e=i.get(String(d)),l=!!(null==e||null==(p=e.hasStep)?void 0:p.call(e,String(u)));if(e&&l){let e="beforeStep"===r?"start":"end";c=`event:${t}:flow:${String(d)}:step:${String(u)}:${e}`}else c=`event:${t}:end`}else c=`event:${t}:end`;if(!c)return;let m=c===`event:${t}:end`||"afterFlow"===r||"afterStep"===r;a.add(e.key);let h=s.get(c)||[];h.push({flow:e,order:l,shouldSkipOnAborted:m}),s.set(c,h)}),s.entries()))for(let o of d.slice().sort((e,t)=>{let l=e.flow.sort??0,n=t.flow.sort??0;return l!==n?l-n:e.order-t.order})){let i=o.shouldSkipOnAborted?Object.assign(e=>e.type===n&&!0!==e.aborted,{__eventType:n}):n,a=e.scheduleModelOperation(e.uid,async e=>{let n=await this.runFlow(e,o.flow.key,l,p,t);if(n instanceof g.zz)throw n;r.push(n)},{when:i});x.push(a)}for(let i of o)if(!a.has(i.key))try{m.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${i.key}' (sequential).`);let o=await this.runFlow(e,i.key,l,p,t);if(o instanceof g.zz){m.debug(`[FlowEngine.dispatchEvent] ${o.message}`),n=!0;break}r.push(o)}catch(e){if(e instanceof g.zz){m.debug(`[FlowEngine.dispatchEvent] ${e.message}`),n=!0;break}throw m.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${i.key}' for event '${t}' (sequential):`),e}return{result:r,abortedByExitAll:n}}let o=(await Promise.all(y.map(async n=>{m.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${n.key}'.`);try{return await this.runFlow(e,n.key,l,p,t)}catch(e){if(m.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${n.key}' for event '${t}':`),c)throw e;return}}))).filter(e=>void 0!==e);return o.some(e=>e instanceof g.zz)&&(n=!0),{result:o,abortedByExitAll:n}},w=u?JSON.stringify(l??{}):"",S=u?eN.generateApplyFlowCacheKey(`event:${e.getFlowCacheScope(t)}:${w}`,t,e.uid):null;try{let{result:o,abortedByExitAll:r}=await this.withApplyFlowCache(S,b);try{await (null==(i=e.onDispatchEventEnd)?void 0:i.call(e,t,n,l,o))}catch(e){m.error({err:e},`BaseModel.dispatchEvent: End hook error for event '${t}'`)}return await this.emitModelEventIf(t,"end",{...h,result:o,...r?{aborted:!0}:{}}),o&&"object"==typeof o&&Object.defineProperty(o,"__abortedByExitAll",{value:r,configurable:!0}),o}catch(o){try{await (null==(a=e.onDispatchEventError)?void 0:a.call(e,t,n,l,o))}catch(e){}if(e.context.logger.error({err:o},`BaseModel.dispatchEvent: Error executing event '${t}' for model '${e.uid}':`),await this.emitModelEventIf(t,"error",{...h,error:o}),c)throw o}finally{for(let e of x)e()}}constructor(e){this.engine=e}}var b=l(58587),w=l(18150),S=l(68238),C=l(67838),F=l(18220),k=l(47674),A=l(21637),P=l(71021),j=l(84626),M=l(96540),I=l(74848),T=l(53619),R=l(92034),E=l(98393),N=l(22803),D=l(42443),B=l(88040),$=l(35710),O=l(18182),q=l(98892),L=l(33954),_=l(57084),V=l(94313),z=l(20616),K=l(52847);let U={marginLeft:32},W=(0,K.PA)(e=>{let{title:t,onChange:l,getDefaultValue:n,disabled:o,itemKey:r,...i}=e,[a,s]=(0,M.useState)(!1),d=(0,z.Db)();(0,M.useEffect)(()=>{let e=!1;return(async()=>{if(n)try{let t=await n();if(e||!t)return;let l=Object.entries(t);if(!l.length)return;let[o,r]=l[0];s(!!r)}catch(e){console.error(e)}})(),()=>{e=!0}},[n]);let u=e=>{s(e),null==l||l({[r]:e})},c=e=>{e.stopPropagation(),o||u(!a)};return(0,I.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between",cursor:o?"not-allowed":"pointer"},onClick:c,children:[t,(0,I.jsx)(V.A,{size:"small",...i,checkedChildren:i.checkedChildren?d.t(i.checkedChildren):void 0,unCheckedChildren:i.unCheckedChildren?d.t(i.unCheckedChildren):void 0,checked:a,style:U,disabled:o})]})});var H=l(36492);let G=(e,t)=>{for(let n of e){var l;if(String((null==n?void 0:n.key)??"")===t)return n;if(null==(l=n.children)?void 0:l.length){let e=G(n.children,t);if(e)return e}}},Y=(e,t,l)=>{let n=t.maxDepth,o="number"==typeof t.arrayLimit?t.arrayLimit:1/0,r=t.mode??"stack",i=new Set,a=new Set,s=(e,t,d)=>{if(!e||t>n)return;let u=()=>{l(e,{depth:t,modelKey:d}),t>=n||Object.entries(e.subModels||{}).forEach(e=>{let[l,n]=e;if(Array.isArray(n)){let e=Number.isFinite(o)?Math.min(n.length,o):n.length;for(let o=0;o<e;o++){let e=n[o];e instanceof L.WD&&s(e,t+1,`${l}[${o}]`)}return}n instanceof L.WD&&s(n,t+1,l)})};if("visited"===r){if(i.has(e))return;i.add(e),u();return}let c=e.uid||`temp-${Date.now()}`;if(!a.has(c)){a.add(c);try{u()}finally{a.delete(c)}}};s(e,1)},J=(e,t)=>{var l;if(!e||!t||"string"!=typeof t)return console.warn("Invalid input parameters"),null;let n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\[(\d+)\])?$/);if(!n)return console.warn(`Invalid subModelKey format: ${t}`),null;let[,o,r]=n,i=null==(l=e.subModels)?void 0:l[o];if(!i)return console.warn(`SubModel '${o}' not found`),null;if(void 0!==r){let e=parseInt(r,10);return Array.isArray(i)?e<0||e>=i.length?(console.warn(`Array index ${e} out of bounds for '${o}'`),null):i[e]instanceof L.WD?i[e]:null:(console.warn(`Expected array for '${o}', got ${typeof i}`),null)}return Array.isArray(i)?(console.warn(`Expected object for '${o}', got array`),null):i instanceof L.WD?i:null},X={switch:W,select:function(e){let{title:t,getDefaultValue:l,onChange:n,options:o,fieldNames:r,itemKey:i,tooltip:a,...s}=e,[d,u]=(0,M.useState)(!1),[c,p]=(0,M.useState)(""),m=(0,z.Db)();(0,M.useEffect)(()=>{let e=!1;return(async()=>{if(l)try{let t=await l();if(e||!t)return;let n=Object.entries(t);if(!n.length)return;let[o,r]=n[0];p(r)}catch(e){console.error(e)}})(),()=>{e=!0}},[l]);let h=(0,M.useRef)(null),f=e=>{p(e),null==n||n({[i]:e})},g=(0,I.jsx)("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:t});return(0,I.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},onClick:e=>{e.stopPropagation(),u(e=>!e)},onMouseLeave:()=>{h.current=setTimeout(()=>{u(!1)},200)},children:[a?(0,I.jsx)(D.A,{title:a,placement:"top",destroyTooltipOnHide:!0,children:g}):g,(0,I.jsx)(H.A,{...s,open:d,popupMatchSelectWidth:!1,bordered:!1,value:c,onChange:f,popupClassName:`select-popup-${t.replaceAll(" ","-")}`,fieldNames:r,options:o,labelRender:e=>m.t(e.label),optionRender:e=>m.t(e.label),style:{textAlign:"right",minWidth:100},onMouseEnter:()=>{clearTimeout(h.current)},dropdownRender:e=>s.dropdownRender?s.dropdownRender(e,u,f):e})]})}},Q=e=>{let{title:t,uiMode:l,itemProps:n}=e,o=(null==l?void 0:l.type)||l,r=o?X[o]:null,i=!!(null==n?void 0:n.disabled),a=null==n?void 0:n.disabledReason,s=null==n?void 0:n.disabledIconColor,d=r?(0,I.jsx)(r,{title:t,...n}):(0,I.jsx)(I.Fragment,{children:t});return i?(0,I.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,I.jsx)(D.A,{title:a,placement:"right",destroyTooltipOnHide:!0,children:(0,I.jsx)(T.A,{style:{color:s}})})]}):d},Z=".nb-toolbar-container-icons",ee=".nb-toolbar-container",et=(0,N.css)`
|
|
3214
|
+
Please run: await ctx.importAsync("${l}") to ensure ctx.render uses a matching ReactDOM.`);throw e.cause=n,e}}return u}function ee(e){return e.endsWith("/")?e:`${e}/`}function et(e,t){try{let l=new URL(e);if(!["http:","https:"].includes(l.protocol))return!1;if(!(null==t?void 0:t.getApiUrl))return!0;let n=new URL(t.getApiUrl()),o=ee(n.pathname),r=ee(l.pathname);return l.origin!==n.origin||!r.startsWith(o)}catch{return!1}}function el(e){return!!(e&&"object"==typeof e&&"collection"in e&&"filterByTk"in e)}function en(e,t){if(t&&0!==t.length){if(el(e))return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l={};for(let[n,o]of Object.entries(e))t.some(e=>e===n||e.startsWith(`${n}.`)||e.startsWith(`${n}[`))&&(l[n]=o);return l}}}function eo(e){if(!e)return;let t=String(e).match(/^([^.[]+)/);return null==t?void 0:t[1]}function er(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!Array.isArray(e)||0===e.length)return{generatedAppends:void 0,generatedFields:void 0};let t=new Set,l=new Set,n=e=>{if(!e)return"";let t=String(e);return(t=(t=(t=t.replace(/\[(?:\d+)\]/g,"")).replace(/\[(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)')\]/g,(e,t,l)=>`.${t||l}`)).replace(/\.\.+/g,".")).replace(/^\./,"").replace(/\.$/,"")};for(let o of e){if(!o)continue;for(;/^\[(\d+)\](\.|$)/.test(o);)o=o.replace(/^\[(\d+)\]\.?/,"");let e=n(o);if(!e)continue;let r=e.split(".").filter(Boolean);if(0!==r.length){if(1===r.length){l.add(r[0]);continue}for(let e=0;e<r.length-1;e++)t.add(r.slice(0,e+1).join("."));l.add(r.join("."))}}return{generatedAppends:t.size?Array.from(t):void 0,generatedFields:l.size?Array.from(l):void 0}}var ei=new WeakMap,ea=new WeakSet,es=new WeakSet,ed=new WeakSet,eu=new WeakSet,ec=new WeakSet,ep=new WeakSet,em=new WeakSet,eh=new WeakSet;class ef{createProxy(){return(0,n._)(this,ei)||(0,r._)(this,ei,new Proxy(this,{get:(e,t,l)=>{if("string"==typeof t){if(Reflect.has(e,t)){let n=Reflect.get(e,t,l);return"function"==typeof n?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e._props,t))return e._getOwnProperty(t,this.createProxy());if(Object.prototype.hasOwnProperty.call(e._methods,t))return e._getOwnMethod(t,this.createProxy());let n=this._findInDelegates(e._delegates,t);return void 0!==n?n.result:void 0}return Reflect.get(e,t,l)},has:(e,t)=>!!("string"==typeof t&&(Reflect.has(e,t)||Object.prototype.hasOwnProperty.call(e._props,t)||Object.prototype.hasOwnProperty.call(e._methods,t)||this._hasInDelegates(e._delegates,t)))||Reflect.has(e,t)})),(0,n._)(this,ei)}defineProperty(e,t){var l;if(this._props[e]&&(null==(l=this._props[e])?void 0:l.once))return;let n=this._props[e];(null==n?void 0:n.meta)&&this._clearMetaNodeCacheFor(n.meta),this._props[e]=t,delete this._observableCache[e],delete this._cache[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:()=>this._getOwnProperty(e,this.createProxy())})}defineMethod(e,t,l){this._methods[e]=t,"string"==typeof l?this._methodInfos[e]={description:l}:l&&"object"==typeof l?this._methodInfos[e]=l:delete this._methodInfos[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!1,writable:!1,value:t.bind(this.createProxy())})}removeCache(e){if(e in this._observableCache)return delete this._observableCache[e],!0;if(e in this._cache)return delete this._cache[e],!0;if(e in this._pending)return delete this._pending[e],!0;for(let t of this._delegates)if(t.removeCache(e))return!0}delegate(e){if(!(e instanceof ef))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)?console.warn(`[FlowContext] delegate - skip duplicate delegate: ${this._delegates.length}`):this._delegates.unshift(e)}addDelegate(e){if(!(e instanceof ef))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)||this._delegates.unshift(e)}clearDelegates(){this._delegates=[],this._metaNodeCache=new WeakMap}removeDelegate(e){if(!(e instanceof ef))throw Error("Delegate must be an instance of FlowContext");let t=this._delegates.indexOf(e);-1!==t&&this._delegates.splice(t,1)}_clearMetaNodeCacheFor(e){this._metaNodeCache.delete(e)}has(e){return!!this._props[e]}getPropertyMetaTree(e,t){let l=this._getPropertiesMeta();if(e){let l=(0,A.YB)(e);if(l&&l.length>0){let e=async(e,t,l)=>{try{let l="function"==typeof e?await e():e;if(!(null==l?void 0:l.properties))return[];let n=l.properties;if("function"==typeof n){let e=await n();l.properties=e,n=e}let o=(0,i._)(this,ea,eg).call(this,n,t,[],l);return Array.isArray(o)?o:await o()}catch(e){return console.warn(`Failed to load meta for ${l}:`,e),[]}},n=(0,i._)(this,es,ev).call(this,l);if(n){let[o,r,a]=n;if(1===l.length){if("function"==typeof r)return()=>e(r,a,o);if(r.properties){if("function"==typeof r.properties)return()=>e(r,a,o);let t=(0,i._)(this,ea,eg).call(this,r.properties,a,[],r);return Array.isArray(t)?t:[]}return[]}if("function"==typeof r){if(null==t?void 0:t.flatten)return()=>e(r,a,o);let l=(0,i._)(this,em,ew).call(this,a);return[(0,i._)(this,eh,eS).call(this,o,r,a,l)]}if(r.properties){let e=[...(0,i._)(this,em,ew).call(this,a),r.title],t=(0,i._)(this,ea,eg).call(this,r.properties,a,e,r);return Array.isArray(t)?t:[]}}return[]}if(null===l)return console.warn(`[FlowContext] getPropertyMetaTree - unsupported value format: "${e}". Only "{{ ctx.propertyName }}" format is supported. Returning empty meta tree.`),[]}return Object.entries(l).sort((e,t)=>{let[,l]=e,[,n]=t,o=("function"==typeof l?l.sort:null==l?void 0:l.sort)??0;return(("function"==typeof n?n.sort:null==n?void 0:n.sort)??0)-o}).map(e=>{let[t,l]=e;return(0,i._)(this,eh,eS).call(this,t,l,[t],[])})}async getApiInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.version||"v1",l=!!e.includeCompletion,n=this.createProxy(),o=e=>"string"==typeof e&&e.startsWith("_"),r=e=>"record"===e||"formValues"===e||"popup"===e,i=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=(()=>{var e,l,n,o,r,i,a,s;let d=(0,R.B)(this),u=R.F.resolve(t,d)||R.F.resolve(t,"*");if(!u)return{};let c=(null==(n=this)||null==(l=n.api)||null==(e=l.auth)?void 0:e.locale)||(null==(r=this)||null==(o=r.i18n)?void 0:o.language)||(null==(i=this)?void 0:i.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})(),s=e$(null==a?void 0:a.methods)?a.methods:{},d=e$(null==a?void 0:a.properties)?a.properties:{},u=e=>"string"==typeof e?{description:e}:e$(e)?e:void 0,c=(e,t)=>{let l="string"==typeof t?t:e$(t)&&"string"==typeof t.description?String(t.description):void 0;return l&&l.includes(`ctx.libs.${e}`)?`libs.${e}`:e},p=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},m=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["title","type","interface","description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},h=e=>{let t=new WeakSet,l=n=>{if(!n||"object"!=typeof n||t.has(n))return;if(t.add(n),Object.prototype.hasOwnProperty.call(n._methodInfos||{},e)){var o;return null==(o=n._methodInfos)?void 0:o[e]}let r=n._delegates;if(Array.isArray(r))for(let e of r){let t=l(e);if(t)return t}};return l(this)},f=async e=>{let t=this.getPropertyOptions(e);if(null==t?void 0:t.info)try{let e="function"==typeof t.info?t.info.call(n,n):t.info;return(i(e)?await e:e)??void 0}catch(e){return}},g=new Set,v=new Set;for(let e of Object.keys(d))g.add(e);for(let e of Object.keys(s))v.add(e);let y=(e,t)=>{if(e&&"object"==typeof e&&!t.has(e)){t.add(e);try{let t=e._props;if(t&&"object"==typeof t)for(let[e,l]of Object.entries(t))(null==l?void 0:l.info)&&g.add(e)}catch(e){}try{let t=e._methodInfos;if(t&&"object"==typeof t)for(let e of Object.keys(t))v.add(e)}catch(e){}try{let l=e._delegates;if(Array.isArray(l))for(let e of l)y(e,t)}catch(e){}}};y(this,new WeakSet);let x={};for(let e of g){if(o(e)||r(e))continue;let t=d[e],n=await f(e);if(void 0===t&&void 0===n)continue;let i=u(t),a=u(n),s={};if(s={...s={...s,...m(i)},...m(a)},delete s.properties,l||delete s.completion,!Object.keys(s).length)continue;let p=c(e,t);x[p]=x[p]?{...x[p]||{},...s||{}}:s}for(let e of v){if(o(e))continue;let t=s[e],n=h(e);if(void 0===t&&void 0===n)continue;let r=u(t),i={};i={...i={...i,...p(r)},...p(n)},delete i.properties,l||delete i.completion,Object.keys(i).length&&(i.type="function",x[e]?x[e]={...x[e]||{},...i||{}}:x[e]=i)}let b=u(d.libs),w=e$(null==b?void 0:b.properties)?b.properties:void 0;if(w)for(let[e,t]of Object.entries(w)){if(o(e))continue;let n=`libs.${e}`;if(x[n])continue;let r=u(t),i={};i={...i,...m(r)},delete i.properties,l||delete i.completion,i.description&&String(i.description).trim()&&(x[n]=i)}return x}async getEnvInfos(){var e,t,l;let n=this.createProxy(),o=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,r={},i=e=>{try{return e()}catch(e){return}},a=e=>null!=e&&("string"==typeof e?e.trim().length>0:!Array.isArray(e)||e.length>0),s=e=>{var t,l,n,o,r;let i={};if(!e)return i;let s=e;for(let e of["dataSourceKey","collectionName","associationName","filterByTk","sourceId"]){let t=null==s?void 0:s[e];a(t)&&(i[e]=t)}if(!("dataSourceKey"in i)){let e=null==(t=s.getDataSourceKey)?void 0:t.call(s);a(e)&&(i.dataSourceKey=e)}if(!("filterByTk"in i)){let e=null==(l=s.getFilterByTk)?void 0:l.call(s);a(e)&&(i.filterByTk=e)}if(!("filterByTk"in i)){let e=null==(n=s.getMeta)?void 0:n.call(s,"currentFilterByTk");a(e)&&(i.filterByTk=e)}if(!("sourceId"in i)){let e=null==(o=s.getSourceId)?void 0:o.call(s);a(e)&&(i.sourceId=e)}if(!("collectionName"in i)||!("associationName"in i)){let e=null==(r=s.getResourceName)?void 0:r.call(s),t="string"==typeof e?e.trim():"";if(t){let e=t.split(".").map(e=>e.trim()).filter(Boolean);1===e.length?"collectionName"in i||(i.collectionName=e[0]):e.length>=2&&("collectionName"in i||(i.collectionName=e[0]),"associationName"in i||(i.associationName=e.slice(1).join(".")))}}return i},d=await (async()=>{try{let e=n.popup;return o(e)?await e:e}catch(e){return}})(),u=i(()=>n.model),c=i(()=>n.blockModel),p=i(()=>{var e;return null==(e=n.view)?void 0:e.inputArgs}),m=i(()=>n.resource),h=s(null==d?void 0:d.resource),f=c,g=c?"ctx.blockModel":void 0,v=g?`${g}.resource`:void 0,y=s(null==f?void 0:f.resource),x=s(p),b=s(m),w=e=>{for(let t of e)if(a(t.value))return{value:t.value,getVar:t.getVar}},S=e=>a(e.collectionName)||a(e.dataSourceKey)||a(e.associationName),C=S(h)?"ctx.popup.resource":S(y)?v:S(x)?"ctx.view.inputArgs":S(b)?"ctx.resource":void 0,F=w([{value:null==h?void 0:h.collectionName,getVar:"ctx.popup.resource.collectionName"},{value:null==y?void 0:y.collectionName,getVar:`${v}.collectionName`},{value:null==x?void 0:x.collectionName,getVar:"ctx.view.inputArgs.collectionName"},{value:null==b?void 0:b.collectionName,getVar:"ctx.resource.collectionName"}]),k=w([{value:null==h?void 0:h.dataSourceKey,getVar:"ctx.popup.resource.dataSourceKey"},{value:null==y?void 0:y.dataSourceKey,getVar:`${v}.dataSourceKey`},{value:null==x?void 0:x.dataSourceKey,getVar:"ctx.view.inputArgs.dataSourceKey"},{value:null==b?void 0:b.dataSourceKey,getVar:"ctx.resource.dataSourceKey"}]),A=w([{value:null==h?void 0:h.associationName,getVar:"ctx.popup.resource.associationName"},{value:null==y?void 0:y.associationName,getVar:`${v}.associationName`},{value:null==x?void 0:x.associationName,getVar:"ctx.view.inputArgs.associationName"},{value:null==b?void 0:b.associationName,getVar:"ctx.resource.associationName"}]),P=w([{value:null==h?void 0:h.filterByTk,getVar:"ctx.popup.resource.filterByTk"},{value:null==y?void 0:y.filterByTk,getVar:`${v}.filterByTk`},{value:null==x?void 0:x.filterByTk,getVar:"ctx.view.inputArgs.filterByTk"},{value:null==b?void 0:b.filterByTk,getVar:"ctx.resource.filterByTk"}]),j=w([{value:null==h?void 0:h.sourceId,getVar:"ctx.popup.resource.sourceId"},{value:null==y?void 0:y.sourceId,getVar:`${v}.sourceId`},{value:null==x?void 0:x.sourceId,getVar:"ctx.view.inputArgs.sourceId"},{value:null==b?void 0:b.sourceId,getVar:"ctx.resource.sourceId"}]),M={},I=!1,T=null==F?void 0:F.value;a(T)&&(M.collectionName={description:"Collection name",getVar:(null==F?void 0:F.getVar)||(C?`${C}.collectionName`:void 0),value:T},I=!0);let R=null==k?void 0:k.value;a(R)&&(M.dataSourceKey={description:"Data source key",getVar:(null==k?void 0:k.getVar)||(C?`${C}.dataSourceKey`:void 0),value:R},I=!0);let E=null==A?void 0:A.value;a(E)&&(M.associationName={description:"Association name",getVar:(null==A?void 0:A.getVar)||(C?`${C}.associationName`:void 0),value:E},I=!0),I&&(a(null==P?void 0:P.value)&&(M.filterByTk={description:"Record filterByTk",getVar:(null==P?void 0:P.getVar)||(C?`${C}.filterByTk`:void 0)}),a(null==j?void 0:j.value)&&(M.sourceId={description:"Source record ID (sourceId)",getVar:(null==j?void 0:j.getVar)||(C?`${C}.sourceId`:void 0)}),r.resource={description:"Resource information",getVar:C,properties:M}),a(null==P?void 0:P.value)&&(r.record={description:"Current record",getVar:"ctx.record"});let N=e=>{try{let t=null==e?void 0:e.title;if("string"==typeof t&&t.trim())return t}catch(e){}try{var t,l;let n=null==e||null==(l=e.constructor)||null==(t=l.meta)?void 0:t.label;if("string"==typeof n&&n.trim())return n}catch(e){}};if(u){let t=N(u),l=u.uid,n=null==(e=u.constructor)?void 0:e.name,o=s(u.resource),i={},d=!1,c=o.collectionName;a(c)&&(i.collectionName={description:"Collection name",getVar:"ctx.model.resource.collectionName",value:c},d=!0);let p=o.dataSourceKey;a(p)&&(i.dataSourceKey={description:"Data source key",getVar:"ctx.model.resource.dataSourceKey",value:p},d=!0);let m=o.associationName;a(m)&&(i.associationName={description:"Association name",getVar:"ctx.model.resource.associationName",value:m},d=!0),r.flowModel={description:"Current FlowModel information",getVar:"ctx.model",properties:{...a(t)?{label:{description:"Flow model label",value:t}}:{},...a(n)?{modelClass:{description:"Flow model class name",value:n}}:{},...a(l)?{uid:{description:"Flow model uid",getVar:"ctx.model.uid",value:l}}:{},...d?{resource:{description:"Flow model resource",getVar:"ctx.model.resource",properties:i}}:{}}}}if((null==d?void 0:d.uid)&&(r.popup={description:"Current popup information",getVar:"ctx.popup",properties:{uid:{description:"Popup uid",getVar:"ctx.popup.uid",value:d.uid},...(null==d?void 0:d.record)?{record:{description:"Popup record",getVar:"ctx.popup.record"}}:{},...(null==d?void 0:d.sourceRecord)?{sourceRecord:{description:"Popup source record",getVar:"ctx.popup.sourceRecord"}}:{}}}),f){let e=N(f),l=f.uid,n=null==(t=f.constructor)?void 0:t.name,o={},i=!1,s=y.collectionName;a(s)&&(o.collectionName={description:"Collection name",getVar:`${v}.collectionName`,value:s},i=!0);let d=y.dataSourceKey;a(d)&&(o.dataSourceKey={description:"Data source key",getVar:`${v}.dataSourceKey`,value:d},i=!0);let u=y.associationName;a(u)&&(o.associationName={description:"Association name",getVar:`${v}.associationName`,value:u},i=!0),r.block={description:"Current block information",getVar:g,properties:{...a(e)?{label:{description:"Block label",value:e}}:{},...a(n)?{modelClass:{description:"Block model class name",value:n}}:{},...a(l)?{uid:{description:"Block uid",getVar:`${g}.uid`,value:l}}:{},...i?{resource:{description:"Block resource",getVar:v,properties:o}}:{}}}}let D=(()=>{let e=null==d?void 0:d.uid;if(a(e))return String(e).trim();let t=null==p?void 0:p.viewUid;if(a(t))return String(t).trim()})(),B=i(()=>n.engine),$=D?null==B?void 0:B.getModel(D,!0):void 0,O=e=>{var t;return(null==(t=e.context)?void 0:t.blockModel)===e};if($){let e=[$],t=[];for(let n=0;n<e.length;n++){let o=e[n];if(O(o)){let e=(null==(l=o.constructor)?void 0:l.name)||o.uid,n=N(o)||e||o.uid,r=s(o.resource),i={};a(r.dataSourceKey)&&(i.dataSourceKey=r.dataSourceKey),a(r.collectionName)&&(i.collectionName=r.collectionName),a(r.associationName)&&(i.associationName=r.associationName);let d={uid:o.uid,label:n,modelClass:e,...Object.keys(i).length>0?{resource:i}:{}};t.push(d)}let r=o.subModels;if(r&&"object"==typeof r)for(let t of Object.values(r))t&&(Array.isArray(t)?e.push(...t):e.push(t))}t.length&&(r.currentViewBlocks={description:"Current view blocks",value:t})}return r}async getVarInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxDepth??3,l=Number.isFinite(t)?Math.max(1,Math.floor(t)):3,n="v1",o=this.createProxy(),r=e=>"string"==typeof e&&e.startsWith("_"),i=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=new WeakMap,s=async e=>{if(!e)return;if("function"!=typeof e)return e;let t=a.get(e);return t||(t=(async()=>{let t=e.call(o,o);return(i(t)?await t:t)||null})(),a.set(e,t)),await t||void 0},d=e=>{if("string"!=typeof e)return;let t=e.trim();if(!t)return;let l=(0,A.YB)(t);return Array.isArray(l)&&l.length>0?l.join("."):"ctx"===t?"":t.startsWith("ctx.")?t.slice(4).trim():t},u=(()=>{let t=e.path;return("string"==typeof t?[t]:Array.isArray(t)?t:[]).map(e=>d(String(e))).filter(e=>"string"==typeof e&&e.length>0)})(),c=(()=>{let t=e.path;return"string"==typeof t?""===d(t):!!Array.isArray(t)&&t.some(e=>""===d(String(e)))})(),p=(()=>{var e,t,l,o,r,i,a,s;let d=(0,R.B)(this),u=R.F.resolve(n,d)||R.F.resolve(n,"*");if(!u)return{};let c=(null==(l=this)||null==(t=l.api)||null==(e=t.auth)?void 0:e.locale)||(null==(r=this)||null==(o=r.i18n)?void 0:o.language)||(null==(i=this)?void 0:i.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})();e$(null==p?void 0:p.methods)&&p.methods,e$(null==p?void 0:p.properties)&&p.properties;let m=e=>"string"==typeof e?{description:e}:e$(e)?e:void 0,h=async(e,t)=>{if(void 0!==e){if("boolean"==typeof e)return e;if("function"==typeof e)try{let l=t(e);return i(l)?!!await l:!!l}catch(e){return!1}return!!e}},f=async(e,t)=>{if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)try{let l=t(e),n=i(l)?await l:l;if("string"==typeof n)return n;return null==n?void 0:String(n)}catch(e){return}return String(e)}},g=async e=>{let t=!1,l=[];try{if("boolean"==typeof e)t=e;else if(Array.isArray(e))l=e;else if("function"==typeof e){let n=e(o),r=i(n)?await n:n;"boolean"==typeof r?t=r:Array.isArray(r)&&(l=r)}}catch(e){t=!1,l=[]}let n=[];if(Array.isArray(l))for(let e of l){if("string"!=typeof e)continue;let t=e.trim();!(!t||"ctx"===t||t.startsWith("ctx."))&&(/\s/.test(t)||n.push(t))}return{hideSelf:!!t,hideSubpaths:n}},v=(e,t)=>{if(!e)return!1;let l=e.split(".").filter(Boolean);for(;l.length;){if(t.has(l.join(".")))return!0;l.pop()}return!1},y=e=>{let t=m(e);if(!t)return{};let l={};for(let e of["title","type","interface","description","examples","completion","ref","params","returns"]){let n=t[e];void 0!==n&&(l[e]=n)}return Array.isArray(l.examples)&&(l.examples=l.examples.filter(e=>"string"==typeof e&&e.trim())),l},x=async e=>{let t,n,{docNode:i,metaNode:a,infoNode:d,depth:u,pathFromRoot:c,hiddenPrefixes:p}=e,b=c.join(".");if(v(b,p))return;let w=m(i),S=m(d),C=await g(null==w?void 0:w.hidden);if(C.hideSelf)return;let F=await g(null==S?void 0:S.hidden);if(F.hideSelf)return;let k=await s(a);if(await h(null==k?void 0:k.hidden,e=>e.call(k,o)))return;let A=new Set(p);for(let e of[...C.hideSubpaths,...F.hideSubpaths]){let t=e.trim();if(!t)continue;let l="ctx"===t?"":t.startsWith("ctx.")?t.slice(4):t;if(!l)continue;let n=b?`${b}.${l}`:l;A.add(n)}let P=await h(null==w?void 0:w.disabled,e=>e(o)),j=await f(null==w?void 0:w.disabledReason,e=>e(o)),M=await h(null==k?void 0:k.disabled,e=>e.call(k,o)),I=await f(null==k?void 0:k.disabledReason,e=>e.call(k,o)),T=await h(null==S?void 0:S.disabled,e=>e(o)),R=await f(null==S?void 0:S.disabledReason,e=>e(o)),E=void 0!==T?T:void 0!==M?M:P,N=void 0!==R?R:void 0!==I?I:j,D={};if(D={...D={...D={...D,...y(w)},...y(k)},...y(S)},void 0!==E&&(D.disabled=!!E),void 0!==N&&(D.disabledReason=N),u>=l)return Object.keys(D).length?D:void 0;let B=e$(null==w?void 0:w.properties)?w.properties:void 0;if(null==k?void 0:k.properties)try{let e=k.properties;if("function"==typeof e){let l=await e.call(k,o);k.properties=l,t=l}else e$(e)&&(t=e)}catch(e){t=void 0}if(e$(S)&&(null==S?void 0:S.properties))try{let e=S.properties;if("function"==typeof e){let t=await e.call(S,o);S.properties=t,n=t}else e$(e)&&(n=e)}catch(e){n=void 0}let $=new Set;if(B)for(let e of Object.keys(B))$.add(e);if(t)for(let e of Object.keys(t))$.add(e);if(n)for(let e of Object.keys(n))$.add(e);if(!$.size)return Object.keys(D).length?D:void 0;let O={};for(let e of $){if(r(e))continue;let l=await x({docNode:null==B?void 0:B[e],metaNode:null==t?void 0:t[e],infoNode:null==n?void 0:n[e],depth:u+1,pathFromRoot:[...c,e],hiddenPrefixes:A});l&&(O[e]=l)}if(Object.keys(O).length&&(D.properties=O),Object.keys(D).length)return D},b=async e=>{if(!e.length)return;let[t,...l]=e,n=this.getPropertyOptions(t);if(null==n?void 0:n.meta)try{if(!l.length)return n.meta;let e=await s(n.meta);if(!e)return;for(let t=0;t<l.length;t++){let n=l[t],r=null==e?void 0:e.properties;if(!r)break;if("function"==typeof r){let t=await r.call(e,o);e.properties=t,r=t}if(!r||"object"!=typeof r)break;let i=null==r?void 0:r[n];if(!i)break;if(t===l.length-1)return i;let a=await s(i);if(!a)break;e=a}return}catch(e){return}};if(!c&&u.length){let e={};for(let t of u){let l=t.split(".").map(e=>e.trim()).filter(Boolean);if(l.some(e=>r(e))||!l.length)continue;let n=await b(l),o=await x({docNode:void 0,metaNode:n,infoNode:void 0,depth:1,pathFromRoot:[],hiddenPrefixes:new Set});o&&(e[t]=o)}return e}let w=this._getPropertiesMeta(),S={};for(let[e,t]of Object.entries(w)){if(r(e))continue;let l=await x({docNode:void 0,metaNode:t,infoNode:void 0,depth:1,pathFromRoot:[e],hiddenPrefixes:new Set});l&&(S[e]=l)}return S}_getPropertiesMeta(){let e={};for(let t of this._delegates)Object.assign(e,t._getPropertiesMeta());for(let[t,l]of Object.entries(this._props))l.meta&&(e[t]=(l.meta,l.meta));return e}_getOwnProperty(e,t){let l=this._props[e];if(l){if("value"in l)return"api"===e?(0,I.k)(l.value,t):l.value;if(l.get){if(!1===l.cache){let n=l.get(t);return"api"===e?(0,I.k)(n,t):n}let n=l.observable?"_observableCache":"_cache";if(e in this[n])return"api"===e?(0,I.k)(this[n][e],t):this[n][e];if(this._pending[e])return this._pending[e];let o=l.get(this.createProxy());return"object"==typeof o&&null!==o&&"function"==typeof o.then||"function"==typeof o&&"function"==typeof o.then?(this._pending[e]=o.then(l=>(this[n][e]=l,delete this._pending[e],"api"===e?(0,I.k)(l,t):l),t=>{throw delete this._pending[e],t}),this._pending[e]):(this[n][e]=o,"api"===e?(0,I.k)(o,t):o)}}}_getOwnMethod(e,t){let l=this._methods[e];return"function"==typeof l?l.bind(t):l}_findPropertyInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return l._props[t];let e=this._findPropertyInDelegates(l._delegates,t);if(void 0!==e)return e}}_findInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return{result:l._getOwnProperty(t,this.createProxy())};if(Object.prototype.hasOwnProperty.call(l._methods,t))return{result:l._getOwnMethod(t,this.createProxy())};let e=this._findInDelegates(l._delegates,t);if(void 0!==e)return e}}_hasInDelegates(e,t){for(let l of e)if(Object.prototype.hasOwnProperty.call(l._props,t)||Object.prototype.hasOwnProperty.call(l._methods,t)||this._hasInDelegates(l._delegates,t))return!0;return!1}getPropertyOptions(e){return Object.prototype.hasOwnProperty.call(this._props,e)?this._props[e]:this._findPropertyInDelegates(this._delegates,e)}constructor(){return(0,a._)(this,ea),(0,a._)(this,es),(0,a._)(this,ed),(0,a._)(this,eu),(0,a._)(this,ec),(0,a._)(this,ep),(0,a._)(this,em),(0,a._)(this,eh),(0,o._)(this,ei,{writable:!0,value:void 0}),this._props={},this._methods={},this._methodInfos={},this._cache={},this._observableCache=s.observable.shallow({}),this._delegates=[],this._pending={},(0,r._)(this,ei,null),this._metaNodeCache=new WeakMap,this.createProxy()}}function eg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0;return"function"==typeof e?async()=>{let o=await e();n&&(n.properties=o);let r=Object.entries(o);return r.sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}),r.map(e=>{let[n,o]=e;return(0,i._)(this,eh,eS).call(this,n,o,[...t,n],l)})}:Object.entries(e).sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}).map(e=>{let[n,o]=e;return(0,i._)(this,eh,eS).call(this,n,o,[...t,n],l)})}function ev(e){if(0===e.length)return null;let[t,...l]=e,n=this._props[t];if(null==n?void 0:n.meta)return(0,i._)(this,eu,ex).call(this,t,n.meta,l,[t]);let o=(0,i._)(this,ed,ey).call(this,this._delegates,t);return o?(0,i._)(this,eu,ex).call(this,t,o,l,[t]):null}function ey(e,t){for(let l of e){let e=l._props[t];if(null==e?void 0:e.meta)return e.meta;let n=(0,i._)(this,ed,ey).call(this,l._delegates,t);if(n)return n}return null}function ex(e,t,l,n){if(0===l.length)return[e,t,n];if("function"==typeof t)return[l[l.length-1],async()=>{let e=await t();return await (0,i._)(this,ep,eb).call(this,e,l)},[...n,...l]];if(t.properties){let[e,...o]=l,r=[...n,e];if("function"==typeof t.properties)return[l[l.length-1],async()=>{let l=t.properties,n=await l();t.properties=n;let r=n[e];if(!r)throw Error(`Property ${e} not found in resolved properties`);return await (0,i._)(this,ep,eb).call(this,r,o)},[...n,...l]];let a=t.properties[e];if(a)return(0,i._)(this,eu,ex).call(this,e,a,o,r)}return null}async function eb(e,t){if(0===t.length)return e;let l=e;for(let e of t){let n=p().get(l,"properties");if(!n)throw Error(`Property path not found: ${t.join(".")}`);if("function"==typeof n){let e=await n();l.properties=e,n=e}let o=n[e];if(!o)throw Error(`Property ${e} not found while resolving path: ${t.join(".")}`);l=o}return l}function ew(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(0===e.length)return[];let l=t?e.slice(0,-1):e;if(0===l.length)return[];let n=[],o=this._getPropertiesMeta();for(let e=0;e<l.length;e++){let t=l[e],r=o[t];if(!r||"function"==typeof r){n.push(t);break}if(n.push(r.title||t),e<l.length-1&&r.properties&&"function"!=typeof r.properties)o=r.properties;else if(e<l.length-1){for(let t=e+1;t<l.length;t++)n.push(l[t]);break}}return n}function eS(e,t){let l,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[e],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=this._metaNodeCache.get(t);if(r)return r.paths=n,r.parentTitles=o.length>0?o:void 0,r;let a=e=>{if(!e)return{disabled:!1,hidden:!1};let t="function"==typeof e.disabled?e.disabled():e.disabled,l="function"==typeof e.disabledReason?e.disabledReason():e.disabledReason,n="function"==typeof e.hidden?e.hidden():e.hidden;return{disabled:!(t&&"function"==typeof t.then)&&!!t,reason:l&&"function"==typeof l.then?void 0:l,hidden:!(n&&"function"==typeof n.then)&&!!n}};if("function"==typeof t){let r=e,s=t.hasChildren;l={name:e,title:t.title||r,type:"object",interface:void 0,options:void 0,uiSchema:void 0,paths:n,parentTitles:o.length>0?o:void 0,disabled:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).disabled},disabledReason:()=>{let e=t();if(!e||"function"!=typeof e.then)return a(e).reason},hidden:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).hidden},children:!1===s?void 0:async()=>{try{let r=await t(),a=(null==r?void 0:r.title)||e;if(l.title=a,l.type=null==r?void 0:r.type,l.interface=null==r?void 0:r.interface,l.options=null==r?void 0:r.options,l.uiSchema=null==r?void 0:r.uiSchema,!(null==r?void 0:r.properties))return[];let s=(0,i._)(this,ea,eg).call(this,r.properties,n,[...o,a],r),d=Array.isArray(s)?s:await s();return l.children=d,d}catch(t){return console.warn(`Failed to load meta for ${e}:`,t),[]}}}}else{let r=t.title,{disabled:s,reason:d,hidden:u}=a(t);l={name:e,title:r,type:t.type,interface:t.interface,options:t.options,uiSchema:t.uiSchema,paths:n,parentTitles:o.length>0?o:void 0,disabled:s,disabledReason:d,hidden:u,children:t.properties?(0,i._)(this,ea,eg).call(this,t.properties,n,[...o,r],t):void 0}}return this._metaNodeCache.set(t,l),l}class eC extends ef{constructor(){super(),this.defineMethod("getModel",(e,t)=>this.engine.getModel(e,t)),this.defineMethod("request",function(e){let t=this.app;return"string"==typeof(null==e?void 0:e.url)&&et(e.url,t)?d.A.request(e):this.api.request(e)}),this.defineMethod("runjs",async function(e,t,l){let{preprocessTemplates:n,...o}=l||{},r={...(null==o?void 0:o.globals)||{},...t||{}},i=await this.createJSRunner({...o||{},globals:r}),a=(0,F.R)({version:null==o?void 0:o.version,preprocessTemplates:n}),s=await (0,A.ji)(String(e??""),{preprocessTemplates:a});return i.run(s)},{description:"Execute a RunJS code string in the current Flow context.",detail:"(code: string, variables?: Record<string, any>, options?: JSRunnerOptions) => Promise<RunJSResult>",params:[{name:"code",type:"string",description:"RunJS code to execute."},{name:"variables",type:"Record<string, any>",optional:!0,description:"Additional globals."},{name:"options",type:"JSRunnerOptions",optional:!0,description:"Runner options."}],returns:{type:"Promise<{ success: boolean; value?: any; error?: any; timeout?: boolean }>"},completion:{insertText:"await ctx.runjs('return 1')"}})}}class eF extends eC{}let ek=["dataSourceKey","collectionName","associationName","filterByTk","sourceId","tabUid"];function eA(e,t){let l={};for(let n of t)void 0!==(null==e?void 0:e[n])&&(l[n]=e[n]);return l}function eP(e){return eA(e,ek)}function ej(e,t){for(let[l,n]of Object.entries(t))void 0===e[l]&&(e[l]=n)}class eM extends eC{constructor(e){if(!(e instanceof S.$))throw Error("Invalid FlowEngine instance");super(),this.engine=e,this.engine=e;const t=new w.zA;t.setFlowEngine(this.engine);const n=new w.qS({key:"main",displayName:"Main"});t.addDataSource(n),this.defineProperty("engine",{value:this.engine,info:{description:"FlowEngine instance.",detail:"FlowEngine"}}),this.defineProperty("sql",{get:e=>new k.tP(e),cache:!1,info:{description:"SQL helper (FlowSQLRepository).",detail:"FlowSQLRepository"}}),this.defineProperty("dataSourceManager",{value:t,info:{description:"DataSourceManager instance.",detail:"DataSourceManager"}});const o=new C(this);this.defineMethod("t",(e,t)=>o.translate(e,t)),this.defineProperty("locale",{get:()=>{var e,t,l;return(null==(t=this.api)||null==(e=t.auth)?void 0:e.locale)||(null==(l=this.i18n)?void 0:l.language)},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current language"),sort:970}),{title:(0,A.MI)("Current language"),sort:970,hasChildren:!1})}),this.defineMethod("renderJson",function(e){return this.resolveJsonTemplate(e)});const r=async function(e,t){let l=(0,A.nN)(e),n=Object.keys(l||{});if(!n.length)return(0,A.M)(e,this);let o={};for(let e of n){let t=l[e]||[],n=this.getPropertyOptions(e),r=null==n?void 0:n.resolveOnServer;if(!0===r)o[e]=t;else if("function"==typeof r){let l=t.filter(e=>{try{return!!r(e)}catch(e){return!1}});l.length&&(o[e]=l)}}let r=Object.keys(o).length>0,i=e;if(r){let l=e=>{let t=(0,T.XU)(e);if(t)return t;try{var l,n,o,r,i,a,s,d,u,c,p,m,h;let t=null==e||null==(n=e.resource)||null==(l=n.getMeta)?void 0:l.call(n,"currentFilterByTk");if(null==t)return;let f=(null==e||null==(o=e.collection)?void 0:o.name)||(null==e||null==(c=e.resource)||null==(u=c.getResourceName)||null==(d=u.call(c))||null==(s=d.split)||null==(a=s.call(d,"."))||null==(i=a.slice)||null==(r=i.call(a,-1))?void 0:r[0]);if(!f)return;let g=(null==e||null==(p=e.collection)?void 0:p.dataSourceKey)||(null==e||null==(h=e.resource)||null==(m=h.getDataSourceKey)?void 0:m.call(h));return{collection:f,dataSourceKey:g,filterByTk:t}}catch(e){return}},n=async()=>{let e={};try{var t,l;let n=null==(t=(l=this)._getPropertiesMeta)?void 0:t.call(l);if(!n||"object"!=typeof n)return e;for(let[t,l]of Object.entries(n))if(o[t])try{let n;if("function"==typeof l){let e=l;n=await e()}else n=l;if(!n||"object"!=typeof n)continue;let r=n.buildVariablesParams;if("function"!=typeof r)continue;let i=await r(this);if(!i)continue;let a=o[t]||[],s=en(i,a);s&&("object"!=typeof s||Object.keys(s).length)&&(e[t]=s)}catch(e){}}catch(e){}return e},r=await n(),u={...r},c=o.view||[];if(!u.view&&c.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let e=(0,T.Cg)(this);e&&(u.view={record:e})}try{let e="formValues",t=o[e]||[];if(t.length){let n=new Set;for(let e of t){let t=eo(e);t&&n.add(t)}let o=null==r?void 0:r[e],i=new Set;if(!o||"object"!=typeof o||Array.isArray(o)||el(o)||Object.keys(o).forEach(e=>i.add(e)),[...n].filter(e=>!i.has(e)).length){let n=l(this);if(n){let{generatedFields:l,generatedAppends:o}=er(t),r={...n,fields:l,appends:o},i=u[e];if(i&&"object"==typeof i&&!Array.isArray(i)&&!el(i)){for(let[t,l]of Object.entries(i))u[`${e}.${t}`]=l;delete u[e]}u[e]=r}}}}catch(e){}let p=Object.keys(u).length?(0,M.d)(this,u):void 0;if(!p){let t=Object.keys(o);if(t.length>0&&t.every(e=>{var t;return null==(t=this.getPropertyOptions(e))?void 0:t.serverOnlyWhenContextParams}))return(0,A.M)(e,this)}if(this.api){var a,s,d;try{let l=(0,j.pk)(this,null==t?void 0:t.contractModelUid);i=await (0,j.o4)(this,{...l?{contractRd:l}:{},rd:(0,j.pk)(this,null==(a=this.model)?void 0:a.uid),template:e,contextParams:p||{}})}catch(t){null==(d=this.logger)||null==(s=d.warn)||s.call(d,{err:t},"variables:resolve failed, fallback to client-only"),i=e}}}return(0,A.M)(i,this)};this.defineMethod("resolveJsonTemplate",r),this.defineMethod("getVar",async function(e){let t=("string"==typeof e?e:String(e??"")).trim();if(t){if("ctx"!==t&&!t.startsWith("ctx."))throw Error(`ctx.getVar(path) expects an expression starting with "ctx.", got: "${t}"`);return this.resolveJsonTemplate(`{{ ${t} }}`)}},'Resolve a ctx expression value by path (expression starts with "ctx.").'),this.defineProperty("requirejs",{get:()=>{var e,t;return null==(t=this.app)||null==(e=t.requirejs)?void 0:e.requirejs}}),this.defineProperty("token",{get:()=>{var e,t;return null==(t=this.api)||null==(e=t.auth)?void 0:e.token},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("API Token"),sort:980}),{title:"API Token",sort:980,hasChildren:!1})}),this.defineProperty("role",{get:()=>{var e,t,l;let n=null==(t=this.api)||null==(e=t.auth)?void 0:e.role;if("__union__"!==n)return n;let o=null==(l=this.user)?void 0:l.roles;return Array.isArray(o)?o.map(e=>null==e?void 0:e.name).filter(e=>!!e):[]},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current role"),sort:990}),{title:(0,A.MI)("Current role"),sort:990,hasChildren:!1})}),this.defineProperty("urlSearchParams",{cache:!1,get:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return h().parse(l)||{}},meta:Object.assign(()=>({type:"object",title:this.t("URL search params"),sort:970,disabled:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return 0===Object.keys(h().parse(l)||{}).length},disabledReason:()=>this.t("The value of this variable is derived from the query string of the page URL. This variable can only be used normally when the page has a query string."),properties:async()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t,n=h().parse(l)||{},o={};for(let e of Object.keys(n))o[e]={type:"string",title:e};return o}}),{title:(0,A.MI)("URL search params"),sort:970,hasChildren:!0})}),this.defineProperty("logger",{get:()=>this.engine.logger.child({module:"flow-engine"})}),this.defineProperty("auth",{get:()=>{var e,t,l,n,o,r;return{roleName:null==(t=this.api)||null==(e=t.auth)?void 0:e.role,locale:null==(n=this.api)||null==(l=n.auth)?void 0:l.locale,token:null==(r=this.api)||null==(o=r.auth)?void 0:o.token,user:this.user}},cache:!1}),this.defineProperty("date",{get:()=>{let e=t=>new Proxy({},{get:(l,n)=>{if("string"!=typeof n)return;let o=[...t,n];if(!(0,A.JE)(o))return;let r=(0,A.Vv)(o);return void 0!==r?r:e(o)}});return e(["date"])},cache:!1}),this.defineMethod("loadCSS",async e=>{let t=(0,A.i)(e);return new Promise((e,l)=>{if(document.querySelector(`link[href="${t}"]`))return void e(null);let n=document.createElement("link");n.rel="stylesheet",n.href=t,n.onload=()=>e(null),n.onerror=()=>l(Error(`Failed to load CSS: ${t}`)),document.head.appendChild(n)})},{description:"Load a CSS file by URL (browser only).",params:[{name:"href",type:"string",description:"CSS URL."}],returns:{type:"Promise<void>"},completion:{insertText:"await ctx.loadCSS('https://example.com/style.css')"},examples:["await ctx.loadCSS('https://example.com/style.css');"]}),this.defineMethod("requireAsync",async e=>{if((0,A.yp)(e))return this.loadCSS(e);let t=(0,A.i)(e,{raw:!0});return await W(this.requirejs,t)}),this.defineMethod("importAsync",async function(e){return(0,A.yp)(e)?this.loadCSS(e):await Z(this,e,{importer:H})}),this.defineMethod("createJSRunner",async function(e){try{let e=await Promise.resolve().then(l.bind(l,88828));"function"==typeof(null==e?void 0:e.setupRunJSContexts)&&await e.setupRunJSContexts()}catch(e){}let t=(null==e?void 0:e.version)||"v1",n=(0,R.B)(this),o=R.F.resolve(t,n)||eY,r=new o(this);r.defineMethod("t",(e,t)=>this.t(e,{ns:"runjs",...t}));let i={};try{var a,s,d,u,c,p,m,h;let e=(null==(d=this)||null==(s=d.api)||null==(a=s.auth)?void 0:a.locale)||(null==(c=this)||null==(u=c.i18n)?void 0:u.language)||(null==(p=this)?void 0:p.locale);i=(null==o||null==(m=o.getDoc)?void 0:m.length)?o.getDoc(e)||{}:(null==o||null==(h=o.getDoc)?void 0:h.call(o))||{}}catch(e){i={}}let f={ctx:eK(r,{doc:i}),...(null==e?void 0:e.globals)||{}},{timeoutMs:g}=e||{};return new F.I({globals:f,timeoutMs:g})}),this.defineMethod("buildServerContextParams",function(e){return(0,M.d)(this,e)}),this.defineMethod("getAction",function(e){return this.engine.getAction(e)}),this.defineMethod("getActions",function(){return this.engine.getActions()}),this.defineMethod("getEvents",function(){return this.engine.getEvents()}),this.defineMethod("runAction",async function(e,t){let l=this.engine.getAction(e),n=await (0,E.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let o={...await (0,A.gG)(l.defaultParams,n)||{},...t||{}},r=l.useRawParams;if("function"==typeof r&&(r=await r(n)),r||(o=await n.resolveJsonTemplate(o)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,o)}),this.defineProperty("acl",{get:()=>new x(this.engine)}),this.defineMethod("aclCheck",function(e){return!!this.skipAclCheck||this.acl.aclCheck(e)}),this.defineMethod("createResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("makeResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("initResource",function(e){return this.has("resource")||this.defineProperty("resource",{get:()=>this.createResource(e)}),this.resource}),this.defineMethod("useResource",function(e){return this.initResource(e)})}}class eI extends eF{constructor(e){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),this.addDelegate(e.flowEngine.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{value:e,info:{description:"Current FlowModel instance.",detail:"FlowModel"}});const t=(0,f.createRef)();this.defineProperty("ref",{get:()=>(this.model._refCreated=!0,t),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}}),this.defineMethod("openView",async function(e,t){var l,n,o,r;let i={..."function"==typeof(null==(l=this.model)?void 0:l.getInputArgs)?eP(this.model.getInputArgs()):{},...eP(this.inputArgs)},a={...t||{}};ej(a,i),(a.defineProperties||a.defineMethods)&&(a.navigation=!1);let s=null;(s=await this.engine.loadModel({uid:e}))||(s=this.engine.createModel({uid:e,use:"PopupActionModel",parentId:this.model.uid,subType:"object",subKey:e,stepParams:{popupSettings:{openView:{...eA(a,["dataSourceKey","collectionName","associationName","mode","size"])}}}}),await s.save()),s.setParent(this.model);let d=(null==a?void 0:a.routeViewUid)??(null==a?void 0:a.viewUid)??((null==(o=s.stepParams)||null==(n=o.popupSettings)?void 0:n.openView)?s.uid:this.model.uid),u=this.view,c={type:(null==a?void 0:a.isMobileLayout)?"embed":(null==a?void 0:a.mode)||"drawer",inputArgs:{...a,viewUid:d,navigation:a.navigation},navigation:null==u?void 0:u.navigation,preventClose:!!(null==a?void 0:a.preventClose),engineCtx:this.engine.context};s.context.defineProperty("view",{value:c});let p=null==(r=s.getFlow)?void 0:r.call(s,"popupSettings"),m=null==p?void 0:p.on,h="click";"string"==typeof m&&m?h=m:m&&"object"==typeof m&&"string"==typeof m.eventName&&m.eventName&&(h=m.eventName),await s.dispatchEvent(h,{...a})}),this.defineMethod("getEvents",function(){return this.model.getEvents()}),this.defineMethod("getAction",function(e){return this.model.getAction(e)}),this.defineMethod("getActions",function(){return this.model.getActions()}),this.defineMethod("runAction",async function(e,t){let l=this.model.getAction(e),n=await (0,E.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let o={...await (0,A.gG)(l.defaultParams,n)||{},...t||{}},r=l.useRawParams;if("function"==typeof r&&(r=await r(n)),r||(o=await n.resolveJsonTemplate(o)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,o)})}}class eT extends eF{constructor(e,t){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),this.master=e,this.fork=t,this.addDelegate(this.master.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{get:()=>this.fork,info:{description:"Current ForkFlowModel instance (as model).",detail:"ForkFlowModel"}});const l=(0,f.createRef)();this.defineProperty("ref",{get:()=>(this.fork._refCreated=!0,l),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}})}}class eR extends eF{_getOwnProperty(e){if("runtime"===this.mode)return super._getOwnProperty(e,this.createProxy());let t=this._props[e];if(t){if("value"in t)return b.create()[e];if(t.get){if(!1===t.cache)return b.create()[e];let l=t.observable?"_observableCache":"_cache";return e in this[l]||(this[l][e]=b.create()[e]),this[l][e]}}}exit(){throw new P.zz(this.flowKey,this.model.uid)}exitAll(){throw new P.zz(this.flowKey,this.model.uid)}get mode(){return this._mode}constructor(e,t,l="runtime"){super(),this.model=e,this.flowKey=t,this._mode=l,this.stepResults={},this.addDelegate(this.model.context),this.defineMethod("getStepParams",l=>e.getStepParams(t,l)||{}),this.defineMethod("setStepParams",(l,n)=>e.setStepParams(t,l,n)),this.defineMethod("getStepResults",e=>p().get(this.steps,[e,"result"])),this.defineMethod("initResource",t=>{e.context.has("resource")?console.log(`[FlowRuntimeContext] useResource - resource already defined in context: ${t}`):(e.context.defineProperty("resource",{get:()=>this.makeResource(t)}),e.resource||(e.resource=e.context.resource))}),this.defineMethod("useResource",e=>this.initResource(e)),this.defineProperty("resource",{get:()=>e.resource||e.context.resource,cache:!1}),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)})}}let eE=new WeakMap,eN=new WeakMap,eD=new WeakMap;function eB(e,t){if(null===t)return;if(Array.isArray(e)||Array.isArray(t)||"object"!=typeof e||"object"!=typeof t)return t??e;let l={...e};for(let n of Object.keys(t)){let o=eB(null==e?void 0:e[n],t[n]);void 0===o?delete l[n]:l[n]=o}return l}function e$(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function eO(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function eq(e){return!0===e||(e&&e$(e)?e:void 0)}function eL(e,t,l){if(!Array.isArray(t)||!t.length)return;let n=e;for(let e of t){if(!e)return;n.children=n.children||{},n.children[e]=n.children[e]||{},n=n.children[e]}n.deprecated=l}function e_(e,t){void 0!==t.deprecated&&(e.deprecated=t.deprecated);let l=t.children||{},n=Object.keys(l);if(n.length)for(let t of(e.children=e.children||{},n))e.children[t]=e.children[t]||{},e_(e.children[t],l[t])}function eV(e){let t={};if(!e)return t;let l=(e,n)=>{if(e$(e))for(let[o,r]of Object.entries(e)){if(!o||!r||"object"!=typeof r||Array.isArray(r))continue;let e=r,i=eq(e.deprecated);i&&eL(t,[...n,o],i),e$(e.properties)&&l(e.properties,[...n,o])}},n=e=>{if(e$(e))for(let[l,n]of Object.entries(e)){if(!l||!n||"object"!=typeof n||Array.isArray(n))continue;let e=eq(n.deprecated);e&&eL(t,[l],e)}};return l(e.properties,[]),n(e.methods),t}function ez(e){let t={},l=new WeakSet,n=(e,l)=>{if(e$(l))for(let[o,r]of Object.entries(l)){if(!o||"string"==typeof r||!r||"object"!=typeof r||Array.isArray(r))continue;let l=r,i=eq(l.deprecated);i&&eL(t,[...e,o],i),e$(l.properties)&&n([...e,o],l.properties)}},o=e=>{if(!e||"object"!=typeof e&&"function"!=typeof e||l.has(e))return;l.add(e);let r=e._methodInfos;if(e$(r))for(let[e,l]of Object.entries(r)){if(!e||!l||"object"!=typeof l||Array.isArray(l))continue;let n=eq(l.deprecated);n&&eL(t,[e],n)}let i=e._props;if(e$(i))for(let[e,l]of Object.entries(i)){if(!e)continue;let o=null==l?void 0:l.info;if(!o||"object"!=typeof o||Array.isArray(o))continue;let r=eq(o.deprecated);r&&eL(t,[e],r),e$(o.properties)&&n([e],o.properties)}let a=e._delegates;if(Array.isArray(a))for(let e of a)o(e)};return o(e),t}function eK(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=eV(t.doc);e_(l,ez(e));let n=new Set,o=new WeakMap,r=new WeakMap,i=new WeakMap,a=e=>{if(!e||"string"!=typeof e)return{};let t=2;for(let l of e.split("\n")){if(!l)continue;let e=l.match(/<anonymous>:(\d+):(\d+)/);if(!e)continue;let n=Number(e[1]),o=Number(e[2]);return{line:Number.isFinite(n)&&n>t?n-t:n,column:Number.isFinite(o)?o:void 0,rawLine:n,rawColumn:o}}return{}},s=(e,t)=>{if(e$(t))for(let[n,o]of Object.entries(t)){if(!n||"string"==typeof o||!o||"object"!=typeof o||Array.isArray(o))continue;let t=o,r=eq(t.deprecated);r&&eL(l,[...e,n],r),e$(t.properties)&&s([...e,n],t.properties)}},d=(e,t)=>{if(!e)return;let n=null==t?void 0:t.info;if(!n||"object"!=typeof n||Array.isArray(n))return;let o=eq(n.deprecated);o&&eL(l,[e],o),e$(n.properties)&&s([e],n.properties)},u=(e,t)=>{if(!e||!t||"object"!=typeof t||Array.isArray(t))return;let n=eq(t.deprecated);n&&eL(l,[e],n)},c=e=>{let t=e;for(;t&&("object"==typeof t||"function"==typeof t);){let e=o.get(t);if(!e)break;t=e}return t},p=e=>{if(e){if("string"==typeof e)return e.trim()||void 0;if(Array.isArray(e)){let t=e.map(e=>"string"==typeof e?e.trim():"").filter(Boolean);return t.length?t.join(", "):void 0}}},m=(t,l,o)=>{if(!t||n.has(t))return;n.add(t);let r=null==e?void 0:e.logger,i="function"==typeof(null==e?void 0:e.t)?(t,l)=>e.t(t,{ns:[A.u4,"client"],nsMode:"fallback",...l}):(e,t)=>{let l=(null==t?void 0:t.defaultValue)??e;return"string"==typeof l&&t?l.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(e,l)=>{let n=null==t?void 0:t[l];return"string"==typeof n||"number"==typeof n?String(n):""}):l},s="object"==typeof l&&l?l:{},d=p(s.replacedBy),u="string"==typeof s.since?String(s.since):void 0,c="string"==typeof s.removedIn?String(s.removedIn):void 0,m="string"==typeof s.message?String(s.message):"",h=a(o),f=h.line?`(line ${h.line}${h.column?`:${h.column}`:""})`:"",g=m.trim(),v=g?i("RunJS deprecated warning with message",{defaultValue:"[RunJS][Deprecated] {{api}} {{message}}{{location}}",api:t,message:g,location:f}):i("RunJS deprecated warning",{defaultValue:"[RunJS][Deprecated] {{api}} is deprecated{{location}}",api:t,location:f}),y=i("RunJS deprecated separator",{defaultValue:"; "}),x=[v];d&&x.push(i("RunJS deprecated replacedBy",{defaultValue:"Use {{replacedBy}} instead",replacedBy:d})),u&&x.push(i("RunJS deprecated since",{defaultValue:"since {{since}}",since:u})),c&&x.push(i("RunJS deprecated removedIn",{defaultValue:"will be removed in {{removedIn}}",removedIn:c}));let b=x.filter(Boolean).join(y);try{r&&"function"==typeof r.warn?r.warn(b):console.warn(b)}catch(e){}},h=(e,t,l)=>{let o=t.deprecated;if(!o)return e;let r=i.get(e)||new Map;if(i.set(e,r),r.has(l))return r.get(l);let a=new Proxy(e,{apply(e,t,r){let i=n.has(l)?void 0:Error().stack;return m(l,o,i),Reflect.apply(e,c(t),r)},get:(e,t,l)=>Reflect.get(e,t,l)});return r.set(l,a),a},f=(e,t,l)=>{if(!e||"object"!=typeof e&&"function"!=typeof e||eO(e)||!(t.children&&Object.keys(t.children).length>0)&&"ctx"!==l)return e;let i=r.get(e)||new Map;if(r.set(e,i),i.has(l))return i.get(l);let a=new Proxy(e,{get(e,o,r){var i;if("symbol"==typeof o)return Reflect.get(e,o,c(r));let a=String(o),s=Reflect.get(e,o,c(r));if("ctx"===l&&"defineProperty"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{d(String((null==t?void 0:t[0])??""),null==t?void 0:t[1])}catch(e){}return n};if("ctx"===l&&"defineMethod"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{u(String((null==t?void 0:t[0])??""),null==t?void 0:t[2])}catch(e){}return n};let p=null==(i=t.children)?void 0:i[a];if(!p)return s;let g=`${l}.${a}`;if("function"==typeof s&&p.deprecated)return h(s,p,g);if(p.deprecated){let e=n.has(g)?void 0:Error().stack;m(g,p.deprecated,e)}return s&&("object"==typeof s||"function"==typeof s)&&p.children?f(s,p,g):s},has:(e,t)=>Reflect.has(e,t)});return o.set(a,e),i.set(l,a),a};return f(e,l,"ctx")}function eU(e,t,l){if(!e$(t))return e;if(!e$(e))return t;let n={...e};for(let o of Object.keys(t)){let r=t[o];if(null===r){delete n[o];continue}let i=l(e$(e)?e[o]:void 0,r);void 0===i?delete n[o]:n[o]=i}return n}function eW(e,t){if(null===t)return;let l=e$(e),n=e$(t),o="string"==typeof e;if("string"==typeof t)return l?eW(e,{description:t}):t;if(n){let n=l?e:o?{description:e}:void 0,r={...n||{}};for(let e of Object.keys(t)){if("properties"===e){let e=t.properties;if(null===e){delete r.properties;continue}let l=eU(null==n?void 0:n.properties,e,eW);void 0===l?delete r.properties:r.properties=l;continue}let l=eB(null==n?void 0:n[e],t[e]);void 0===l?delete r[e]:r[e]=l}return r}return t??e}function eH(e,t){if(null===t)return;let l=e$(e),n=e$(t),o="string"==typeof e;if("string"==typeof t)return l?eH(e,{description:t}):t;if(n){let n=l?e:o?{description:e}:void 0,r={...n||{}};for(let e of Object.keys(t)){let l=eB(null==n?void 0:n[e],t[e]);void 0===l?delete r[e]:r[e]=l}return r}return t??e}function eG(e,t){let l=e$(e)?e:{},n=e$(t)?t:{},o={...l};for(let e of Object.keys(n)){if("properties"===e){let e=eU(l.properties,n.properties,eW);void 0===e?delete o.properties:o.properties=e;continue}if("methods"===e){let e=eU(l.methods,n.methods,eH);void 0===e?delete o.methods:o.methods=e;continue}let t=eB(l[e],n[e]);void 0===t?delete o[e]:o[e]=t}return o}class eY extends ef{exit(){var e;throw new P.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}exitAll(){var e;throw new P.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}static define(e,t){let l=null==t?void 0:t.locale;if(l){let t=eN.get(this)||new Map,n=t.get(l)||{};t.set(l,eG(n,e)),eN.set(this,t)}else{let t=eE.get(this)||{};eE.set(this,eG(t,e))}eD.delete(this)}static getDoc(e){let t=this,l=eD.get(t),n=String(e||"default");if(l&&l.has(n))return l.get(n);let o=[],r=t;for(;r&&r.prototype;)o.unshift(r),r=Object.getPrototypeOf(r);let i={};for(let e of o)i=eG(i,eE.get(e)||{});if(e)for(let t of o){let l=eN.get(t);l&&l.has(e)&&(i=eG(i,l.get(e)))}return l||(l=new Map,eD.set(t,l)),l.set(n,i),i}constructor(e){super(),this.addDelegate(e),this.defineProperty("React",{value:f}),this.defineProperty("antd",{value:u}),this.defineProperty("dayjs",{value:D()});const t={...v,createRoot:(e,t)=>{let l=(null==e?void 0:e.__el)||e;return this.engine.reactView.createRoot(l,t)}};t.__nbRunjsInternalShim=!0,this.defineProperty("ReactDOM",{value:t}),(0,B.oJ)(this),this.defineMethod("openView",async function(t,l){let n=e.openView;if("function"!=typeof n)throw Error("ctx.openView is not available in current context.");let o=(0,A.cg)(l);return n(t,o?{...l||{},[A.sU]:o}:l)}),this.defineMethod("render",function(e,t){let l=t||this.element;if(!l)throw Error("ctx.render: container not provided and ctx.element is not available");let n=(null==l?void 0:l.__el)||l,o=globalThis;o.__nbRunjsRoots=o.__nbRunjsRoots||new WeakMap;let r=o.__nbRunjsRoots,i=e=>{if(!e)return;if(e.disposeTheme&&"function"==typeof e.disposeTheme){try{e.disposeTheme()}catch(e){}e.disposeTheme=void 0}let t=e.root||e;if(t&&"function"==typeof t.unmount)try{t.unmount()}catch(e){}},a=()=>{let e=r.get(n);e&&(i(e),r.delete(n))};if("string"==typeof e)return a(),new y.x(n).innerHTML=String(e??""),null;if(e&&e.nodeType&&(1===e.nodeType||3===e.nodeType||11===e.nodeType)){for(a();n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(e),null}let s=this.ReactDOM,d=this,c=r.get(n);return c&&c.rendererKey===s&&c.ownerKey===d||(c&&(i(c),r.delete(n)),c={rendererKey:s,ownerKey:d,root:this.ReactDOM.createRoot(n),disposeTheme:void 0,lastVnode:void 0},r.set(n,c)),(0,B.$B)({ctx:this,entry:c,vnode:e,containerEl:n,rootMap:r,unmountContainerRoot:a,internalReact:f,internalAntd:u})})}}},48910(e,t,l){"use strict";l.d(t,{$:()=>eN});var n=l(88243),o=l(16213),r=l(95243),i=l(2543),a=l.n(i),s=l(81318),d=l.n(s),u=l(64171);class c extends u.Z{getAction(e){return this.actions.get(e)}getActions(){return new Map(this.actions)}}var p=l(26955);class m extends p.L{getEvent(e){return this.events.get(e)}getEvents(){return new Map(this.events)}}var h=l(29007),f=l(60182),g=l(31108),v=l(88439),y=l(62572);class x{async emitModelEventIf(e,t,l){e&&await this.engine.emitter.emitAsync(`model:event:${e}:${t}`,l)}async withApplyFlowCache(e,t){if(!e||!this.engine)return await t();let l=this.engine.applyFlowCache.get(e);if(l){if("resolved"===l.status)return l.data;if("rejected"===l.status)throw l.error;if("pending"===l.status)return await l.promise}let n=t().then(t=>(this.engine.applyFlowCache.set(e,{status:"resolved",data:t,promise:Promise.resolve(t)}),t)).catch(t=>{throw this.engine.applyFlowCache.set(e,{status:"rejected",error:t,promise:Promise.reject(t)}),t});return this.engine.applyFlowCache.set(e,{status:"pending",promise:n}),await n}async runFlow(e,t,l,n,o){var r;let i,s=e.getFlow(t);if(!s)return e.context.logger.error(`BaseModel.applyFlow: Flow with key '${t}' not found.`),Promise.reject(Error(`Flow '${t}' not found.`));let d=new h.W5(e,t);d.defineProperty("reactView",{value:e.reactView}),d.defineProperty("inputArgs",{value:{...l}}),d.defineProperty("runId",{value:n||`run-${Date.now()}`});let u=d.stepResults,c=e.getEvent("string"==typeof s.on?s.on:null==(r=s.on)?void 0:r.eventName);c&&((c={...c}).defaultParams={...a().get(s,"on.defaultParams",{}),...c.defaultParams});let p=c?{eventStep:c,...s.steps}:s.steps;(0,v.w)(d,p,e,t);let m=d.steps,x={uid:e.uid,model:e,runId:d.runId,inputArgs:l,flowKey:t};for(let[l,n]of(await this.emitModelEventIf(o,`flow:${t}:start`,x),Object.entries(p))){let r,a,s={},c=n.useRawParams;if(n.use){let o=e.getAction(n.use);if(!o){d.logger.error(`BaseModel.applyFlow: Action '${n.use}' not found for step '${l}' in flow '${t}'. Skipping.`);continue}a=await (0,y.v)(d,{...o,...n}),r=n.handler||o.handler,c=c??o.useRawParams;let i=await (0,f.gG)(o.defaultParams,a),u=await (0,f.gG)(n.defaultParams,a);s={...i,...u}}else{if(!n.handler)continue;a=await (0,y.v)(d,n),r=n.handler,s={...await (0,f.gG)(n.defaultParams,a)}}let p=e.getStepParams(t,l);void 0!==p&&(s={...s,...p}),"function"==typeof c&&(c=await c(a)),c||(s=await a.resolveJsonTemplate(s));try{if(!r){d.logger.error(`BaseModel.applyFlow: No handler available for step '${l}' in flow '${t}'. Skipping.`);continue}await this.emitModelEventIf(o,`flow:${t}:step:${l}:start`,{...x,stepKey:l});let e=r(a,s);i=!1!==n.isAwait?await e:e,u[l]=i,m[l].result=u[l],await this.emitModelEventIf(o,`flow:${t}:step:${l}:end`,{...x,result:i,stepKey:l})}catch(e){if(e instanceof f.sy||e instanceof g.zz||await this.emitModelEventIf(o,`flow:${t}:step:${l}:error`,{...x,error:e,stepKey:l}),e instanceof f.sy)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(o,`flow:${t}:step:${l}:end`,{...x,stepKey:l}),await this.emitModelEventIf(o,`flow:${t}:end`,{...x,result:u}),Promise.resolve(u);if(e instanceof g.zz)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(o,`flow:${t}:step:${l}:end`,{...x,stepKey:l,aborted:!0}),await this.emitModelEventIf(o,`flow:${t}:end`,{...x,result:e,aborted:!0}),Promise.resolve(e);return await this.emitModelEventIf(o,`flow:${t}:error`,{...x,error:e}),d.logger.error({err:e},`BaseModel.applyFlow: Error executing step '${l}' in flow '${t}':`),Promise.reject(e)}}return await this.emitModelEventIf(o,`flow:${t}:end`,{...x,result:u}),Promise.resolve(u)}async dispatchEvent(e,t,l,n){var o,r,i,a;let s="beforeRender"===t,d=!!(null==n?void 0:n.sequential),u=!!(null==n?void 0:n.useCache),c=s,p=`${e.uid}-${t}-${Date.now()}`,m=e.context.logger,h={uid:e.uid,model:e,runId:p,inputArgs:l};try{await this.emitModelEventIf(t,"start",h),await (null==(o=e.onDispatchEventStart)?void 0:o.call(e,t,n,l))}catch(o){if(s&&o instanceof f.sy)return m.debug(`[FlowModel.dispatchEvent] ${o.message}`),[];try{await (null==(r=e.onDispatchEventError)?void 0:r.call(e,t,n,l,o))}finally{m.error({err:o},`BaseModel.dispatchEvent: Start hook error for event '${t}'`)}if(c)throw o;return}let v=s?e.getEventFlows("beforeRender"):Array.from(e.getFlows().values()).filter(e=>{let l=e.on;return!!l&&("string"==typeof l?l===t:"object"==typeof l&&l.eventName===t)}),y="click"===t&&(null==l?void 0:l.triggerByRouter)===!0?v.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}):v,x=[],b=async()=>{let n=!1;if(d){let o=y.map((e,t)=>({f:e,i:t})).slice().sort((e,t)=>{var l,n;let o=e.f.flowRegistry,r=t.f.flowRegistry,i=null==o||null==(l=o.constructor)?void 0:l._type,a=null==r||null==(n=r.constructor)?void 0:n._type,s=+("instance"!==i),d=+("instance"!==a);if(s!==d)return s-d;let u=e.f.sort??0,c=t.f.sort??0;return u!==c?u-c:e.i-t.i}).map(e=>e.f),r=[],i=new Map(o.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}).map(e=>[e.key,e])),a=new Set,s=new Map;for(let[n,d]of(o.forEach((e,l)=>{let n=e.on,o="object"==typeof n?n:void 0;if(!o)return;let r=o.phase,d=o.flowKey,u=o.stepKey;if(!r||"beforeAllFlows"===r)return;let c=null;if("afterAllFlows"===r)c=`event:${t}:end`;else if("beforeFlow"===r||"afterFlow"===r)if(d)if(i.get(String(d))){let e="beforeFlow"===r?"start":"end";c=`event:${t}:flow:${String(d)}:${e}`}else c=`event:${t}:end`;else c=`event:${t}:end`;else if("beforeStep"!==r&&"afterStep"!==r)return;else if(d&&u){var p;let e=i.get(String(d)),l=!!(null==e||null==(p=e.hasStep)?void 0:p.call(e,String(u)));if(e&&l){let e="beforeStep"===r?"start":"end";c=`event:${t}:flow:${String(d)}:step:${String(u)}:${e}`}else c=`event:${t}:end`}else c=`event:${t}:end`;if(!c)return;let m=c===`event:${t}:end`||"afterFlow"===r||"afterStep"===r;a.add(e.key);let h=s.get(c)||[];h.push({flow:e,order:l,shouldSkipOnAborted:m}),s.set(c,h)}),s.entries()))for(let o of d.slice().sort((e,t)=>{let l=e.flow.sort??0,n=t.flow.sort??0;return l!==n?l-n:e.order-t.order})){let i=o.shouldSkipOnAborted?Object.assign(e=>e.type===n&&!0!==e.aborted,{__eventType:n}):n,a=e.scheduleModelOperation(e.uid,async e=>{let n=await this.runFlow(e,o.flow.key,l,p,t);if(n instanceof g.zz)throw n;r.push(n)},{when:i});x.push(a)}for(let i of o)if(!a.has(i.key))try{m.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${i.key}' (sequential).`);let o=await this.runFlow(e,i.key,l,p,t);if(o instanceof g.zz){m.debug(`[FlowEngine.dispatchEvent] ${o.message}`),n=!0;break}r.push(o)}catch(e){if(e instanceof g.zz){m.debug(`[FlowEngine.dispatchEvent] ${e.message}`),n=!0;break}throw m.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${i.key}' for event '${t}' (sequential):`),e}return{result:r,abortedByExitAll:n}}let o=(await Promise.all(y.map(async n=>{m.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${n.key}'.`);try{return await this.runFlow(e,n.key,l,p,t)}catch(e){if(m.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${n.key}' for event '${t}':`),c)throw e;return}}))).filter(e=>void 0!==e);return o.some(e=>e instanceof g.zz)&&(n=!0),{result:o,abortedByExitAll:n}},w=u?JSON.stringify(l??{}):"",S=u?eN.generateApplyFlowCacheKey(`event:${e.getFlowCacheScope(t)}:${w}`,t,e.uid):null;try{let{result:o,abortedByExitAll:r}=await this.withApplyFlowCache(S,b);try{await (null==(i=e.onDispatchEventEnd)?void 0:i.call(e,t,n,l,o))}catch(e){m.error({err:e},`BaseModel.dispatchEvent: End hook error for event '${t}'`)}return await this.emitModelEventIf(t,"end",{...h,result:o,...r?{aborted:!0}:{}}),o&&"object"==typeof o&&Object.defineProperty(o,"__abortedByExitAll",{value:r,configurable:!0}),o}catch(o){try{await (null==(a=e.onDispatchEventError)?void 0:a.call(e,t,n,l,o))}catch(e){}if(e.context.logger.error({err:o},`BaseModel.dispatchEvent: Error executing event '${t}' for model '${e.uid}':`),await this.emitModelEventIf(t,"error",{...h,error:o}),c)throw o}finally{for(let e of x)e()}}constructor(e){this.engine=e}}var b=l(58587),w=l(18150),S=l(68238),C=l(67838),F=l(18220),k=l(47674),A=l(21637),P=l(71021),j=l(84626),M=l(96540),I=l(74848),T=l(53619),R=l(92034),E=l(98393),N=l(22803),D=l(42443),B=l(88040),$=l(35710),O=l(18182),q=l(98892),L=l(33954),_=l(57084),V=l(94313),z=l(20616),K=l(52847);let U={marginLeft:32},W=(0,K.PA)(e=>{let{title:t,onChange:l,getDefaultValue:n,disabled:o,itemKey:r,...i}=e,[a,s]=(0,M.useState)(!1),d=(0,z.Db)();(0,M.useEffect)(()=>{let e=!1;return(async()=>{if(n)try{let t=await n();if(e||!t)return;let l=Object.entries(t);if(!l.length)return;let[o,r]=l[0];s(!!r)}catch(e){console.error(e)}})(),()=>{e=!0}},[n]);let u=e=>{s(e),null==l||l({[r]:e})},c=e=>{e.stopPropagation(),o||u(!a)};return(0,I.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between",cursor:o?"not-allowed":"pointer"},onClick:c,children:[t,(0,I.jsx)(V.A,{size:"small",...i,checkedChildren:i.checkedChildren?d.t(i.checkedChildren):void 0,unCheckedChildren:i.unCheckedChildren?d.t(i.unCheckedChildren):void 0,checked:a,style:U,disabled:o})]})});var H=l(36492);let G=(e,t)=>{for(let n of e){var l;if(String((null==n?void 0:n.key)??"")===t)return n;if(null==(l=n.children)?void 0:l.length){let e=G(n.children,t);if(e)return e}}},Y=(e,t,l)=>{let n=t.maxDepth,o="number"==typeof t.arrayLimit?t.arrayLimit:1/0,r=t.mode??"stack",i=new Set,a=new Set,s=(e,t,d)=>{if(!e||t>n)return;let u=()=>{l(e,{depth:t,modelKey:d}),t>=n||Object.entries(e.subModels||{}).forEach(e=>{let[l,n]=e;if(Array.isArray(n)){let e=Number.isFinite(o)?Math.min(n.length,o):n.length;for(let o=0;o<e;o++){let e=n[o];e instanceof L.WD&&s(e,t+1,`${l}[${o}]`)}return}n instanceof L.WD&&s(n,t+1,l)})};if("visited"===r){if(i.has(e))return;i.add(e),u();return}let c=e.uid||`temp-${Date.now()}`;if(!a.has(c)){a.add(c);try{u()}finally{a.delete(c)}}};s(e,1)},J=(e,t)=>{var l;if(!e||!t||"string"!=typeof t)return console.warn("Invalid input parameters"),null;let n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\[(\d+)\])?$/);if(!n)return console.warn(`Invalid subModelKey format: ${t}`),null;let[,o,r]=n,i=null==(l=e.subModels)?void 0:l[o];if(!i)return console.warn(`SubModel '${o}' not found`),null;if(void 0!==r){let e=parseInt(r,10);return Array.isArray(i)?e<0||e>=i.length?(console.warn(`Array index ${e} out of bounds for '${o}'`),null):i[e]instanceof L.WD?i[e]:null:(console.warn(`Expected array for '${o}', got ${typeof i}`),null)}return Array.isArray(i)?(console.warn(`Expected object for '${o}', got array`),null):i instanceof L.WD?i:null},X={switch:W,select:function(e){let{title:t,getDefaultValue:l,onChange:n,options:o,fieldNames:r,itemKey:i,tooltip:a,...s}=e,[d,u]=(0,M.useState)(!1),[c,p]=(0,M.useState)(""),m=(0,z.Db)();(0,M.useEffect)(()=>{let e=!1;return(async()=>{if(l)try{let t=await l();if(e||!t)return;let n=Object.entries(t);if(!n.length)return;let[o,r]=n[0];p(r)}catch(e){console.error(e)}})(),()=>{e=!0}},[l]);let h=(0,M.useRef)(null),f=e=>{p(e),null==n||n({[i]:e})},g=(0,I.jsx)("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:t});return(0,I.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},onClick:e=>{e.stopPropagation(),u(e=>!e)},onMouseLeave:()=>{h.current=setTimeout(()=>{u(!1)},200)},children:[a?(0,I.jsx)(D.A,{title:a,placement:"top",destroyTooltipOnHide:!0,children:g}):g,(0,I.jsx)(H.A,{...s,open:d,popupMatchSelectWidth:!1,bordered:!1,value:c,onChange:f,popupClassName:`select-popup-${t.replaceAll(" ","-")}`,fieldNames:r,options:o,labelRender:e=>m.t(e.label),optionRender:e=>m.t(e.label),style:{textAlign:"right",minWidth:100},onMouseEnter:()=>{clearTimeout(h.current)},dropdownRender:e=>s.dropdownRender?s.dropdownRender(e,u,f):e})]})}},Q=e=>{let{title:t,uiMode:l,itemProps:n}=e,o=(null==l?void 0:l.type)||l,r=o?X[o]:null,i=!!(null==n?void 0:n.disabled),a=null==n?void 0:n.disabledReason,s=null==n?void 0:n.disabledIconColor,d=r?(0,I.jsx)(r,{title:t,...n}):(0,I.jsx)(I.Fragment,{children:t});return i?(0,I.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,I.jsx)(D.A,{title:a,placement:"right",destroyTooltipOnHide:!0,children:(0,I.jsx)(T.A,{style:{color:s}})})]}):d},Z=".nb-toolbar-container-icons",ee=".nb-toolbar-container",et=(0,N.css)`
|
|
3215
3215
|
width: max-content;
|
|
3216
3216
|
min-width: max-content;
|
|
3217
3217
|
|
|
@@ -3566,5 +3566,5 @@ ${r.join("\n")}`:""}function k(e){let t=String((null==e?void 0:e.message)||"");i
|
|
|
3566
3566
|
${i.join("\n")}`:""}function j(e,t){let l=Error(t);l.cause=e;try{let t="string"==typeof(null==e?void 0:e.name)?e.name:"";t&&(l.name=t)}catch(e){}try{let n="string"==typeof(null==e?void 0:e.stack)?e.stack:"";if(n){let e=String(n).split("\n");e.length&&(e[0]=`${l.name}: ${t}`,l.stack=e.join("\n"))}}catch(e){}return l}function M(e){if(!e)return null;let t=d.get(e);if(t)return t;if("function"!=typeof e.createElement)return null;let l=e.Component;if("function"!=typeof l)return null;class n extends l{static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){try{var t,l,n;let o=null==(t=this.props)?void 0:t.enhanceReactError,r="function"==typeof o?o(e):e,i=String((null==r?void 0:r.message)||"");if(i&&/\[RunJS Hint\]/.test(i)){console.error(i);let e=null==(n=this.props)||null==(l=n.ctx)?void 0:l.logger;e&&"function"==typeof e.error&&e.error(i)}}catch(e){}}componentDidUpdate(e){var t,l;(null==e?void 0:e.resetKey)!==(null==(t=this.props)?void 0:t.resetKey)&&(null==(l=this.state)?void 0:l.error)&&this.setState({error:void 0})}render(){var t,l;let n=null==(t=this.state)?void 0:t.error;if(!n)return this.props.children;let o="";try{let e=null==(l=this.props)?void 0:l.enhanceReactError,t="function"==typeof e?e(n):n;o=String((null==t?void 0:t.message)||t||(null==n?void 0:n.message)||n||"")}catch(e){o=String((null==n?void 0:n.message)||n||"")}let r={boxSizing:"border-box",padding:12,borderRadius:6,border:"1px solid #ffccc7",background:"#fff2f0",color:"#a8071a",fontSize:12,lineHeight:1.5,maxWidth:"100%",overflow:"auto"},i={margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},a={fontWeight:600,marginBottom:8};return e.createElement("div",{style:r},e.createElement("div",{style:a},"RunJS render error"),e.createElement("pre",{style:i},o))}constructor(...e){super(...e),this.state={}}}return d.set(e,n),n}function I(e){let{ctx:t,vnode:l,enhanceReactError:n,resetKey:o}=e,r=null==t?void 0:t.React,i=M(r);return i?r.createElement(i,{ctx:t,enhanceReactError:n,resetKey:o},l):l}function T(e){var t;let{ctx:l,entry:n,containerEl:r,rootMap:i,unmountContainerRoot:a,enhanceReactError:s,internalReact:d,internalAntd:u}=e;if(!(!(null==(t=l.ReactDOM)?void 0:t.__nbRunjsInternalShim)&&l.React&&l.React!==d&&l.antd&&l.antd!==u&&void 0!==l.antd.ConfigProvider)){if(n.disposeTheme){try{n.disposeTheme()}catch(e){}n.disposeTheme=void 0}return!1}let c=()=>{var e,t,o,r,i,a,s;null==l||null==(t=l.engine)||null==(e=t.context)||e.themeToken;let d=null==l||null==(r=l.engine)||null==(o=r.context)?void 0:o.antdConfig,u=(null==l||null==(s=l.engine)||null==(a=s.context)||null==(i=a.locales)?void 0:i.antd)||(null==d?void 0:d.locale),c=l.antd.ConfigProvider,p=l.antd.App,m={popupMatchSelectWidth:!1,locale:u||{}};d&&"object"==typeof d&&(void 0!==d.direction&&(m.direction=d.direction),"string"==typeof d.prefixCls&&(m.prefixCls=d.prefixCls),"string"==typeof d.iconPrefixCls&&(m.iconPrefixCls=d.iconPrefixCls),"function"==typeof d.getPopupContainer&&(m.getPopupContainer=d.getPopupContainer),d.theme&&"object"==typeof d.theme&&(m.theme=d.theme));let h=n.lastVnode,f=p?l.React.createElement(c,m,l.React.createElement(p,null,h)):l.React.createElement(c,m,h);n.root.render(f)};return n.disposeTheme?c():n.disposeTheme=(0,o.autorun)(()=>{try{if(r&&1===r.nodeType&&"boolean"==typeof r.isConnected&&!r.isConnected&&n.wasConnected)return void queueMicrotask(()=>{i.get(r)===n&&a()});r&&1===r.nodeType&&"boolean"==typeof r.isConnected&&r.isConnected&&(n.wasConnected=!0),c()}catch(e){throw s(e)}}),!0}function R(e){let{ctx:t,entry:l,vnode:n,containerEl:o,rootMap:r,unmountContainerRoot:i,internalReact:a,internalAntd:s}=e,d=e=>{let l=String((null==e?void 0:e.message)||e||"");if(!l||/\[RunJS Hint\]/.test(l))return e;let n=/invalid hook call/i.test(l),o=k(e);if(!n&&!o)return e;let r=F({ctx:t,internalReact:a,internalAntd:s})||P({ctx:t,internalReact:a,internalAntd:s,err:e});return r?j(e,`${l}${r}`):e};try{return l.__nbRunjsRenderSeq=(l.__nbRunjsRenderSeq||0)+1,l.lastVnode=I({ctx:t,vnode:n,enhanceReactError:d,resetKey:l.__nbRunjsRenderSeq}),T({ctx:t,entry:l,containerEl:o,rootMap:r,unmountContainerRoot:i,enhanceReactError:d,internalReact:a,internalAntd:s})||l.root.render(l.lastVnode),l.root}catch(e){throw d(e)}}},44476(e,t,l){"use strict";l.d(t,{Hi:()=>d,KC:()=>s,af:()=>u});var n=l(2543),o=l.n(n),r=l(35846);function i(e){if(!e)return;let t=e.match(/^([^.[]+)/);return null==t?void 0:t[1]}function a(e,t){var l;if(!e||!t)return;let n=e.getField(t);return n||((null==(l=e.getFields)?void 0:l.call(e))||[]).find(e=>e.name===t)}function s(e,t){if(null!=e){if(Array.isArray(t)){if("object"!=typeof e||!e)return;let l=e,n={};for(let e of t){let t=l[e];if(null==t)return;n[e]=t}return n}if("string"==typeof e||"number"==typeof e)return e;if("object"==typeof e)return e[t]}}function d(e,t){return l=>{if(!l||!l.includes("."))return!1;let n=i(l);if(!n)return!1;let r=a(e(),n);if(!(null==r?void 0:r.isAssociationField()))return!1;if("function"==typeof t){let e=t();if(e&&"object"==typeof e&&void 0!==o().get(e,l))return!1}return!0}}function u(e,t,l){let n=(0,r.H)(e,t,!0),o=async()=>{let t=await n();return t?{...t,buildVariablesParams:t=>{var n;let o=e(),r=l(t);if(!o||!r||"object"!=typeof r)return{};let i={};for(let e of(null==(n=o.getFields)?void 0:n.call(o))||[]){let t=e.name;if(!t||!e.isAssociationField())continue;let l=e.target,n=e.targetCollection;if(!l||!n)continue;let o=n.filterTargetKey,a=r[t];if(null!=a)if(Array.isArray(a)){let e=a.map(e=>s(e,o)).filter(e=>null!=e);e.length&&(i[t]={collection:l,dataSourceKey:n.dataSourceKey,filterByTk:e})}else{let e=s(a,o);null!=e&&(i[t]={collection:l,dataSourceKey:n.dataSourceKey,filterByTk:e})}}return i}}:null};return o.title=t,o}},35846(e,t,l){"use strict";l.d(t,{H:()=>d});let n=["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"],o=["integer","float","double","decimal"];function r(e,t){return!!(e.interface&&(t||e.filterable))}function i(e,t){let l=s(e);if(e.isAssociationField()){let n=e.targetCollection;return n?{type:"object",...l,properties:async()=>{let e={};return n.fields.forEach(l=>{r(l,t)&&(e[l.name]=i(l,t))}),e}}:{type:"object",...l}}return{type:a(e),...l}}function a(e){let t=e.type;if(n.includes(t))return"object";if(o.includes(t))return"number";switch(t){case"boolean":return"boolean";case"json":return"object";case"array":return"array";default:return"string"}}function s(e){return{title:e.title||e.name,interface:e.interface,options:e.options,uiSchema:e.uiSchema||{}}}function d(e,t,l){let n=async()=>{let n="function"==typeof e?e():e;return n?{type:"object",title:t||n.title||n.name,properties:async()=>{let e={};return n.fields.forEach(t=>{r(t,l)&&(e[t.name]=i(t,l))}),e}}:null};return n.title=t,n}},62572(e,t,l){"use strict";l.d(t,{v:()=>o});var n=l(29007);async function o(e,t){if(null==t||!t.defineProperties&&!t.defineMethods)return e;let l=new n.cB;l.addDelegate(e);let o=l.createProxy(),r=o,i=e,a=t=>{let l=Reflect.get(i,t,i);return"function"==typeof l?l.bind(e):l},s=e=>"defineProperty"===e||"defineMethod"===e||Reflect.has(r,e)||Reflect.has(i,e),d=new Proxy(o,{get:(e,t,n)=>"string"==typeof t?"defineProperty"===t?(e,t)=>l.defineProperty(e,t):"defineMethod"===t?(e,t,n)=>l.defineMethod(e,t,n):Reflect.has(r,t)?Reflect.get(r,t,n):a(t):Reflect.get(r,t,n),set:(e,t,l)=>Reflect.set(i,t,l),has:(e,t)=>s(t),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(r,t)||Object.getOwnPropertyDescriptor(i,t)});if(t)for(let e of Array.isArray(t)?t:[t]){if(!e)continue;let t=e.defineProperties;if(t){let e="function"==typeof t?await t(d):t;if(!e||"object"!=typeof e)throw TypeError("defineProperties must return an object of PropertyOptions");for(let[t,n]of Object.entries(e)){if(!n||"object"!=typeof n)throw TypeError(`defineProperties['${t}'] must be a PropertyOptions object`);l.defineProperty(t,n)}}let n=e.defineMethods;if(n){let e="function"==typeof n?await n(d):n;if(!e||"object"!=typeof e)throw TypeError("defineMethods must return an object of functions");for(let[t,n]of Object.entries(e)){if("function"!=typeof n)throw TypeError(`defineMethods['${t}'] must be a function`);l.defineMethod(t,n)}}}return new Proxy(o,{get:(t,l,n)=>"string"==typeof l?"defineProperty"===l?(t,l)=>e.defineProperty(t,l):"defineMethod"===l?(t,l,n)=>e.defineMethod(t,l,n):Reflect.has(r,l)?Reflect.get(r,l,n):a(l):Reflect.get(r,l,n),set:(e,t,l)=>Reflect.set(i,t,l),has:(e,t)=>s(t),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(r,t)||Object.getOwnPropertyDescriptor(i,t)})}},44951(e,t,l){"use strict";l.d(t,{BL:()=>s,T$:()=>r});var n=l(16639);function o(e,t){if(!e||"object"!=typeof e)return;let l=e;if("function"==typeof l.get){let e=l.get(t);if(null!=e&&""!==e)return e}let n=t.toLowerCase();for(let[t,l]of Object.entries(e))if(t.toLowerCase()===n)return l}function r(e){let t=o(e,"x-data-source");return Array.isArray(t)?String(t[0]||"main"):null==t||""===t?"main":String(t)}function i(e){let t=String(e||"").trim();if(!t)return[];let l=new Set([t]);return t.includes(".")&&l.add(t.split(".")[0]),Array.from(l)}function a(e,t){if(!t)return[e];let l=[],n=new Set,o=e,r=0;for(;o&&r++<50;)n.has(o)||(l.push(o),n.add(o)),o=o.previousEngine;return l}function s(e){var t,l,o,r;let{engine:s,resourceName:d,includePreviousEngines:u}=e;if(!(null==s?void 0:s.markDataSourceDirty))return[];let c=i(d);if(!c.length)return[];let p=String(e.dataSourceKey||"main"),m=a(s,u),h=new Map;for(let e of m){let t=new Map;for(let l of(h.set(e,t),c))t.set(l,(null==(o=e.getDataSourceDirtyVersion)?void 0:o.call(e,p,l))||0)}for(let e of m){let t=h.get(e);for(let l of c){let n=(null==t?void 0:t.get(l))||0;((null==(r=e.getDataSourceDirtyVersion)?void 0:r.call(e,p,l))||0)===n&&e.markDataSourceDirty(p,l)}}return null==(l=s.emitter)||null==(t=l.emit)||t.call(l,n.HK,{dataSourceKey:p,resourceNames:c}),c}},9297(e,t,l){"use strict";l.d(t,{k:()=>$,q:()=>r});var n=l(33329),o=l(44951);let r="__nocobaseSkipDataSourceDirty",i=Symbol("nocobaseDirtyDispatchToken"),a=new WeakMap,s=new WeakSet,d=["add","bulkdestroy","bulkupdate","create","delete","destroy","execute","firstorcreate","import","move","remove","save","saveastemplate","set","setfields","submit","update","updateorcreate","upsert"];function u(e){if(!e||"object"!=typeof e)return!1;let t=e;return"function"==typeof t.resource&&"function"==typeof t.request}function c(e){let t=String(e||"").trim();if(!t)return!1;let l=t.split("/")[0],n=l.toLowerCase();return d.some(e=>{if(n===e)return!0;if(!n.startsWith(e)||l.length<=e.length)return!1;let t=l[e.length];return"-"===t||"_"===t||t>="A"&&t<="Z"})}function p(){var e;return"u"<typeof window||null==(e=window.location)?void 0:e.origin}function m(e,t){try{return new URL(e,t)}catch{return}}function h(e){let t=e.search(/[?#]/);return -1===t?e:e.slice(0,t)}function f(e){let t=h(e).trim();if(!t)return;let l=t.replace(/^\/+/,"");if(l&&"api"!==l)return l.startsWith("api/")?l.slice(4):l}function g(e){return e.endsWith("/")?e:`${e}/`}function v(e){if(null==e?void 0:e.getApiUrl)try{return m(e.getApiUrl(),p())}catch{return}}function y(e,t){let l=h(e).trim();if(!l.startsWith("/"))return;let n=g(t);if(!g(l).startsWith(n))return;let o=n.replace(/\/$/,"");return l.slice(o.length).replace(/^\/+/,"")||void 0}function x(e,t){if(!["http:","https:"].includes(e.protocol))return;if(null==t?void 0:t.getApiUrl){let l=v(t);if(!l||e.origin!==l.origin)return;return y(e.pathname,l.pathname)}let l=p();if(l&&e.origin===l)return f(e.pathname)}function b(e,t){if("string"!=typeof e)return;let l=e.trim();if(!l||l.startsWith("//"))return;if(/^https?:\/\//i.test(l)){let e=m(l);if(!e)return;return x(e,t.app)}let n=v(t.app),o=n?y(l,n.pathname):void 0;return o||f(l)}function w(e){try{return decodeURIComponent(e)}catch{return e}}function S(e){return String(e??"").trim()||void 0}function C(e){let t,l=[],n=-1;for(let o=0;o<e.length;o+=2){let r=e[o],i=r.lastIndexOf(":"),a=-1===i?r:r.slice(0,i);if(!a)return;if(l.push(w(a)),-1!==i){t=w(r.slice(i+1)).trim(),n=o;break}}if(t&&l.length&&!(e.length>n+2))return{resourceName:l.join("."),actionName:t}}function F(e,t){let l=b(e,t);if(!l)return;let n=h(l).split("/").filter(Boolean);if("dataSources"===w(n[0]||"")&&n.length>=3){let e=S(w(n[1])),t=C(n.slice(2));if(e&&t)return{...t,dataSourceKey:e}}return C(n)}function k(e,t,l,n){let o=e.trim(),r=l.trim();if(!o||!r)return;if(o.includes("/")){let e=F(`${o}:${r}`,n);if(e)return e}let i="dataSources.";if(o.startsWith(i)){let e=S(t),l=o.slice(i.length).trim();if(e&&l)return{dataSourceKey:e,resourceName:l,actionName:r}}return{resourceName:o,actionName:r}}function A(e,t){let l="string"==typeof(null==e?void 0:e.resource)?e.resource:void 0,n="string"==typeof(null==e?void 0:e.action)?e.action:void 0;return l&&n?k(l,e.resourceOf,n,t):F(null==e?void 0:e.url,t)}function P(e,t){if(e)return JSON.stringify([e.dataSourceKey||(0,o.T$)(t),e.resourceName,e.actionName])}function j(e,t){return P(A(e,t),e.headers)}function M(e,t,l){let n=String(e??"").trim();if(n)return JSON.stringify([n,String(t??""),(0,o.T$)(l)])}function I(e,t){if(e&&t&&(!e.requestKey||e.requestKey===t))return e}function T(e,t){if(e&&t&&(!e.resourceKey||e.resourceKey===t))return e}function R(e,t,l){(0,o.BL)({engine:e.engine,dataSourceKey:t.dataSourceKey||(0,o.T$)(l),resourceName:t.resourceName,includePreviousEngines:!0})}function E(e,t,l,n){!e.skip&&!e.marked&&l&&c(l.actionName)&&(e.marked=!0,R(t,l,n))}function N(e){return!!e&&"object"==typeof e}function D(e,t,l,n,o,a,s){return new Proxy(t,{get(t,d,u){let p=Reflect.get(t,d,u);if("string"!=typeof d||"function"!=typeof p||!c(d))return p;let m=p;return async function(){let t;for(var c,p,h=arguments.length,f=Array(h),g=0;g<h;g++)f[g]=arguments[g];let v=N(f[1])?f[1]:void 0,y=k(l,n,d,e),x=P(y,o),b=M(l,n,o),w=I(null==v?void 0:v[i],x)||I(s,x),S=w||{marked:!1,skip:!1},C=!w;(c=S).requestKey||(c.requestKey=x),(p=S).resourceKey||(p.resourceKey=b),(null==v?void 0:v[r])&&(S.skip=!0);let F=v||null==f[1]?[f[0],{...v,[i]:S}]:f;a.push({key:x,token:S});try{t=Reflect.apply(m,u,F)}finally{a.pop()}let A=await t;return C&&E(S,e,y,o),A}}})}function B(e,t){let l,o,a=e.resource,d=e.request,u=a===n.APIClient.prototype.resource,p=d===n.APIClient.prototype.request,m=[],h=[],f=!1,g=!1,v=()=>f?l:w,y=()=>g?o:S,x=(e,t)=>{let l=M(t[0],t[1],t[2]),n=T(e,l),o=!!n&&f;if(n){var r;(r=n).resourceKey||(r.resourceKey=l),m.push({key:l,token:n})}try{let e=Reflect.apply(v(),F,t);if(!o||!n)return e;return new Proxy(e,{get(e,t,o){let r=Reflect.get(e,t,o);if("string"!=typeof t||"function"!=typeof r||!c(t))return r;let a=r;return function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let s=N(t[1])?t[1]:void 0,d=s||null==t[1]?[t[0],{...s,[i]:n}]:t;m.push({key:l,token:n}),h.push({key:n.requestKey,token:n});try{return Reflect.apply(a,o,d)}finally{h.pop(),m.pop()}}}})}finally{n&&m.pop()}},b=l=>{let n=Object.create(e);return Object.defineProperties(n,{request:{configurable:!0,value:e=>{let n=e,o=j(n,t),r=h.at(-1),a=I(null==n?void 0:n[i],o)||(o&&(null==r?void 0:r.key)===o?r.token:void 0)||I(l,o),{[i]:s,...d}=n,u=a?{...d,[i]:a}:d;if(a){var c;(c=a).requestKey||(c.requestKey=o),h.push({key:o,token:a})}try{return Reflect.apply(y(),F,[u])}finally{a&&h.pop()}}},resource:{configurable:!0,value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let o=M(t[0],t[1],t[2]),r=m.at(-1);return x(T(l,o)||(o&&(null==r?void 0:r.key)===o?r.token:void 0),t)}}}),n},w=(l,n,o,r)=>{let i=M(l,n,o),s=m.at(-1),d=i&&(null==s?void 0:s.key)===i?s.token:void 0,c=b(d);return D(t,Reflect.apply(a,u?c:e,[l,n,o,r]),l,n,o,h,d)},S=l=>{var n,o;let a=l,s=j(a,t),u=h.at(-1),c=I(null==a?void 0:a[i],s)||(s&&(null==u?void 0:u.key)===s?u.token:void 0),m=c||{marked:!1,skip:!1},f=!c;(n=m).requestKey||(n.requestKey=s),"string"==typeof a.resource&&((o=m).resourceKey||(o.resourceKey=M(a.resource,a.resourceOf,a.headers))),(null==a?void 0:a[r])&&(m.skip=!0);let g=A(a,t),{[i]:v,[r]:y,...x}=a,w=b(m);return Reflect.apply(d,p?w:e,[x]).then(e=>(f&&E(m,t,g,a.headers),e))},C=(e,t)=>{let l=Reflect.getOwnPropertyDescriptor(e,t);return!!l&&!l.configurable},F=new Proxy(e,{get:(e,t,n)=>"resource"===t?C(e,t)?Reflect.get(e,t,n):f?l:w:"request"===t?C(e,t)?Reflect.get(e,t,n):g?o:S:Reflect.get(e,t,n),set(e,t,n,r){if("resource"===t){let o=Reflect.getOwnPropertyDescriptor(e,t);return(!o||!!o.configurable&&!!Reflect.isExtensible(e))&&(f=!0,l=n,!0)}if("request"===t){let l=Reflect.getOwnPropertyDescriptor(e,t);return(!l||!!l.configurable&&!!Reflect.isExtensible(e))&&(g=!0,o=n,!0)}return Reflect.set(e,t,n,r)},deleteProperty(e,t){if("resource"!==t&&"request"!==t)return Reflect.deleteProperty(e,t);let n=Reflect.getOwnPropertyDescriptor(e,t);return(!n||!!n.configurable&&!!Reflect.isExtensible(e))&&("resource"===t?(f=!1,l=void 0):(g=!1,o=void 0),!0)},defineProperty:(e,t,l)=>"resource"!==t&&"request"!==t&&Reflect.defineProperty(e,t,l)});return s.add(F),F}function $(e,t){if(!u(e)||s.has(e))return e;let l=e,n=a.get(l);n||(n=new WeakMap,a.set(l,n));let o=n.get(t);if(o)return o;let r=B(e,t);return n.set(t,r),r}},31108(e,t,l){"use strict";l.d(t,{VD:()=>r,sy:()=>n,zz:()=>o});class n extends Error{constructor(e,t,l){super(l||`Flow '${e}' on model '${t}' exited via ctx.exit().`),this.name="FlowExitException",this.flowKey=e,this.modelUid=t}}class o extends Error{constructor(e,t,l){super(l||`Flow '${e}' on model '${t}' exited via ctx.exitAll().`),this.name="FlowExitAllException",this.flowKey=e,this.modelUid=t}}class r extends Error{constructor(e="Flow settings save cancelled."){super(e),this.name="FlowCancelSaveException"}}},60182(e,t,l){"use strict";l.d(t,{pM:()=>th,te:()=>eA,ju:()=>j.ju,Fv:()=>i,MI:()=>d,vq:()=>tm.v,yz:()=>N,M5:()=>eF,X4:()=>ek,Vv:()=>eI,E2:()=>eE,lW:()=>a,n2:()=>T,FA:()=>p,J3:()=>eN,vP:()=>j.vP,ME:()=>y,H9:()=>A.H,ey:()=>eT.ey,KB:()=>ee,JE:()=>ep,kl:()=>o,u4:()=>n,UX:()=>j.UX,XM:()=>k,Kh:()=>eP,AP:()=>I,mP:()=>eL,zz:()=>u.zz,D1:()=>eT.D1,gG:()=>m.gG,I2:()=>eT.I2,af:()=>P.af,mv:()=>m.mv,QP:()=>c,pk:()=>m.pk,Xh:()=>eT.Xh,$S:()=>j.$S,EI:()=>tf,_:()=>eT._,qI:()=>C,sU:()=>L,ln:()=>w,Z8:()=>D,cg:()=>z,zE:()=>ty,wx:()=>g.w,yp:()=>tg.y,y4:()=>eC,dN:()=>G,ye:()=>J,$n:()=>eq,VD:()=>u.VD,ji:()=>tp,WJ:()=>r,i:()=>tg.i,hz:()=>ej,MZ:()=>s,sy:()=>u.sy,YB:()=>M,xI:()=>j.xI,KC:()=>P.KC,$X:()=>eS,o7:()=>S,mH:()=>tc,M:()=>m.M,nN:()=>j.nN,GZ:()=>E,Hi:()=>P.Hi,pc:()=>j.pc,_3:()=>F,Gu:()=>Y,DX:()=>ew,XU:()=>j.XU});let n="flow-engine",o={DATA:"dataBlocks",FILTER:"filterBlocks",OTHER:"otherBlocks"},r={data:{key:o.DATA,label:"Data blocks",type:"group",hasCurrentFlowContext:!0},filter:{key:o.FILTER,label:"Filter blocks",type:"group",hasCurrentFlowContext:!1},other:{key:o.OTHER,label:"Other blocks",type:"group",hasCurrentFlowContext:!1}},i={CURRENT_RECORD:"currentRecord",ASSOCIATION_RECORDS:"associationRecords",OTHER_RECORDS:"otherRecords",OTHER_COLLECTIONS:"otherCollections",CURRENT_COLLECTIONS:"currentCollections"};function a(e){var t;return(null==(t=e.flowEngine)?void 0:t.translate)?(t,l)=>e.flowEngine.translate(t,{ns:[n,"client"],nsMode:"fallback",...l}):e=>e}function s(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}function d(e,t){return s(e,t)}var u=l(31108);function c(e){return e}function p(e,t){if(e===t)return!1;if(e.prototype instanceof t)return!0;let l=Object.getPrototypeOf(e.prototype);for(;l&&l!==Object.prototype;){if(l.constructor===t)return!0;l=Object.getPrototypeOf(l)}return!1}var m=l(81982),h=l(27153),f=l(29007),g=l(88439);async function v(e,t){if(!e)return{};if("function"==typeof e)try{return await e(t)||{}}catch(e){return console.error("Error resolving uiSchema function:",e),{}}return e}async function y(e,t){if(!e)return"dialog";if("function"==typeof e)try{return await e(t)||"dialog"}catch(e){return console.error("Error resolving uiMode function:",e),"dialog"}return e}let x={},b=e=>{if("function"==typeof e)return!0;if(!e||"object"!=typeof e)return!1;let t=new WeakSet,l=e=>{if("function"==typeof e)return!0;if(!e||"object"!=typeof e||t.has(e))return!1;if(t.add(e),Array.isArray(e)){for(let t of e)if(l(t))return!0;return!1}for(let t of Object.keys(e))if(l(e[t]))return!0;return!1};return l(e)};function w(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{noCache:n=!1}=l,o=e=>/\{\{.*?\}\}/g.test(e);return(t=>{let l,r=!1;if("string"==typeof t&&t.startsWith("{{")&&(r=!0,l=t),t&&"object"==typeof t&&!Array.isArray(t)){try{l=JSON.stringify(t)}catch(e){return console.warn("Failed to stringify:",e),t}let i=!!(r=o(l))&&!n&&b(t);if(x[l]&&!n&&!i)return x[l];if(i)try{return h.Schema.compile(t,e)}catch(e){return console.warn("Failed to compile with Formily Schema.compile:",e),t}}if(Array.isArray(t)){try{l=JSON.stringify(t)}catch(e){return console.warn("Failed to stringify:",e),t}let i=!!(r=o(l))&&!n&&b(t);if(x[l]&&!n&&!i)return x[l];if(i)try{return h.Schema.compile(t,e)}catch(e){return console.warn("Failed to compile with Formily Schema.compile:",e),t}}if(r){if(!l)try{return h.Schema.compile(t,e)}catch(e){return console.warn("Failed to compile with Formily Schema.compile:",e),t}try{if(n)return h.Schema.compile(t,e);return x[l]=x[l]||h.Schema.compile(t,e),x[l]}catch(l){console.log("compileUiSchema error",t,l);try{return h.Schema.compile(t,e)}catch(e){}}}return t})(t)}async function S(e,t,l){let n=new f.W5(e,t.key,"settings");(0,g.w)(n,t.steps,e,t.key),n.defineProperty("currentStep",{value:l});let o=l.uiSchema;if(l.use)try{var r;let t=null==(r=e.getAction)?void 0:r.call(e,l.use);t&&t.uiSchema&&(o=o||t.uiSchema)}catch(e){console.warn(`Failed to get action ${l.use}:`,e)}let i=await v(o||{},n);return 0===Object.keys(i).length?null:i}async function C(e,t,l){if(!l)return!0;let{hideInSettings:n}=l;if("function"==typeof n)try{let l=new f.W5(e,t.key,"settings");return(0,g.w)(l,t.steps||{},e,t.key),!!await n(l)}catch(e){return console.warn(`Error evaluating hideInSettings for event '${l.name||""}' in flow '${t.key}':`,e),!1}return!!n}async function F(e,t,l){if(!l)return!0;let n=l.hideInSettings;if(void 0===n&&l.use){var o;let t=null==(o=e.getAction)?void 0:o.call(e,l.use);n=null==t?void 0:t.hideInSettings}if("function"==typeof n)try{let o=new f.W5(e,t.key,"settings");return(0,g.w)(o,t.steps,e,t.key),o.defineProperty("currentStep",{value:l}),!!await n(o)}catch(e){return console.warn(`Error evaluating hideInSettings for step '${l.key||""}' in flow '${t.key}':`,e),!1}return!!n}async function k(e,t,l){let n;if(!l)return{disabled:!1};let o=l.disabledInSettings,r=l.disabledReasonInSettings;if((void 0===o||void 0===r)&&l.use)try{var i;let t=null==(i=e.getAction)?void 0:i.call(e,l.use);void 0===o&&(o=null==t?void 0:t.disabledInSettings),void 0===r&&(r=null==t?void 0:t.disabledReasonInSettings)}catch(e){console.warn(`Failed to get action ${l.use}:`,e)}let a=null,s=()=>(a||(a=new f.W5(e,t.key,"settings"),(0,g.w)(a,t.steps,e,t.key),a.defineProperty("currentStep",{value:l})),a),d=!1;if("function"==typeof o)try{d=!!await o(s())}catch(e){return console.warn(`Error evaluating disabledInSettings for step '${l.key||""}' in flow '${t.key}':`,e),{disabled:!1}}else d=!!o;if(!d)return{disabled:!1};if("function"==typeof r)try{let e=await r(s());null!=e&&""!==e&&(n=String(e))}catch(e){console.warn(`Error evaluating disabledReasonInSettings for step '${l.key||""}' in flow '${t.key}':`,e)}else null!=r&&""!==r&&(n=String(r));return{disabled:!0,reason:n}}var A=l(35846),P=l(44476),j=l(73398);function M(e){if("string"!=typeof e)return null;let t=e.trim(),l=/^\{\{\s*ctx(?:\.(.+?))?\s*\}\}$/,n=t.match(l);if(!n)return null;let o=n[1];return o?o.split(".").map(e=>e.trim()).filter(e=>e.length>0):[]}function I(e){return 0===e.length?"{{ ctx }}":`{{ ctx.${e.join(".")} }}`}function T(e){if("string"!=typeof e)return!1;let t=e.trim();return/^\{\{\s*ctx(?:\..+?)?\s*\}\}$/.test(t)}let R=new WeakMap;function E(e,t){R.set(e,t??null)}function N(e){return R.get(e)??null}function D(e){R.delete(e)}let B=["drawer","dialog","embed"],$=["small","medium","large"],O="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",q=8,L=Symbol.for("nocobase.runjs.openViewRouteState");function _(e){return"string"==typeof e&&B.includes(e)}function V(e){return"string"==typeof e&&$.includes(e)}function z(e){let t={};return _(null==e?void 0:e.mode)&&(t.mode=e.mode),V(null==e?void 0:e.size)&&(t.size=e.size),t.mode||t.size?t:void 0}function K(e){let t=0x811c9dc5;for(let l=0;l<e.length;l++)t^=e.charCodeAt(l),t=Math.imul(t,0x1000193);return t>>>0}function U(e){let t=4*(e.mode?B.indexOf(e.mode)+1:0)+(e.size?$.indexOf(e.size)+1:0);return t>0?t:void 0}function W(e){let t=Math.floor(e/4),l=e%4;return z({mode:t?B[t-1]:void 0,size:l?$[l-1]:void 0})}function H(e,t){let l=K(`${e}:${t}`),n="";for(let e=0;e<q;e++)n+=O[(l=Math.imul(l^t+17*e,0x1000193)>>>0)%O.length];return n}function G(e){return"string"==typeof e&&e.length===q&&[...e].every(e=>O.includes(e))}function Y(e,t){let l=z(t),n=l?U(l):void 0;return n?H(e,n):void 0}function J(e,t){if(G(t)){for(let l=1;l<16;l++)if(H(e,l)===t)return W(l)}}let X=e=>e&&"/"!==e?`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`:"/",Q=e=>`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`,Z=(e,t)=>{let l=X(e),n=Q(t);return l===n?"":l.startsWith(`${n}/`)?l.slice(n.length+1):""},ee=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||"/"===e)return[];let l=t.rootPrefix||"admin",n=t.basePath?Z(e,t.basePath):"",o=(t.basePath?n:e).replace(/^\/+/,"").split("/").filter(Boolean);if(o.length<(t.basePath?1:2))return[];let r=[],i=null,a=0;for(t.basePath&&(i={viewUid:o[0]},a=1);a<o.length;){let e=o[a];if(e===l||"view"===e)if(i&&r.push(i),a+1<o.length)i={viewUid:o[a+1]},a+=2;else break;else if(i){if("opts"===e){if(a+1<o.length){let e=J(i.viewUid,o[a+1]);e&&(i.openViewRouteState=e),a+=2}else a++;continue}if(a+1>=o.length){a++;continue}let t=o[a+1],l=t;try{l=decodeURIComponent(t)}catch(e){}switch(e){case"tab":i.tabUid=l;break;case"filterbytk":{let e=e=>{let t={};return e.split("&").forEach(e=>{let[l,n=""]=e.split("=");if(l)try{let e=decodeURIComponent(l),o=decodeURIComponent(n);t[e]=o}catch(e){t[l]=n}}),t},t=l;if(l&&(l.startsWith("{")||l.startsWith("[")))try{let e=JSON.parse(l);t=e&&"object"==typeof e&&!Array.isArray(e)?e:l}catch(e){t=l}else l&&/^[^=&]+=[^=&]*(?:&[^=&]+=[^=&]*)*$/.test(l)&&(t=e(l));i.filterByTk=t;break}case"sourceid":i.sourceId=l}a+=2}else a++}return i&&r.push(i),r};var et=l(74353),el=l.n(et);let en=/^\{\{\s*ctx\.date(?:\.(.+?))?\s*\}\}$/,eo=new Set(["today","now","yesterday","tomorrow","thisWeek","lastWeek","nextWeek","thisMonth","lastMonth","nextMonth","thisQuarter","lastQuarter","nextQuarter","thisYear","lastYear","nextYear"]),er=new Set(["next","past"]),ei=new Set(["day","week","month","year"]),ea=128;function es(e){if("string"!=typeof e)return null;let t=e.trim().match(en);if(!t)return null;let l=String(t[1]||"");return l?l.split(".").map(e=>e.trim()).filter(Boolean):[]}function ed(e){if("date"!==e[0])return!1;if(1===e.length)return!0;if("preset"===e[1])return 2===e.length||3===e.length&&eo.has(e[2]);if("relative"===e[1])return 2===e.length||(3===e.length?er.has(e[2]):4===e.length?er.has(e[2])&&ei.has(e[3]):5===e.length&&er.has(e[2])&&ei.has(e[3])&&"number"==typeof ey(e[4]));if("exact"===e[1]){if(2===e.length)return!0;if("single"===e[2])return 3===e.length||(4===e.length?"date"===e[3]:5===e.length&&"date"===e[3]&&/^v.+/.test(e[4]));if("range"===e[2]){if(3===e.length)return!0;if(4===e.length)return"date"===e[3];if(5===e.length)return"date"===e[3]&&/^v.+/.test(e[4]);if(6===e.length)return"date"===e[3]&&/^v.+/.test(e[4])&&/^v.+/.test(e[5])}}return!1}function eu(e){let t=String(e||"");if(!t.startsWith("v"))return;let l=eS(t.slice(1));if(l&&!(l.length>ea))return l}function ec(e){if("date"!==e[0])return null;if("format"!==e[1])return{baseSegments:e};if(e.length<4)return null;let t=eu(e[2]);return t?{baseSegments:["date",...e.slice(3)],format:t}:null}function ep(e){let t=em((e||[]).map(e=>String(e)));if("date"!==t[0])return!1;if(1===t.length)return!0;if("format"!==t[1])return ed(t);if(2===t.length)return!0;if(3===t.length)return"string"==typeof eu(t[2]);let l=ec(t);return!!l&&ed(l.baseSegments)}function em(e){return"date"===e[0]?e:["date",...e]}function eh(e){let t=em(e);return`{{ ctx.${t.join(".")} }}`}function ef(e){var t;let l=null==(t=globalThis)?void 0:t.Buffer;if(l&&"function"==typeof l.from)return l.from(e,"utf8").toString("base64");if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))));throw Error("No base64 encoder available")}function eg(e){var t;let l=null==(t=globalThis)?void 0:t.Buffer;if(l&&"function"==typeof l.from)return l.from(e,"base64").toString("utf8");if("function"==typeof atob)return decodeURIComponent(Array.from(atob(e)).map(e=>`%${e.charCodeAt(0).toString(16).padStart(2,"0")}`).join(""));throw Error("No base64 decoder available")}function ev(e){if(null!=e){if("string"==typeof e){let t=e.trim();return t.length?t:void 0}if(el().isDayjs(e))return e.toISOString();if(e instanceof Date)return el()(e).toISOString();if("number"==typeof e||"boolean"==typeof e)return String(e)}}function ey(e){let t=String(e||"").match(/^n(\d+)$/);if(!t)return;let l=Number(t[1]);if(Number.isFinite(l)&&!(l<=0))return l}function ex(e){let t=e.day(),l=0===t?-6:1-t;return e.add(l,"day").startOf("day")}function eb(e){let t=3*Math.floor(e.month()/3);return e.month(t).startOf("month")}function ew(e){return ef(String(e||"")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function eS(e){try{let t=String(e||"").replace(/=+$/g,"");if(!t||!/^[A-Za-z0-9_-]+$/.test(t))return;let l=t.replace(/-/g,"+").replace(/_/g,"/"),n=l.length%4==0?0:4-l.length%4,o=`${l}${"=".repeat(n)}`,r=eg(o);if(ew(r)!==t)return;return r}catch(e){return}}function eC(e){return"string"==typeof e&&en.test(e.trim())}function eF(e){if(!ep(e))return!1;let t=ec(em((e||[]).map(e=>String(e))));if(!t)return!1;let l=t.baseSegments;return"preset"===l[1]?3===l.length&&eo.has(l[2]):"relative"===l[1]?5===l.length&&er.has(l[2])&&ei.has(l[3])&&"number"==typeof ey(l[4]):"exact"===l[1]&&"single"===l[2]&&"date"===l[3]?5===l.length&&/^v.+/.test(l[4]):"exact"===l[1]&&"range"===l[2]&&"date"===l[3]&&6===l.length&&/^v.+/.test(l[4])&&/^v.+/.test(l[5])}function ek(e){if(!eC(e))return;let t=ec(em(es(e)||[]));if(!t)return;let l=t.baseSegments;if("preset"===l[1]&&3===l.length&&eo.has(l[2]))return{type:l[2]};if("relative"===l[1]&&5===l.length&&er.has(l[2])&&ei.has(l[3])){let e=ey(l[4]);return"number"==typeof e?{type:l[2],unit:l[3],number:e}:void 0}if("exact"===l[1]&&"single"===l[2]&&"date"===l[3]&&5===l.length){let e=String(l[4]||"");if(!e.startsWith("v"))return;return eS(e.slice(1))}if("exact"===l[1]&&"range"===l[2]&&"date"===l[3]&&6===l.length){let e=String(l[4]||""),t=String(l[5]||"");if(!e.startsWith("v")||!t.startsWith("v"))return;let n=eS(e.slice(1)),o=eS(t.slice(1));if(void 0===n||void 0===o)return;return[n,o]}}function eA(e){if(!eC(e))return;let t=ec(em(es(e)||[]));if(!t)return;let l=ek(e),n=t.format?{format:t.format}:{};if("string"==typeof l)return{kind:"exact",value:l,...n};if(Array.isArray(l)&&2===l.length&&"string"==typeof l[0]&&"string"==typeof l[1])return{kind:"exact",value:[l[0],l[1]],...n};if(!l||"object"!=typeof l)return;let o=l;if("past"===o.type||"next"===o.type){if("string"!=typeof o.unit||!ei.has(o.unit)||"number"!=typeof o.number)return;return{kind:"relative",direction:o.type,amount:o.number,unit:o.unit,...n}}if("string"==typeof o.type&&eo.has(o.type))return{kind:"preset",preset:o.type,...n}}function eP(e){let t;if("preset"===e.kind){if(!eo.has(e.preset))return;t={type:e.preset}}else if("relative"===e.kind){if(!er.has(e.direction)||!ei.has(e.unit))return;let l=Math.floor(Number(e.amount));if(!Number.isFinite(l)||l<=0)return;t={type:e.direction,unit:e.unit,number:l}}else t=e.value;let l=ej(t);if(!l||!e.format)return l;let n=String(e.format);if(!n.trim()||n.length>ea)return;let o=em(es(l)||[]);return eh(["date","format",`v${ew(n)}`,...o.slice(1)])}function ej(e){if(eC(e))return String(e).trim();if(null==e||""===e)return;if(Array.isArray(e)){let t=ev(e[0]),l=ev(e[1]);return t&&l?eh(["date","exact","range","date",`v${ew(t)}`,`v${ew(l)}`]):t?eh(["date","exact","single","date",`v${ew(t)}`]):void 0}if("object"==typeof e&&e){let t=e,l="string"==typeof t.type?t.type:"";if("past"===l||"next"===l){let e="string"==typeof t.unit&&ei.has(t.unit)?t.unit:"day",n=Number(t.number),o=Number.isFinite(n)&&n>0?Math.floor(n):1;return eh(["date","relative",l,e,`n${o}`])}if(eo.has(l))return eh(["date","preset",l])}let t=ev(e);if(t)return eh(["date","exact","single","date",`v${ew(t)}`])}function eM(e,t){let l=e=>{if("string"!=typeof e)return e;let l=el()(e);return l.isValid()?l.format(t):e};return Array.isArray(e)?e.map(l):l(e)}function eI(e){let t=ec(em((e||[]).map(e=>String(e))));if(!t)return;if(t.format)return eM(eI(t.baseSegments),t.format);let l=t.baseSegments;if("date"===l[0]){if("preset"===l[1]&&3===l.length){let e=l[2];if("now"===e)return el()().toISOString();let t=el()();return"today"===e?t.format("YYYY-MM-DD"):"yesterday"===e?t.add(-1,"day").format("YYYY-MM-DD"):"tomorrow"===e?t.add(1,"day").format("YYYY-MM-DD"):"thisWeek"===e?ex(t).format("YYYY-MM-DD"):"lastWeek"===e?ex(t.add(-1,"week")).format("YYYY-MM-DD"):"nextWeek"===e?ex(t.add(1,"week")).format("YYYY-MM-DD"):"thisMonth"===e?t.startOf("month").format("YYYY-MM-DD"):"lastMonth"===e?t.add(-1,"month").startOf("month").format("YYYY-MM-DD"):"nextMonth"===e?t.add(1,"month").startOf("month").format("YYYY-MM-DD"):"thisQuarter"===e?eb(t).format("YYYY-MM-DD"):"lastQuarter"===e?eb(t.add(-3,"month")).format("YYYY-MM-DD"):"nextQuarter"===e?eb(t.add(3,"month")).format("YYYY-MM-DD"):"thisYear"===e?t.startOf("year").format("YYYY-MM-DD"):"lastYear"===e?t.add(-1,"year").startOf("year").format("YYYY-MM-DD"):"nextYear"===e?t.add(1,"year").startOf("year").format("YYYY-MM-DD"):void 0}if("relative"===l[1]&&5===l.length&&er.has(l[2])&&ei.has(l[3])){let e=ey(l[4]);if("number"!=typeof e)return;let t="past"===l[2]?-1:1,n=l[3];return el()().add(t*e,n).format("YYYY-MM-DD")}if("exact"===l[1]&&"single"===l[2]&&"date"===l[3]&&5===l.length){let e=String(l[4]||"");if(!e.startsWith("v"))return;return eS(e.slice(1))}if("exact"===l[1]&&"range"===l[2]&&"date"===l[3]&&6===l.length){let e=String(l[4]||""),t=String(l[5]||"");if(!e.startsWith("v")||!t.startsWith("v"))return;let n=eS(e.slice(1)),o=eS(t.slice(1));if(void 0===n||void 0===o)return;return[n,o]}}}var eT=l(51143);let eR=new Set(["code","version"]);function eE(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.keys(e);if(!t.includes("code")||"string"!=typeof e.code||"version"in e&&null!=e.version&&"string"!=typeof e.version)return!1;for(let e of t)if(!eR.has(e))return!1;return!0}function eN(e){return{code:String((null==e?void 0:e.code)??""),version:String((null==e?void 0:e.version)??"v1")}}function eD(e){let t="",l="code";for(let n=0;n<e.length;n++){let o=e[n],r=n+1<e.length?e[n+1]:"";if("code"===l){if("/"===o&&"/"===r){t+=" ",n++,l="line";continue}if("/"===o&&"*"===r){t+=" ",n++,l="block";continue}if("'"===o){t+=" ",l="single";continue}if('"'===o){t+=" ",l="double";continue}t+=o;continue}if("line"===l){"\n"===o?(t+="\n",l="code"):t+=" ";continue}if("block"===l){"*"===o&&"/"===r?(t+=" ",n++,l="code"):t+="\n"===o?"\n":" ";continue}if("single"===l){if("\\"===o){t+=" ",n++;continue}"'"===o?(t+=" ",l="code"):t+="\n"===o?"\n":" ";continue}if("\\"===o){t+=" ",n++;continue}'"'===o?(t+=" ",l="code"):t+="\n"===o?"\n":" "}return t}function eB(e){let t="",l="code";for(let n=0;n<e.length;n++){let o=e[n],r=n+1<e.length?e[n+1]:"";if("code"===l){if("/"===o&&"/"===r){t+=" ",n++,l="line";continue}if("/"===o&&"*"===r){t+=" ",n++,l="block";continue}if("'"===o){t+=o,l="single";continue}if('"'===o){t+=o,l="double";continue}t+=o;continue}if("line"===l){"\n"===o?(t+="\n",l="code"):t+=" ";continue}if("block"===l){"*"===o&&"/"===r?(t+=" ",n++,l="code"):t+="\n"===o?"\n":" ";continue}if("single"===l){if(t+=o,"\\"===o){let l=n+1<e.length?e[n+1]:"";l&&(t+=l,n++);continue}"'"===o&&(l="code");continue}if(t+=o,"\\"===o){let l=n+1<e.length?e[n+1]:"";l&&(t+=l,n++);continue}'"'===o&&(l="code")}return t}function e$(e){let t;if(!e)return{subPath:"",wildcard:!1};let l=e;l=l.replace(/\[['"]([a-zA-Z_$][a-zA-Z0-9_$]*)['"]\]/g,".$1");let n=/\[([^\]]+)\]/g;for(;t=n.exec(l);){let e=String(t[1]??"").trim();if(!(/^\d+$/.test(e)||/^['"][a-zA-Z_$][a-zA-Z0-9_$]*['"]$/.test(e)))return{subPath:l.startsWith(".")?l.slice(1):l,wildcard:!0}}return l.startsWith(".")&&(l=l.slice(1)),{subPath:l,wildcard:!1}}function eO(e){let t=String(e||"").trim();if(!t||"ctx"===t)return null;let l=t.match(/^ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)([\s\S]*)$/);if(l){let e=l[1]||"",t=e$(l[2]||"");return{varName:e,subPath:t.subPath,wildcard:t.wildcard}}let n=t.match(/^ctx\s*\[\s*(['"])([a-zA-Z_$][a-zA-Z0-9_$]*)\1\s*\]([\s\S]*)$/);if(n){let e=n[2]||"",t=e$(n[3]||"");return{varName:e,subPath:t.subPath,wildcard:t.wildcard}}return null}function eq(e){let t;if("string"!=typeof e||!e.trim())return{};let l=eD(e),n=eB(e),o=new Map,r=(e,t)=>{if(!e)return;let l=o.get(e)||new Set;l.add(t||""),o.set(e,l)},i=e=>{let t=eO(e);(null==t?void 0:t.varName)&&r(t.varName,t.wildcard?"":t.subPath)},a=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*(?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g;for(;t=a.exec(l);)i(`ctx.${t[1]||""}`);let s=/ctx\s*\[\s*(['"])([a-zA-Z_$][a-zA-Z0-9_$]*)\1\s*\]((?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g;for(;t=s.exec(n);)i(`ctx['${t[2]||""}']${t[3]||""}`);let d=/ctx\.getVar\s*\(\s*(['"])((?:\\.|(?!\1)[\s\S])*)\1\s*\)/g;for(;t=d.exec(n);){let e=String(t[2]||"").replace(/\\'/g,"'").replace(/\\"/g,'"').trim();e.startsWith("ctx")&&i(e)}let u={};for(let[e,t]of o.entries())u[e]=Array.from(t);return u}async function eL(e,t){let l={};if(!t||"object"!=typeof t||Array.isArray(t))return l;for(let[n,o]of Object.entries(t))if(void 0!==o){if(eE(o)){let{code:t,version:r}=eN(o);if(!t.trim())continue;let i=await (0,eT._)(e,t,{version:r});if(!(null==i?void 0:i.success))throw Error(`RunJS execution failed for "${n}"`);void 0!==i.value&&(l[n]=i.value);continue}l[n]=o}return l}var e_=l(49773);let eV="ctx.resolveJsonTemplate",ez=/\{\{\s*ctx(?:\.|\[|\?\.)/,eK=/\bctx(?:\?\.|\.)libs\b/,eU="__runjs_templateValueToString",eW=/\b__runjs_ctx_tpl_\d+\b/,eH=/\b__runjs_templateValueToString(?:_\d+)?\b/,eG=/\b__runjs_ctx_tpl_\d+\b|\b__runjs_templateValueToString(?:_\d+)?\b/,eY=/\b__runjs_ensure_libs\b/,eJ=256,eX={withTemplates:new Map,withoutTemplates:new Map};function eQ(e,t){let l=e.get(t);if(void 0!==l)return e.delete(t),e.set(t,l),l}function eZ(e,t,l,n){if(e.has(t)&&e.delete(t),e.set(t,l),e.size<=n)return;let o=e.keys().next().value;void 0!==o&&e.delete(o)}function e0(e){return!!e&&/[A-Za-z0-9_$]/.test(e)}function e1(e){if(!e.startsWith("{{")||!e.endsWith("}}"))return!1;let t=e.slice(2,-2).trim();return t.startsWith("ctx.")||t.startsWith("ctx[")||t.startsWith("ctx?.")}function e2(e,t){if(!e.startsWith(eV,t))return!1;let l=t>0?e[t-1]:"",n=e[t+eV.length]||"";return!(e0(l)||e0(n))}function e8(e,t){let l=t+2;for(;l<e.length;){let t=e[l];if(l+=1,"\n"===t)break}return l}function e5(e,t){let l=t+2;for(;l<e.length;){let t=e[l],n=e[l+1];if("*"===t&&"/"===n)return l+2;l+=1}return l}function e4(e,t,l){let n=t+1;for(;n<e.length;){let t=e[n];if("\\"===t){n+=2;continue}if(n+=1,t===l)break}return n}function e3(e,t){let l=t+1;for(;l<e.length;){let t=e[l];if("\\"===t){l+=2;continue}if("`"===t)return l+1;if("$"===t&&"{"===e[l+1]){l+=2;let t=1;for(;l<e.length&&t>0;){let n=e[l],o=e[l+1];if("'"===n||'"'===n){l=e4(e,l,n);continue}if("`"===n){l=e3(e,l);continue}if("/"===n&&"/"===o){l=e8(e,l);continue}if("/"===n&&"*"===o){l=e5(e,l);continue}"{"===n?t+=1:"}"===n&&(t-=1),l+=1}continue}l+=1}return l}function e6(e){if(!ez.test(e))return[];let t=[],l=0;for(;l<e.length;){let n=e.indexOf("{{",l);if(-1===n)break;let o=e.indexOf("}}",n+2);if(-1===o)break;let r=e.slice(n,o+2);e1(r)&&t.push(r),l=o+2}return t}function e9(e,t){let l=t;for(;l<e.length&&/\s/.test(e[l]);)l+=1;return l}function e7(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]);)l-=1;return l}function te(e,t){let l=t;for(;;){l=e9(e,l);let t=e[l],n=e[l+1];if("/"===t&&"/"===n){l=e8(e,l);continue}if("/"===t&&"*"===n){l=e5(e,l);continue}return l}}function tt(e){return!!e&&/[A-Za-z_$]/.test(e)}function tl(e,t){if(!tt(e[t]))return null;let l=t+1;for(;l<e.length&&e0(e[l]);)l+=1;return{name:e.slice(t,l),end:l}}function tn(e,t,l){if(e[t]!==l)return null;let n=t+1,o="";for(;n<e.length;){let t=e[n];if("\\"===t){let t=e[n+1];if(void 0===t)break;o+=t,n+=2;continue}if(t===l)return{value:o,end:n+1};o+=t,n+=1}return null}function to(e,t){if(!e.startsWith("ctx",t))return null;let l=t>0?e[t-1]:"",n=e[t+3]||"";if(e0(l)||e0(n))return null;let o=e.slice(t+3);return o.startsWith(".libs")?t+3+5:o.startsWith("?.libs")?t+3+6:null}function tr(e,t){let l=to(e,t);if(null===l)return null;let n=te(e,l),o=e[n],r=e[n+1],i=e[n+2];if("?"===o&&"."===r&&"["===i){n=te(e,n+3);let t=e[n];if("'"===t||'"'===t){let l=tn(e,n,t);if(!l)return{end:n+1};let o=te(e,l.end);return"]"===e[o]&&(o+=1),{end:o,key:l.value}}return{end:n}}if("["===o){n=te(e,n+1);let t=e[n];if("'"===t||'"'===t){let l=tn(e,n,t);if(!l)return{end:n+1};let o=te(e,l.end);return"]"===e[o]&&(o+=1),{end:o,key:l.value}}return{end:n}}if("?"===o&&"."===r){n=te(e,n+2);let t=tl(e,n);return t?{end:t.end,key:t.name}:{end:n}}if("."===o){n=te(e,n+1);let t=tl(e,n);return t?{end:t.end,key:t.name}:{end:n}}return{end:l}}function ti(e){let t=[],l=String(e??""),n=0,o=0,r=0,i=0,a=e=>{let l=String(e??"").trim();if(!l||l.startsWith("..."))return;let n=l,o=0,r=0,i=0,a=0;for(;o<l.length;){let e=l[o],t=l[o+1];if("/"===e&&"/"===t)break;if("/"===e&&"*"===t){let e=l.indexOf("*/",o+2);o=-1===e?l.length:e+2;continue}if("'"===e||'"'===e){let t=o+1;for(;t<l.length;){let n=l[t];if("\\"===n){t+=2;continue}if(t+=1,n===e)break}o=t;continue}if("`"===e){let e=o+1;for(;e<l.length;){let t=l[e];if("\\"===t){e+=2;continue}if(e+=1,"`"===t)break}o=e;continue}if("{"===e?r+=1:"}"===e?r-=1:"["===e?i+=1:"]"===e?i-=1:"("===e?a+=1:")"===e&&(a-=1),0===r&&0===i&&0===a&&(":"===e||"="===e)){n=l.slice(0,o).trim();break}o+=1}if(!n)return;if(n.startsWith("'")||n.startsWith('"')){let e=n[0],l=tn(n,0,e);l&&t.push(l.value);return}let s=n.match(/^[A-Za-z_$][A-Za-z0-9_$]*/);s&&t.push(s[0])},s=0;for(;s<l.length;){let e=l[s],t=l[s+1];if("/"===e&&"/"===t)break;if("/"===e&&"*"===t){let e=l.indexOf("*/",s+2);s=-1===e?l.length:e+2;continue}if("'"===e||'"'===e){s=e4(l,s,e);continue}if("`"===e){s=e3(l,s);continue}"{"===e?o+=1:"}"===e?o-=1:"["===e?r+=1:"]"===e?r-=1:"("===e?i+=1:")"===e&&(i-=1),0===o&&0===r&&0===i&&","===e&&(a(l.slice(n,s)),n=s+1),s+=1}return a(l.slice(n)),t}function ta(e){if(!eK.test(e))return[];let t=new Set,l=l=>{let o=l,r=1;for(;o<e.length&&r>0;){let l=e[o],i=e[o+1];if("/"===l&&"/"===i){o=e8(e,o);continue}if("/"===l&&"*"===i){o=e5(e,o);continue}if("'"===l||'"'===l){o=e4(e,o,l);continue}if("`"===l){o=n(o+1);continue}let a=tr(e,o);if(a){a.key&&t.add(a.key),o=a.end;continue}"{"===l?r+=1:"}"===l&&(r-=1),o+=1}return o},n=t=>{let n=t;for(;n<e.length;){let t=e[n],o=e[n+1];if("\\"===t){n+=2;continue}if("`"===t)return n+1;if("$"===t&&"{"===o){n=l(n+2);continue}n+=1}return n},o=0;for(;o<e.length;){let l=e[o],r=e[o+1];if("/"===l&&"/"===r){o=e8(e,o);continue}if("/"===l&&"*"===r){o=e5(e,o);continue}if("'"===l||'"'===l){o=e4(e,o,l);continue}if("`"===l){o=n(o+1);continue}let i=tr(e,o);if(i){i.key&&t.add(i.key),o=i.end;continue}if("="===l&&"="!==r&&">"!==r&&"<"!==r){let l=te(e,o+1);if(null!==to(e,l)){let l=e7(e,o-1);if("}"===e[l]){let n=0,o=l;for(;o>=0;){let t=e[o];if("}"===t)n+=1;else if("{"===t&&0==(n-=1))break;o-=1}if(o>=0&&"{"===e[o])for(let n of ti(e.slice(o+1,l)))t.add(n)}}}o+=1}return Array.from(t)}function ts(e){if(eY.test(e)||!eK.test(e))return e;let t=ta(e);return t.length?`/* __runjs_ensure_libs */
|
|
3567
3567
|
await ctx.__ensureLibs(${JSON.stringify(t)});
|
|
3568
3568
|
${e}`:e}function td(e,t,l){let n=e9(e,l);if(":"!==e[n])return!1;let o=e7(e,t-1),r=o>=0?e[o]:"";return"{"===r||","===r}function tu(e,t,l,n){let o=Array.from(new Set(t));if(!o.length)return e;let r=e;for(let e of o){let t=l(e);r=`(${r}).split(${JSON.stringify(e)}).join(${n}(${t}, ${JSON.stringify(e)}))`}return r}function tc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ez.test(e))return e;let l=!1!==t.processBarePlaceholders,n=!1!==t.processStringLiterals;if(l&&n&&eG.test(e)||l&&!n&&eW.test(e)||!l&&n&&eH.test(e))return e;let o=new Map,r=[],i=!1,a=new Set,s=(t=>{if(!e.includes(t)&&!a.has(t))return a.add(t),t;let l=1;for(;e.includes(`${t}_${l}`)||a.has(`${t}_${l}`);)l+=1;let n=`${t}_${l}`;return a.add(n),n})(eU),d=0,u=()=>{for(;;){let t=`__runjs_ctx_tpl_${d}`;if(d+=1,!(e.includes(t)||a.has(t)))return a.add(t),t}},c=e=>{let t=o.get(e);if(t)return t;let l=u();return o.set(e,l),r.push(`const ${l} = await ctx.resolveJsonTemplate(${JSON.stringify(e)});`),l},p="",m=0,h=!1,f=0;for(;m<e.length;){let t=e[m],o=e[m+1];if("/"===t&&"/"===o){let t=e8(e,m);p+=e.slice(m,t),m=t;continue}if("/"===t&&"*"===o){let t=e5(e,m);p+=e.slice(m,t),m=t;continue}if("'"===t||'"'===t){let l=e4(e,m,t),o=e.slice(m,l);if(n&&0===f){let t=e6(o);if(t.length){i=!0;let n=tu(o,t,c,s);p+=td(e,m,l)?`[${n}]`:n}else p+=o}else p+=o;m=l;continue}if("`"===t){let t=e3(e,m),l=e.slice(m,t);if(n&&0===f){let n=e6(l);if(n.length){i=!0;let o=tu(l,n,c,s);p+=td(e,m,t)?`[${o}]`:o}else p+=l}else p+=l;m=t;continue}if(0===f&&!h&&e2(e,m)){p+=eV,m+=eV.length,h=!0;continue}if(h){if(/\s/.test(t)){p+=t,m+=1;continue}if("("===t){p+=t,m+=1,h=!1,f=1;continue}h=!1;continue}if(f>0){"("===t?f+=1:")"===t&&(f-=1),p+=t,m+=1;continue}if(l&&"{"===t&&"{"===o){let t=e.indexOf("}}",m+2);if(-1!==t){let l=e.slice(m,t+2);if(e1(l)){p+=c(l),m=t+2;continue}}}p+=t,m+=1}if(!r.length)return p;let g=[];return i&&g.push(`const ${s} = (value, placeholder) => {`," if (typeof value === 'undefined') return placeholder;"," if (typeof value === 'object' && value !== null) {"," try {"," return JSON.stringify(value);"," } catch (e) {"," return String(value);"," }"," }"," return String(value);","};"),g.push(...r),`${g.join("\n")}
|
|
3569
|
-
${p}`}async function tp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l="string"==typeof e?e:String(e??""),n=!!t.preprocessTemplates,o=n?eX.withTemplates:eX.withoutTemplates,r=eQ(o,l);if(r)return await r;let i=(async()=>{if(!n)return ts(await (0,e_.W)(l));let e=tc(l,{processStringLiterals:!1});return ts(tc(await (0,e_.W)(e),{processBarePlaceholders:!1}))})();eZ(o,l,i,eJ);try{return await i}catch(e){throw o.delete(l),e}}var tm=l(62572);function th(e){if(Array.isArray(e)){let t=e.map(e=>th(e)).filter(e=>void 0!==e);return t.length?t:void 0}if(e&&"object"==typeof e){let t={};return Object.keys(e).forEach(l=>{let n=th(e[l]);void 0!==n&&(t[l]=n)}),Object.keys(t).length?t:void 0}return null==e||"string"==typeof e&&""===e?void 0:e}let tf=e=>"string"==typeof e.on?"beforeRender"===e.on:"object"==typeof e.on?"beforeRender"===e.on.eventName:!e.on&&!0!==e.manual;var tg=l(47684);let tv="0123456789abcdefghijklmnopqrstuvwxyz";function ty(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:11,l="";for(let e=0;e<t;e++)l+=tv[Math.random()*tv.length|0];return`${e}${l}`}},49773(e,t,l){"use strict";async function n(e){if(!/<[A-Za-z]|<\//.test(e))return e;try{var t;let n=await l.e("1339").then(l.bind(l,1608)),o=(null==n?void 0:n.transform)||(null==n||null==(t=n.default)?void 0:t.transform);if("function"!=typeof o)return e;let r=o(e,{transforms:["jsx"],jsxPragma:"ctx.React.createElement",jsxFragmentPragma:"ctx.React.Fragment",disableESTransforms:!0,production:!0});return(r&&(r.code||(null==r?void 0:r.output)))??e}catch(t){return e}}l.d(t,{W:()=>n})},81982(e,t,l){"use strict";l.d(t,{M:()=>f,gG:()=>a,mv:()=>s,o4:()=>m,pk:()=>h});var n=l(40542),o=l(13939),r=l(2543),i=l.n(r);async function a(e,t){if(!e)return{};if("function"==typeof e)try{return await e(t)||{}}catch(e){return console.error("Error resolving defaultParams function:",e),{}}return e}async function s(e,t,l){if(!e)return{};if("function"==typeof e)try{return await e(t,l)||{}}catch(e){return console.error("Error resolving createModelOptions function:",e),{}}return e}let d={queue:[],timer:null,inflightByRun:new Map},u=10;function c(e){if(Array.isArray(e))return e.map(c);if(i().isPlainObject(e)){let t=Object.entries(e).map(e=>{let[t,l]=e;return[t,c(l)]});return Object.fromEntries(i().sortBy(t,e=>{let[t]=e;return t}))}return e}function p(e){try{return JSON.stringify(c(e))}catch{try{return JSON.stringify(e)}catch{return String(e)}}}function m(e,t){let l,n,o=d,r=e.runId||"GLOBAL",i=p(t),a=o.inflightByRun.get(r);a||(a=new Map,o.inflightByRun.set(r,a));let s=a.get(i);if(s)return s;let c=new Promise((e,t)=>{l=e,n=t});a.set(i,c);let m={id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,ctx:e,payload:t,resolve:l,reject:n,runId:r,dedupKey:i};o.queue.push(m);let h=async()=>{var t,l,n,r,i,a;let s=o.queue.splice(0,o.queue.length);if(o.timer=null,!s.length)return;let d=null==(t=s[0].ctx)?void 0:t.api;if(!d){for(let e of s)try{e.resolve(e.payload.template)}catch(t){e.reject(t)}finally{null==(l=o.inflightByRun.get(e.runId))||l.delete(e.dedupKey)}return}try{let e=s.map(e=>({id:e.id,rd:e.payload.rd,template:e.payload.template,contextParams:e.payload.contextParams||{}})),t=await d.request({method:"POST",url:"variables:resolve",data:{values:{batch:e}}}),l=t.data??t,r=l.data??l,i=null==r?void 0:r.results,a=Array.isArray(i)?i:Array.isArray(r)?r:[],u=new Map;for(let e of a){let t=(null==e?void 0:e.id)!=null?String(e.id):"";t&&u.set(t,null==e?void 0:e.data)}for(let e of s)try{let t=String(e.id),l=u.has(t)?u.get(t):e.payload.template;e.resolve(l)}catch(t){e.reject(t)}finally{null==(n=o.inflightByRun.get(e.runId))||n.delete(e.dedupKey)}}catch(t){for(let l of s)try{null==e||null==(i=e.logger)||null==(r=i.warn)||r.call(i,{err:t},"variables:resolve(batch) failed, fallback"),l.resolve(l.payload.template)}catch(e){l.reject(e)}finally{null==(a=o.inflightByRun.get(l.runId))||a.delete(l.dedupKey)}}};return o.timer||(o.timer=setTimeout(h,u)),c}function h(e,t){var l,n;return(0,o.generateFlowModelRdFromToken)(t,null==e||null==(n=e.api)||null==(l=n.auth)?void 0:l.token)}async function f(e,t){let l=async e=>{if("string"==typeof e&&/\{\{.*?\}\}/.test(e))return await y(e,t);if(Array.isArray(e))return Promise.all(e.map(l));if(e&&"object"==typeof e){let t={};for(let[n,o]of Object.entries(e))t[n]=await l(o);return t}return e};return l(e)}async function g(e,t){let l=await v(e.trim(),t),n=await t.runjs(`return ${l}`,{t:t.t});return(null==n?void 0:n.success)?n.value:void 0}async function v(e,t){let l,n=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*(?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g,o=[],r=new Set;for(;null!==(l=n.exec(e));){let e=l[0],t=l[1],n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)/);if(n){let l=n[1],i=t.substring(l.length);o.push({fullPath:e,firstKey:l,restPath:i}),r.add(l)}}if(0===o.length)return e;let i=new Map;for(let e of r)try{let l=await t[e],n=l&&!0===l.__isRecordProxy__;i.set(e,n)}catch(t){i.set(e,!1)}o.sort((e,t)=>t.fullPath.length-e.fullPath.length);let a=e;for(let{fullPath:e,firstKey:t,restPath:l}of o){let n,o=i.get(t)||!1;n=""===l?`await ctx.${t}`:o?`await (await ctx.${t})${l}`:`(await ctx.${t})${l}`;let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=RegExp(`\\b${r}\\b`,"g");a=a.replace(s,n)}return a}async function y(e,t){let l=e=>{let t=e.trim().match(/^ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*))?$/);return t?t[2]?`${t[1]}.${t[2]}`:t[1]:null},o=async e=>{let l=e.split("."),o=l.shift();if(!o)return;let r=await t[o];return 0===l.length?r:(0,n.D)(r,l.join("."))},r=async e=>{let n=l(e);if(n){let l=await o(n);return void 0===l&&n.includes("-")?await g(e,t):l}return await g(e,t)},i=e.match(/^\s*\{\{\s*([^{}]+?)\s*\}\}\s*$/);if(i){let e=i[1];return await r(e)}let a=[...e.matchAll(/\{\{\s*(.+?)\s*\}\}/g)],s=e;for(let[e,t]of a){let l=await r(t);if(void 0!==l){let t="object"==typeof l&&null!==l?JSON.stringify(l):String(l);s=s.replace(e,t)}}return s}},47684(e,t,l){"use strict";function n(e,t){if(!e||"string"!=typeof e)throw Error("invalid url");let l=e.trim();if(l.startsWith("http://")||l.startsWith("https://"))return l;let n=window.__esm_cdn_base_url__||"https://esm.sh",o=(null==t?void 0:t.addSuffix)&&window.__esm_cdn_suffix__||"",r=n.replace(/\/$/,""),i=l.replace(/^\//,"");if(null==t?void 0:t.raw){let e=i.includes("?")?"&":"?";return`${r}/${i}${e}raw`}return`${r}/${i}${o}`}function o(e){return!!e&&"string"==typeof e&&e.split("?")[0].split("#")[0].endsWith(".css")}l.d(t,{i:()=>n,y:()=>o})},51143(e,t,l){"use strict";function n(){var e,t;let l=globalThis;if((null==(e=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:e.windowAllow)&&(null==(t=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:t.documentAllow))return l.__nocobaseRunJSSafeGlobalsRegistry;let n={windowAllow:new Set,documentAllow:new Set};return l.__nocobaseRunJSSafeGlobalsRegistry=n,n}function o(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.windowAllow.add(e)}}function r(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.documentAllow.add(e)}}function i(e){return n().windowAllow.has(e)}function a(e){return n().documentAllow.has(e)}function s(e){let t=()=>`${window.location.origin}${window.location.pathname}`,l=(e,l,n)=>{if(!(e=>{try{let l=new URL(e,t()),n=l.protocol.toLowerCase();if("about:"===n)return"about:blank"===l.href;return"http:"===n||"https:"===n}catch{return!1}})(e))throw Error("Unsafe URL: window.open only allows http/https/about:blank.");let o="_blank",r=(e=>{let t=new Set;return e&&e.split(",").map(e=>e.trim()).filter(Boolean).forEach(e=>{let l=e.split("=")[0].trim().toLowerCase();"noopener"!==l&&"noreferrer"!==l&&t.add(e)}),t.add("noopener"),t.add("noreferrer"),Array.from(t).join(",")})(n),i=window.open.call(window,e,o,r);if(i&&"opener"in i)try{i.opener=null}catch{}return i},n=(e,n)=>{let o=new URL(e,t()),r=o.protocol.toLowerCase(),i="about:"===r&&"about:blank"===o.href;if("http:"!==r&&"https:"!==r&&!i)throw Error("Unsafe URL: only http/https/about:blank are allowed.");if(i)return(null==n?void 0:n.replace)?window.location.replace("about:blank"):window.location.assign("about:blank");if(o.protocol===window.location.protocol&&o.hostname===window.location.hostname&&o.port===window.location.port)return(null==n?void 0:n.replace)?window.location.replace(o.href):window.location.assign(o.href);if(!l(o.href))throw Error("Popup blocked: cross-origin navigation is opened in a new tab.")},o=new Proxy({},{get(e,t){switch(t){case"origin":return window.location.origin;case"protocol":return window.location.protocol;case"host":return window.location.host;case"hostname":return window.location.hostname;case"port":return window.location.port;case"pathname":return window.location.pathname;case"assign":return e=>n(e,{replace:!1});case"replace":return e=>n(e,{replace:!0});case"reload":return window.location.reload.bind(window.location);case"href":throw Error("Reading location.href is not allowed.");default:throw Error(`Access to location property "${t}" is not allowed.`)}},set(e,t,l){if("href"===t)return n(String(l),{replace:!1}),!0;throw Error("Mutation on location is not allowed.")}}),r={setTimeout:window.setTimeout.bind(window),clearTimeout:window.clearTimeout.bind(window),setInterval:window.setInterval.bind(window),clearInterval:window.clearInterval.bind(window),console,Math,Date,FormData,..."u">typeof Blob?{Blob}:{},..."u">typeof URL?{URL}:{},addEventListener:addEventListener.bind(window),open:l,location:o,...e||{}};return new Proxy(Object.create(null),{get(e,t){if("string"!=typeof t)return Reflect.get(e,t);if(t in r)return r[t];if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(i(t)){let e=window[t];return"function"==typeof e?e.bind(window):e}throw Error(`Access to global property "${t}" is not allowed.`)},set(e,t,l){if("string"!=typeof t)return Reflect.set(e,t,l),!0;if(t in r)throw Error(`Mutation of global property "${t}" is not allowed.`);return e[t]=l,!0},has:(e,t)=>"string"!=typeof t?Reflect.has(e,t):!!(t in r||Object.prototype.hasOwnProperty.call(e,t)||i(t))})}function d(e){let t={createElement:document.createElement.bind(document),querySelector:document.querySelector.bind(document),querySelectorAll:document.querySelectorAll.bind(document),...e||{}};return new Proxy(Object.create(null),{get(e,l){if("string"!=typeof l)return Reflect.get(e,l);if(l in t)return t[l];if(Object.prototype.hasOwnProperty.call(e,l))return e[l];if(a(l)){let e=document[l];return"function"==typeof e?e.bind(document):e}throw Error(`Access to document property "${l}" is not allowed.`)},set(e,l,n){if("string"!=typeof l)return Reflect.set(e,l,n),!0;if(l in t)throw Error(`Mutation of document property "${l}" is not allowed.`);return e[l]=n,!0},has:(e,l)=>"string"!=typeof l?Reflect.has(e,l):!!(l in t||Object.prototype.hasOwnProperty.call(e,l)||a(l))})}function u(e){var t;let l="u">typeof window&&window.navigator||void 0,n={},o=null==l||null==(t=l.clipboard)?void 0:t.writeText;"function"==typeof o&&(n.writeText=o.bind(l.clipboard));let r={clipboard:n};return Object.defineProperty(r,"onLine",{get:()=>!!(null==l?void 0:l.onLine),enumerable:!0,configurable:!1}),Object.defineProperty(r,"language",{get:()=>null==l?void 0:l.language,enumerable:!0,configurable:!1}),Object.defineProperty(r,"languages",{get:()=>(null==l?void 0:l.languages)?[...l.languages]:void 0,enumerable:!0,configurable:!1}),Object.assign(r,e||{}),new Proxy({},{get(e,t){if(t in r)return r[t];throw Error(`Access to navigator property "${String(t)}" is not allowed.`)}})}function c(e){let t={};try{let e=u();t.navigator=e;try{t.window=s({navigator:e})}catch{}}catch{}try{t.document=d()}catch{}return e?{...t,...e}:t}async function p(e,t,l,n){if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.runjs)return e.runjs(t,c(n),l)}l.d(t,{D1:()=>u,I2:()=>c,Vm:()=>o,Xh:()=>d,_:()=>p,ey:()=>s,yz:()=>r})},22928(e,t,l){"use strict";function n(e){let t={};return Object.entries(e||{}).forEach(e=>{let[l,n]=e;null!=n&&(t[l]=n)}),t}function o(e,t,l){try{var n,o,r,i,a;let s=null==(o=e.dataSourceManager)||null==(n=o.getDataSource)?void 0:n.call(o,t||"main"),d=null==s||null==(i=s.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,l);return(null==d||null==(a=d.getPrimaryKey)?void 0:a.call(d))||"id"}catch(e){return"id"}}function r(e,t){var l,r;if(!t)return;let i=t.dataSourceKey||"main",a=t.collection||(null==(l=t.record)?void 0:l.__collectionName);if(!a)return;let s=o(e,i,a)||"id",d=void 0!==t.filterByTk?t.filterByTk:void 0!==t.id?t.id:null==(r=t.record)?void 0:r[s];if(void 0!==d)return n({collection:a,filterByTk:d,dataSourceKey:i,associationName:t.associationName,sourceId:t.sourceId,fields:t.fields,appends:t.appends})}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=e=>!!e&&"object"==typeof e&&"string"==typeof e.collection&&(void 0!==e.filterByTk||void 0!==e.id||e.record),n={},o=(t,i)=>{if(l(t)){let l=r(e,t);l&&(n[i.join(".")]=l);return}if(Array.isArray(t)){for(let e=0;e<t.length;e++)o(t[e],[...i,String(e)]);return}if(t&&"object"==typeof t){for(let[e,l]of Object.entries(t))o(l,[...i,e]);return}};return o(t,[]),Object.keys(n).length?n:void 0}l.d(t,{d:()=>i})},88439(e,t,l){"use strict";function n(e,t,l,n){let o={},r={};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let s=t[a],d={};if(s.uiSchema&&"object"==typeof s.uiSchema){for(let[e,t]of Object.entries(s.uiSchema))if(t&&"object"==typeof t){var i;let l=t;d[e]={type:l.type||"any",title:l.title||(null==(i=l["x-decorator-props"])?void 0:i.label)||e,interface:l["x-component"],uiSchema:l}}}let u=Object.keys(d).length>0;r[a]={type:"object",title:e.t(s.title)||a,display:u?"default":"none",properties:u?{params:{type:"object",title:"Parameters",display:"flatten",properties:d}}:void 0},o[a]={get params(){return l.getStepParams(n,a)||{}},get uiSchema(){return s.uiSchema},result:void 0}}e.defineProperty("steps",{get:()=>o})}l.d(t,{w:()=>n})},73398(e,t,l){"use strict";function n(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function o(e){return!!e&&/[a-zA-Z_$]/.test(e)}function r(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function i(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function a(e,t){let l=i(e,t);for(;"!"===e[l];)l=i(e,l+1);return l}function s(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function d(e,t){let l=s(e,t-1);if("("!==e[l])return!1;let n=s(e,l-1);if(n<0)return!0;let o=e[n];return!r(o)&&")"!==o&&"]"!==o}function u(e,t){let l=i(e,t);if(")"!==e[l])return!1;let n=i(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function c(e,t){if(!o(e[t]))return null;let l=t+1;for(;r(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function p(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function m(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,o="";for(;n<e.length;){let t=e[n];if("\\"===t){o+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:o,next:n+1};o+=t,n+=1}return null}function h(e,t){let l=i(e,t+1),n=m(e,l);if(n)return(l=i(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let o=p(e,l);return o?(l=i(e,o.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:o.value}:{dynamic:!0}}function f(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function g(e,t){let l=a(e,t);if("["===e[l])return h(e,l);if(e.startsWith("?.",l)){let t=i(e,l+2);if("["===e[t])return h(e,t);let n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=i(e,l+1),n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function v(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function y(e,t){if("ctx"!==e.slice(t,t+3)||r(e[t-1])||r(e[t+3]))return null;if(d(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=g(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],o=l.next,i=!1,s=!1;for(;o<e.length;){let t=a(e,o);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){i=!0,o=t;break}let l=g(e,o);if(!l){o=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(s=!0);break}if(l.dynamic){s=!0,o=t;break}f(n,l.kind,l.value),o=l.next}let c=n.join(".");return{next:Math.max(o,l.next),reference:{methodCall:i,path:c||void 0,unsupportedDynamicPath:s||u(e,o),varName:l.value}}}function x(e){let t=v(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=y(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function b(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function w(e){let t={},l=!1,o=e=>{for(let n of x(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&b(t,n.varName,n.path,n.methodCall)}},r=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)o(t[1]);return}Array.isArray(e)?e.forEach(r):n(e)&&Object.values(e).forEach(r)};return r(e),{unsupportedDynamicPath:l,usage:t}}function S(e){return new Set(Object.keys(w(e).usage))}function C(e){return w(e).usage}l.d(t,{xI:()=>E,vP:()=>$,$S:()=>N,pc:()=>D,Cg:()=>I,nN:()=>O,ju:()=>q,Xx:()=>R,vE:()=>T,XU:()=>M,UX:()=>B});var F=l(22928),k=l(35846),A=l(44476),P=l(2543),j=l.n(P);function M(e){var t,l,n,o;let r=e.resource,i=e.collection,a=e.record,s=(null==i?void 0:i.name)||(null==r||null==(t=r.getResourceName)?void 0:t.call(r)),d=(null==i?void 0:i.dataSourceKey)||(null==r||null==(l=r.getDataSourceKey)?void 0:l.call(r)),u=(null==r||null==(n=r.getFilterByTk)?void 0:n.call(r))??(null==i||null==(o=i.getFilterByTK)?void 0:o.call(i,a));if(!s||null==u)return;let c=String(s).split(".");return{collection:c[c.length-1],dataSourceKey:d,filterByTk:u}}function I(e){var t,l,n;let o=e.view;if(!o)return;let r=(null==o?void 0:o.inputArgs)||{},i=(null==r?void 0:r.collectionName)||(null==o||null==(t=o.record)?void 0:t.collection),a=(null==r?void 0:r.dataSourceKey)||(null==o||null==(l=o.record)?void 0:l.dataSourceKey)||"main",s=(null==r?void 0:r.filterByTk)||(null==o||null==(n=o.record)?void 0:n.filterByTk),d=null==r?void 0:r.associationName,u=null==r?void 0:r.sourceId;if(i&&null!=s)return{collection:i,dataSourceKey:a,filterByTk:s,sourceId:u,associationName:d}}function T(e,t){var l,n,o;let r=null==(l=e.inputArgs)?void 0:l.record,i=null==(n=e.collection)?void 0:n.filterTargetKey;if(!r||!i)return;let a=t.view,s=null==a||null==(o=a.inputArgs)?void 0:o.filterByTk,d=r[i];if(null!=s&&null!=d&&s===d)return j().cloneDeep(r)}function R(e,t){return l=>{var n,o,r,i;if(!("record"===l||l.startsWith("record.")))return!1;let a=t();if(!a)return!0;if("record"===l)return!1;let s=I(e),d=null==s?void 0:s.collection,u=(null==s?void 0:s.dataSourceKey)||"main";if(!d)return!0;let c=null==(o=e.dataSourceManager)||null==(n=o.getDataSource)?void 0:n.call(o,u),p=null==c||null==(i=c.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,d);if(!p)return!0;let m=(0,A.Hi)(()=>p,()=>a),h=l.startsWith("record.")?l.slice(7):"";return!!h&&m(h)}}function E(e,t){let l=(0,A.Hi)(e,()=>t());return n=>{let o=t();if(!o)return!0;if(!n)return!1;let r=e();if(!n.includes(".")){var i;let e,t=n;return r&&("function"==typeof r.getField&&(e=r.getField(t)),e||"function"!=typeof r.getFields||(e=(r.getFields()||[]).find(e=>(null==e?void 0:e.name)===t))),!!(null==e||null==(i=e.isAssociationField)?void 0:i.call(e))&&null==(null==o?void 0:o[t])}return l(n)}}async function N(e,t,l){let n=await (0,k.H)(e,t,!0)();return n?{...n,buildVariablesParams:e=>l?l(e):M(e)}:null}function D(e,t,l){let n=async()=>N(e,t,l);return n.title=t,n}function B(e,t,l){var n,o;return D(t,(null==l?void 0:l.title)?(null==(n=e.t)?void 0:n.call(e,l.title))||l.title:(null==(o=e.t)?void 0:o.call(e,"Current record"))||"Current record",e=>M(e))}let $=S,O=C;async function q(e,t){let l=C(t)||{},n=Object.keys(l);if(!n.length)return;let o={};for(let t of n){var r;let l,n=null==(r=e.getPropertyOptions)?void 0:r.call(e,t),i=null==n?void 0:n.meta;if(i){try{let t="function"==typeof i?await i():i,n=null==t?void 0:t.buildVariablesParams;"function"==typeof n&&(l=await n(e))}catch(e){continue}l&&(o[t]=l)}}let i=l.view||[];if(!o.view&&i.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let t=I(e);t&&(o.view={record:t})}return(0,F.d)(e,o)}},67778(e,t,l){"use strict";l.d(t,{sp:()=>M,bt:()=>E,U:()=>el,N5:()=>U,xB:()=>L,mW:()=>q,fP:()=>Y});var n=l(74848),o=l(96540),r=l(99418),i=l(11869),a=l(29007),s=l(52568),d=l(73398);function u(e){if((null==e?void 0:e.sourceId)==null||""===e.sourceId||"string"!=typeof e.associationName)return;let t=e.associationName.split(".")[0];if(t)return{collection:t,dataSourceKey:e.dataSourceKey||"main",filterByTk:e.sourceId}}function c(e){return null!=e}function p(e,t){if(e===t)return!0;if(!c(e)||!c(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(l){return String(e)===String(t)}}function m(e){var t;let l=null==e||null==(t=e.navigation)?void 0:t.viewStack;return Array.isArray(l)?l:[]}function h(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m(e);if(!l.length)return -1;let n=(null==e?void 0:e.inputArgs)||{},o=(null==e||null==(t=e.navigation)?void 0:t.viewParams)||{},r=n.viewUid??o.viewUid;if(!r)return l.length-1;let i=l.map((e,t)=>({item:e,index:t})).filter(e=>{let{item:t}=e;return(null==t?void 0:t.viewUid)===r});if(!i.length)return l.length-1;let a=["filterByTk","sourceId","tabUid"],s=i[i.length-1].index,d=-1;for(let{item:e,index:t}of i){let l=0,o=!0;for(let t of a)if(c(n[t])){if(!p(null==e?void 0:e[t],n[t])){o=!1;break}l+=1}o&&l>=d&&(s=t,d=l)}return s}function f(e,t){return t??e.view}function g(e){var t;if(!e)return!1;let l=m(e),n=null==e||null==(t=e.inputArgs)?void 0:t.openerUids,o=Array.isArray(n)&&n.length>0;return h(e,l)>=1||o}function v(e,t){let l=t=>e.t(t),n=function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return g(f(l,t))},o=async e=>{let l=f(e,t);if(!l||!g(l))return;let n=await y(e,l),o=null==n?void 0:n.resource;return(null==o?void 0:o.collectionName)&&null!=o.filterByTk?{collection:o.collectionName,dataSourceKey:o.dataSourceKey||"main",filterByTk:o.filterByTk,associationName:o.associationName,sourceId:o.sourceId}:(0,d.Cg)(e)},r=async()=>{var t,l,n,r;let i=await o(e);if(!(null==i?void 0:i.collection))return null;let a=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,i.dataSourceKey||"main");return(null==a||null==(r=a.collectionManager)||null==(n=r.getCollection)?void 0:n.call(r,i.collection))||null},i=async(l,n)=>{var o,r,i,a,s,d;try{let s=n||e,d=f(s,t),u=m(d),c=h(d,u);if(c<1||l<1)return;let p=c-l;if(p<1)return;let g=u[p];if(!(null==g?void 0:g.viewUid))return;let v=null==(o=s.engine)?void 0:o.getModel(g.viewUid,!0);if(!v)try{v=await s.engine.loadModel({uid:g.viewUid})}catch(t){null==(a=s.logger||e.logger)||null==(i=a.warn)||i.call(a,{err:t},"[FlowEngine] popup.getParentRecordRef loadModel failed")}let y=(null==v||null==(r=v.getStepParams)?void 0:r.call(v,"popupSettings","openView"))||{},x=null==y?void 0:y.collectionName,b=(null==y?void 0:y.dataSourceKey)||"main",w=(null==g?void 0:g.filterByTk)??(null==g?void 0:g.sourceId);if(!x||null==w)return;return{collection:x,dataSourceKey:b,filterByTk:w,sourceId:null==g?void 0:g.sourceId,associationName:null==y?void 0:y.associationName}}catch(t){null==(d=(null==n?void 0:n.logger)||e.logger)||null==(s=d.warn)||s.call(d,{err:t},"[FlowEngine] popup.getParentRecordRef failed");return}},a=l=>{try{let n=f(e,t),o=m(n);return h(n,o)-l>=1}catch(e){return!1}},s=t=>{let n=()=>({type:"object",title:l("Parent popup"),disabled:()=>!a(t),disabledReason:()=>a(t)?void 0:l("No parent popup"),hidden:()=>!a(t),properties:async()=>{let n=await i(t),o={};if(o.uid={type:"string",title:l("Popup uid")},n){let t=(()=>{try{var t,l,o,r;let i=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,n.dataSourceKey||"main");return(null==i||null==(r=i.collectionManager)||null==(o=r.getCollection)?void 0:o.call(r,n.collection||""))||null}catch(e){return null}})();o.record=await (0,d.$S)(()=>t,l("Popup record"),()=>n)||{type:"object",title:l("Popup record")}}else o.record={type:"object",title:l("Popup record")};return o.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},o}});return n.title=l("Parent popup"),n},c=()=>({type:"object",title:l("Current popup"),disabled:()=>!n(),hidden:()=>!n(),buildVariablesParams:async e=>{var l,r,a,s;if(!n(e))return;let d=await o(e),c=f(e,t),p=null==c?void 0:c.inputArgs,g={};if(d){let e={...d};!e.associationName&&(null==p?void 0:p.associationName)&&(e.associationName=p.associationName),void 0===e.sourceId&&void 0!==(null==p?void 0:p.sourceId)&&(e.sourceId=null==p?void 0:p.sourceId),g.record=e}try{let t=m(c);if(h(c,t)>=2){let t=g,l=1,n=await i(l,e);for(;n;){let o={record:n},r=u(n);r&&(o.sourceRecord=r),t.parent=o,t=o,l+=1,n=await i(l,e)}}}catch(t){null==(r=e.logger)||null==(l=r.debug)||l.call(r,{err:t},"[FlowEngine] buildVariablesParams: build parent-chain failed")}try{let e=u({sourceId:null==p?void 0:p.sourceId,associationName:null==p?void 0:p.associationName,dataSourceKey:null==p?void 0:p.dataSourceKey});e&&(g.sourceRecord=e)}catch(t){null==(s=e.logger)||null==(a=s.debug)||a.call(s,{err:t},"[FlowEngine] buildVariablesParams: infer sourceRecord failed")}return g},properties:async()=>{var n,a,u,c;let p={};if(p.uid={type:"string",title:l("Popup uid")},await o(e)){let e=async()=>{let e=await r();return e?await (0,d.$S)(()=>e,l("Current popup record"),e=>o(e)):null};e.title=l("Current popup record"),e.hasChildren=!0,p.record=e}try{let o=f(e,t),r=null==o?void 0:o.inputArgs,i=null==r?void 0:r.sourceId,s=null==r?void 0:r.associationName,u=(null==r?void 0:r.dataSourceKey)||"main";if(!s||"string"!=typeof s||!s.includes(".")){let t=m(o),l=h(o,t),r=l>=0?null==t?void 0:t[l]:void 0;if(null==r?void 0:r.viewUid){let t=null==e||null==(n=e.engine)?void 0:n.getModel(r.viewUid,!0);t||(t=await e.engine.loadModel({uid:r.viewUid}));let l=(null==t||null==(a=t.getStepParams)?void 0:a.call(t,"popupSettings","openView"))||{};s=(null==l?void 0:l.associationName)||s,u=(null==l?void 0:l.dataSourceKey)||u}}if(null!=i&&""!==i&&s&&"string"==typeof s){let t=String(s).includes(".")?String(s).split(".")[0]:void 0;if(t){let n=()=>{try{var l,n,o,r;let i=null==(n=e.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u);return(null==i||null==(r=i.collectionManager)||null==(o=r.getCollection)?void 0:o.call(r,t))||null}catch(e){return null}},o=await (0,d.$S)(n,l("Current popup parent record"),()=>({collection:t,dataSourceKey:u,filterByTk:i}));o&&(p.sourceRecord=o)}}}catch(t){null==(c=e.logger)||null==(u=c.debug)||u.call(c,{err:t},"[FlowEngine] popup.properties: build sourceRecord failed")}return p.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},await i(1)&&(p.parent=s(1)),p}});return c.title=l("Current popup"),c.sort=975,c}async function y(e,t){var l,n,o;let r=m(t),i=h(t,r),a=null==t||null==(n=t.inputArgs)||null==(l=n.parentItem)?void 0:l.value,s=null==t||null==(o=t.inputArgs)?void 0:o.openerUids,d=Array.isArray(s)&&s.length>0;if(!(i>=1||d))return;if(!r.length){let e=(null==t?void 0:t.inputArgs)||{};if(!(e.collectionName||null!=e.filterByTk||null!=e.sourceId||e.associationName||e.viewUid))return;return{uid:e.viewUid,resource:{dataSourceKey:e.dataSourceKey||"main",collectionName:e.collectionName,associationName:e.associationName,filterByTk:e.filterByTk,sourceId:e.sourceId},...void 0!==a?{sourceRecord:a}:{}}}let u=async t=>{var l,n,o,i,a,s;if(t<0||!(null==(l=r[t])?void 0:l.viewUid))return;let d=r[t].viewUid,c=null==(n=e.engine)?void 0:n.getModel(d,!0);c||(c=await (null==(s=e.engine)?void 0:s.loadModel({uid:d})));let p=(null==c||null==(o=c.getStepParams)?void 0:o.call(c,"popupSettings","openView"))||{},m=null==p?void 0:p.collectionName,h={uid:d,resource:{dataSourceKey:(null==p?void 0:p.dataSourceKey)||"main",collectionName:m,associationName:null==p?void 0:p.associationName,filterByTk:null==(i=r[t])?void 0:i.filterByTk,sourceId:null==(a=r[t])?void 0:a.sourceId}},f=await u(t-1);return f&&(h.parent=f),h},c=await u(i);return c&&void 0!==a&&(c.sourceRecord=a),c}function x(e,t){let l=/^(?:record|sourceRecord)(?:\.|$)|^parent(?:\.parent)*(?:\.(?:record|sourceRecord))(?:\.|$)/,n=e=>{var l,n;if("sourceRecord"!==e&&!e.startsWith("sourceRecord."))return!1;let o=null==t||null==(l=t.inputArgs)?void 0:l.parentItem;if(void 0===(null==o?void 0:o.value))return!0;let r="sourceRecord"===e?"":e.slice(13);if(!r)return!1;let i=null==t||null==(n=t.inputArgs)?void 0:n.parentItemResolver;if("function"==typeof i)return i(`value.${r}`);let a=r.split(".").filter(Boolean),s=o.value;for(let e of a){if(null===s||"object"!=typeof s||!(e in s))return!0;s=s[e]}return!1};e.defineProperty("popup",{get:async()=>y(e,t),meta:v(e,t),resolveOnServer:e=>{try{if("sourceRecord"===e||e.startsWith("sourceRecord."))return n(e);return!!e&&l.test(e)}catch(e){return!1}}})}var b=l(18182);let w=(0,o.forwardRef)((e,t)=>{let{afterClose:l,footer:r,header:i,hidden:a,...s}=e,[d,u]=(0,o.useState)(!0),[c,p]=(0,o.useState)(s),[m,h]=(0,o.useState)(()=>r),[f,g]=(0,o.useState)(i);(0,o.useImperativeHandle)(t,()=>({destroy:()=>{u(!1),null==l||l()},update:e=>p(t=>({...t,...e})),setFooter:e=>{h(e)},setHeader:e=>{0===Object.values(e||{}).length?g(null):g(e)}}));let v={...c,title:(null==f?void 0:f.title)||c.title,extra:null==f?void 0:f.extra,footer:void 0!==m?m:c.footer??null},y=o.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return(0,n.jsx)(b.A,{closable:!1,rootClassName:a?"nb-hidden":"",getContainer:y,...v,open:d,onCancel:c.onCancel,afterClose:()=>{null==l||l()},children:c.children})});function S(){let[e,t]=o.useState([]);return[e,o.useCallback(e=>(t(t=>[...t,e]),()=>{t(t=>t.filter(t=>t!==e))}),[])]}var C=l(16639),F=l(20616),k=l(47451);async function A(e,t){var l;return!!t.force||!1!==await (null==(l=e.beforeClose)?void 0:l.call(e,t))}function P(e,t){var l;let n=null==t?void 0:t.layoutContext,o=null==t||null==(l=t.engine)?void 0:l.context;n instanceof a.cB&&n!==t&&n!==o&&e.addDelegate(n)}let j=0;function M(){let e=o.useRef(null),t=(t,l)=>{var u,c,p;let m,h,f=null==l?void 0:l.engine;j+=1;let g=o.createRef(),v=new Promise(e=>{h=e}),y=null,b=null,S=e=>{let{children:t}=e;return o.useEffect(()=>{var e;return y=t,null==(e=g.current)||e.setFooter(t),()=>{var e;y=null,null==(e=g.current)||e.setFooter(null)}},[t]),null},M=e=>(o.useEffect(()=>{var t;return b=e,null==(t=g.current)||t.setHeader(e),()=>{var e;b=null,null==(e=g.current)||e.setHeader(null)}},[e]),null),I=new a.cB,T=(0,k._)(l.engine),R=(0,C.eX)(f,T);I.defineProperty("engine",{value:T}),I.addDelegate(T.context),!1!==t.inheritContext?I.addDelegate(l):(I.addDelegate(l.engine.context),P(I,l));let E=!1,N={type:"dialog",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,o,r;if(E)return;E=!0,null==(l=t.onClose)||l.call(t),null==(n=g.current)||n.destroy(),null==m||m(),null==h||h(e);let i=null==R?void 0:R.emitter;(0,C.Z8)(i),null==i||null==(r=i.emit)||r.call(i,C.B9,{type:"dialog",viewUid:null==N||null==(o=N.inputArgs)?void 0:o.viewUid}),T.unlinkFromStack()},update:e=>{var t;return null==(t=g.current)?void 0:t.update(e)},close:async(e,l)=>{var n,o;return(!t.preventClose||!!l)&&!!await A(N,{result:e,force:l})&&(t.triggerByRouter&&(null==(o=t.inputArgs)||null==(n=o.navigation)?void 0:n.back)?t.inputArgs.navigation.back():N.destroy(e),!0)},Footer:S,Header:M,setFooter:e=>{var t;y=e,null==(t=g.current)||t.setFooter(e)},setHeader:e=>{var t;b=e,null==(t=g.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,I)}};I.defineProperty("view",{get:()=>N,resolveOnServer:(0,d.Xx)(I,()=>(0,d.vE)(l,I))}),T.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),N.destroy()}),x(I,N);let D=(0,i.observer)(()=>{var e,l,i,a;let s=o.useRef(!1),d="function"==typeof t.content?t.content(N,I):t.content,u="string"==typeof d?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:r.A.sanitize(d)}}):d;return(o.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,N,I)},[]),(null==(l=t.inputArgs)||null==(e=l.hidden)?void 0:e.value)&&!s.current)?null:(s.current=!0,(0,n.jsx)(w,{className:"nb-dialog-overflow-hidden",ref:g,hidden:null==(a=t.inputArgs)||null==(i=a.hidden)?void 0:i.value,footer:y,header:b,...t,onCancel:()=>{N.close(t.result)},children:u}))},{displayName:"DialogWithContext"}),B=(null==t||null==(c=t.inputArgs)?void 0:c.viewUid)||`page-${j}`,$=(0,n.jsx)(F.I6,{engine:T,children:(0,n.jsx)(s.YQ,{context:I,children:(0,n.jsx)(D,{})})},B);return m=null==(p=e.current)?void 0:p.patchElement($),Object.assign(v,N)},l=o.useMemo(()=>({open:t}),[]),u=o.memo(o.forwardRef((e,t)=>{let[l,r]=S();return o.useImperativeHandle(t,()=>({patchElement:r}),[r]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(u,{ref:e},"dialog-holder")]}var I=l(97134),T=l(61793);let R=o.forwardRef((e,t)=>{var l;let{children:r,footer:i,title:a,extra:s,hidden:d,isMobile:u,...c}=e,[p,m]=o.useState(!0),[h,f]=o.useState(()=>i),[g,v]=o.useState({title:a,extra:s,...c.header});o.useImperativeHandle(t,()=>({destroy:()=>{m(!1)},update:e=>{Object.assign(c,e)},setFooter:e=>{f(e)},setHeader:e=>{0===Object.values(e||{}).length?v(null):v(e)}}),[]);let y=o.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return u?(0,n.jsx)(T.D,{className:d?"nb-hidden":"",visible:p,...c,footer:h,...g,onClose:c.onClose,children:r}):(0,n.jsx)(I.A,{rootClassName:d?"nb-hidden":"",closable:!1,getContainer:y,...c,open:p,footer:h,styles:{...c.styles,footer:{display:"flex",justifyContent:"flex-end",...null==(l=c.styles)?void 0:l.footer}},...g,onClose:c.onClose,children:r})});function E(){let e=o.useRef(null),t=o.useMemo(()=>i.observable.shallow({value:[]}),[]),l=o.memo(e=>{let{index:r}=e,[a,s]=o.useState(null);return(o.useEffect(()=>{(0,i.autorun)(()=>{let e=t.value;e[r]&&a!==e[r]&&s(e[r]),e[r]||s(null)})},[a,r]),a)?(0,n.jsx)(a,{children:(0,n.jsx)(l,{index:r+1})}):null});l.displayName="RenderNestedDrawer";let u=(t,l)=>{var u,c;let p,m,h=l.engine,f=o.createRef(),g=new Promise(e=>{m=e}),v=null,y=null,b=e=>{let{children:t}=e;return o.useEffect(()=>{var e;return v=t,null==(e=f.current)||e.setFooter(t),()=>{var e;v=null,null==(e=f.current)||e.setFooter(null)}},[t]),null},w=e=>(o.useEffect(()=>{var t;return y=e,null==(t=f.current)||t.setHeader(e),()=>{var e;y=null,null==(e=f.current)||e.setHeader(null)}},[e]),null),S=new a.cB,j=(0,k._)(l.engine),M=(0,C.eX)(h,j);S.defineProperty("engine",{value:j}),S.addDelegate(j.context),!1!==t.inheritContext?S.addDelegate(l):(S.addDelegate(l.engine.context),P(S,l));let I=!1,T={type:"drawer",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,o,r;if(I)return;I=!0,null==(l=t.onClose)||l.call(t),null==(n=f.current)||n.destroy(),null==p||p(),null==m||m(e);let i=null==M?void 0:M.emitter;(0,C.Z8)(i),null==i||null==(r=i.emit)||r.call(i,C.B9,{type:"drawer",viewUid:null==T||null==(o=T.inputArgs)?void 0:o.viewUid}),j.unlinkFromStack()},update:e=>{var t;return null==(t=f.current)?void 0:t.update(e)},close:async(e,l)=>{var n,o;return(!t.preventClose||!!l)&&!!await A(T,{result:e,force:l})&&(t.triggerByRouter&&(null==(o=t.inputArgs)||null==(n=o.navigation)?void 0:n.back)?t.inputArgs.navigation.back():T.destroy(e),!0)},Footer:b,Header:w,setFooter:e=>{var t;v=e,null==(t=f.current)||t.setFooter(e)},setHeader:e=>{var t;y=e,null==(t=f.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,S)}};S.defineProperty("view",{get:()=>T,resolveOnServer:(0,d.Xx)(S,()=>(0,d.vE)(l,S))}),j.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),T.destroy()}),x(S,T);let E=o.memo((0,i.observer)(e=>{var l,i,a,s;let d=o.useRef(!1),u="function"==typeof t.content?t.content(T,S):t.content,c="string"==typeof u?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:r.A.sanitize(u)}}):u;return(o.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,T,S)},[]),(null==(i=t.inputArgs)||null==(l=i.hidden)?void 0:l.value)&&!d.current)?(0,n.jsx)(n.Fragment,{children:e.children}):(d.current=!0,(0,n.jsxs)(R,{ref:f,...t,footer:v,header:t.header||y,hidden:null==(s=t.inputArgs)||null==(a=s.hidden)?void 0:a.value,onClose:()=>{T.close(t.result)},isMobile:S.isMobileLayout,children:[c,e.children]}))}));E.displayName="DrawerWithContext";let N=o.memo(e=>{let{children:t}=e;return(0,n.jsx)(F.I6,{engine:j,children:(0,n.jsx)(s.YQ,{context:S,children:(0,n.jsx)(E,{children:t})})})});return N.displayName="RenderDrawer",p=null==(c=e.current)?void 0:c.patchElement(N),Object.assign(g,T)},c=o.useMemo(()=>({open:u}),[]),p=o.memo(o.forwardRef((e,r)=>{let[i,a]=S();return o.useImperativeHandle(r,()=>({patchElement:a}),[a]),o.useEffect(()=>{t.value=i},[i]),(0,n.jsx)(l,{index:0})}));return[c,(0,n.jsx)(p,{ref:e},"drawer-holder")]}var N=l(40961),D=l(31333),B=l(71021);let $=(0,o.forwardRef)((e,t)=>{let[l,r]=o.useState({}),{visible:i=!0,footer:a=null,header:s=null,children:d,hidden:u,title:c,styles:p={},zIndex:m=4,onClose:h}={...e,...l},f=(0,o.useRef)(!1),g=(0,F.uf)(),[v,y]=(0,o.useState)(()=>a),[x,b]=(0,o.useState)(s);(0,o.useImperativeHandle)(t,()=>({destroy:()=>{f.current||(f.current=!0)},update:e=>{r(e)},setFooter:e=>{y(e)},setHeader:e=>{0===Object.values(e||{}).length?b(null):b(e)}}));let w=(0,o.useMemo)(()=>({display:u?"none":"flex",flexDirection:"column",height:"100%",zIndex:m}),[u,m]),S=(0,o.useMemo)(()=>{if(!x&&!c)return null;let{title:e=c,extra:t}=x||{},l=g.context.themeToken;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:`${l.paddingSM}px ${l.padding}px`,borderBottom:`1px solid ${l.colorSplit}`,backgroundColor:l.colorBgContainer,...p.header},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:l.marginXS},children:[(0,n.jsx)(B.Ay,{type:"text",size:"small",icon:(0,n.jsx)(D.A,{}),onClick:async()=>{f.current||!1!==await (null==h?void 0:h())&&(f.current=!0)},style:{color:l.colorTextTertiary}}),e&&(0,n.jsx)("div",{style:{fontSize:l.fontSizeLG,fontWeight:l.fontWeightStrong,color:l.colorText},children:e})]}),t&&(0,n.jsx)("div",{children:t})]})},[x,c,g.context.themeToken,p.header,h]),C=(0,o.useMemo)(()=>{if(!v)return null;let e=g.context.themeToken;return(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",padding:`${e.paddingXS}px ${e.padding}px`,borderTop:`1px solid ${e.colorSplit}`,backgroundColor:e.colorBgContainer,...p.footer},children:v})},[v,g.context.themeToken,p.footer]);return i?(0,n.jsxs)("div",{style:{...w,...p.content},children:[S,(0,n.jsx)("div",{style:{flex:1,overflowY:"auto",...p.body},children:d}),C]}):null}),O=0,q="nocobase-embed-container",L="nocobaseEmbedReplacing";function _(e){return!!e&&"function"==typeof e.then}function V(e,t){e.dataset[L]="1";try{let l=t.close();if(_(l))return Promise.resolve(l).finally(()=>{delete e.dataset[L]});return delete e.dataset[L],l}catch(t){throw delete e.dataset[L],t}}function z(e,t,l){let n,o={},r=e.then(e=>{let{page:t}=e;return(n=t)&&("beforeClose"in o&&(n.beforeClose=o.beforeClose),"update"in o&&n.update(o.update),"footer"in o&&n.setFooter(o.footer),"header"in o&&n.setHeader(o.header),o.destroyed&&n.destroy(o.destroyed.result)),{page:t}});return Object.assign(r.then(e=>{let{page:t}=e;return!!t&&t}),{type:"embed",inputArgs:t,preventClose:l,Header:null,Footer:null,get beforeClose(){return(null==n?void 0:n.beforeClose)??o.beforeClose},set beforeClose(value){n?n.beforeClose=value:o.beforeClose=value},close:(e,t)=>r.then(l=>{let{page:n}=l;return!!n&&n.close(e,t)}),destroy:e=>{n?n.destroy(e):o.destroyed={result:e}},update:e=>{n?n.update(e):o.update={...o.update,...e}},setFooter:e=>{n?n.setFooter(e):o.footer=e},setHeader:e=>{n?n.setHeader(e):o.header=e}})}let K=o.memo(o.forwardRef((e,t)=>{let[l,r]=S();return o.useImperativeHandle(t,()=>({patchElement:r}),[r]),(0,n.jsx)(n.Fragment,{children:l})}));function U(){let e=o.useRef(null),t=o.useRef(null),l=o.useRef(0),r=(r,u)=>{let{target:c,content:p,preventClose:m,inheritContext:h=!0,inputArgs:f={},onOpenCancelled:g,...v}=r,y=c instanceof HTMLElement&&c.id===q,b=()=>{var l,g,b;let w,S,j,M=null==u?void 0:u.engine;O+=1;let I=o.createRef(),T=new Promise(e=>{S=e}),R=e=>{let{children:t}=e;return o.useEffect(()=>{var e;return null==(e=I.current)||e.setFooter(t),()=>{var e;null==(e=I.current)||e.setFooter(null)}},[t]),null},E=e=>(o.useEffect(()=>{var t;return null==(t=I.current)||t.setHeader(e),()=>{var e;null==(e=I.current)||e.setHeader(null)}},[e]),null),D=new a.cB,B=(0,k._)(u.engine),q=(0,C.eX)(M,B);D.defineProperty("engine",{value:B}),D.addDelegate(B.context),h?D.addDelegate(u):(D.addDelegate(u.engine.context),P(D,u));let _=!1,V={type:"embed",inputArgs:f,preventClose:!!r.preventClose,beforeClose:void 0,destroy:e=>{var l,n,o,i,a;if(!_){if(_=!0,null==(l=r.onClose)||l.call(r),null==S||S(e),null==(n=I.current)||n.destroy(),null==w||w(),y&&t.current===V&&(t.current=null),!(y&&c instanceof HTMLElement&&(null==(o=c.dataset)?void 0:o[L])==="1")){let e=null==q?void 0:q.emitter;(0,C.Z8)(e),null==e||null==(a=e.emit)||a.call(e,C.B9,{type:"embed",viewUid:null==V||null==(i=V.inputArgs)?void 0:i.viewUid})}B.unlinkFromStack()}},update:e=>{var t;return null==(t=I.current)?void 0:t.update(e)},close:(e,t)=>_?Promise.resolve(!0):j||(j=(async()=>{try{var l,n;if(m&&!t)return j=void 0,!1;let o=await A(V,{result:e,force:t});if(_)return!0;if(!o)return j=void 0,!1;if(r.triggerByRouter&&(null==(n=r.inputArgs)||null==(l=n.navigation)?void 0:l.back))return r.inputArgs.navigation.back(),!0;return V.destroy(e),!0}catch(e){throw _||(j=void 0),e}})()),Header:E,Footer:R,setFooter:e=>{var t;null==(t=I.current)||t.setFooter(e)},setHeader:e=>{var t;null==(t=I.current)||t.setHeader(e)},navigation:null==(l=r.inputArgs)?void 0:l.navigation,get record(){return(0,d.vE)(u,D)}};D.defineProperty("view",{get:()=>V,resolveOnServer:(0,d.Xx)(D,()=>(0,d.vE)(u,D))}),x(D,V);let z=(0,i.observer)(()=>{var e,t,l,i;let a=o.useRef(!1),s=o.useMemo(()=>"function"==typeof p?p(V,D):p,[]);return(D.themeToken,o.useEffect(()=>{var e;null==(e=r.onOpen)||e.call(r,V,D)},[]),(null==(t=r.inputArgs)||null==(e=t.hidden)?void 0:e.value)&&!a.current)?null:(a.current=!0,(0,n.jsx)($,{ref:I,hidden:null==(i=r.inputArgs)||null==(l=i.hidden)?void 0:l.value,...v,onClose:()=>V.close(r.result),children:s}))},{displayName:"PageWithContext"}),K=(null==f?void 0:f.viewUid)||`page-${O}`,U=(0,n.jsx)(F.I6,{engine:B,children:(0,n.jsx)(s.YQ,{context:D,children:(0,n.jsx)(z,{})})},K);return w=c&&c instanceof HTMLElement?null==(g=e.current)?void 0:g.patchElement(N.createPortal(U,c,K)):null==(b=e.current)?void 0:b.patchElement(U),y&&(t.current=V),Object.assign(T,V)};if(y&&t.current){let e,n=l.current+=1,o=()=>null==g?void 0:g();try{e=V(c,t.current)}catch(e){throw o(),e}if(_(e))return z(Promise.resolve(e).then(e=>!1===e||n!==l.current?(o(),{page:null}):{page:b()},e=>{throw o(),e}),f,!!r.preventClose);if(!1===e)return o(),z(Promise.resolve({page:null}),f,!!r.preventClose)}return b()};return[o.useMemo(()=>({open:r}),[]),(0,n.jsx)(K,{ref:e},"page-holder")]}var W=l(28073);let H=0,G=o.forwardRef((e,t)=>{var l,r;let{afterClose:i,content:a,placement:s,rect:d,...u}=e,[c,p]=o.useState(!0),[m,h]=o.useState({content:a,placement:s,rect:d,...u});return o.useImperativeHandle(t,()=>({destroy:()=>p(!1),update:e=>h(t=>({...t,...e})),close:(e,t)=>p(!1)})),o.useEffect(()=>{c||null==i||i()},[c,i]),(0,n.jsx)(W.A,{arrow:!1,open:c,trigger:["click"],destroyTooltipOnHide:!0,content:m.content,placement:m.placement,getPopupContainer:()=>document.querySelector("#nocobase-app-container")||document.body,onOpenChange:e=>{(e||!m.preventClose)&&(p(e),e||null==i||i())},...m,children:(0,n.jsx)("span",{style:{position:"absolute",top:((null==(l=m.rect)?void 0:l.top)??0)+window.scrollY,left:((null==(r=m.rect)?void 0:r.left)??0)+window.scrollX,width:0,height:0}})})});function Y(){let e=o.useRef(null),t=t=>{var l,i;let a,s;H+=1;let{target:d,placement:u="rightTop",content:c,...p}=t,m=o.createRef(),h=(null==d||null==(l=d.getBoundingClientRect)?void 0:l.call(d))??{top:0,left:0},f=new Promise(e=>{s=e}),g={type:"popover",destroy:()=>{var e;return null==(e=m.current)?void 0:e.destroy()},update:e=>{var t;return null==(t=m.current)?void 0:t.update(e)},close:e=>{var t;null==s||s(e),null==(t=m.current)||t.close(e)}},v="function"==typeof c?c(g):c,y="string"==typeof v?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:r.A.sanitize(v)}}):v,x=(0,n.jsx)(G,{ref:m,content:y,placement:u,rect:h,afterClose:()=>{var e;null==a||a(),null==(e=t.onClose)||e.call(t),null==s||s(t.result)},...p},`popover-${H}`);return a=null==(i=e.current)?void 0:i.patchElement(x),Object.assign(f,g)},l=o.useMemo(()=>({open:t}),[]),i=o.memo(o.forwardRef((e,t)=>{let[l,r]=S();return o.useImperativeHandle(t,()=>({patchElement:r}),[]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(i,{ref:e},"popover-holder")]}var J=l(52847),X=l(60182);function Q(e){return null==e?"":e&&"object"==typeof e&&!Array.isArray(e)?encodeURIComponent(Object.entries(e).map(e=>{let[t,l]=e;return`${encodeURIComponent(String(t))}=${encodeURIComponent(String(l))}`}).join("&")):encodeURIComponent(String(e))}function Z(e){return null!=e&&""!==String(e)}function ee(e){let t=e||"/admin";return`/${t.replace(/^\/+/,"").replace(/\/+$/,"")}`}function et(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=ee(t.basePath||t.prefix);if(!e||0===e.length)return l;let n=l.replace(/^\/+/,"").split("/").filter(Boolean);return e.forEach((e,t)=>{t>0&&n.push("view"),n.push(e.viewUid);let l=(0,X.Gu)(e.viewUid,e.openViewRouteState);if(l&&n.push("opts",l),e.tabUid&&n.push("tab",e.tabUid),null!=e.filterByTk){let t=Q(e.filterByTk);t&&n.push("filterbytk",t)}Z(e.sourceId)&&n.push("sourceid",String(e.sourceId))}),"/"+n.join("/")}class el{setViewStack(e){this.viewStack=Object.freeze([...e]),this.viewParams=this.viewStack[this.viewStack.length-1]||{}}changeTo(e){let t=et(this.viewStack.map((t,l)=>l===this.viewStack.length-1?{...t,...e}:{...t}),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(t,{replace:!0})}navigateTo(e,t){let l=et([...this.viewStack,e],{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(l,t)}back(){let e=et(this.viewStack.slice(0,-1),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(e,{replace:!0})}getLayoutBasePath(){var e,t;let l=null==(e=this.ctx.layout)?void 0:e.routePath;return this.basePath||(null==(t=this.ctx.layoutRoute)?void 0:t.basePathname)||((null==l?void 0:l.startsWith("/"))?l:"/admin")}constructor(e,t,l={}){this.setViewStack(t),this.ctx=e,this.basePath=l.basePath||l.layoutBasePath,(0,J.E8)(this,{viewParams:J.sH})}}},16639(e,t,l){"use strict";l.d(t,{B9:()=>o,FH:()=>s,HK:()=>r,Z8:()=>d,eX:()=>p,i6:()=>i,tb:()=>n});let n=Symbol.for("__NOCOBASE_VIEW_ACTIVATED_VERSION__"),o="view:activated",r="dataSource:dirty",i="__NOCOBASE_ENGINE_SCOPE__",a="view";function s(e){let t=Reflect.get(e,n),l="number"==typeof t?t:Number(t);return Number.isFinite(l)&&l>0?l:0}function d(e){let t=s(e);if(!Object.isExtensible(e))return t;let l=t+1;return Reflect.set(e,n,l),l}function u(e){return Reflect.get(e,i)===a}function c(e){let t=e,l=0;for(;t&&l++<50;){if(u(t))return t;t=t.previousEngine}}function p(e,t){if(!e)return;let l=c(e);return l||c(null==t?void 0:t.previousEngine)||e}},33329(e,t,l){"use strict";l.r(t),l.d(t,{BaseStorage:()=>d,LocalStorage:()=>c,MemoryStorage:()=>u,SessionStorage:()=>p,APIClient:()=>m,Auth:()=>s,getSubAppName:()=>h,hasHeaderValue:()=>a});var n=l(88909),o=l(55373),r=l.n(o);let i=(e,t)=>{if(!e)return;let l="function"==typeof e.toJSON?e.toJSON():e,n=Object.keys(l||{}).find(e=>e.toLowerCase()===t.toLowerCase());return n?l[n]:void 0},a=(e,t)=>{let l=i(e,t);return null!=l&&""!==l};class s{get storagePrefix(){return this.api.storagePrefix}get locale(){return this.getLocale()}set locale(e){this.setLocale(e)}get role(){return this.getRole()}set role(e){this.setRole(e)}get token(){return this.getToken()}set token(e){this.setToken(e)}get authenticator(){return this.getAuthenticator()}set authenticator(e){this.setAuthenticator(e)}getOption(e){return this.api.storage.getItem(e)}setOption(e,t){return this.options[e]=t,this.api.storage.setItem(e,t||"")}getLocale(){return this.getOption("locale")}setLocale(e){this.setOption("locale",e)}getRole(){return this.getOption("role")}setRole(e){this.setOption("role",e)}getToken(){return this.getOption("token")}setToken(e){this.setOption("token",e),this.api.app&&this.api.app.eventBus.dispatchEvent(new CustomEvent("auth:tokenChanged",{detail:{token:e,authenticator:this.authenticator}}))}getAuthenticator(){return this.getOption("auth")}setAuthenticator(e){this.setOption("auth",e)}middleware(e){return this.locale&&e.headers&&(e.headers["X-Locale"]=this.locale),this.role&&e.headers&&(e.headers["X-Role"]=this.role),this.authenticator&&!a(e.headers,"X-Authenticator")&&e.headers&&(e.headers["X-Authenticator"]=this.authenticator),this.token&&!a(e.headers,"Authorization")&&e.headers&&(e.headers.Authorization=`Bearer ${this.token}`),e}async signIn(e,t){var l;let n=await this.api.request({method:"post",url:"auth:signIn",data:e,headers:{"X-Authenticator":t}}),o=null==n||null==(l=n.data)?void 0:l.data;return this.setAuthenticator(t),this.setToken(null==o?void 0:o.token),n}async signUp(e,t){return await this.api.request({method:"post",url:"auth:signUp",data:e,headers:{"X-Authenticator":t}})}async signOut(){let e=await this.api.request({method:"post",url:"auth:signOut"});return this.setToken(null),this.setRole(null),this.setAuthenticator(null),e}async lostPassword(e){let t=Object.fromEntries(new URLSearchParams(window.location.search).entries());return await this.api.request({method:"post",url:"auth:lostPassword",data:{...e,baseURL:window.location.href.split("/forgot-password")[0]},headers:{"X-Authenticator":t.name}})}async resetPassword(e){return await this.api.request({method:"post",url:"auth:resetPassword",data:e})}async checkResetToken(e){return await this.api.request({method:"post",url:"auth:checkResetToken",data:e})}constructor(e){this.options={locale:null,role:null,authenticator:null,token:null},this.api=e,this.api.axios.interceptors.request.use(this.middleware.bind(this))}}class d{toUpperCase(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];return e.toUpperCase()+l.map(e=>e.toUpperCase()).join("_")}}class u extends d{clear(){this.items.clear()}getItem(e){return this.items.get(e)}setItem(e,t){return this.items.set(e,t)}removeItem(e){return this.items.delete(e)}constructor(...e){super(...e),this.items=new Map}}class c extends d{clear(){return this.items.clear()}getItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.getItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.getItem(this.toUpperCase(this.storagePrefix,e))}setItem(e,t){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.setItem(this.toUpperCase(this.baseStoragePrefix,e),t):this.items.setItem(this.toUpperCase(this.storagePrefix,e),t)}removeItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.removeItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.removeItem(this.toUpperCase(this.storagePrefix,e))}constructor(e,t="",l=!1){super(),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.localStorage}}class p extends c{constructor(e,t="",l=!1){super(e,t,l),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.sessionStorage}}class m{toErrMessages(e){var t,l,n,o,r,i,a,s,d,u,c;if("u">typeof document&&"string"==typeof(null==e||null==(t=e.response)?void 0:t.data)){let t=document.createElement("div");t.innerHTML=null==e||null==(d=e.response)?void 0:d.data;let l=t.textContent||t.innerText;return l.includes("Error occurred while trying")||l.includes("502 Bad Gateway")?[{code:"APP_WARNING",message:l="The application may be starting up. Please try again later."}]:[{message:l}]}return(null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.error)?[null==e||null==(c=e.response)||null==(u=c.data)?void 0:u.error]:(null==e||null==(r=e.response)||null==(o=r.data)?void 0:o.errors)||(null==e||null==(a=e.response)||null==(i=a.data)?void 0:i.messages)||(null==e||null==(s=e.response)?void 0:s.error)||[{message:e.message||"Server error"}]}getHeaders(){let e={};return this.auth.locale&&(e["X-Locale"]=this.auth.locale),this.auth.role&&(e["X-Role"]=this.auth.role),this.auth.authenticator&&(e["X-Authenticator"]=this.auth.authenticator),this.auth.token&&(e.Authorization=`Bearer ${this.auth.token}`),e}createStorage(e){return"localStorage"===e&&"u">typeof localStorage?new c(this.storagePrefix,this.baseStoragePrefix,this.shareToken):"sessionStorage"===e&&"u">typeof sessionStorage?new p(this.storagePrefix,this.baseStoragePrefix,this.shareToken):new u}initStorage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"localStorage";if(e){this.storage=new e(this);return}this.storage=this.createStorage(t)}interceptors(){this.axios.interceptors.request.use(e=>(e.paramsSerializer=e=>r().stringify(e,{strictNullHandling:!0,arrayFormat:"brackets"}),e))}request(e){let{resource:t,resourceOf:l,action:n,params:o,headers:r}=e;return t?this.resource(t,l,r)[n](o):this.axios.request(e)}resource(e,t,l,n){return new Proxy({},{get:(o,r)=>{if(n)return;let i=e.split(".").join(`/${encodeURIComponent(t)||"_"}/`),a={url:i+=`:${r.toString()}`};return["get","list"].includes(r)?a.method="get":a.method="post",async(e,t)=>{let{values:n,filter:o,...r}=e||{};return a.params=r,o&&("string"==typeof o?a.params.filter=o:(o["*"]&&delete o["*"],a.params.filter=JSON.stringify(o))),"get"!==a.method&&(a.data=n||{}),await this.request({...a,...t,headers:l})}}})}constructor(e){if(this.storagePrefix="NOCOBASE_",this.baseStoragePrefix="NOCOBASE_",this.shareToken=!1,this.options=e,"function"==typeof e)this.axios=e;else{const{appName:t,authClass:l,storageType:o,storageClass:r,storagePrefix:i="NOCOBASE_",shareToken:a=!1,...s}=e||{};this.shareToken=a,this.baseStoragePrefix=i,this.storagePrefix=t?`${i}${t.toUpperCase()}_`:i,this.axios=n.A.create(s),this.initStorage(r,o),l&&(this.auth=new l(this))}this.storage||this.initStorage(),this.auth||(this.auth=new s(this)),this.interceptors()}}let h=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";if("u"<typeof window||!window.location.pathname)return;let t=`${e}apps/`;if(window.location.pathname.startsWith(t))return window.location.pathname.substring(t.length).split("/",1)[0]||""}},40542(e,t,l){"use strict";l.d(t,{D:()=>n});let n=(e,t,l)=>{if(!e)return l;let o=t.split("."),r=[],i=e,a=!1;for(let e=0;e<o.length;e++){let t=o[e];if(Array.isArray(i)){for(let t of(a=!0,i)){let i=n(t,o.slice(e).join("."),l);r=r.concat(i)}break}if((null==i?void 0:i[t])===void 0)break;i=i[t],e===o.length-1&&r.push(i)}return 0===(r=r.filter(e=>void 0!==e)).length?l:a?r.filter(e=>null!==e):r[0]}},13939(e,t,l){"use strict";l.r(t),l.d(t,{getDayRange:()=>tm,isEmptyFilter:()=>ed,sleep:()=>es,getDateVars:()=>ty,str2moment:()=>eg,unflatten:()=>ti,sortTree:()=>ea,generateFlowModelRdFromToken:()=>e$,forEach:()=>eA,utc2unit:()=>tf,extractUsedVariablePaths:()=>t4,getValuesByPath:()=>eO,isArray:()=>et,moment2str:()=>ex,transformLiquidContext:()=>t6,isURL:()=>tN,isPortalInBody:()=>tM,extractUsedVariableNames:()=>t5,parseHTML:()=>tI,toGmt:()=>ep,isPlainObject:()=>en,lockdownSes:()=>tA,splitPathToTwoParts:()=>tx,transformFilter:()=>Y,parseSQLBindParams:()=>le,getPickerFormat:()=>eC,nextTick:()=>er,removeNullCondition:()=>eu,CollectionsGraph:()=>V,isValidFilter:()=>eK,evaluateConditions:()=>Z,toUnit:()=>tg,removeInvalidFilterItems:()=>J,getFormatFromDateStr:()=>ek,BASE_BLOCKED_IDENTIFIERS:()=>tC,toLocal:()=>em,getDayRangeByParams:()=>L,getDefaultFormat:()=>ec,transformMultiColumnToSingleColumn:()=>t$,treeFind:()=>ei,transformSQL:()=>lt,parseFilter:()=>tp,flatten:()=>tr,isEmpty:()=>el,getOffsetRangeByParams:()=>B,offsetFromString:()=>eb,tval:()=>tP,error:()=>eQ,extractVariableUsage:()=>t8,Registry:()=>tb,lodash:()=>o(),parse:()=>eG,hasEmptyValue:()=>eo,toFixedByStep:()=>e6,getDateTimeFormat:()=>eF,showToast:()=>e5,Handlebars:()=>e_(),getLiquidContext:()=>t9,merge:()=>e2,dayjs:()=>i(),parseLiquidContext:()=>t7,uid:()=>tE,isString:()=>ee});var n=l(2543),o=l.n(n),r=l(74353),i=l.n(r),a=l(97375),s=l.n(a),d=l(90445),u=l.n(d),c=l(43522),p=l.n(c),m=l(37872),h=l.n(m),f=l(98867),g=l.n(f),v=l(8906),y=l.n(v),x=l(68313),b=l.n(x),w=l(21840),S=l.n(w),C=l(41816),F=l.n(C),k=l(88569),A=l.n(k),P=l(83826),j=l.n(P),M=l(8134),I=l.n(M),T=l(28623),R=l.n(T),E=l(46986),N=l.n(E);i().extend(N()),i().extend(S()),i().extend(A()),i().extend(j()),i().extend(F()),i().extend(b()),i().extend(h()),i().extend(g()),i().extend(y()),i().extend(I()),i().extend(R()),i().extend(u()),i().extend(s()),i().extend(p());let D=e=>{if(!e)return i()();if(/^[+-]\d{2}:\d{2}$/.test(e)){let[t,l,n]=e.match(/([+-])(\d{2}):(\d{2})/).slice(1),o=(60*parseInt(l)+parseInt(n))*("+"===t?1:-1);return i()().utcOffset(o)}return i()().tz(e)},B=e=>{let t,l,{type:n,unit:o="day",number:r=1,timezone:i}=e,a=D(i),s="week"===o?"isoWeek":o;if("past"===n){let e=a.startOf(s);t=e.subtract(r,o).startOf(s),l=e.subtract(1,o).endOf(s)}else if("next"===n)l=(t=a.startOf(s).add(1,o).startOf(s)).add(r-1,o).endOf(s);else throw Error(`Unsupported type: ${n}`);return[t.format("YYYY-MM-DD HH:mm:ss"),l.format("YYYY-MM-DD HH:mm:ss")]},$=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).startOf(t)},O=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).endOf(t)},q={today:e=>[$(0,"day",null==e?void 0:e.timezone),O(0,"day",null==e?void 0:e.timezone)],yesterday:e=>[$(-1,"day",null==e?void 0:e.timezone),O(-1,"day",null==e?void 0:e.timezone)],tomorrow:e=>[$(1,"day",null==e?void 0:e.timezone),O(1,"day",null==e?void 0:e.timezone)],thisWeek:e=>[$(0,"isoWeek",null==e?void 0:e.timezone),O(0,"isoWeek",null==e?void 0:e.timezone)],lastWeek:e=>[$(-1,"isoWeek",null==e?void 0:e.timezone),O(-1,"isoWeek",null==e?void 0:e.timezone)],nextWeek:e=>[$(1,"isoWeek",null==e?void 0:e.timezone),O(1,"isoWeek",null==e?void 0:e.timezone)],thisMonth:e=>[$(0,"month",null==e?void 0:e.timezone),O(0,"month",null==e?void 0:e.timezone)],lastMonth:e=>[$(-1,"month",null==e?void 0:e.timezone),O(-1,"month",null==e?void 0:e.timezone)],nextMonth:e=>[$(1,"month",null==e?void 0:e.timezone),O(1,"month",null==e?void 0:e.timezone)],thisQuarter:e=>[$(0,"quarter",null==e?void 0:e.timezone),O(0,"quarter",null==e?void 0:e.timezone)],lastQuarter:e=>[$(-1,"quarter",null==e?void 0:e.timezone),O(-1,"quarter",null==e?void 0:e.timezone)],nextQuarter:e=>[$(1,"quarter",null==e?void 0:e.timezone),O(1,"quarter",null==e?void 0:e.timezone)],thisYear:e=>[$(0,"year",null==e?void 0:e.timezone),O(0,"year",null==e?void 0:e.timezone)],lastYear:e=>[$(-1,"year",null==e?void 0:e.timezone),O(-1,"year",null==e?void 0:e.timezone)],nextYear:e=>[$(1,"year",null==e?void 0:e.timezone),O(1,"year",null==e?void 0:e.timezone)]},L=e=>{if("past"===e.type||"next"===e.type)return B(e);let t=q[e.type];if(!t)throw Error(`Unsupported type: ${e.type}`);let[l,n]=t(e);return[l.format("YYYY-MM-DD HH:mm:ss"),n.format("YYYY-MM-DD HH:mm:ss")]};var _=l(38362);class V{static graphlib(){return _}static connectedNodes(e){let t=(0,n.castArray)(e.nodes),l=(0,n.castArray)(e.excludes||[]),o=V.build(e),r=new Set;for(let e of t)for(let t of _.alg.preorder(o,e))l.includes(t)||r.add(t);return Array.from(r)}static preOrder(e){return V.graphlib().alg.preorder(V.build(e),e.node)}static build(e){let t=e.collections,l="forward"===((null==e?void 0:e.direction)||"forward"),n=new _.Graph;for(let e of t)n.setNode(e.name);for(let e of t){for(let t of e.inherits||[])l?n.setEdge(e.name,t):n.setEdge(t,e.name);for(let t of e.fields||[])if(("hasMany"===t.type||"belongsTo"===t.type||"hasOne"===t.type)&&(l?n.setEdge(e.name,t.target):n.setEdge(t.target,e.name)),"belongsToMany"===t.type){let o=t.through;l?(n.setEdge(e.name,o),n.setEdge(o,t.target)):(n.setEdge(t.target,o),n.setEdge(o,e.name))}}return n}}var z=l(81814),K=l.n(z);function U(e){return"path"in e&&"operator"in e}function W(e){return"logic"in e&&"items"in e}function H(e){let{path:t,operator:l,value:n}=e;return{[t]:{[l]:n}}}function G(e){let{logic:t,items:l}=e;return{[t]:l.map(e=>{if(U(e))return H(e);if(W(e))return G(e);throw Error("Invalid filter item type")})}}function Y(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return eu(G(e))}function J(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return e.items=e.items.filter(e=>U(e)?!!e.operator:!!W(e)&&J(e)),{...e}}function X(e,t){let{path:l,operator:n,value:o}=e;return t(l,n,o)}function Q(e,t){let{logic:l,items:n}=e;if(!n||0===n.length)return!0;let o=n.map(e=>{if(U(e))return X(e,t);if(W(e))return Q(e,t);throw Error("Invalid filter item type")});if("$and"===l)return o.every(e=>!0===e);if("$or"===l)return o.some(e=>!0===e);throw Error(`Unsupported logic operator: ${l}`)}function Z(e,t){if(!e||"object"!=typeof e)throw Error("Invalid conditions: conditions must be an object");if(!W(e))throw Error("Invalid conditions: conditions must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid conditions: items must be an array");if("function"!=typeof t)throw Error("Invalid evaluator: evaluator must be a function");return Q(e,t)}let ee=e=>"string"==typeof e,et=e=>Array.isArray(e),el=e=>en(e)?0===Object.keys(e).length:!!Array.isArray(e)&&0===e.length,en=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},eo=e=>{let t=!0;for(let l in e){if(t=!1,et(e[l])&&0===e[l].length||!e[l])return!0;if(en(e[l])||et(e[l]))return eo(e[l])}return t},er=e=>{setTimeout(e)};function ei(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return;let{childrenKey:n="children"}=l;for(let o of Array.isArray(e)?[...e]:[e]){if(t(o))return o;let e="function"==typeof n?n(o):o[n];if(Array.isArray(e)&&e.length>0){let n=ei(e,t,l);if(void 0!==n)return n}}}function ea(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"children",n=!(arguments.length>3)||void 0===arguments[3]||arguments[3];return e&&Array.isArray(e)&&0!==e.length?o().orderBy(e,t,n?"asc":"desc").map(e=>e[l]&&e[l].length>0?{...e,[l]:ea(e[l],t,l,n)}:e):e}function es(e){return new Promise(t=>{setTimeout(t,e)})}function ed(e){return!!(!e||"$and"in e&&o().isEmpty(e.$and)||"$or"in e&&o().isEmpty(e.$or))}let eu=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:K(),l=t(e||{}),n={};for(let e in l){let t=l[e];null==t||el(t)||""===t||(n[e]=t)}let r=t.unflatten(n);for(let e in r)Array.isArray(r[e])&&(r[e]=r[e].filter(e=>null!=e));return o().isEmpty(r)?void 0:r},ec=e=>e.format?e.format:e.dateFormat?e.showTime?`${e.dateFormat} ${e.timeFormat||"HH:mm:ss"}`:e.dateFormat:"month"===e.picker?"YYYY-MM":"quarter"===e.picker?"YYYY-\\QQ":"year"===e.picker?"YYYY":"week"===e.picker?"YYYY[W]W":e.showTime?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD",ep=e=>e&&i().isDayjs(e)?`${e.format("YYYY-MM-DD")}T${e.format("HH:mm:ss.SSS")}Z`:e,em=e=>e?Array.isArray(e)?e.map(e=>e.startOf("second").toISOString()):i().isDayjs(e)?e.startOf("second").toISOString():void 0:e,eh=e=>{try{let t=parseInt(e.slice(0,4)),l=parseInt(e.slice(-1));return i()().quarter(l).year(t)}catch(e){return null}},ef=(e,t)=>{if(!e)return;let l=t.utcOffset,{gmt:n,picker:o,utc:r=!0,dateOnly:a}=t;if(!i()(e).isValid())return eh(e);if(a){let t=i()(e);if(!t.isValid())return e;let l=t.format("YYYY-MM-DD");return i().utc(l,"YYYY-MM-DD")}return r?i().isDayjs(e)?l?e.utcOffset(eb(l)):e:n?i()(e).utcOffset(0):l?i()(e).utcOffset(eb(l)):i()(e):i()(e)},eg=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?e.map(e=>ef(e,t)):e?ef(e,t):e},ev=(e,t)=>"year"===t?e.format("YYYY")+"-01-01T00:00:00.000Z":"month"===t||"quarter"===t?e.format("YYYY-MM")+"-01T00:00:00.000Z":e.format("YYYY-MM-DD")+"T00:00:00.000Z",ey=(e,t)=>e?Array.isArray(e)?e.map(e=>ev(e,t)):i().isDayjs(e)?ev(e,t):void 0:e,ex=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{showTime:l,gmt:n,picker:o}=t;return e?l?n?ep(e):em(e):ey(e,o):e};function eb(e){if(!o().isString(e))return e;let t=/([+-]|\d\d)/gi,l=/Z|[+-]\d\d(?::?\d\d)?/gi,n=/[+-]?\d+(\.\d{1,3})?/,r=(e||"").match(l);if(null===r&&(r=(e||"").match(n)),null===r)return null;let i=((r[r.length-1]||[])+"").match(t)||["-",0,0],a=+(60*Number(i[1]))+ew(i[2]);return 0===a?0:"+"===i[0]?a:-a}function ew(e){let t=+e,l=0;return 0!==t&&isFinite(t)&&(l=eS(t)),l}function eS(e){return e<0?Math.ceil(e)||0:Math.floor(e)}let eC=e=>{switch(e){case"week":return"YYYY[W]W";case"month":return"YYYY-MM";case"quarter":return"YYYY[Q]Q";case"year":return"YYYY";default:return"YYYY-MM-DD"}},eF=(e,t,l,n)=>"date"===e&&l?`${t} ${n||"HH:mm:ss"}`:t;function ek(e){return/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(e)?"YYYY-MM-DD HH:mm:ss":/^\d{4}-\d{2}-\d{2}$/.test(e)?"YYYY-MM-DD":/^\d{4}-\d{2}$/.test(e)?"YYYY-MM":/^\d{4}$/.test(e)?"YYYY":/^\d{4}Q[1-4]$/.test(e)?"YYYY[Q]Q":/^\d{4}-\d{2}-\d{2}T/.test(e)?"YYYY-MM-DDTHH:mm:ss.SSSZ":null}let eA=(e,t)=>{Array.isArray(e)?e.forEach(t):Object.keys(e).forEach(l=>{t(e[l],l)})};var eP=l(48287).Buffer;let ej=new Map;function eM(e){return"function"==typeof btoa?btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,""):eP.from(e,"binary").toString("base64url")}function eI(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),l=t.padEnd(t.length+(4-t.length%4)%4,"=");return"function"==typeof atob?atob(l):eP.from(l,"base64").toString("binary")}function eT(e){let t=0x811c9dc5;for(let l=0;l<e.length;l+=1)t^=e.charCodeAt(l),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)}function eR(e,t){if(!t)return"";let l="";for(let n=0;n<e.length;n+=1)l+=String.fromCharCode(e.charCodeAt(n)^t.charCodeAt(n%t.length));return l}function eE(e){if(!e||"string"!=typeof e)return null;let t=e.split(".");if(t.length<2)return null;try{return JSON.parse(eI(t[1]))}catch{return null}}function eN(e){let t=null==e?void 0:e.userId,l=(null==e?void 0:e.signInTime)||(null==e?void 0:e.jti);return"string"!=typeof t&&"number"!=typeof t||"string"!=typeof l&&"number"!=typeof l?"":`${t}:${l}`}function eD(e){return eN(eE(e))}function eB(e,t){if("string"!=typeof e&&"number"!=typeof e||!t)return;let l=String(e),n=`${t}
|
|
3570
|
-
${l}`,o=ej.get(n);if(o)return o;let r=eM(eR(l,eT(`mask:v1:${t}`))),i=eT(`check:v1:${t}:${l}`),a=`v1.${r}.${i}`;return ej.set(n,a),a}function e$(e,t){return eB(e,eD(t))}let eO=(e,t,l)=>{if(!e)return l;let n=t.split("."),o=[],r=e,i=!1;for(let e=0;e<n.length;e++){let t=n[e];if(Array.isArray(r)){for(let t of(i=!0,r)){let r=eO(t,n.slice(e).join("."),l);o=o.concat(r)}break}if((null==r?void 0:r[t])===void 0)break;r=r[t],e===n.length-1&&o.push(r)}return 0===(o=o.filter(e=>void 0!==e)).length?l:i?o.filter(e=>null!==e):o[0]};var eq=l(88835),eL=l(60639),e_=l.n(eL),eV=l(79441);let ez=l.n(eV)()();function eK(e){if(!e)return!1;let t=[e.$and,e.$or].filter(Boolean);return 0==t.length?Object.keys(e).length>0:t.some(e=>{if(Array.isArray(e))return e.some(eK);if(e.$and||e.$or)return eK(e);let[t]=Object.keys(e);if(!t||!e[t])return!1;let[l]=Object.keys(e[t]);return!!l&&void 0!==e[t][l]})}function eU(e){let t=typeof e;return Array.isArray(e)?t="array":e instanceof Date?t="date":null===e&&(t="null"),t}function eW(e){let t=e.substr(2,e.length-4).trim(),l=t.indexOf(":");return -1!==l?{key:t.substr(0,l),defaultValue:t.substr(l+1)}:{key:t}}function eH(e,t){return e.parameters=Array.from(new Map(t.map(e=>[e.key,e])).values()),e}function eG(e){switch(eU(e)){case"string":return eY(e);case"object":return eJ(e);case"array":return eX(e);default:return eH(function(){return e},[])}}Object.keys(ez).forEach(function(e){e_().registerHelper(e,ez[e])}),e_().registerHelper("json",function(e){return JSON.stringify(e)}),e_().registerHelper("urlParse",function(e){try{return JSON.stringify(eq.parse(e))}catch(t){return`Invalid URL: ${e}`}}),e_().registerHelper("dateFormat",(e,t,l)=>"string"==typeof l?i()(e).tz(l).format(t):i()(e).format(t)),e_().registerHelper("isNull",e=>o().isNull(e));let eY=(()=>{let e=/{{(\w|:|[\s-+.,@/()?=*_$])+}}/g;return t=>{let l=[],o=e=>t,r=t.match(e);return r&&(l=r.map(eW),o=e=>(e=e||{},r.reduce((o,i,a)=>{let s=l[a],d=(0,n.get)(e,s.key);return(void 0===d&&(d=s.defaultValue),"function"==typeof d&&(d=d()),1===r.length&&t.startsWith("{{")&&t.endsWith("}}"))?d:(d instanceof Date&&(d=d.toISOString()),o.replace(i,null==d?"":d))},t))),eH(o,l)}})();function eJ(e){let t=Object.keys(e).map(t=>({keyTemplate:eY(t),valueTemplate:eG(e[t])}));return eH(e=>t.reduce((t,l)=>(t[l.keyTemplate(e)]=l.valueTemplate(e),t),{}),t.reduce((e,t)=>e.concat(t.valueTemplate.parameters,t.keyTemplate.parameters),[]))}function eX(e){let t=e.map(eG);return eH(e=>t.map(t=>t(e)),t.reduce((e,t)=>e.concat(t.parameters),[]))}let eQ=function(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];console.error(e,...l)};var eZ=l(14744),e0=l.n(eZ);let e1=(e,t,l)=>t;function e2(e,t,l){return e0()(e,t,{arrayMerge:e1,...l})}var e8=l(76511);let e5=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;e8.Ay[t]({message:e,duration:l})};var e4=l(5062),e3=l(85738);function e6(e,t){if(null==e||""===e)return"";let l=(0,e4.i5)(t);return(0,e3.Mg)(String(e),".",l)}var e9=l(63560),e7=l.n(e9),te=l(95093),tt=l.n(te);let tl=/^\s*\{\{([\s\S]*)\}\}\s*$/;function tn(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function to(e){return e}function tr(e,t){let l=(t=t||{}).delimiter||".",n=t.maxDepth,r=t.transformKey||to,i=t.transformValue||to,a={};function s(e,d,u){u=u||1,o().isObjectLike(e)&&Object.keys(e).forEach(function(o){var c;let p=e[o],m=t.safe&&Array.isArray(p),h=Object.prototype.toString.call(p),f=tn(p),g="[object Object]"===h||"[object Array]"===h,v=d?d+l+r(o):r(o);if(null==(c=t.breakOn)?void 0:c.call(t,{key:o,value:p,path:v})){a[v]=i(p,v);return}if(!m&&!f&&g&&Object.keys(p).length&&(!t.maxDepth||u<n))return s(p,v,u+1);a[v]=i(p,v)})}return s(e),a}function ti(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l={},n=t.transformValue||to;for(let t of Object.keys(e))e7()(l,t,n(e[t],t));return l}let ta=e=>{let t=e.split(".").pop()||"";return t.startsWith("$")||(t=""),{operator:t}},ts=e=>["$dateOn","$dateNotOn","$dateBefore","$dateAfter","$dateNotBefore","$dateNotAfter","$dateBetween"].includes(e);function td(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function tu(e){return(null==e?void 0:e.type)==="dateOnly"||(null==e?void 0:e.type)==="datetimeNoTz"||(null==e?void 0:e.constructor.name)==="DateOnlyField"||(null==e?void 0:e.constructor.name)==="DatetimeNoTzField"}let tc=(e,t)=>e?(e.type&&(e=L({...e,timezone:t})),Array.isArray(e))?(2===e.length?e.push("[]",t):3===e.length&&e.push(t),e):"string"==typeof e?!t||/(\+|-)\d\d:\d\d$/.test(e)?e:e+t:td(e)?e.toISOString():void 0:null,tp=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=new Set,n=t.vars||{},o=t.timezone,r=t.now,i=t.getField,a=tr(e,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if("string"!=typeof e)return e;let t=tl.exec(e);if(t){let e=t[1].trim();e.startsWith("$user")&&l.add(e.substring(6))}return e}});if(l.size>0){let e=await n.$user({fields:[...l.values()]});Object.assign(n,{$user:e})}return ti(a,{transformValue(e,t){let{operator:l}=ta(t);if("string"==typeof e){let a=tl.exec(e);if(a){let s=eO(n,a[1].trim(),null),d=null==i?void 0:i(t);e="function"==typeof s?null==s?void 0:s({field:d,operator:l,timezone:o,now:r}):s}}if(ts(l)){let l=null==i?void 0:i(t);return tu(l)?e.type?L({...e,timezone:(null==l?void 0:l.timezone)||o}):e:tc(e,(null==l?void 0:l.timezone)||o)}return e}})};function tm(e){let{now:t,timezone:l="+00:00",offset:n}=e,o=th(t).utcOffset(eb(l));return n>0?[(o=o.add(1,"day").startOf("day")).format("YYYY-MM-DD"),o.clone().add(n,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]:[o.clone().subtract(-1*n-1,"day").startOf("day").format("YYYY-MM-DD"),o.clone().add(1,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]}function th(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?i().isDayjs(e)?e:t?tt()(e):i()(e):t?tt()():i()()}function tf(e){var t;let{now:l,unit:n,timezone:o="+00:00",offset:r}=e,i=th(l,"isoWeek"===n);i=(i=i.utcOffset(eb(o))).startOf(n),r>0?i=i.add(r,n):r<0&&(i=i.subtract(-1*r,n));let a={year:()=>i.format("YYYY"),quarter:()=>i.format("YYYY[Q]Q"),month:()=>i.format("YYYY-MM"),week:()=>i.format("gggg[w]ww"),isoWeek:()=>i.format("GGGG[W]WW"),day:()=>i.format("YYYY-MM-DD")},s=null==(t=a[n])?void 0:t.call(a);return o?s+o:s}let tg=(e,t)=>l=>{let{now:n,timezone:o,field:r}=l;return(null==r?void 0:r.timezone)&&(o=null==r?void 0:r.timezone),tf({now:n,timezone:o,unit:e,offset:t})},tv=e=>t=>{let{now:l,timezone:n,field:o}=t;return(null==o?void 0:o.timezone)&&(n=null==o?void 0:o.timezone),tm({now:l,timezone:n,offset:e})};function ty(){return{now:new Date().toISOString(),today:tg("day"),yesterday:tg("day",-1),tomorrow:tg("day",1),thisWeek:tg("week"),lastWeek:tg("week",-1),nextWeek:tg("week",1),thisIsoWeek:tg("isoWeek"),lastIsoWeek:tg("isoWeek",-1),nextIsoWeek:tg("isoWeek",1),thisMonth:tg("month"),lastMonth:tg("month",-1),nextMonth:tg("month",1),thisQuarter:tg("quarter"),lastQuarter:tg("quarter",-1),nextQuarter:tg("quarter",1),thisYear:tg("year"),lastYear:tg("year",-1),nextYear:tg("year",1),last7Days:tv(-7),next7Days:tv(7),last30Days:tv(-30),next30Days:tv(30),last90Days:tv(-90),next90Days:tv(90)}}function tx(e){let t=e.split(".");return[t.shift(),t.join(".")]}class tb{register(e,t){if(!this.options.override&&this.map.has(e))throw Error(`this registry does not allow to override existing keys: "${e}"`);this.map.set(e,t)}get(e){return this.map.get(e)}getKeys(){return this.map.keys()}getValues(){return this.map.values()}getEntities(){return this.map.entries()}constructor(e={override:!1}){this.map=new Map,this.options=e}}l(67980);let tw=Symbol.for("nocobase.utils.sesLockdown"),tS=Symbol.for("nocobase.utils.bufferOverrides"),tC=["globalThis","global","self","Function","AsyncFunction","GeneratorFunction","eval","Compartment","lockdown","harden","assert"];function tF(e){return!!e&&"object"==typeof e&&(e.message||"").includes("(SES_ALREADY_LOCKED_DOWN)")}function tk(){let e=globalThis;if(e[tS])return;let t=e.Buffer;if(!t||!t.prototype)return;let l=t.prototype;for(let e of Reflect.ownKeys(l)){let t=Object.getOwnPropertyDescriptor(l,e);if(!t||"function"!=typeof t.value||!t.configurable)continue;let n=t.value,o=function(){return n},r=function(t){if(this===l)throw TypeError(`Cannot assign to read only property '${String(e)}' of object 'Buffer.prototype'`);Object.defineProperty(this,e,{configurable:!0,enumerable:!0,writable:!0,value:t})};Object.defineProperty(o,"originalValue",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(l,e,{configurable:t.configurable,enumerable:t.enumerable,get:o,set:r})}e[tS]=!0}function tA(e){tk();let t=globalThis;if(!t[tw]){if("function"!=typeof lockdown)throw Error("SES lockdown is unavailable in the current runtime environment.");try{lockdown(e)}catch(e){if(!tF(e))throw e}t[tw]=!0}}function tP(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}var tj=l(65606);let tM=e=>{for(;e;){var t;if("root"===e.id||(null==(t=e.classList)?void 0:t.contains("nb-action")))return!1;e=e.parentNode}return!tj.env.__TEST__};function tI(e,t){return e.replace(/\{\{(\w+)\}\}/g,function(e,l){return void 0!==t[l]?t[l]:e})}let tT=36,tR="";for(;tT--;)tR+=tT.toString(36);function tE(e){let t="",l=e||11;for(;l--;)t+=tR[36*Math.random()|0];return t}function tN(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}var tD=l(27153),tB="2.1.37";let t$=(e,t)=>{if(!e)return e;if("Grid"!==e["x-component"])return Object.keys(e.properties||{}).forEach(l=>{e.properties[l]=t$(e.properties[l],t)}),e;let l=e.parent;e=e.toJSON?e.toJSON():o().cloneDeep(e);let n={},{properties:r={}}=e,i=0;if(Object.keys(r).forEach((e,l)=>{let a=r[e];if("Grid.Row"!==a["x-component"]){a["x-index"]=++i,n[e]=a;return}if(a.properties){if(1===Object.keys(a.properties).length){a["x-index"]=++i,n[e]=a;return}Object.keys(a.properties).forEach((l,r)=>{let s=a.properties[l];if(o().set(s,"x-component-props.width",100),0===r){a["x-index"]=++i,n[e]=a;return}null!=t&&t(s)||(delete a.properties[l],n[`${tE()}_${l}`]=tO(s,l,++i))})}}),e.properties=n,l){let t=new tD.Schema(e,l);return l.properties&&Object.keys(l.properties).forEach(n=>{n===e.name&&(l.properties[n]=t)}),t}return e};function tO(e,t,l){return{type:"void",version:"2.0","x-component":"Grid.Row","x-app-version":tB,"x-uid":tE(),"x-async":!1,"x-index":l,_isJSONSchemaObject:!0,properties:{[t]:e}}}function tq(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function tL(e){return!!e&&/[a-zA-Z_$]/.test(e)}function t_(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function tV(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function tz(e,t){let l=tV(e,t);for(;"!"===e[l];)l=tV(e,l+1);return l}function tK(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function tU(e,t){let l=tK(e,t-1);if("("!==e[l])return!1;let n=tK(e,l-1);if(n<0)return!0;let o=e[n];return!t_(o)&&")"!==o&&"]"!==o}function tW(e,t){let l=tV(e,t);if(")"!==e[l])return!1;let n=tV(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function tH(e,t){if(!tL(e[t]))return null;let l=t+1;for(;t_(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function tG(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function tY(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,o="";for(;n<e.length;){let t=e[n];if("\\"===t){o+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:o,next:n+1};o+=t,n+=1}return null}function tJ(e,t){let l=tV(e,t+1),n=tY(e,l);if(n)return(l=tV(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let o=tG(e,l);return o?(l=tV(e,o.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:o.value}:{dynamic:!0}}function tX(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function tQ(e,t){let l=tz(e,t);if("["===e[l])return tJ(e,l);if(e.startsWith("?.",l)){let t=tV(e,l+2);if("["===e[t])return tJ(e,t);let n=tH(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=tV(e,l+1),n=tH(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function tZ(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function t0(e,t){if("ctx"!==e.slice(t,t+3)||t_(e[t-1])||t_(e[t+3]))return null;if(tU(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=tQ(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],o=l.next,r=!1,i=!1;for(;o<e.length;){let t=tz(e,o);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){r=!0,o=t;break}let l=tQ(e,o);if(!l){o=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(i=!0);break}if(l.dynamic){i=!0,o=t;break}tX(n,l.kind,l.value),o=l.next}let a=n.join(".");return{next:Math.max(o,l.next),reference:{methodCall:r,path:a||void 0,unsupportedDynamicPath:i||tW(e,o),varName:l.value}}}function t1(e){let t=tZ(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=t0(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function t2(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function t8(e){let t={},l=!1,n=e=>{for(let n of t1(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&t2(t,n.varName,n.path,n.methodCall)}},o=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)n(t[1]);return}Array.isArray(e)?e.forEach(o):tq(e)&&Object.values(e).forEach(o)};return o(e),{unsupportedDynamicPath:l,usage:t}}function t5(e){return new Set(Object.keys(t8(e).usage))}function t4(e){return t8(e).usage}let t3=new(l(23155)).HX;function t6(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t={};for(let l of e){let e=l.replace(/^ctx\./,"").split("."),n=t;for(let t=0;t<e.length;t++){let o=e[t];t===e.length-1?n[o]=`{{${l}}}`:(n[o]=n[o]||{},n=n[o])}}return t}async function t9(e){return t6(await t3.fullVariables(e))}async function t7(e,t){return await t3.parseAndRender(e,{ctx:t})}function le(e){let t=1,l={};return{sql:e.replace(/{{\s*([^}]+)\s*}}/g,(e,n)=>{let o=`__var${t}`;return l[o]=`{{${n.trim()}}}`,t++,`$${o}`}),bind:l}}async function lt(e){let{sql:t,bind:l}=le(e),n=await t9(t);return{sql:t,bind:l,liquidContext:n}}},59598(){},23005(){},14892(){},2813(){},61511(){},92489(){},52453(){},72522(){},66883(){},9845(){}},function(e){var t=function(t){return e(e.s=t)};e.O(0,["1339","2174","268","3210","3338","3658","3782","404","8159","8732","8878","9200","9223","957","9817","9967"],function(){return t(87696)}),e.O()}]);
|
|
3569
|
+
${p}`}async function tp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l="string"==typeof e?e:String(e??""),n=!!t.preprocessTemplates,o=n?eX.withTemplates:eX.withoutTemplates,r=eQ(o,l);if(r)return await r;let i=(async()=>{if(!n)return ts(await (0,e_.W)(l));let e=tc(l,{processStringLiterals:!1});return ts(tc(await (0,e_.W)(e),{processBarePlaceholders:!1}))})();eZ(o,l,i,eJ);try{return await i}catch(e){throw o.delete(l),e}}var tm=l(62572);function th(e){if(Array.isArray(e)){let t=e.map(e=>th(e)).filter(e=>void 0!==e);return t.length?t:void 0}if(e&&"object"==typeof e){let t={};return Object.keys(e).forEach(l=>{let n=th(e[l]);void 0!==n&&(t[l]=n)}),Object.keys(t).length?t:void 0}return null==e||"string"==typeof e&&""===e?void 0:e}let tf=e=>"string"==typeof e.on?"beforeRender"===e.on:"object"==typeof e.on?"beforeRender"===e.on.eventName:!e.on&&!0!==e.manual;var tg=l(47684);let tv="0123456789abcdefghijklmnopqrstuvwxyz";function ty(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:11,l="";for(let e=0;e<t;e++)l+=tv[Math.random()*tv.length|0];return`${e}${l}`}},49773(e,t,l){"use strict";async function n(e){if(!/<[A-Za-z]|<\//.test(e))return e;try{var t;let n=await l.e("1339").then(l.bind(l,1608)),o=(null==n?void 0:n.transform)||(null==n||null==(t=n.default)?void 0:t.transform);if("function"!=typeof o)return e;let r=o(e,{transforms:["jsx"],jsxPragma:"ctx.React.createElement",jsxFragmentPragma:"ctx.React.Fragment",disableESTransforms:!0,production:!0});return(r&&(r.code||(null==r?void 0:r.output)))??e}catch(t){return e}}l.d(t,{W:()=>n})},81982(e,t,l){"use strict";l.d(t,{M:()=>f,gG:()=>a,mv:()=>s,o4:()=>m,pk:()=>h});var n=l(40542),o=l(13939),r=l(2543),i=l.n(r);async function a(e,t){if(!e)return{};if("function"==typeof e)try{return await e(t)||{}}catch(e){return console.error("Error resolving defaultParams function:",e),{}}return e}async function s(e,t,l){if(!e)return{};if("function"==typeof e)try{return await e(t,l)||{}}catch(e){return console.error("Error resolving createModelOptions function:",e),{}}return e}let d={queue:[],timer:null,inflightByRun:new Map},u=10;function c(e){if(Array.isArray(e))return e.map(c);if(i().isPlainObject(e)){let t=Object.entries(e).map(e=>{let[t,l]=e;return[t,c(l)]});return Object.fromEntries(i().sortBy(t,e=>{let[t]=e;return t}))}return e}function p(e){try{return JSON.stringify(c(e))}catch{try{return JSON.stringify(e)}catch{return String(e)}}}function m(e,t){let l,n,o=d,r=e.runId||"GLOBAL",i=p(t),a=o.inflightByRun.get(r);a||(a=new Map,o.inflightByRun.set(r,a));let s=a.get(i);if(s)return s;let c=new Promise((e,t)=>{l=e,n=t});a.set(i,c);let m={id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,ctx:e,payload:t,resolve:l,reject:n,runId:r,dedupKey:i};o.queue.push(m);let h=async()=>{var t,l,n,r,i,a;let s=o.queue.splice(0,o.queue.length);if(o.timer=null,!s.length)return;let d=null==(t=s[0].ctx)?void 0:t.api;if(!d){for(let e of s)try{e.resolve(e.payload.template)}catch(t){e.reject(t)}finally{null==(l=o.inflightByRun.get(e.runId))||l.delete(e.dedupKey)}return}try{let e=s.map(e=>({id:e.id,contractRd:e.payload.contractRd,rd:e.payload.rd,template:e.payload.template,contextParams:e.payload.contextParams||{}})),t=await d.request({method:"POST",url:"variables:resolve",data:{values:{batch:e}}}),l=t.data??t,r=l.data??l,i=null==r?void 0:r.results,a=Array.isArray(i)?i:Array.isArray(r)?r:[],u=new Map;for(let e of a){let t=(null==e?void 0:e.id)!=null?String(e.id):"";t&&u.set(t,null==e?void 0:e.data)}for(let e of s)try{let t=String(e.id),l=u.has(t)?u.get(t):e.payload.template;e.resolve(l)}catch(t){e.reject(t)}finally{null==(n=o.inflightByRun.get(e.runId))||n.delete(e.dedupKey)}}catch(t){for(let l of s)try{null==e||null==(i=e.logger)||null==(r=i.warn)||r.call(i,{err:t},"variables:resolve(batch) failed, fallback"),l.resolve(l.payload.template)}catch(e){l.reject(e)}finally{null==(a=o.inflightByRun.get(l.runId))||a.delete(l.dedupKey)}}};return o.timer||(o.timer=setTimeout(h,u)),c}function h(e,t){var l,n;return(0,o.generateFlowModelRdFromToken)(t,null==e||null==(n=e.api)||null==(l=n.auth)?void 0:l.token)}async function f(e,t){let l=async e=>{if("string"==typeof e&&/\{\{.*?\}\}/.test(e))return await y(e,t);if(Array.isArray(e))return Promise.all(e.map(l));if(e&&"object"==typeof e){let t={};for(let[n,o]of Object.entries(e))t[n]=await l(o);return t}return e};return l(e)}async function g(e,t){let l=await v(e.trim(),t),n=await t.runjs(`return ${l}`,{t:t.t});return(null==n?void 0:n.success)?n.value:void 0}async function v(e,t){let l,n=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*(?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g,o=[],r=new Set;for(;null!==(l=n.exec(e));){let e=l[0],t=l[1],n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)/);if(n){let l=n[1],i=t.substring(l.length);o.push({fullPath:e,firstKey:l,restPath:i}),r.add(l)}}if(0===o.length)return e;let i=new Map;for(let e of r)try{let l=await t[e],n=l&&!0===l.__isRecordProxy__;i.set(e,n)}catch(t){i.set(e,!1)}o.sort((e,t)=>t.fullPath.length-e.fullPath.length);let a=e;for(let{fullPath:e,firstKey:t,restPath:l}of o){let n,o=i.get(t)||!1;n=""===l?`await ctx.${t}`:o?`await (await ctx.${t})${l}`:`(await ctx.${t})${l}`;let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=RegExp(`\\b${r}\\b`,"g");a=a.replace(s,n)}return a}async function y(e,t){let l=e=>{let t=e.trim().match(/^ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*))?$/);return t?t[2]?`${t[1]}.${t[2]}`:t[1]:null},o=async e=>{let l=e.split("."),o=l.shift();if(!o)return;let r=await t[o];return 0===l.length?r:(0,n.D)(r,l.join("."))},r=async e=>{let n=l(e);if(n){let l=await o(n);return void 0===l&&n.includes("-")?await g(e,t):l}return await g(e,t)},i=e.match(/^\s*\{\{\s*([^{}]+?)\s*\}\}\s*$/);if(i){let e=i[1];return await r(e)}let a=[...e.matchAll(/\{\{\s*(.+?)\s*\}\}/g)],s=e;for(let[e,t]of a){let l=await r(t);if(void 0!==l){let t="object"==typeof l&&null!==l?JSON.stringify(l):String(l);s=s.replace(e,t)}}return s}},47684(e,t,l){"use strict";function n(e,t){if(!e||"string"!=typeof e)throw Error("invalid url");let l=e.trim();if(l.startsWith("http://")||l.startsWith("https://"))return l;let n=window.__esm_cdn_base_url__||"https://esm.sh",o=(null==t?void 0:t.addSuffix)&&window.__esm_cdn_suffix__||"",r=n.replace(/\/$/,""),i=l.replace(/^\//,"");if(null==t?void 0:t.raw){let e=i.includes("?")?"&":"?";return`${r}/${i}${e}raw`}return`${r}/${i}${o}`}function o(e){return!!e&&"string"==typeof e&&e.split("?")[0].split("#")[0].endsWith(".css")}l.d(t,{i:()=>n,y:()=>o})},51143(e,t,l){"use strict";function n(){var e,t;let l=globalThis;if((null==(e=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:e.windowAllow)&&(null==(t=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:t.documentAllow))return l.__nocobaseRunJSSafeGlobalsRegistry;let n={windowAllow:new Set,documentAllow:new Set};return l.__nocobaseRunJSSafeGlobalsRegistry=n,n}function o(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.windowAllow.add(e)}}function r(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.documentAllow.add(e)}}function i(e){return n().windowAllow.has(e)}function a(e){return n().documentAllow.has(e)}function s(e){let t=()=>`${window.location.origin}${window.location.pathname}`,l=(e,l,n)=>{if(!(e=>{try{let l=new URL(e,t()),n=l.protocol.toLowerCase();if("about:"===n)return"about:blank"===l.href;return"http:"===n||"https:"===n}catch{return!1}})(e))throw Error("Unsafe URL: window.open only allows http/https/about:blank.");let o="_blank",r=(e=>{let t=new Set;return e&&e.split(",").map(e=>e.trim()).filter(Boolean).forEach(e=>{let l=e.split("=")[0].trim().toLowerCase();"noopener"!==l&&"noreferrer"!==l&&t.add(e)}),t.add("noopener"),t.add("noreferrer"),Array.from(t).join(",")})(n),i=window.open.call(window,e,o,r);if(i&&"opener"in i)try{i.opener=null}catch{}return i},n=(e,n)=>{let o=new URL(e,t()),r=o.protocol.toLowerCase(),i="about:"===r&&"about:blank"===o.href;if("http:"!==r&&"https:"!==r&&!i)throw Error("Unsafe URL: only http/https/about:blank are allowed.");if(i)return(null==n?void 0:n.replace)?window.location.replace("about:blank"):window.location.assign("about:blank");if(o.protocol===window.location.protocol&&o.hostname===window.location.hostname&&o.port===window.location.port)return(null==n?void 0:n.replace)?window.location.replace(o.href):window.location.assign(o.href);if(!l(o.href))throw Error("Popup blocked: cross-origin navigation is opened in a new tab.")},o=new Proxy({},{get(e,t){switch(t){case"origin":return window.location.origin;case"protocol":return window.location.protocol;case"host":return window.location.host;case"hostname":return window.location.hostname;case"port":return window.location.port;case"pathname":return window.location.pathname;case"assign":return e=>n(e,{replace:!1});case"replace":return e=>n(e,{replace:!0});case"reload":return window.location.reload.bind(window.location);case"href":throw Error("Reading location.href is not allowed.");default:throw Error(`Access to location property "${t}" is not allowed.`)}},set(e,t,l){if("href"===t)return n(String(l),{replace:!1}),!0;throw Error("Mutation on location is not allowed.")}}),r={setTimeout:window.setTimeout.bind(window),clearTimeout:window.clearTimeout.bind(window),setInterval:window.setInterval.bind(window),clearInterval:window.clearInterval.bind(window),console,Math,Date,FormData,..."u">typeof Blob?{Blob}:{},..."u">typeof URL?{URL}:{},addEventListener:addEventListener.bind(window),open:l,location:o,...e||{}};return new Proxy(Object.create(null),{get(e,t){if("string"!=typeof t)return Reflect.get(e,t);if(t in r)return r[t];if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(i(t)){let e=window[t];return"function"==typeof e?e.bind(window):e}throw Error(`Access to global property "${t}" is not allowed.`)},set(e,t,l){if("string"!=typeof t)return Reflect.set(e,t,l),!0;if(t in r)throw Error(`Mutation of global property "${t}" is not allowed.`);return e[t]=l,!0},has:(e,t)=>"string"!=typeof t?Reflect.has(e,t):!!(t in r||Object.prototype.hasOwnProperty.call(e,t)||i(t))})}function d(e){let t={createElement:document.createElement.bind(document),querySelector:document.querySelector.bind(document),querySelectorAll:document.querySelectorAll.bind(document),...e||{}};return new Proxy(Object.create(null),{get(e,l){if("string"!=typeof l)return Reflect.get(e,l);if(l in t)return t[l];if(Object.prototype.hasOwnProperty.call(e,l))return e[l];if(a(l)){let e=document[l];return"function"==typeof e?e.bind(document):e}throw Error(`Access to document property "${l}" is not allowed.`)},set(e,l,n){if("string"!=typeof l)return Reflect.set(e,l,n),!0;if(l in t)throw Error(`Mutation of document property "${l}" is not allowed.`);return e[l]=n,!0},has:(e,l)=>"string"!=typeof l?Reflect.has(e,l):!!(l in t||Object.prototype.hasOwnProperty.call(e,l)||a(l))})}function u(e){var t;let l="u">typeof window&&window.navigator||void 0,n={},o=null==l||null==(t=l.clipboard)?void 0:t.writeText;"function"==typeof o&&(n.writeText=o.bind(l.clipboard));let r={clipboard:n};return Object.defineProperty(r,"onLine",{get:()=>!!(null==l?void 0:l.onLine),enumerable:!0,configurable:!1}),Object.defineProperty(r,"language",{get:()=>null==l?void 0:l.language,enumerable:!0,configurable:!1}),Object.defineProperty(r,"languages",{get:()=>(null==l?void 0:l.languages)?[...l.languages]:void 0,enumerable:!0,configurable:!1}),Object.assign(r,e||{}),new Proxy({},{get(e,t){if(t in r)return r[t];throw Error(`Access to navigator property "${String(t)}" is not allowed.`)}})}function c(e){let t={};try{let e=u();t.navigator=e;try{t.window=s({navigator:e})}catch{}}catch{}try{t.document=d()}catch{}return e?{...t,...e}:t}async function p(e,t,l,n){if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.runjs)return e.runjs(t,c(n),l)}l.d(t,{D1:()=>u,I2:()=>c,Vm:()=>o,Xh:()=>d,_:()=>p,ey:()=>s,yz:()=>r})},22928(e,t,l){"use strict";function n(e){let t={};return Object.entries(e||{}).forEach(e=>{let[l,n]=e;null!=n&&(t[l]=n)}),t}function o(e,t,l){try{var n,o,r,i,a;let s=null==(o=e.dataSourceManager)||null==(n=o.getDataSource)?void 0:n.call(o,t||"main"),d=null==s||null==(i=s.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,l);return(null==d||null==(a=d.getPrimaryKey)?void 0:a.call(d))||"id"}catch(e){return"id"}}function r(e,t){var l,r;if(!t)return;let i=t.dataSourceKey||"main",a=t.collection||(null==(l=t.record)?void 0:l.__collectionName);if(!a)return;let s=o(e,i,a)||"id",d=void 0!==t.filterByTk?t.filterByTk:void 0!==t.id?t.id:null==(r=t.record)?void 0:r[s];if(void 0!==d)return n({collection:a,filterByTk:d,dataSourceKey:i,associationName:t.associationName,sourceId:t.sourceId,fields:t.fields,appends:t.appends})}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=e=>!!e&&"object"==typeof e&&"string"==typeof e.collection&&(void 0!==e.filterByTk||void 0!==e.id||e.record),n={},o=(t,i)=>{if(l(t)){let l=r(e,t);l&&(n[i.join(".")]=l);return}if(Array.isArray(t)){for(let e=0;e<t.length;e++)o(t[e],[...i,String(e)]);return}if(t&&"object"==typeof t){for(let[e,l]of Object.entries(t))o(l,[...i,e]);return}};return o(t,[]),Object.keys(n).length?n:void 0}l.d(t,{d:()=>i})},88439(e,t,l){"use strict";function n(e,t,l,n){let o={},r={};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let s=t[a],d={};if(s.uiSchema&&"object"==typeof s.uiSchema){for(let[e,t]of Object.entries(s.uiSchema))if(t&&"object"==typeof t){var i;let l=t;d[e]={type:l.type||"any",title:l.title||(null==(i=l["x-decorator-props"])?void 0:i.label)||e,interface:l["x-component"],uiSchema:l}}}let u=Object.keys(d).length>0;r[a]={type:"object",title:e.t(s.title)||a,display:u?"default":"none",properties:u?{params:{type:"object",title:"Parameters",display:"flatten",properties:d}}:void 0},o[a]={get params(){return l.getStepParams(n,a)||{}},get uiSchema(){return s.uiSchema},result:void 0}}e.defineProperty("steps",{get:()=>o})}l.d(t,{w:()=>n})},73398(e,t,l){"use strict";function n(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function o(e){return!!e&&/[a-zA-Z_$]/.test(e)}function r(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function i(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function a(e,t){let l=i(e,t);for(;"!"===e[l];)l=i(e,l+1);return l}function s(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function d(e,t){let l=s(e,t-1);if("("!==e[l])return!1;let n=s(e,l-1);if(n<0)return!0;let o=e[n];return!r(o)&&")"!==o&&"]"!==o}function u(e,t){let l=i(e,t);if(")"!==e[l])return!1;let n=i(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function c(e,t){if(!o(e[t]))return null;let l=t+1;for(;r(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function p(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function m(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,o="";for(;n<e.length;){let t=e[n];if("\\"===t){o+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:o,next:n+1};o+=t,n+=1}return null}function h(e,t){let l=i(e,t+1),n=m(e,l);if(n)return(l=i(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let o=p(e,l);return o?(l=i(e,o.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:o.value}:{dynamic:!0}}function f(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function g(e,t){let l=a(e,t);if("["===e[l])return h(e,l);if(e.startsWith("?.",l)){let t=i(e,l+2);if("["===e[t])return h(e,t);let n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=i(e,l+1),n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function v(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function y(e,t){if("ctx"!==e.slice(t,t+3)||r(e[t-1])||r(e[t+3]))return null;if(d(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=g(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],o=l.next,i=!1,s=!1;for(;o<e.length;){let t=a(e,o);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){i=!0,o=t;break}let l=g(e,o);if(!l){o=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(s=!0);break}if(l.dynamic){s=!0,o=t;break}f(n,l.kind,l.value),o=l.next}let c=n.join(".");return{next:Math.max(o,l.next),reference:{methodCall:i,path:c||void 0,unsupportedDynamicPath:s||u(e,o),varName:l.value}}}function x(e){let t=v(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=y(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function b(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function w(e){let t={},l=!1,o=e=>{for(let n of x(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&b(t,n.varName,n.path,n.methodCall)}},r=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)o(t[1]);return}Array.isArray(e)?e.forEach(r):n(e)&&Object.values(e).forEach(r)};return r(e),{unsupportedDynamicPath:l,usage:t}}function S(e){return new Set(Object.keys(w(e).usage))}function C(e){return w(e).usage}l.d(t,{xI:()=>E,vP:()=>$,$S:()=>N,pc:()=>D,Cg:()=>I,nN:()=>O,ju:()=>q,Xx:()=>R,vE:()=>T,XU:()=>M,UX:()=>B});var F=l(22928),k=l(35846),A=l(44476),P=l(2543),j=l.n(P);function M(e){var t,l,n,o;let r=e.resource,i=e.collection,a=e.record,s=(null==i?void 0:i.name)||(null==r||null==(t=r.getResourceName)?void 0:t.call(r)),d=(null==i?void 0:i.dataSourceKey)||(null==r||null==(l=r.getDataSourceKey)?void 0:l.call(r)),u=(null==r||null==(n=r.getFilterByTk)?void 0:n.call(r))??(null==i||null==(o=i.getFilterByTK)?void 0:o.call(i,a));if(!s||null==u)return;let c=String(s).split(".");return{collection:c[c.length-1],dataSourceKey:d,filterByTk:u}}function I(e){var t,l,n;let o=e.view;if(!o)return;let r=(null==o?void 0:o.inputArgs)||{},i=(null==r?void 0:r.collectionName)||(null==o||null==(t=o.record)?void 0:t.collection),a=(null==r?void 0:r.dataSourceKey)||(null==o||null==(l=o.record)?void 0:l.dataSourceKey)||"main",s=(null==r?void 0:r.filterByTk)||(null==o||null==(n=o.record)?void 0:n.filterByTk),d=null==r?void 0:r.associationName,u=null==r?void 0:r.sourceId;if(i&&null!=s)return{collection:i,dataSourceKey:a,filterByTk:s,sourceId:u,associationName:d}}function T(e,t){var l,n,o;let r=null==(l=e.inputArgs)?void 0:l.record,i=null==(n=e.collection)?void 0:n.filterTargetKey;if(!r||!i)return;let a=t.view,s=null==a||null==(o=a.inputArgs)?void 0:o.filterByTk,d=r[i];if(null!=s&&null!=d&&s===d)return j().cloneDeep(r)}function R(e,t){return l=>{var n,o,r,i;if(!("record"===l||l.startsWith("record.")))return!1;let a=t();if(!a)return!0;if("record"===l)return!1;let s=I(e),d=null==s?void 0:s.collection,u=(null==s?void 0:s.dataSourceKey)||"main";if(!d)return!0;let c=null==(o=e.dataSourceManager)||null==(n=o.getDataSource)?void 0:n.call(o,u),p=null==c||null==(i=c.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,d);if(!p)return!0;let m=(0,A.Hi)(()=>p,()=>a),h=l.startsWith("record.")?l.slice(7):"";return!!h&&m(h)}}function E(e,t){let l=(0,A.Hi)(e,()=>t());return n=>{let o=t();if(!o)return!0;if(!n)return!1;let r=e();if(!n.includes(".")){var i;let e,t=n;return r&&("function"==typeof r.getField&&(e=r.getField(t)),e||"function"!=typeof r.getFields||(e=(r.getFields()||[]).find(e=>(null==e?void 0:e.name)===t))),!!(null==e||null==(i=e.isAssociationField)?void 0:i.call(e))&&null==(null==o?void 0:o[t])}return l(n)}}async function N(e,t,l){let n=await (0,k.H)(e,t,!0)();return n?{...n,buildVariablesParams:e=>l?l(e):M(e)}:null}function D(e,t,l){let n=async()=>N(e,t,l);return n.title=t,n}function B(e,t,l){var n,o;return D(t,(null==l?void 0:l.title)?(null==(n=e.t)?void 0:n.call(e,l.title))||l.title:(null==(o=e.t)?void 0:o.call(e,"Current record"))||"Current record",e=>M(e))}let $=S,O=C;async function q(e,t){let l=C(t)||{},n=Object.keys(l);if(!n.length)return;let o={};for(let t of n){var r;let l,n=null==(r=e.getPropertyOptions)?void 0:r.call(e,t),i=null==n?void 0:n.meta;if(i){try{let t="function"==typeof i?await i():i,n=null==t?void 0:t.buildVariablesParams;"function"==typeof n&&(l=await n(e))}catch(e){continue}l&&(o[t]=l)}}let i=l.view||[];if(!o.view&&i.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let t=I(e);t&&(o.view={record:t})}return(0,F.d)(e,o)}},67778(e,t,l){"use strict";l.d(t,{sp:()=>M,bt:()=>E,U:()=>el,N5:()=>U,xB:()=>L,mW:()=>q,fP:()=>Y});var n=l(74848),o=l(96540),r=l(99418),i=l(11869),a=l(29007),s=l(52568),d=l(73398);function u(e){if((null==e?void 0:e.sourceId)==null||""===e.sourceId||"string"!=typeof e.associationName)return;let t=e.associationName.split(".")[0];if(t)return{collection:t,dataSourceKey:e.dataSourceKey||"main",filterByTk:e.sourceId}}function c(e){return null!=e}function p(e,t){if(e===t)return!0;if(!c(e)||!c(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(l){return String(e)===String(t)}}function m(e){var t;let l=null==e||null==(t=e.navigation)?void 0:t.viewStack;return Array.isArray(l)?l:[]}function h(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m(e);if(!l.length)return -1;let n=(null==e?void 0:e.inputArgs)||{},o=(null==e||null==(t=e.navigation)?void 0:t.viewParams)||{},r=n.viewUid??o.viewUid;if(!r)return l.length-1;let i=l.map((e,t)=>({item:e,index:t})).filter(e=>{let{item:t}=e;return(null==t?void 0:t.viewUid)===r});if(!i.length)return l.length-1;let a=["filterByTk","sourceId","tabUid"],s=i[i.length-1].index,d=-1;for(let{item:e,index:t}of i){let l=0,o=!0;for(let t of a)if(c(n[t])){if(!p(null==e?void 0:e[t],n[t])){o=!1;break}l+=1}o&&l>=d&&(s=t,d=l)}return s}function f(e,t){return t??e.view}function g(e){var t;if(!e)return!1;let l=m(e),n=null==e||null==(t=e.inputArgs)?void 0:t.openerUids,o=Array.isArray(n)&&n.length>0;return h(e,l)>=1||o}function v(e,t){let l=t=>e.t(t),n=function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return g(f(l,t))},o=async e=>{let l=f(e,t);if(!l||!g(l))return;let n=await y(e,l),o=null==n?void 0:n.resource;return(null==o?void 0:o.collectionName)&&null!=o.filterByTk?{collection:o.collectionName,dataSourceKey:o.dataSourceKey||"main",filterByTk:o.filterByTk,associationName:o.associationName,sourceId:o.sourceId}:(0,d.Cg)(e)},r=async()=>{var t,l,n,r;let i=await o(e);if(!(null==i?void 0:i.collection))return null;let a=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,i.dataSourceKey||"main");return(null==a||null==(r=a.collectionManager)||null==(n=r.getCollection)?void 0:n.call(r,i.collection))||null},i=async(l,n)=>{var o,r,i,a,s,d;try{let s=n||e,d=f(s,t),u=m(d),c=h(d,u);if(c<1||l<1)return;let p=c-l;if(p<1)return;let g=u[p];if(!(null==g?void 0:g.viewUid))return;let v=null==(o=s.engine)?void 0:o.getModel(g.viewUid,!0);if(!v)try{v=await s.engine.loadModel({uid:g.viewUid})}catch(t){null==(a=s.logger||e.logger)||null==(i=a.warn)||i.call(a,{err:t},"[FlowEngine] popup.getParentRecordRef loadModel failed")}let y=(null==v||null==(r=v.getStepParams)?void 0:r.call(v,"popupSettings","openView"))||{},x=null==y?void 0:y.collectionName,b=(null==y?void 0:y.dataSourceKey)||"main",w=(null==g?void 0:g.filterByTk)??(null==g?void 0:g.sourceId);if(!x||null==w)return;return{collection:x,dataSourceKey:b,filterByTk:w,sourceId:null==g?void 0:g.sourceId,associationName:null==y?void 0:y.associationName}}catch(t){null==(d=(null==n?void 0:n.logger)||e.logger)||null==(s=d.warn)||s.call(d,{err:t},"[FlowEngine] popup.getParentRecordRef failed");return}},a=l=>{try{let n=f(e,t),o=m(n);return h(n,o)-l>=1}catch(e){return!1}},s=t=>{let n=()=>({type:"object",title:l("Parent popup"),disabled:()=>!a(t),disabledReason:()=>a(t)?void 0:l("No parent popup"),hidden:()=>!a(t),properties:async()=>{let n=await i(t),o={};if(o.uid={type:"string",title:l("Popup uid")},n){let t=(()=>{try{var t,l,o,r;let i=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,n.dataSourceKey||"main");return(null==i||null==(r=i.collectionManager)||null==(o=r.getCollection)?void 0:o.call(r,n.collection||""))||null}catch(e){return null}})();o.record=await (0,d.$S)(()=>t,l("Popup record"),()=>n)||{type:"object",title:l("Popup record")}}else o.record={type:"object",title:l("Popup record")};return o.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},o}});return n.title=l("Parent popup"),n},c=()=>({type:"object",title:l("Current popup"),disabled:()=>!n(),hidden:()=>!n(),buildVariablesParams:async e=>{var l,r,a,s;if(!n(e))return;let d=await o(e),c=f(e,t),p=null==c?void 0:c.inputArgs,g={};if(d){let e={...d};!e.associationName&&(null==p?void 0:p.associationName)&&(e.associationName=p.associationName),void 0===e.sourceId&&void 0!==(null==p?void 0:p.sourceId)&&(e.sourceId=null==p?void 0:p.sourceId),g.record=e}try{let t=m(c);if(h(c,t)>=2){let t=g,l=1,n=await i(l,e);for(;n;){let o={record:n},r=u(n);r&&(o.sourceRecord=r),t.parent=o,t=o,l+=1,n=await i(l,e)}}}catch(t){null==(r=e.logger)||null==(l=r.debug)||l.call(r,{err:t},"[FlowEngine] buildVariablesParams: build parent-chain failed")}try{let e=u({sourceId:null==p?void 0:p.sourceId,associationName:null==p?void 0:p.associationName,dataSourceKey:null==p?void 0:p.dataSourceKey});e&&(g.sourceRecord=e)}catch(t){null==(s=e.logger)||null==(a=s.debug)||a.call(s,{err:t},"[FlowEngine] buildVariablesParams: infer sourceRecord failed")}return g},properties:async()=>{var n,a,u,c;let p={};if(p.uid={type:"string",title:l("Popup uid")},await o(e)){let e=async()=>{let e=await r();return e?await (0,d.$S)(()=>e,l("Current popup record"),e=>o(e)):null};e.title=l("Current popup record"),e.hasChildren=!0,p.record=e}try{let o=f(e,t),r=null==o?void 0:o.inputArgs,i=null==r?void 0:r.sourceId,s=null==r?void 0:r.associationName,u=(null==r?void 0:r.dataSourceKey)||"main";if(!s||"string"!=typeof s||!s.includes(".")){let t=m(o),l=h(o,t),r=l>=0?null==t?void 0:t[l]:void 0;if(null==r?void 0:r.viewUid){let t=null==e||null==(n=e.engine)?void 0:n.getModel(r.viewUid,!0);t||(t=await e.engine.loadModel({uid:r.viewUid}));let l=(null==t||null==(a=t.getStepParams)?void 0:a.call(t,"popupSettings","openView"))||{};s=(null==l?void 0:l.associationName)||s,u=(null==l?void 0:l.dataSourceKey)||u}}if(null!=i&&""!==i&&s&&"string"==typeof s){let t=String(s).includes(".")?String(s).split(".")[0]:void 0;if(t){let n=()=>{try{var l,n,o,r;let i=null==(n=e.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u);return(null==i||null==(r=i.collectionManager)||null==(o=r.getCollection)?void 0:o.call(r,t))||null}catch(e){return null}},o=await (0,d.$S)(n,l("Current popup parent record"),()=>({collection:t,dataSourceKey:u,filterByTk:i}));o&&(p.sourceRecord=o)}}}catch(t){null==(c=e.logger)||null==(u=c.debug)||u.call(c,{err:t},"[FlowEngine] popup.properties: build sourceRecord failed")}return p.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},await i(1)&&(p.parent=s(1)),p}});return c.title=l("Current popup"),c.sort=975,c}async function y(e,t){var l,n,o;let r=m(t),i=h(t,r),a=null==t||null==(n=t.inputArgs)||null==(l=n.parentItem)?void 0:l.value,s=null==t||null==(o=t.inputArgs)?void 0:o.openerUids,d=Array.isArray(s)&&s.length>0;if(!(i>=1||d))return;if(!r.length){let e=(null==t?void 0:t.inputArgs)||{};if(!(e.collectionName||null!=e.filterByTk||null!=e.sourceId||e.associationName||e.viewUid))return;return{uid:e.viewUid,resource:{dataSourceKey:e.dataSourceKey||"main",collectionName:e.collectionName,associationName:e.associationName,filterByTk:e.filterByTk,sourceId:e.sourceId},...void 0!==a?{sourceRecord:a}:{}}}let u=async t=>{var l,n,o,i,a,s;if(t<0||!(null==(l=r[t])?void 0:l.viewUid))return;let d=r[t].viewUid,c=null==(n=e.engine)?void 0:n.getModel(d,!0);c||(c=await (null==(s=e.engine)?void 0:s.loadModel({uid:d})));let p=(null==c||null==(o=c.getStepParams)?void 0:o.call(c,"popupSettings","openView"))||{},m=null==p?void 0:p.collectionName,h={uid:d,resource:{dataSourceKey:(null==p?void 0:p.dataSourceKey)||"main",collectionName:m,associationName:null==p?void 0:p.associationName,filterByTk:null==(i=r[t])?void 0:i.filterByTk,sourceId:null==(a=r[t])?void 0:a.sourceId}},f=await u(t-1);return f&&(h.parent=f),h},c=await u(i);return c&&void 0!==a&&(c.sourceRecord=a),c}function x(e,t){let l=/^(?:record|sourceRecord)(?:\.|$)|^parent(?:\.parent)*(?:\.(?:record|sourceRecord))(?:\.|$)/,n=e=>{var l,n;if("sourceRecord"!==e&&!e.startsWith("sourceRecord."))return!1;let o=null==t||null==(l=t.inputArgs)?void 0:l.parentItem;if(void 0===(null==o?void 0:o.value))return!0;let r="sourceRecord"===e?"":e.slice(13);if(!r)return!1;let i=null==t||null==(n=t.inputArgs)?void 0:n.parentItemResolver;if("function"==typeof i)return i(`value.${r}`);let a=r.split(".").filter(Boolean),s=o.value;for(let e of a){if(null===s||"object"!=typeof s||!(e in s))return!0;s=s[e]}return!1};e.defineProperty("popup",{get:async()=>y(e,t),meta:v(e,t),resolveOnServer:e=>{try{if("sourceRecord"===e||e.startsWith("sourceRecord."))return n(e);return!!e&&l.test(e)}catch(e){return!1}}})}var b=l(18182);let w=(0,o.forwardRef)((e,t)=>{let{afterClose:l,footer:r,header:i,hidden:a,...s}=e,[d,u]=(0,o.useState)(!0),[c,p]=(0,o.useState)(s),[m,h]=(0,o.useState)(()=>r),[f,g]=(0,o.useState)(i);(0,o.useImperativeHandle)(t,()=>({destroy:()=>{u(!1),null==l||l()},update:e=>p(t=>({...t,...e})),setFooter:e=>{h(e)},setHeader:e=>{0===Object.values(e||{}).length?g(null):g(e)}}));let v={...c,title:(null==f?void 0:f.title)||c.title,extra:null==f?void 0:f.extra,footer:void 0!==m?m:c.footer??null},y=o.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return(0,n.jsx)(b.A,{closable:!1,rootClassName:a?"nb-hidden":"",getContainer:y,...v,open:d,onCancel:c.onCancel,afterClose:()=>{null==l||l()},children:c.children})});function S(){let[e,t]=o.useState([]);return[e,o.useCallback(e=>(t(t=>[...t,e]),()=>{t(t=>t.filter(t=>t!==e))}),[])]}var C=l(16639),F=l(20616),k=l(47451);async function A(e,t){var l;return!!t.force||!1!==await (null==(l=e.beforeClose)?void 0:l.call(e,t))}function P(e,t){var l;let n=null==t?void 0:t.layoutContext,o=null==t||null==(l=t.engine)?void 0:l.context;n instanceof a.cB&&n!==t&&n!==o&&e.addDelegate(n)}let j=0;function M(){let e=o.useRef(null),t=(t,l)=>{var u,c,p;let m,h,f=null==l?void 0:l.engine;j+=1;let g=o.createRef(),v=new Promise(e=>{h=e}),y=null,b=null,S=e=>{let{children:t}=e;return o.useEffect(()=>{var e;return y=t,null==(e=g.current)||e.setFooter(t),()=>{var e;y=null,null==(e=g.current)||e.setFooter(null)}},[t]),null},M=e=>(o.useEffect(()=>{var t;return b=e,null==(t=g.current)||t.setHeader(e),()=>{var e;b=null,null==(e=g.current)||e.setHeader(null)}},[e]),null),I=new a.cB,T=(0,k._)(l.engine),R=(0,C.eX)(f,T);I.defineProperty("engine",{value:T}),I.addDelegate(T.context),!1!==t.inheritContext?I.addDelegate(l):(I.addDelegate(l.engine.context),P(I,l));let E=!1,N={type:"dialog",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,o,r;if(E)return;E=!0,null==(l=t.onClose)||l.call(t),null==(n=g.current)||n.destroy(),null==m||m(),null==h||h(e);let i=null==R?void 0:R.emitter;(0,C.Z8)(i),null==i||null==(r=i.emit)||r.call(i,C.B9,{type:"dialog",viewUid:null==N||null==(o=N.inputArgs)?void 0:o.viewUid}),T.unlinkFromStack()},update:e=>{var t;return null==(t=g.current)?void 0:t.update(e)},close:async(e,l)=>{var n,o;return(!t.preventClose||!!l)&&!!await A(N,{result:e,force:l})&&(t.triggerByRouter&&(null==(o=t.inputArgs)||null==(n=o.navigation)?void 0:n.back)?t.inputArgs.navigation.back():N.destroy(e),!0)},Footer:S,Header:M,setFooter:e=>{var t;y=e,null==(t=g.current)||t.setFooter(e)},setHeader:e=>{var t;b=e,null==(t=g.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,I)}};I.defineProperty("view",{get:()=>N,resolveOnServer:(0,d.Xx)(I,()=>(0,d.vE)(l,I))}),T.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),N.destroy()}),x(I,N);let D=(0,i.observer)(()=>{var e,l,i,a;let s=o.useRef(!1),d="function"==typeof t.content?t.content(N,I):t.content,u="string"==typeof d?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:r.A.sanitize(d)}}):d;return(o.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,N,I)},[]),(null==(l=t.inputArgs)||null==(e=l.hidden)?void 0:e.value)&&!s.current)?null:(s.current=!0,(0,n.jsx)(w,{className:"nb-dialog-overflow-hidden",ref:g,hidden:null==(a=t.inputArgs)||null==(i=a.hidden)?void 0:i.value,footer:y,header:b,...t,onCancel:()=>{N.close(t.result)},children:u}))},{displayName:"DialogWithContext"}),B=(null==t||null==(c=t.inputArgs)?void 0:c.viewUid)||`page-${j}`,$=(0,n.jsx)(F.I6,{engine:T,children:(0,n.jsx)(s.YQ,{context:I,children:(0,n.jsx)(D,{})})},B);return m=null==(p=e.current)?void 0:p.patchElement($),Object.assign(v,N)},l=o.useMemo(()=>({open:t}),[]),u=o.memo(o.forwardRef((e,t)=>{let[l,r]=S();return o.useImperativeHandle(t,()=>({patchElement:r}),[r]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(u,{ref:e},"dialog-holder")]}var I=l(97134),T=l(61793);let R=o.forwardRef((e,t)=>{var l;let{children:r,footer:i,title:a,extra:s,hidden:d,isMobile:u,...c}=e,[p,m]=o.useState(!0),[h,f]=o.useState(()=>i),[g,v]=o.useState({title:a,extra:s,...c.header});o.useImperativeHandle(t,()=>({destroy:()=>{m(!1)},update:e=>{Object.assign(c,e)},setFooter:e=>{f(e)},setHeader:e=>{0===Object.values(e||{}).length?v(null):v(e)}}),[]);let y=o.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return u?(0,n.jsx)(T.D,{className:d?"nb-hidden":"",visible:p,...c,footer:h,...g,onClose:c.onClose,children:r}):(0,n.jsx)(I.A,{rootClassName:d?"nb-hidden":"",closable:!1,getContainer:y,...c,open:p,footer:h,styles:{...c.styles,footer:{display:"flex",justifyContent:"flex-end",...null==(l=c.styles)?void 0:l.footer}},...g,onClose:c.onClose,children:r})});function E(){let e=o.useRef(null),t=o.useMemo(()=>i.observable.shallow({value:[]}),[]),l=o.memo(e=>{let{index:r}=e,[a,s]=o.useState(null);return(o.useEffect(()=>{(0,i.autorun)(()=>{let e=t.value;e[r]&&a!==e[r]&&s(e[r]),e[r]||s(null)})},[a,r]),a)?(0,n.jsx)(a,{children:(0,n.jsx)(l,{index:r+1})}):null});l.displayName="RenderNestedDrawer";let u=(t,l)=>{var u,c;let p,m,h=l.engine,f=o.createRef(),g=new Promise(e=>{m=e}),v=null,y=null,b=e=>{let{children:t}=e;return o.useEffect(()=>{var e;return v=t,null==(e=f.current)||e.setFooter(t),()=>{var e;v=null,null==(e=f.current)||e.setFooter(null)}},[t]),null},w=e=>(o.useEffect(()=>{var t;return y=e,null==(t=f.current)||t.setHeader(e),()=>{var e;y=null,null==(e=f.current)||e.setHeader(null)}},[e]),null),S=new a.cB,j=(0,k._)(l.engine),M=(0,C.eX)(h,j);S.defineProperty("engine",{value:j}),S.addDelegate(j.context),!1!==t.inheritContext?S.addDelegate(l):(S.addDelegate(l.engine.context),P(S,l));let I=!1,T={type:"drawer",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,o,r;if(I)return;I=!0,null==(l=t.onClose)||l.call(t),null==(n=f.current)||n.destroy(),null==p||p(),null==m||m(e);let i=null==M?void 0:M.emitter;(0,C.Z8)(i),null==i||null==(r=i.emit)||r.call(i,C.B9,{type:"drawer",viewUid:null==T||null==(o=T.inputArgs)?void 0:o.viewUid}),j.unlinkFromStack()},update:e=>{var t;return null==(t=f.current)?void 0:t.update(e)},close:async(e,l)=>{var n,o;return(!t.preventClose||!!l)&&!!await A(T,{result:e,force:l})&&(t.triggerByRouter&&(null==(o=t.inputArgs)||null==(n=o.navigation)?void 0:n.back)?t.inputArgs.navigation.back():T.destroy(e),!0)},Footer:b,Header:w,setFooter:e=>{var t;v=e,null==(t=f.current)||t.setFooter(e)},setHeader:e=>{var t;y=e,null==(t=f.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,S)}};S.defineProperty("view",{get:()=>T,resolveOnServer:(0,d.Xx)(S,()=>(0,d.vE)(l,S))}),j.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),T.destroy()}),x(S,T);let E=o.memo((0,i.observer)(e=>{var l,i,a,s;let d=o.useRef(!1),u="function"==typeof t.content?t.content(T,S):t.content,c="string"==typeof u?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:r.A.sanitize(u)}}):u;return(o.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,T,S)},[]),(null==(i=t.inputArgs)||null==(l=i.hidden)?void 0:l.value)&&!d.current)?(0,n.jsx)(n.Fragment,{children:e.children}):(d.current=!0,(0,n.jsxs)(R,{ref:f,...t,footer:v,header:t.header||y,hidden:null==(s=t.inputArgs)||null==(a=s.hidden)?void 0:a.value,onClose:()=>{T.close(t.result)},isMobile:S.isMobileLayout,children:[c,e.children]}))}));E.displayName="DrawerWithContext";let N=o.memo(e=>{let{children:t}=e;return(0,n.jsx)(F.I6,{engine:j,children:(0,n.jsx)(s.YQ,{context:S,children:(0,n.jsx)(E,{children:t})})})});return N.displayName="RenderDrawer",p=null==(c=e.current)?void 0:c.patchElement(N),Object.assign(g,T)},c=o.useMemo(()=>({open:u}),[]),p=o.memo(o.forwardRef((e,r)=>{let[i,a]=S();return o.useImperativeHandle(r,()=>({patchElement:a}),[a]),o.useEffect(()=>{t.value=i},[i]),(0,n.jsx)(l,{index:0})}));return[c,(0,n.jsx)(p,{ref:e},"drawer-holder")]}var N=l(40961),D=l(31333),B=l(71021);let $=(0,o.forwardRef)((e,t)=>{let[l,r]=o.useState({}),{visible:i=!0,footer:a=null,header:s=null,children:d,hidden:u,title:c,styles:p={},zIndex:m=4,onClose:h}={...e,...l},f=(0,o.useRef)(!1),g=(0,F.uf)(),[v,y]=(0,o.useState)(()=>a),[x,b]=(0,o.useState)(s);(0,o.useImperativeHandle)(t,()=>({destroy:()=>{f.current||(f.current=!0)},update:e=>{r(e)},setFooter:e=>{y(e)},setHeader:e=>{0===Object.values(e||{}).length?b(null):b(e)}}));let w=(0,o.useMemo)(()=>({display:u?"none":"flex",flexDirection:"column",height:"100%",zIndex:m}),[u,m]),S=(0,o.useMemo)(()=>{if(!x&&!c)return null;let{title:e=c,extra:t}=x||{},l=g.context.themeToken;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:`${l.paddingSM}px ${l.padding}px`,borderBottom:`1px solid ${l.colorSplit}`,backgroundColor:l.colorBgContainer,...p.header},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:l.marginXS},children:[(0,n.jsx)(B.Ay,{type:"text",size:"small",icon:(0,n.jsx)(D.A,{}),onClick:async()=>{f.current||!1!==await (null==h?void 0:h())&&(f.current=!0)},style:{color:l.colorTextTertiary}}),e&&(0,n.jsx)("div",{style:{fontSize:l.fontSizeLG,fontWeight:l.fontWeightStrong,color:l.colorText},children:e})]}),t&&(0,n.jsx)("div",{children:t})]})},[x,c,g.context.themeToken,p.header,h]),C=(0,o.useMemo)(()=>{if(!v)return null;let e=g.context.themeToken;return(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",padding:`${e.paddingXS}px ${e.padding}px`,borderTop:`1px solid ${e.colorSplit}`,backgroundColor:e.colorBgContainer,...p.footer},children:v})},[v,g.context.themeToken,p.footer]);return i?(0,n.jsxs)("div",{style:{...w,...p.content},children:[S,(0,n.jsx)("div",{style:{flex:1,overflowY:"auto",...p.body},children:d}),C]}):null}),O=0,q="nocobase-embed-container",L="nocobaseEmbedReplacing";function _(e){return!!e&&"function"==typeof e.then}function V(e,t){e.dataset[L]="1";try{let l=t.close();if(_(l))return Promise.resolve(l).finally(()=>{delete e.dataset[L]});return delete e.dataset[L],l}catch(t){throw delete e.dataset[L],t}}function z(e,t,l){let n,o={},r=e.then(e=>{let{page:t}=e;return(n=t)&&("beforeClose"in o&&(n.beforeClose=o.beforeClose),"update"in o&&n.update(o.update),"footer"in o&&n.setFooter(o.footer),"header"in o&&n.setHeader(o.header),o.destroyed&&n.destroy(o.destroyed.result)),{page:t}});return Object.assign(r.then(e=>{let{page:t}=e;return!!t&&t}),{type:"embed",inputArgs:t,preventClose:l,Header:null,Footer:null,get beforeClose(){return(null==n?void 0:n.beforeClose)??o.beforeClose},set beforeClose(value){n?n.beforeClose=value:o.beforeClose=value},close:(e,t)=>r.then(l=>{let{page:n}=l;return!!n&&n.close(e,t)}),destroy:e=>{n?n.destroy(e):o.destroyed={result:e}},update:e=>{n?n.update(e):o.update={...o.update,...e}},setFooter:e=>{n?n.setFooter(e):o.footer=e},setHeader:e=>{n?n.setHeader(e):o.header=e}})}let K=o.memo(o.forwardRef((e,t)=>{let[l,r]=S();return o.useImperativeHandle(t,()=>({patchElement:r}),[r]),(0,n.jsx)(n.Fragment,{children:l})}));function U(){let e=o.useRef(null),t=o.useRef(null),l=o.useRef(0),r=(r,u)=>{let{target:c,content:p,preventClose:m,inheritContext:h=!0,inputArgs:f={},onOpenCancelled:g,...v}=r,y=c instanceof HTMLElement&&c.id===q,b=()=>{var l,g,b;let w,S,j,M=null==u?void 0:u.engine;O+=1;let I=o.createRef(),T=new Promise(e=>{S=e}),R=e=>{let{children:t}=e;return o.useEffect(()=>{var e;return null==(e=I.current)||e.setFooter(t),()=>{var e;null==(e=I.current)||e.setFooter(null)}},[t]),null},E=e=>(o.useEffect(()=>{var t;return null==(t=I.current)||t.setHeader(e),()=>{var e;null==(e=I.current)||e.setHeader(null)}},[e]),null),D=new a.cB,B=(0,k._)(u.engine),q=(0,C.eX)(M,B);D.defineProperty("engine",{value:B}),D.addDelegate(B.context),h?D.addDelegate(u):(D.addDelegate(u.engine.context),P(D,u));let _=!1,V={type:"embed",inputArgs:f,preventClose:!!r.preventClose,beforeClose:void 0,destroy:e=>{var l,n,o,i,a;if(!_){if(_=!0,null==(l=r.onClose)||l.call(r),null==S||S(e),null==(n=I.current)||n.destroy(),null==w||w(),y&&t.current===V&&(t.current=null),!(y&&c instanceof HTMLElement&&(null==(o=c.dataset)?void 0:o[L])==="1")){let e=null==q?void 0:q.emitter;(0,C.Z8)(e),null==e||null==(a=e.emit)||a.call(e,C.B9,{type:"embed",viewUid:null==V||null==(i=V.inputArgs)?void 0:i.viewUid})}B.unlinkFromStack()}},update:e=>{var t;return null==(t=I.current)?void 0:t.update(e)},close:(e,t)=>_?Promise.resolve(!0):j||(j=(async()=>{try{var l,n;if(m&&!t)return j=void 0,!1;let o=await A(V,{result:e,force:t});if(_)return!0;if(!o)return j=void 0,!1;if(r.triggerByRouter&&(null==(n=r.inputArgs)||null==(l=n.navigation)?void 0:l.back))return r.inputArgs.navigation.back(),!0;return V.destroy(e),!0}catch(e){throw _||(j=void 0),e}})()),Header:E,Footer:R,setFooter:e=>{var t;null==(t=I.current)||t.setFooter(e)},setHeader:e=>{var t;null==(t=I.current)||t.setHeader(e)},navigation:null==(l=r.inputArgs)?void 0:l.navigation,get record(){return(0,d.vE)(u,D)}};D.defineProperty("view",{get:()=>V,resolveOnServer:(0,d.Xx)(D,()=>(0,d.vE)(u,D))}),x(D,V);let z=(0,i.observer)(()=>{var e,t,l,i;let a=o.useRef(!1),s=o.useMemo(()=>"function"==typeof p?p(V,D):p,[]);return(D.themeToken,o.useEffect(()=>{var e;null==(e=r.onOpen)||e.call(r,V,D)},[]),(null==(t=r.inputArgs)||null==(e=t.hidden)?void 0:e.value)&&!a.current)?null:(a.current=!0,(0,n.jsx)($,{ref:I,hidden:null==(i=r.inputArgs)||null==(l=i.hidden)?void 0:l.value,...v,onClose:()=>V.close(r.result),children:s}))},{displayName:"PageWithContext"}),K=(null==f?void 0:f.viewUid)||`page-${O}`,U=(0,n.jsx)(F.I6,{engine:B,children:(0,n.jsx)(s.YQ,{context:D,children:(0,n.jsx)(z,{})})},K);return w=c&&c instanceof HTMLElement?null==(g=e.current)?void 0:g.patchElement(N.createPortal(U,c,K)):null==(b=e.current)?void 0:b.patchElement(U),y&&(t.current=V),Object.assign(T,V)};if(y&&t.current){let e,n=l.current+=1,o=()=>null==g?void 0:g();try{e=V(c,t.current)}catch(e){throw o(),e}if(_(e))return z(Promise.resolve(e).then(e=>!1===e||n!==l.current?(o(),{page:null}):{page:b()},e=>{throw o(),e}),f,!!r.preventClose);if(!1===e)return o(),z(Promise.resolve({page:null}),f,!!r.preventClose)}return b()};return[o.useMemo(()=>({open:r}),[]),(0,n.jsx)(K,{ref:e},"page-holder")]}var W=l(28073);let H=0,G=o.forwardRef((e,t)=>{var l,r;let{afterClose:i,content:a,placement:s,rect:d,...u}=e,[c,p]=o.useState(!0),[m,h]=o.useState({content:a,placement:s,rect:d,...u});return o.useImperativeHandle(t,()=>({destroy:()=>p(!1),update:e=>h(t=>({...t,...e})),close:(e,t)=>p(!1)})),o.useEffect(()=>{c||null==i||i()},[c,i]),(0,n.jsx)(W.A,{arrow:!1,open:c,trigger:["click"],destroyTooltipOnHide:!0,content:m.content,placement:m.placement,getPopupContainer:()=>document.querySelector("#nocobase-app-container")||document.body,onOpenChange:e=>{(e||!m.preventClose)&&(p(e),e||null==i||i())},...m,children:(0,n.jsx)("span",{style:{position:"absolute",top:((null==(l=m.rect)?void 0:l.top)??0)+window.scrollY,left:((null==(r=m.rect)?void 0:r.left)??0)+window.scrollX,width:0,height:0}})})});function Y(){let e=o.useRef(null),t=t=>{var l,i;let a,s;H+=1;let{target:d,placement:u="rightTop",content:c,...p}=t,m=o.createRef(),h=(null==d||null==(l=d.getBoundingClientRect)?void 0:l.call(d))??{top:0,left:0},f=new Promise(e=>{s=e}),g={type:"popover",destroy:()=>{var e;return null==(e=m.current)?void 0:e.destroy()},update:e=>{var t;return null==(t=m.current)?void 0:t.update(e)},close:e=>{var t;null==s||s(e),null==(t=m.current)||t.close(e)}},v="function"==typeof c?c(g):c,y="string"==typeof v?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:r.A.sanitize(v)}}):v,x=(0,n.jsx)(G,{ref:m,content:y,placement:u,rect:h,afterClose:()=>{var e;null==a||a(),null==(e=t.onClose)||e.call(t),null==s||s(t.result)},...p},`popover-${H}`);return a=null==(i=e.current)?void 0:i.patchElement(x),Object.assign(f,g)},l=o.useMemo(()=>({open:t}),[]),i=o.memo(o.forwardRef((e,t)=>{let[l,r]=S();return o.useImperativeHandle(t,()=>({patchElement:r}),[]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(i,{ref:e},"popover-holder")]}var J=l(52847),X=l(60182);function Q(e){return null==e?"":e&&"object"==typeof e&&!Array.isArray(e)?encodeURIComponent(Object.entries(e).map(e=>{let[t,l]=e;return`${encodeURIComponent(String(t))}=${encodeURIComponent(String(l))}`}).join("&")):encodeURIComponent(String(e))}function Z(e){return null!=e&&""!==String(e)}function ee(e){let t=e||"/admin";return`/${t.replace(/^\/+/,"").replace(/\/+$/,"")}`}function et(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=ee(t.basePath||t.prefix);if(!e||0===e.length)return l;let n=l.replace(/^\/+/,"").split("/").filter(Boolean);return e.forEach((e,t)=>{t>0&&n.push("view"),n.push(e.viewUid);let l=(0,X.Gu)(e.viewUid,e.openViewRouteState);if(l&&n.push("opts",l),e.tabUid&&n.push("tab",e.tabUid),null!=e.filterByTk){let t=Q(e.filterByTk);t&&n.push("filterbytk",t)}Z(e.sourceId)&&n.push("sourceid",String(e.sourceId))}),"/"+n.join("/")}class el{setViewStack(e){this.viewStack=Object.freeze([...e]),this.viewParams=this.viewStack[this.viewStack.length-1]||{}}changeTo(e){let t=et(this.viewStack.map((t,l)=>l===this.viewStack.length-1?{...t,...e}:{...t}),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(t,{replace:!0})}navigateTo(e,t){let l=et([...this.viewStack,e],{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(l,t)}back(){let e=et(this.viewStack.slice(0,-1),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(e,{replace:!0})}getLayoutBasePath(){var e,t;let l=null==(e=this.ctx.layout)?void 0:e.routePath;return this.basePath||(null==(t=this.ctx.layoutRoute)?void 0:t.basePathname)||((null==l?void 0:l.startsWith("/"))?l:"/admin")}constructor(e,t,l={}){this.setViewStack(t),this.ctx=e,this.basePath=l.basePath||l.layoutBasePath,(0,J.E8)(this,{viewParams:J.sH})}}},16639(e,t,l){"use strict";l.d(t,{B9:()=>o,FH:()=>s,HK:()=>r,Z8:()=>d,eX:()=>p,i6:()=>i,tb:()=>n});let n=Symbol.for("__NOCOBASE_VIEW_ACTIVATED_VERSION__"),o="view:activated",r="dataSource:dirty",i="__NOCOBASE_ENGINE_SCOPE__",a="view";function s(e){let t=Reflect.get(e,n),l="number"==typeof t?t:Number(t);return Number.isFinite(l)&&l>0?l:0}function d(e){let t=s(e);if(!Object.isExtensible(e))return t;let l=t+1;return Reflect.set(e,n,l),l}function u(e){return Reflect.get(e,i)===a}function c(e){let t=e,l=0;for(;t&&l++<50;){if(u(t))return t;t=t.previousEngine}}function p(e,t){if(!e)return;let l=c(e);return l||c(null==t?void 0:t.previousEngine)||e}},33329(e,t,l){"use strict";l.r(t),l.d(t,{BaseStorage:()=>d,LocalStorage:()=>c,MemoryStorage:()=>u,SessionStorage:()=>p,APIClient:()=>m,Auth:()=>s,getSubAppName:()=>h,hasHeaderValue:()=>a});var n=l(88909),o=l(55373),r=l.n(o);let i=(e,t)=>{if(!e)return;let l="function"==typeof e.toJSON?e.toJSON():e,n=Object.keys(l||{}).find(e=>e.toLowerCase()===t.toLowerCase());return n?l[n]:void 0},a=(e,t)=>{let l=i(e,t);return null!=l&&""!==l};class s{get storagePrefix(){return this.api.storagePrefix}get locale(){return this.getLocale()}set locale(e){this.setLocale(e)}get role(){return this.getRole()}set role(e){this.setRole(e)}get token(){return this.getToken()}set token(e){this.setToken(e)}get authenticator(){return this.getAuthenticator()}set authenticator(e){this.setAuthenticator(e)}getOption(e){return this.api.storage.getItem(e)}setOption(e,t){return this.options[e]=t,this.api.storage.setItem(e,t||"")}getLocale(){return this.getOption("locale")}setLocale(e){this.setOption("locale",e)}getRole(){return this.getOption("role")}setRole(e){this.setOption("role",e)}getToken(){return this.getOption("token")}setToken(e){this.setOption("token",e),this.api.app&&this.api.app.eventBus.dispatchEvent(new CustomEvent("auth:tokenChanged",{detail:{token:e,authenticator:this.authenticator}}))}getAuthenticator(){return this.getOption("auth")}setAuthenticator(e){this.setOption("auth",e)}middleware(e){return this.locale&&e.headers&&(e.headers["X-Locale"]=this.locale),this.role&&e.headers&&(e.headers["X-Role"]=this.role),this.authenticator&&!a(e.headers,"X-Authenticator")&&e.headers&&(e.headers["X-Authenticator"]=this.authenticator),this.token&&!a(e.headers,"Authorization")&&e.headers&&(e.headers.Authorization=`Bearer ${this.token}`),e}async signIn(e,t){var l;let n=await this.api.request({method:"post",url:"auth:signIn",data:e,headers:{"X-Authenticator":t}}),o=null==n||null==(l=n.data)?void 0:l.data;return this.setAuthenticator(t),this.setToken(null==o?void 0:o.token),n}async signUp(e,t){return await this.api.request({method:"post",url:"auth:signUp",data:e,headers:{"X-Authenticator":t}})}async signOut(){let e=await this.api.request({method:"post",url:"auth:signOut"});return this.setToken(null),this.setRole(null),this.setAuthenticator(null),e}async lostPassword(e){let t=Object.fromEntries(new URLSearchParams(window.location.search).entries());return await this.api.request({method:"post",url:"auth:lostPassword",data:{...e,baseURL:window.location.href.split("/forgot-password")[0]},headers:{"X-Authenticator":t.name}})}async resetPassword(e){return await this.api.request({method:"post",url:"auth:resetPassword",data:e})}async checkResetToken(e){return await this.api.request({method:"post",url:"auth:checkResetToken",data:e})}constructor(e){this.options={locale:null,role:null,authenticator:null,token:null},this.api=e,this.api.axios.interceptors.request.use(this.middleware.bind(this))}}class d{toUpperCase(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];return e.toUpperCase()+l.map(e=>e.toUpperCase()).join("_")}}class u extends d{clear(){this.items.clear()}getItem(e){return this.items.get(e)}setItem(e,t){return this.items.set(e,t)}removeItem(e){return this.items.delete(e)}constructor(...e){super(...e),this.items=new Map}}class c extends d{clear(){return this.items.clear()}getItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.getItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.getItem(this.toUpperCase(this.storagePrefix,e))}setItem(e,t){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.setItem(this.toUpperCase(this.baseStoragePrefix,e),t):this.items.setItem(this.toUpperCase(this.storagePrefix,e),t)}removeItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.removeItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.removeItem(this.toUpperCase(this.storagePrefix,e))}constructor(e,t="",l=!1){super(),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.localStorage}}class p extends c{constructor(e,t="",l=!1){super(e,t,l),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.sessionStorage}}class m{toErrMessages(e){var t,l,n,o,r,i,a,s,d,u,c;if("u">typeof document&&"string"==typeof(null==e||null==(t=e.response)?void 0:t.data)){let t=document.createElement("div");t.innerHTML=null==e||null==(d=e.response)?void 0:d.data;let l=t.textContent||t.innerText;return l.includes("Error occurred while trying")||l.includes("502 Bad Gateway")?[{code:"APP_WARNING",message:l="The application may be starting up. Please try again later."}]:[{message:l}]}return(null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.error)?[null==e||null==(c=e.response)||null==(u=c.data)?void 0:u.error]:(null==e||null==(r=e.response)||null==(o=r.data)?void 0:o.errors)||(null==e||null==(a=e.response)||null==(i=a.data)?void 0:i.messages)||(null==e||null==(s=e.response)?void 0:s.error)||[{message:e.message||"Server error"}]}getHeaders(){let e={};return this.auth.locale&&(e["X-Locale"]=this.auth.locale),this.auth.role&&(e["X-Role"]=this.auth.role),this.auth.authenticator&&(e["X-Authenticator"]=this.auth.authenticator),this.auth.token&&(e.Authorization=`Bearer ${this.auth.token}`),e}createStorage(e){return"localStorage"===e&&"u">typeof localStorage?new c(this.storagePrefix,this.baseStoragePrefix,this.shareToken):"sessionStorage"===e&&"u">typeof sessionStorage?new p(this.storagePrefix,this.baseStoragePrefix,this.shareToken):new u}initStorage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"localStorage";if(e){this.storage=new e(this);return}this.storage=this.createStorage(t)}interceptors(){this.axios.interceptors.request.use(e=>(e.paramsSerializer=e=>r().stringify(e,{strictNullHandling:!0,arrayFormat:"brackets"}),e))}request(e){let{resource:t,resourceOf:l,action:n,params:o,headers:r}=e;return t?this.resource(t,l,r)[n](o):this.axios.request(e)}resource(e,t,l,n){return new Proxy({},{get:(o,r)=>{if(n)return;let i=e.split(".").join(`/${encodeURIComponent(t)||"_"}/`),a={url:i+=`:${r.toString()}`};return["get","list"].includes(r)?a.method="get":a.method="post",async(e,t)=>{let{values:n,filter:o,...r}=e||{};return a.params=r,o&&("string"==typeof o?a.params.filter=o:(o["*"]&&delete o["*"],a.params.filter=JSON.stringify(o))),"get"!==a.method&&(a.data=n||{}),await this.request({...a,...t,headers:l})}}})}constructor(e){if(this.storagePrefix="NOCOBASE_",this.baseStoragePrefix="NOCOBASE_",this.shareToken=!1,this.options=e,"function"==typeof e)this.axios=e;else{const{appName:t,authClass:l,storageType:o,storageClass:r,storagePrefix:i="NOCOBASE_",shareToken:a=!1,...s}=e||{};this.shareToken=a,this.baseStoragePrefix=i,this.storagePrefix=t?`${i}${t.toUpperCase()}_`:i,this.axios=n.A.create(s),this.initStorage(r,o),l&&(this.auth=new l(this))}this.storage||this.initStorage(),this.auth||(this.auth=new s(this)),this.interceptors()}}let h=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";if("u"<typeof window||!window.location.pathname)return;let t=`${e}apps/`;if(window.location.pathname.startsWith(t))return window.location.pathname.substring(t.length).split("/",1)[0]||""}},40542(e,t,l){"use strict";l.d(t,{D:()=>n});let n=(e,t,l)=>{if(!e)return l;let o=t.split("."),r=[],i=e,a=!1;for(let e=0;e<o.length;e++){let t=o[e];if(Array.isArray(i)){for(let t of(a=!0,i)){let i=n(t,o.slice(e).join("."),l);r=r.concat(i)}break}if((null==i?void 0:i[t])===void 0)break;i=i[t],e===o.length-1&&r.push(i)}return 0===(r=r.filter(e=>void 0!==e)).length?l:a?r.filter(e=>null!==e):r[0]}},13939(e,t,l){"use strict";l.r(t),l.d(t,{getDayRange:()=>tm,isEmptyFilter:()=>ed,sleep:()=>es,getDateVars:()=>ty,str2moment:()=>eg,unflatten:()=>ti,sortTree:()=>ea,generateFlowModelRdFromToken:()=>e$,forEach:()=>eA,utc2unit:()=>tf,extractUsedVariablePaths:()=>t4,getValuesByPath:()=>eO,isArray:()=>et,moment2str:()=>ex,transformLiquidContext:()=>t6,isURL:()=>tN,isPortalInBody:()=>tM,extractUsedVariableNames:()=>t5,parseHTML:()=>tI,toGmt:()=>ep,isPlainObject:()=>en,lockdownSes:()=>tA,splitPathToTwoParts:()=>tx,transformFilter:()=>Y,parseSQLBindParams:()=>le,getPickerFormat:()=>eC,nextTick:()=>er,removeNullCondition:()=>eu,CollectionsGraph:()=>V,isValidFilter:()=>eK,evaluateConditions:()=>Z,toUnit:()=>tg,removeInvalidFilterItems:()=>J,getFormatFromDateStr:()=>ek,BASE_BLOCKED_IDENTIFIERS:()=>tC,toLocal:()=>em,getDayRangeByParams:()=>L,getDefaultFormat:()=>ec,transformMultiColumnToSingleColumn:()=>t$,treeFind:()=>ei,transformSQL:()=>lt,parseFilter:()=>tp,flatten:()=>tr,isEmpty:()=>el,getOffsetRangeByParams:()=>B,offsetFromString:()=>eb,tval:()=>tP,error:()=>eQ,extractVariableUsage:()=>t8,Registry:()=>tb,lodash:()=>o(),parse:()=>eG,hasEmptyValue:()=>eo,toFixedByStep:()=>e6,getDateTimeFormat:()=>eF,showToast:()=>e5,Handlebars:()=>e_(),getLiquidContext:()=>t9,merge:()=>e2,dayjs:()=>i(),parseLiquidContext:()=>t7,uid:()=>tE,isString:()=>ee});var n=l(2543),o=l.n(n),r=l(74353),i=l.n(r),a=l(97375),s=l.n(a),d=l(90445),u=l.n(d),c=l(43522),p=l.n(c),m=l(37872),h=l.n(m),f=l(98867),g=l.n(f),v=l(8906),y=l.n(v),x=l(68313),b=l.n(x),w=l(21840),S=l.n(w),C=l(41816),F=l.n(C),k=l(88569),A=l.n(k),P=l(83826),j=l.n(P),M=l(8134),I=l.n(M),T=l(28623),R=l.n(T),E=l(46986),N=l.n(E);i().extend(N()),i().extend(S()),i().extend(A()),i().extend(j()),i().extend(F()),i().extend(b()),i().extend(h()),i().extend(g()),i().extend(y()),i().extend(I()),i().extend(R()),i().extend(u()),i().extend(s()),i().extend(p());let D=e=>{if(!e)return i()();if(/^[+-]\d{2}:\d{2}$/.test(e)){let[t,l,n]=e.match(/([+-])(\d{2}):(\d{2})/).slice(1),o=(60*parseInt(l)+parseInt(n))*("+"===t?1:-1);return i()().utcOffset(o)}return i()().tz(e)},B=e=>{let t,l,{type:n,unit:o="day",number:r=1,timezone:i}=e,a=D(i),s="week"===o?"isoWeek":o;if("past"===n){let e=a.startOf(s);t=e.subtract(r,o).startOf(s),l=e.subtract(1,o).endOf(s)}else if("next"===n)l=(t=a.startOf(s).add(1,o).startOf(s)).add(r-1,o).endOf(s);else throw Error(`Unsupported type: ${n}`);return[t.format("YYYY-MM-DD HH:mm:ss"),l.format("YYYY-MM-DD HH:mm:ss")]},$=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).startOf(t)},O=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).endOf(t)},q={today:e=>[$(0,"day",null==e?void 0:e.timezone),O(0,"day",null==e?void 0:e.timezone)],yesterday:e=>[$(-1,"day",null==e?void 0:e.timezone),O(-1,"day",null==e?void 0:e.timezone)],tomorrow:e=>[$(1,"day",null==e?void 0:e.timezone),O(1,"day",null==e?void 0:e.timezone)],thisWeek:e=>[$(0,"isoWeek",null==e?void 0:e.timezone),O(0,"isoWeek",null==e?void 0:e.timezone)],lastWeek:e=>[$(-1,"isoWeek",null==e?void 0:e.timezone),O(-1,"isoWeek",null==e?void 0:e.timezone)],nextWeek:e=>[$(1,"isoWeek",null==e?void 0:e.timezone),O(1,"isoWeek",null==e?void 0:e.timezone)],thisMonth:e=>[$(0,"month",null==e?void 0:e.timezone),O(0,"month",null==e?void 0:e.timezone)],lastMonth:e=>[$(-1,"month",null==e?void 0:e.timezone),O(-1,"month",null==e?void 0:e.timezone)],nextMonth:e=>[$(1,"month",null==e?void 0:e.timezone),O(1,"month",null==e?void 0:e.timezone)],thisQuarter:e=>[$(0,"quarter",null==e?void 0:e.timezone),O(0,"quarter",null==e?void 0:e.timezone)],lastQuarter:e=>[$(-1,"quarter",null==e?void 0:e.timezone),O(-1,"quarter",null==e?void 0:e.timezone)],nextQuarter:e=>[$(1,"quarter",null==e?void 0:e.timezone),O(1,"quarter",null==e?void 0:e.timezone)],thisYear:e=>[$(0,"year",null==e?void 0:e.timezone),O(0,"year",null==e?void 0:e.timezone)],lastYear:e=>[$(-1,"year",null==e?void 0:e.timezone),O(-1,"year",null==e?void 0:e.timezone)],nextYear:e=>[$(1,"year",null==e?void 0:e.timezone),O(1,"year",null==e?void 0:e.timezone)]},L=e=>{if("past"===e.type||"next"===e.type)return B(e);let t=q[e.type];if(!t)throw Error(`Unsupported type: ${e.type}`);let[l,n]=t(e);return[l.format("YYYY-MM-DD HH:mm:ss"),n.format("YYYY-MM-DD HH:mm:ss")]};var _=l(38362);class V{static graphlib(){return _}static connectedNodes(e){let t=(0,n.castArray)(e.nodes),l=(0,n.castArray)(e.excludes||[]),o=V.build(e),r=new Set;for(let e of t)for(let t of _.alg.preorder(o,e))l.includes(t)||r.add(t);return Array.from(r)}static preOrder(e){return V.graphlib().alg.preorder(V.build(e),e.node)}static build(e){let t=e.collections,l="forward"===((null==e?void 0:e.direction)||"forward"),n=new _.Graph;for(let e of t)n.setNode(e.name);for(let e of t){for(let t of e.inherits||[])l?n.setEdge(e.name,t):n.setEdge(t,e.name);for(let t of e.fields||[])if(("hasMany"===t.type||"belongsTo"===t.type||"hasOne"===t.type)&&(l?n.setEdge(e.name,t.target):n.setEdge(t.target,e.name)),"belongsToMany"===t.type){let o=t.through;l?(n.setEdge(e.name,o),n.setEdge(o,t.target)):(n.setEdge(t.target,o),n.setEdge(o,e.name))}}return n}}var z=l(81814),K=l.n(z);function U(e){return"path"in e&&"operator"in e}function W(e){return"logic"in e&&"items"in e}function H(e){let{path:t,operator:l,value:n}=e;return{[t]:{[l]:n}}}function G(e){let{logic:t,items:l}=e;return{[t]:l.map(e=>{if(U(e))return H(e);if(W(e))return G(e);throw Error("Invalid filter item type")})}}function Y(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return eu(G(e))}function J(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return e.items=e.items.filter(e=>U(e)?!!e.operator:!!W(e)&&J(e)),{...e}}function X(e,t){let{path:l,operator:n,value:o}=e;return t(l,n,o)}function Q(e,t){let{logic:l,items:n}=e;if(!n||0===n.length)return!0;let o=n.map(e=>{if(U(e))return X(e,t);if(W(e))return Q(e,t);throw Error("Invalid filter item type")});if("$and"===l)return o.every(e=>!0===e);if("$or"===l)return o.some(e=>!0===e);throw Error(`Unsupported logic operator: ${l}`)}function Z(e,t){if(!e||"object"!=typeof e)throw Error("Invalid conditions: conditions must be an object");if(!W(e))throw Error("Invalid conditions: conditions must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid conditions: items must be an array");if("function"!=typeof t)throw Error("Invalid evaluator: evaluator must be a function");return Q(e,t)}let ee=e=>"string"==typeof e,et=e=>Array.isArray(e),el=e=>en(e)?0===Object.keys(e).length:!!Array.isArray(e)&&0===e.length,en=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},eo=e=>{let t=!0;for(let l in e){if(t=!1,et(e[l])&&0===e[l].length||!e[l])return!0;if(en(e[l])||et(e[l]))return eo(e[l])}return t},er=e=>{setTimeout(e)};function ei(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return;let{childrenKey:n="children"}=l;for(let o of Array.isArray(e)?[...e]:[e]){if(t(o))return o;let e="function"==typeof n?n(o):o[n];if(Array.isArray(e)&&e.length>0){let n=ei(e,t,l);if(void 0!==n)return n}}}function ea(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"children",n=!(arguments.length>3)||void 0===arguments[3]||arguments[3];return e&&Array.isArray(e)&&0!==e.length?o().orderBy(e,t,n?"asc":"desc").map(e=>e[l]&&e[l].length>0?{...e,[l]:ea(e[l],t,l,n)}:e):e}function es(e){return new Promise(t=>{setTimeout(t,e)})}function ed(e){return!!(!e||"$and"in e&&o().isEmpty(e.$and)||"$or"in e&&o().isEmpty(e.$or))}let eu=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:K(),l=t(e||{}),n={};for(let e in l){let t=l[e];null==t||el(t)||""===t||(n[e]=t)}let r=t.unflatten(n);for(let e in r)Array.isArray(r[e])&&(r[e]=r[e].filter(e=>null!=e));return o().isEmpty(r)?void 0:r},ec=e=>e.format?e.format:e.dateFormat?e.showTime?`${e.dateFormat} ${e.timeFormat||"HH:mm:ss"}`:e.dateFormat:"month"===e.picker?"YYYY-MM":"quarter"===e.picker?"YYYY-\\QQ":"year"===e.picker?"YYYY":"week"===e.picker?"YYYY[W]W":e.showTime?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD",ep=e=>e&&i().isDayjs(e)?`${e.format("YYYY-MM-DD")}T${e.format("HH:mm:ss.SSS")}Z`:e,em=e=>e?Array.isArray(e)?e.map(e=>e.startOf("second").toISOString()):i().isDayjs(e)?e.startOf("second").toISOString():void 0:e,eh=e=>{try{let t=parseInt(e.slice(0,4)),l=parseInt(e.slice(-1));return i()().quarter(l).year(t)}catch(e){return null}},ef=(e,t)=>{if(!e)return;let l=t.utcOffset,{gmt:n,picker:o,utc:r=!0,dateOnly:a}=t;if(!i()(e).isValid())return eh(e);if(a){let t=i()(e);if(!t.isValid())return e;let l=t.format("YYYY-MM-DD");return i().utc(l,"YYYY-MM-DD")}return r?i().isDayjs(e)?l?e.utcOffset(eb(l)):e:n?i()(e).utcOffset(0):l?i()(e).utcOffset(eb(l)):i()(e):i()(e)},eg=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?e.map(e=>ef(e,t)):e?ef(e,t):e},ev=(e,t)=>"year"===t?e.format("YYYY")+"-01-01T00:00:00.000Z":"month"===t||"quarter"===t?e.format("YYYY-MM")+"-01T00:00:00.000Z":e.format("YYYY-MM-DD")+"T00:00:00.000Z",ey=(e,t)=>e?Array.isArray(e)?e.map(e=>ev(e,t)):i().isDayjs(e)?ev(e,t):void 0:e,ex=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{showTime:l,gmt:n,picker:o}=t;return e?l?n?ep(e):em(e):ey(e,o):e};function eb(e){if(!o().isString(e))return e;let t=/([+-]|\d\d)/gi,l=/Z|[+-]\d\d(?::?\d\d)?/gi,n=/[+-]?\d+(\.\d{1,3})?/,r=(e||"").match(l);if(null===r&&(r=(e||"").match(n)),null===r)return null;let i=((r[r.length-1]||[])+"").match(t)||["-",0,0],a=+(60*Number(i[1]))+ew(i[2]);return 0===a?0:"+"===i[0]?a:-a}function ew(e){let t=+e,l=0;return 0!==t&&isFinite(t)&&(l=eS(t)),l}function eS(e){return e<0?Math.ceil(e)||0:Math.floor(e)}let eC=e=>{switch(e){case"week":return"YYYY[W]W";case"month":return"YYYY-MM";case"quarter":return"YYYY[Q]Q";case"year":return"YYYY";default:return"YYYY-MM-DD"}},eF=(e,t,l,n)=>"date"===e&&l?`${t} ${n||"HH:mm:ss"}`:t;function ek(e){return/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(e)?"YYYY-MM-DD HH:mm:ss":/^\d{4}-\d{2}-\d{2}$/.test(e)?"YYYY-MM-DD":/^\d{4}-\d{2}$/.test(e)?"YYYY-MM":/^\d{4}$/.test(e)?"YYYY":/^\d{4}Q[1-4]$/.test(e)?"YYYY[Q]Q":/^\d{4}-\d{2}-\d{2}T/.test(e)?"YYYY-MM-DDTHH:mm:ss.SSSZ":null}let eA=(e,t)=>{Array.isArray(e)?e.forEach(t):Object.keys(e).forEach(l=>{t(e[l],l)})};var eP=l(48287).Buffer;let ej=new Map;function eM(e){return"function"==typeof btoa?btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,""):eP.from(e,"binary").toString("base64url")}function eI(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),l=t.padEnd(t.length+(4-t.length%4)%4,"=");return"function"==typeof atob?atob(l):eP.from(l,"base64").toString("binary")}function eT(e){let t=0x811c9dc5;for(let l=0;l<e.length;l+=1)t^=e.charCodeAt(l),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)}function eR(e,t){if(!t)return"";let l="";for(let n=0;n<e.length;n+=1)l+=String.fromCharCode(e.charCodeAt(n)^t.charCodeAt(n%t.length));return l}function eE(e){if(!e||"string"!=typeof e)return null;let t=e.split(".");if(t.length<2)return null;try{return JSON.parse(eI(t[1]))}catch{return null}}function eN(e){let t=null==e?void 0:e.userId,l=(null==e?void 0:e.signInTime)||(null==e?void 0:e.jti);return"string"!=typeof t&&"number"!=typeof t||"string"!=typeof l&&"number"!=typeof l?"":`${t}:${l}`}function eD(e){return eN(eE(e))}function eB(e,t){if("string"!=typeof e&&"number"!=typeof e||!t)return;let l=String(e),n=`${t}
|
|
3570
|
+
${l}`,o=ej.get(n);if(o)return o;let r=eM(eR(l,eT(`mask:v1:${t}`))),i=eT(`check:v1:${t}:${l}`),a=`v1.${r}.${i}`;return ej.set(n,a),a}function e$(e,t){return eB(e,eD(t))}let eO=(e,t,l)=>{if(!e)return l;let n=t.split("."),o=[],r=e,i=!1;for(let e=0;e<n.length;e++){let t=n[e];if(Array.isArray(r)){for(let t of(i=!0,r)){let r=eO(t,n.slice(e).join("."),l);o=o.concat(r)}break}if((null==r?void 0:r[t])===void 0)break;r=r[t],e===n.length-1&&o.push(r)}return 0===(o=o.filter(e=>void 0!==e)).length?l:i?o.filter(e=>null!==e):o[0]};var eq=l(88835),eL=l(60639),e_=l.n(eL),eV=l(79441);let ez=l.n(eV)()();function eK(e){if(!e)return!1;let t=[e.$and,e.$or].filter(Boolean);return 0==t.length?Object.keys(e).length>0:t.some(e=>{if(Array.isArray(e))return e.some(eK);if(e.$and||e.$or)return eK(e);let[t]=Object.keys(e);if(!t||!e[t])return!1;let[l]=Object.keys(e[t]);return!!l&&void 0!==e[t][l]})}function eU(e){let t=typeof e;return Array.isArray(e)?t="array":e instanceof Date?t="date":null===e&&(t="null"),t}function eW(e){let t=e.substr(2,e.length-4).trim(),l=t.indexOf(":");return -1!==l?{key:t.substr(0,l),defaultValue:t.substr(l+1)}:{key:t}}function eH(e,t){return e.parameters=Array.from(new Map(t.map(e=>[e.key,e])).values()),e}function eG(e){switch(eU(e)){case"string":return eY(e);case"object":return eJ(e);case"array":return eX(e);default:return eH(function(){return e},[])}}Object.keys(ez).forEach(function(e){e_().registerHelper(e,ez[e])}),e_().registerHelper("json",function(e){return JSON.stringify(e)}),e_().registerHelper("urlParse",function(e){try{return JSON.stringify(eq.parse(e))}catch(t){return`Invalid URL: ${e}`}}),e_().registerHelper("dateFormat",(e,t,l)=>"string"==typeof l?i()(e).tz(l).format(t):i()(e).format(t)),e_().registerHelper("isNull",e=>o().isNull(e));let eY=(()=>{let e=/{{(\w|:|[\s-+.,@/()?=*_$])+}}/g;return t=>{let l=[],o=e=>t,r=t.match(e);return r&&(l=r.map(eW),o=e=>(e=e||{},r.reduce((o,i,a)=>{let s=l[a],d=(0,n.get)(e,s.key);return(void 0===d&&(d=s.defaultValue),"function"==typeof d&&(d=d()),1===r.length&&t.startsWith("{{")&&t.endsWith("}}"))?d:(d instanceof Date&&(d=d.toISOString()),o.replace(i,null==d?"":d))},t))),eH(o,l)}})();function eJ(e){let t=Object.keys(e).map(t=>({keyTemplate:eY(t),valueTemplate:eG(e[t])}));return eH(e=>t.reduce((t,l)=>(t[l.keyTemplate(e)]=l.valueTemplate(e),t),{}),t.reduce((e,t)=>e.concat(t.valueTemplate.parameters,t.keyTemplate.parameters),[]))}function eX(e){let t=e.map(eG);return eH(e=>t.map(t=>t(e)),t.reduce((e,t)=>e.concat(t.parameters),[]))}let eQ=function(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];console.error(e,...l)};var eZ=l(14744),e0=l.n(eZ);let e1=(e,t,l)=>t;function e2(e,t,l){return e0()(e,t,{arrayMerge:e1,...l})}var e8=l(76511);let e5=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;e8.Ay[t]({message:e,duration:l})};var e4=l(5062),e3=l(85738);function e6(e,t){if(null==e||""===e)return"";let l=(0,e4.i5)(t);return(0,e3.Mg)(String(e),".",l)}var e9=l(63560),e7=l.n(e9),te=l(95093),tt=l.n(te);let tl=/^\s*\{\{([\s\S]*)\}\}\s*$/;function tn(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function to(e){return e}function tr(e,t){let l=(t=t||{}).delimiter||".",n=t.maxDepth,r=t.transformKey||to,i=t.transformValue||to,a={};function s(e,d,u){u=u||1,o().isObjectLike(e)&&Object.keys(e).forEach(function(o){var c;let p=e[o],m=t.safe&&Array.isArray(p),h=Object.prototype.toString.call(p),f=tn(p),g="[object Object]"===h||"[object Array]"===h,v=d?d+l+r(o):r(o);if(null==(c=t.breakOn)?void 0:c.call(t,{key:o,value:p,path:v})){a[v]=i(p,v);return}if(!m&&!f&&g&&Object.keys(p).length&&(!t.maxDepth||u<n))return s(p,v,u+1);a[v]=i(p,v)})}return s(e),a}function ti(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l={},n=t.transformValue||to;for(let t of Object.keys(e))e7()(l,t,n(e[t],t));return l}let ta=e=>{let t=e.split(".").pop()||"";return t.startsWith("$")||(t=""),{operator:t}},ts=e=>["$dateOn","$dateNotOn","$dateBefore","$dateAfter","$dateNotBefore","$dateNotAfter","$dateBetween"].includes(e);function td(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function tu(e){return(null==e?void 0:e.type)==="dateOnly"||(null==e?void 0:e.type)==="datetimeNoTz"||(null==e?void 0:e.constructor.name)==="DateOnlyField"||(null==e?void 0:e.constructor.name)==="DatetimeNoTzField"}let tc=(e,t)=>e?(e.type&&(e=L({...e,timezone:t})),Array.isArray(e))?(2===e.length?e.push("[]",t):3===e.length&&e.push(t),e):"string"==typeof e?!t||/(\+|-)\d\d:\d\d$/.test(e)?e:e+t:td(e)?e.toISOString():void 0:null,tp=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=new Set,n=t.vars||{},o=t.timezone,r=t.now,i=t.getField,a=tr(e,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if("string"!=typeof e)return e;let t=tl.exec(e);if(t){let e=t[1].trim();e.startsWith("$user")&&l.add(e.substring(6))}return e}});if(l.size>0){let e=await n.$user({fields:[...l.values()]});Object.assign(n,{$user:e})}return ti(a,{transformValue(e,t){let{operator:l}=ta(t);if("string"==typeof e){let a=tl.exec(e);if(a){let s=eO(n,a[1].trim(),null),d=null==i?void 0:i(t);e="function"==typeof s?null==s?void 0:s({field:d,operator:l,timezone:o,now:r}):s}}if(ts(l)){let l=null==i?void 0:i(t);return tu(l)?e.type?L({...e,timezone:(null==l?void 0:l.timezone)||o}):e:tc(e,(null==l?void 0:l.timezone)||o)}return e}})};function tm(e){let{now:t,timezone:l="+00:00",offset:n}=e,o=th(t).utcOffset(eb(l));return n>0?[(o=o.add(1,"day").startOf("day")).format("YYYY-MM-DD"),o.clone().add(n,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]:[o.clone().subtract(-1*n-1,"day").startOf("day").format("YYYY-MM-DD"),o.clone().add(1,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]}function th(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?i().isDayjs(e)?e:t?tt()(e):i()(e):t?tt()():i()()}function tf(e){var t;let{now:l,unit:n,timezone:o="+00:00",offset:r}=e,i=th(l,"isoWeek"===n);i=(i=i.utcOffset(eb(o))).startOf(n),r>0?i=i.add(r,n):r<0&&(i=i.subtract(-1*r,n));let a={year:()=>i.format("YYYY"),quarter:()=>i.format("YYYY[Q]Q"),month:()=>i.format("YYYY-MM"),week:()=>i.format("gggg[w]ww"),isoWeek:()=>i.format("GGGG[W]WW"),day:()=>i.format("YYYY-MM-DD")},s=null==(t=a[n])?void 0:t.call(a);return o?s+o:s}let tg=(e,t)=>l=>{let{now:n,timezone:o,field:r}=l;return(null==r?void 0:r.timezone)&&(o=null==r?void 0:r.timezone),tf({now:n,timezone:o,unit:e,offset:t})},tv=e=>t=>{let{now:l,timezone:n,field:o}=t;return(null==o?void 0:o.timezone)&&(n=null==o?void 0:o.timezone),tm({now:l,timezone:n,offset:e})};function ty(){return{now:new Date().toISOString(),today:tg("day"),yesterday:tg("day",-1),tomorrow:tg("day",1),thisWeek:tg("week"),lastWeek:tg("week",-1),nextWeek:tg("week",1),thisIsoWeek:tg("isoWeek"),lastIsoWeek:tg("isoWeek",-1),nextIsoWeek:tg("isoWeek",1),thisMonth:tg("month"),lastMonth:tg("month",-1),nextMonth:tg("month",1),thisQuarter:tg("quarter"),lastQuarter:tg("quarter",-1),nextQuarter:tg("quarter",1),thisYear:tg("year"),lastYear:tg("year",-1),nextYear:tg("year",1),last7Days:tv(-7),next7Days:tv(7),last30Days:tv(-30),next30Days:tv(30),last90Days:tv(-90),next90Days:tv(90)}}function tx(e){let t=e.split(".");return[t.shift(),t.join(".")]}class tb{register(e,t){if(!this.options.override&&this.map.has(e))throw Error(`this registry does not allow to override existing keys: "${e}"`);this.map.set(e,t)}get(e){return this.map.get(e)}getKeys(){return this.map.keys()}getValues(){return this.map.values()}getEntities(){return this.map.entries()}constructor(e={override:!1}){this.map=new Map,this.options=e}}l(67980);let tw=Symbol.for("nocobase.utils.sesLockdown"),tS=Symbol.for("nocobase.utils.bufferOverrides"),tC=["globalThis","global","self","Function","AsyncFunction","GeneratorFunction","eval","Compartment","lockdown","harden","assert"];function tF(e){return!!e&&"object"==typeof e&&(e.message||"").includes("(SES_ALREADY_LOCKED_DOWN)")}function tk(){let e=globalThis;if(e[tS])return;let t=e.Buffer;if(!t||!t.prototype)return;let l=t.prototype;for(let e of Reflect.ownKeys(l)){let t=Object.getOwnPropertyDescriptor(l,e);if(!t||"function"!=typeof t.value||!t.configurable)continue;let n=t.value,o=function(){return n},r=function(t){if(this===l)throw TypeError(`Cannot assign to read only property '${String(e)}' of object 'Buffer.prototype'`);Object.defineProperty(this,e,{configurable:!0,enumerable:!0,writable:!0,value:t})};Object.defineProperty(o,"originalValue",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(l,e,{configurable:t.configurable,enumerable:t.enumerable,get:o,set:r})}e[tS]=!0}function tA(e){tk();let t=globalThis;if(!t[tw]){if("function"!=typeof lockdown)throw Error("SES lockdown is unavailable in the current runtime environment.");try{lockdown(e)}catch(e){if(!tF(e))throw e}t[tw]=!0}}function tP(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}var tj=l(65606);let tM=e=>{for(;e;){var t;if("root"===e.id||(null==(t=e.classList)?void 0:t.contains("nb-action")))return!1;e=e.parentNode}return!tj.env.__TEST__};function tI(e,t){return e.replace(/\{\{(\w+)\}\}/g,function(e,l){return void 0!==t[l]?t[l]:e})}let tT=36,tR="";for(;tT--;)tR+=tT.toString(36);function tE(e){let t="",l=e||11;for(;l--;)t+=tR[36*Math.random()|0];return t}function tN(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}var tD=l(27153),tB="2.1.38";let t$=(e,t)=>{if(!e)return e;if("Grid"!==e["x-component"])return Object.keys(e.properties||{}).forEach(l=>{e.properties[l]=t$(e.properties[l],t)}),e;let l=e.parent;e=e.toJSON?e.toJSON():o().cloneDeep(e);let n={},{properties:r={}}=e,i=0;if(Object.keys(r).forEach((e,l)=>{let a=r[e];if("Grid.Row"!==a["x-component"]){a["x-index"]=++i,n[e]=a;return}if(a.properties){if(1===Object.keys(a.properties).length){a["x-index"]=++i,n[e]=a;return}Object.keys(a.properties).forEach((l,r)=>{let s=a.properties[l];if(o().set(s,"x-component-props.width",100),0===r){a["x-index"]=++i,n[e]=a;return}null!=t&&t(s)||(delete a.properties[l],n[`${tE()}_${l}`]=tO(s,l,++i))})}}),e.properties=n,l){let t=new tD.Schema(e,l);return l.properties&&Object.keys(l.properties).forEach(n=>{n===e.name&&(l.properties[n]=t)}),t}return e};function tO(e,t,l){return{type:"void",version:"2.0","x-component":"Grid.Row","x-app-version":tB,"x-uid":tE(),"x-async":!1,"x-index":l,_isJSONSchemaObject:!0,properties:{[t]:e}}}function tq(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function tL(e){return!!e&&/[a-zA-Z_$]/.test(e)}function t_(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function tV(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function tz(e,t){let l=tV(e,t);for(;"!"===e[l];)l=tV(e,l+1);return l}function tK(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function tU(e,t){let l=tK(e,t-1);if("("!==e[l])return!1;let n=tK(e,l-1);if(n<0)return!0;let o=e[n];return!t_(o)&&")"!==o&&"]"!==o}function tW(e,t){let l=tV(e,t);if(")"!==e[l])return!1;let n=tV(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function tH(e,t){if(!tL(e[t]))return null;let l=t+1;for(;t_(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function tG(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function tY(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,o="";for(;n<e.length;){let t=e[n];if("\\"===t){o+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:o,next:n+1};o+=t,n+=1}return null}function tJ(e,t){let l=tV(e,t+1),n=tY(e,l);if(n)return(l=tV(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let o=tG(e,l);return o?(l=tV(e,o.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:o.value}:{dynamic:!0}}function tX(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function tQ(e,t){let l=tz(e,t);if("["===e[l])return tJ(e,l);if(e.startsWith("?.",l)){let t=tV(e,l+2);if("["===e[t])return tJ(e,t);let n=tH(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=tV(e,l+1),n=tH(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function tZ(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function t0(e,t){if("ctx"!==e.slice(t,t+3)||t_(e[t-1])||t_(e[t+3]))return null;if(tU(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=tQ(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],o=l.next,r=!1,i=!1;for(;o<e.length;){let t=tz(e,o);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){r=!0,o=t;break}let l=tQ(e,o);if(!l){o=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(i=!0);break}if(l.dynamic){i=!0,o=t;break}tX(n,l.kind,l.value),o=l.next}let a=n.join(".");return{next:Math.max(o,l.next),reference:{methodCall:r,path:a||void 0,unsupportedDynamicPath:i||tW(e,o),varName:l.value}}}function t1(e){let t=tZ(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=t0(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function t2(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function t8(e){let t={},l=!1,n=e=>{for(let n of t1(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&t2(t,n.varName,n.path,n.methodCall)}},o=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)n(t[1]);return}Array.isArray(e)?e.forEach(o):tq(e)&&Object.values(e).forEach(o)};return o(e),{unsupportedDynamicPath:l,usage:t}}function t5(e){return new Set(Object.keys(t8(e).usage))}function t4(e){return t8(e).usage}let t3=new(l(23155)).HX;function t6(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t={};for(let l of e){let e=l.replace(/^ctx\./,"").split("."),n=t;for(let t=0;t<e.length;t++){let o=e[t];t===e.length-1?n[o]=`{{${l}}}`:(n[o]=n[o]||{},n=n[o])}}return t}async function t9(e){return t6(await t3.fullVariables(e))}async function t7(e,t){return await t3.parseAndRender(e,{ctx:t})}function le(e){let t=1,l={};return{sql:e.replace(/{{\s*([^}]+)\s*}}/g,(e,n)=>{let o=`__var${t}`;return l[o]=`{{${n.trim()}}}`,t++,`$${o}`}),bind:l}}async function lt(e){let{sql:t,bind:l}=le(e),n=await t9(t);return{sql:t,bind:l,liquidContext:n}}},59598(){},23005(){},14892(){},2813(){},61511(){},92489(){},52453(){},72522(){},66883(){},9845(){}},function(e){var t=function(t){return e(e.s=t)};e.O(0,["1339","2174","268","3210","3338","3658","3782","404","8159","8732","8878","9200","9223","957","9817","9967"],function(){return t(87696)}),e.O()}]);
|