@tego/web 1.6.3 → 1.6.5

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.
@@ -1,2 +0,0 @@
1
- /*! For license information please see index.ad117c8a.js.LICENSE.txt */
2
- (()=>{var e,t,n,o,l,r,i,a={20181:function(e,t,n){var o={"./lv.js":["86422","8875"],"./sr-cyrl.js":["61796","7765"],"./bi.js":["42469","9270"],"./id.js":["22085","8806"],"./he.js":["17455","2852"],"./kk.js":["30702","7091"],"./ar-ly.js":["27743","9716"],"./hr.js":["83294","6867"],"./ko.js":["45954","2287"],"./ar-dz.js":["65946","5655"],"./nl.js":["56614","2043"],"./tet.js":["72863","7284"],"./lb.js":["65018","2951"],"./de.js":["34107","792"],"./zh-tw.js":["84538","8839"],"./de-at.js":["92433","7130"],"./tg.js":["77197","5246"],"./am.js":["16598","5195"],"./ky.js":["55764","5221"],"./kn.js":["13841","938"],"./ss.js":["10238","9011"],"./hu.js":["5599","7156"],"./ar-iq.js":["37066","9191"],"./uk.js":["36396","8637"],"./se.js":["97592","7633"],"./pt-br.js":["10977","9242"],"./ar-sa.js":["89892","5701"],"./en-il.js":["23621","2502"],"./nb.js":["5624","81"],"./hi.js":["80963","1648"],"./gl.js":["42139","9592"],"./mi.js":["17790","5043"],"./en-ie.js":["24686","6339"],"./ur.js":["47563","4248"],"./me.js":["49130","6647"],"./fy.js":["32513","7962"],"./ar.js":["86415","9556"],"./ar-kw.js":["72906","4519"],"./fr-ca.js":["24593","8650"],"./de-ch.js":["22959","1284"],"./pa-in.js":["5095","5324"],"./eo.js":["17488","7417"],"./ro.js":["33655","2556"],"./te.js":["811","1832"],"./tl-ph.js":["72649","226"],"./zh.js":["88110","2339"],"./es-mx.js":["94976","7625"],"./it.js":["91605","4006"],"./zh-hk.js":["74514","2351"],"./da.js":["29631","1172"],"./fr-ch.js":["4954","327"],"./uz-latn.js":["76149","8598"],"./bo.js":["94407","4780"],"./ht.js":["13512","9249"],"./lo.js":["62221","446"],"./en-sg.js":["73466","823"],"./ml.js":["929","6509"],"./br.js":["68596","4885"],"./my.js":["48270","9843"],"./uz.js":["30435","4624"],"./tzm.js":["35211","2744"],"./zh-cn.js":["80750"],"./ne.js":["21357","1182"],"./gom-latn.js":["25913","1138"],"./az.js":["22215","7660"],"./bg.js":["81391","9844"],"./en-au.js":["19270","5019"],"./mr.js":["72931","2848"],"./gd.js":["31155","4176"],"./oc-lnc.js":["62840","8625"],"./yo.js":["31924","5621"],"./cv.js":["57073","3018"],"./lt.js":["56332","8381"],"./th.js":["42672","6265"],"./cs.js":["73934","9171"],"./es.js":["23668","2197"],"./bn.js":["70256","4521"],"./sr.js":["59805","9646"],"./sw.js":["39474","5999"],"./et.js":["37537","4026"],"./sv-fi.js":["71523","176"],"./fa.js":["21705","1202"],"./gu.js":["95804","6621"],"./fo.js":["97419","2248"],"./bs.js":["16539","8040"],"./eu.js":["17810","7487"],"./ja.js":["38357","6422"],"./es-do.js":["55224","8769"],"./nl-be.js":["78242","1455"],"./tk.js":["27209","9458"],"./en-ca.js":["97068","3693"],"./tzm-latn.js":["8829","9854"],"./ug-cn.js":["90004","4325"],"./mn.js":["16799","1508"],"./pt.js":["38576","505"],"./cy.js":["43132","4461"],"./ru.js":["57009","8890"],"./sq.js":["22036","3237"],"./ga.js":["22848","4297"],"./km.js":["34200","2769"],"./ku.js":["84416","3081"],"./tr.js":["26642","6335"],"./af.js":["21051","3448"],"./hy-am.js":["53842","1199"],"./x-pseudo.js":["47473","9130"],"./tlh.js":["55662","4275"],"./sd.js":["60751","228"],"./is.js":["91104","8377"],"./sl.js":["96551","8332"],"./ms-my.js":["20927","6644"],"./jv.js":["51984","5593"],"./el.js":["67849","8706"],"./ka.js":["99900","2381"],"./bn-bd.js":["63339","9288"],"./en-gb.js":["20593","9370"],"./mk.js":["73332","7973"],"./sv.js":["93377","8090"],"./be.js":["26673","602"],"./pl.js":["28488","2465"],"./rn.js":["43936","7385"],"./dv.js":["61102","9507"],"./si.js":["91580","8125"],"./en.js":["40711","4268"],"./vi.js":["88097","9226"],"./en-in.js":["49347","9344"],"./es-us.js":["83545","9330"],"./es-pr.js":["63607","9708"],"./fi.js":["5521","3386"],"./bm.js":["3209","4594"],"./ca.js":["98996","7301"],"./ar-ma.js":["74518","7147"],"./ms.js":["17468","5133"],"./nn.js":["80380","7421"],"./ta.js":["47919","564"],"./ar-tn.js":["88486","9291"],"./sk.js":["25286","2123"],"./rw.js":["51375","5604"],"./tzl.js":["35940","773"],"./en-nz.js":["77080","4689"],"./mt.js":["7945","7682"],"./en-tt.js":["28652","2765"],"./fr.js":["92448","1881"],"./it-ch.js":["58385","3834"]};function l(e){if(!n.o(o,e))return Promise.resolve().then(function(){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=o[e],l=t[0];return Promise.all(t.slice(1).map(n.e)).then(function(){return n.t(l,23)})}l.keys=()=>Object.keys(o),l.id=20181,e.exports=l},87375:function(e,t,n){"use strict";let o,l,r,i;var a,s,c,d,u,p,m={};n.r(m),n.d(m,{array:()=>rA,boolean:()=>rD,collection:()=>rq,collectionField:()=>r_,datetime:()=>rI,enumType:()=>rN,id:()=>rT,number:()=>rP,object:()=>rk,string:()=>rj,tableoid:()=>rR,time:()=>rM});var h={};n.r(h),n.d(h,{Approval:()=>iW,ApprovalNew:()=>iH,Apps:()=>i$,Design:()=>iJ,Dispatcher:()=>iX,SiteMessage:()=>iQ,Trigger:()=>iY,Workflow:()=>iU});var x={};n.r(x),n.d(x,{FormActiveFieldsProvider:()=>uN,filterByCleanedFields:()=>uR,findFilterTargets:()=>u$,getAfterWorkflows:()=>uz,getAssociationPath:()=>u9,getBeforeWorkflows:()=>uL,getFormValues:()=>uq,updateFilterTargets:()=>uU,useAssociationCreateActionProps:()=>uK,useAssociationFilterBlockProps:()=>u7,useAssociationFilterProps:()=>u5,useAssociationNames:()=>pe,useBulkDestroyActionProps:()=>u2,useCancelActionProps:()=>uV,useCollectValuesToSubmit:()=>u_,useCreateActionProps:()=>uG,useCustomizeRequestActionProps:()=>uX,useCustomizeUpdateActionProps:()=>uY,useDataBlockParentRecord:()=>nh,useDestroyActionProps:()=>uQ,useDetailPrintActionProps:()=>u1,useDetailsPaginationProps:()=>u3,useDisassociateActionProps:()=>u0,useFilterBlockActionProps:()=>uW,useFormActiveFields:()=>uM,useInsertSchema:()=>uE,useIsMobile:()=>uD,useOptionalFieldList:()=>u4,useParsedFilter:()=>lD,useRefreshActionProps:()=>u6,useRemoveActionProps:()=>uZ,useResetBlockActionProps:()=>uH,useUpdateActionProps:()=>uJ});var f={};n.r(f),n.d(f,{SchemaInitializerActionModal:()=>mN,SchemaInitializerActionModalInternal:()=>mM,SchemaInitializerChild:()=>mj,SchemaInitializerChildren:()=>mb,SchemaInitializerDivider:()=>mk,SchemaInitializerItem:()=>mf,SchemaInitializerItemGroup:()=>mI,SchemaInitializerItemGroupInternal:()=>mP,SchemaInitializerItemInternal:()=>mv,SchemaInitializerItems:()=>mT,SchemaInitializerMenu:()=>mm,SchemaInitializerSelect:()=>mD,SchemaInitializerSelectInternal:()=>mR,SchemaInitializerSubMenu:()=>mh,SchemaInitializerSubMenuInternal:()=>mx,SchemaInitializerSwitch:()=>mg,SchemaInitializerSwitchInternal:()=>my,useSchemaInitializerStyles:()=>p7,useSchemaInitializerSubMenuContext:()=>mp});var v={};n.r(v),n.d(v,{isDeleteButtonDisabled:()=>hN,useBulkDestroyAction:()=>hj,useBulkDestroyActionAndRefreshCM:()=>hM,useCancelAction:()=>hr,useChildrenCollections:()=>hu,useCollectionFieldsOptions:()=>hf,useCollectionFilterOptions:()=>hm,useCollectionFilterOptionsV2:()=>hh,useCreateAction:()=>hy,useCreateActionAndRefreshCM:()=>hk,useCreateActionWithoutRefresh:()=>hb,useDeleteButtonDisabled:()=>hT,useDestroyAction:()=>hF,useDestroyActionAndRefreshCM:()=>hP,useFilterAction:()=>hg,useFilterActionProps:()=>hD,useFilterDataSource:()=>hv,useKanbanEvents:()=>hs,useLinkageCollectionFilterOptions:()=>hx,useMoveAction:()=>hS,useResetFilterAction:()=>ha,useSelfAndChildrenCollections:()=>hp,useSortFields:()=>hd,useUpdateAction:()=>hw,useUpdateActionAndRefreshCM:()=>hI,useUpdateViewAction:()=>hC,useValuesFromRA:()=>hA,useValuesFromRecord:()=>hi});var g={};n.r(g),n.d(g,{ForeignKey:()=>h4,SourceCollection:()=>h6,SourceForeignKey:()=>h0,SourceKey:()=>h3,TargetForeignKey:()=>h2,TargetKey:()=>h5,ThroughCollection:()=>h8,ThroughForeignKey:()=>h1});var y={};n.r(y),n.d(y,{autoIncrement:()=>fg,collectionDataSource:()=>fA,constraintsProps:()=>fb,dataSource:()=>fw,dateTimeProps:()=>fS,defaultProps:()=>fF,operators:()=>m,primaryKey:()=>fv,recordPickerViewer:()=>fj,relationshipType:()=>fy,reverseFieldProperties:()=>fC,type:()=>fx,unique:()=>ff});var b={};n.r(b),n.d(b,{ActionBarAssociationFilterAction:()=>g0,ActionInitializer:()=>gZ,AssociationFilter:()=>gX,AssociationFilterDesignerDelete:()=>g1,AssociationFilterDesignerDisplayField:()=>g2,AssociationFilterPlugin:()=>gJ,BlockInitializer:()=>g6,BlockItemInitializer:()=>g3,CreateFilterActionInitializer:()=>g5,CreateResetActionInitializer:()=>g4,CustomizeActionInitializer:()=>g8,DataBlockInitializer:()=>vB,DeleteEventActionInitializer:()=>g7,FilterCustomItemInitializer:()=>yI,FilterFormItem:()=>yM,FilterFormItemCustom:()=>yP,FilterItemCustomDesigner:()=>yT,G2PlotInitializer:()=>g9,InitializerWithSwitch:()=>gQ,RecordAssociationBlockInitializer:()=>yt,RecordAssociationDetailsBlockInitializer:()=>yo,RecordAssociationFormBlockInitializer:()=>yi,RecordAssociationGridCardBlockInitializer:()=>ys,RecordAssociationListBlockInitializer:()=>yd,RecordReadPrettyAssociationFormBlockInitializer:()=>yp,SearchCollections:()=>vq,SelectActionInitializer:()=>yh,SubmitActionInitializer:()=>yx,TableActionColumnInitializer:()=>yf,useCollectionJoinFieldTitle:()=>yN,useCreateAssociationDetailsBlock:()=>yl,useCreateAssociationDetailsWithoutPagination:()=>ym,useCreateAssociationFormBlock:()=>ya,useCreateAssociationGridCardBlock:()=>yc,useCreateAssociationListBlock:()=>yu,useCreateAssociationTableBlock:()=>yn,useFieldComponents:()=>yk,useMenuSearch:()=>vO});var C={};n.r(C),n.d(C,{AssignedField:()=>b5,AssignedFieldValueType:()=>b3,CreateAction:()=>Cn,CreateRecordAction:()=>Cl,useAclCheck:()=>Ce});var S={};n.r(S),n.d(S,{DndContext:()=>SM,DragHandler:()=>SV,DraggableContext:()=>Sq,Sortable:()=>SB,SortableContext:()=>S_,SortableItem:()=>SE,SortableProvider:()=>SO});var w={};n.r(w),n.d(w,{Action:()=>dT,ActionArea:()=>cu,ActionAreaPlayer:()=>cd,ActionAreaProvider:()=>ca,ActionAreaStub:()=>cc,ActionBar:()=>d_,ActionBarProvider:()=>dD,ActionContext:()=>ce,ActionContextProvider:()=>ct,ActionDesigner:()=>dA,AfterSuccess:()=>dh,AntdSchemaComponentPlugin:()=>w7,AppendsTreeSelect:()=>Fr,AppendsTreeSelectV2:()=>Fu,AssignedFieldValues:()=>dd,AssociationCascader:()=>Fp,AssociationField:()=>jL,AssociationSelect:()=>j$,AutoComplete:()=>jU,Block:()=>AG,BlockItem:()=>pr,ButtonEditor:()=>dc,CardItem:()=>jY,Cascader:()=>jZ,Checkbox:()=>j4,CollectionSelect:()=>j7,ColorPicker:()=>Al,ColorSelect:()=>Ai,Cron:()=>Am,CronSet:()=>Ah,CustomCascader:()=>Aj,DataSourceCollectionCascader:()=>Ae,DataSourceSelect:()=>j9,DatePicker:()=>AD,DatePickerProvider:()=>AT,Details:()=>AR,DetailsDesigner:()=>S6,DynamicComponent:()=>dU,EditComponent:()=>pb,EditDefaultValue:()=>py,EditDescription:()=>px,EditOperator:()=>pw,EditPattern:()=>pC,EditRequired:()=>pv,EditSortField:()=>I7,EditTitle:()=>ph,EditTitleField:()=>pF,EditTooltip:()=>pf,EditValidationRules:()=>pg,Editable:()=>IP,EllipsisWithTooltip:()=>gi,EnabledToggle:()=>Pl,Expand:()=>AB,FileSelector:()=>gN,Filter:()=>dJ,FilterAction:()=>dK,FilterActionContext:()=>dL,FixedBlockDesignerItem:()=>bM,FixedBlockWrapper:()=>bI,Form:()=>SU,FormDialog:()=>AE,FormField:()=>wc,FormItem:()=>pu,FormTab:()=>AL,FormV2:()=>S1,Grid:()=>A3,GridCard:()=>ky,GridRowContext:()=>A$,HTMLEncode:()=>pi,IconFilterInput:()=>kb,IconFilterList:()=>kC,IconPicker:()=>kS,Input:()=>gd,InputNumber:()=>kF,InputReadPretty:()=>gs,InputRecordPicker:()=>gE,InternalCheckbox:()=>j3,InternalRadioGroup:()=>j5,IsDownLoad:()=>dS,Json:()=>go,List:()=>kO,Markdown:()=>k$,MarkdownReadPretty:()=>kU,MediaCard:()=>Tn,Menu:()=>Im,NanoIDInput:()=>Ix,Page:()=>wH,PageExtendComponentContext:()=>w5,PageExtendComponentProvider:()=>w4,PageHeader:()=>rl.z,Pagination:()=>Iv,Password:()=>IF,Percent:()=>IA,Preview:()=>gT,QuickEdit:()=>IT,Radio:()=>IN,ReadPretty:()=>gs,ReadPrettyRecordPicker:()=>gG,RecordPicker:()=>gK,RecordPickerContext:()=>g_,RecordPickerProvider:()=>gV,RemoteSelect:()=>wo,RemoveButton:()=>dx,RequestSettings:()=>du,RichText:()=>Iq,ScrollArea:()=>IO,SecondConFirm:()=>dC,Select:()=>wt,SetFilterScope:()=>dy,SettingDownTitle:()=>dF,ShowData:()=>dw,SingleValueCascader:()=>Fm,SkipValidation:()=>dp,Slider:()=>AC,Space:()=>IB,StablePopover:()=>dE,Table:()=>I8,TableBlockDesigner:()=>I9,TableColumnDesigner:()=>ue,TableField:()=>Pe,TableSelectorDesigner:()=>Pt,TableV2:()=>Pr,Tabs:()=>Pu,TabsContextProvider:()=>Pa,TextAreaWithGlobalScope:()=>P9,TimePicker:()=>Px,TrackingLink:()=>To,Tree:()=>Py,TreeSelect:()=>Pv,UnixTimestamp:()=>PC,Upload:()=>PS,UploadReadFile:()=>Pw,Variable:()=>P7,VariableScopeProvider:()=>P4,WorkflowConfig:()=>dv,WorkflowSelect:()=>df,actionSettings:()=>dj,actionSettingsItems:()=>db,collectFieldStateOfLinkageRules:()=>de,defaultFieldNames:()=>Sm,fetchTemplateData:()=>wr,filterFormItemSettings:()=>Su,findByUid:()=>Ir,findFilterOperators:()=>pm,findKeysByUid:()=>Ia,findMenuItem:()=>Ii,findSchema:()=>dm,formDetailsSettings:()=>ws,formItemSettings:()=>ut,formSettings:()=>wi,formV1Settings:()=>SW,genStyleHook:()=>cP,getCurrentOptions:()=>Sh,getCustomCondition:()=>d3,getDatePickerLabels:()=>gR,getLabelFormatValue:()=>gq,getTempFieldState:()=>c9,isFileCollection:()=>pp,isShowFilePicker:()=>gL,isSubMode:()=>nW,pageSettings:()=>w3,pageTabSettings:()=>w2,readPrettyFormSettings:()=>wa,removeNullCondition:()=>d5,useA:()=>cn,useActionAreaStub:()=>cs,useActionBarContext:()=>dR,useActionContext:()=>co,useCloseAction:()=>cl,useColorFields:()=>d9,useColumnSchema:()=>sb,useDatePickerContext:()=>AP,useEnsureOperatorsValid:()=>pS,useFieldMode:()=>ud,useFieldNames:()=>gM,useFieldServiceFilter:()=>jk,useFilterActionProps:()=>d4,useFilterFieldOptions:()=>d2,useFilterFieldProps:()=>d8,useFilterOptions:()=>d0,useFixedBlock:()=>bk,useFixedSchema:()=>bA,useGetAriaLabelOfAction:()=>dP,useGetAriaLabelOfDrawer:()=>cN,useGetAriaLabelOfModal:()=>cV,useGetAriaLabelOfPopover:()=>dO,useGetFilterFieldOptions:()=>d1,useGetFilterOptions:()=>dZ,useGridContext:()=>A2,useGridRowContext:()=>A6,useIsAddNewForm:()=>un,useIsAssociationField:()=>ui,useIsBlockInPage:()=>bN,useIsFieldReadPretty:()=>ul,useIsFileField:()=>uc,useIsFormReadPretty:()=>uo,useIsMuiltipleAble:()=>us,useIsMultipleSelect:()=>ua,useIsSelectFieldMode:()=>uu,useLabelFields:()=>d7,useLabelUiSchema:()=>gD,useLinkageAction:()=>cr,usePageExtendComponentContext:()=>w8,useSetFilterScopeVisible:()=>dg,useStyles:()=>bX,useTabsContext:()=>Ps,useTitleFieldOptions:()=>uh,useValidateSchema:()=>up,useVariableScope:()=>P8});var F={};n.r(F),n.d(F,{MenuConfigure:()=>NG,PermissionContext:()=>N$,PermissionProvider:()=>NU,RoleConfigure:()=>NH,RoleResourceCollectionContext:()=>N9,RoleTable:()=>N2,RolesResourcesActions:()=>Me,ScopeSelect:()=>N7,SettingCenterPermissionProvider:()=>NK,SettingCenterProvider:()=>M9,SettingsCenterConfigure:()=>De,StrategyActions:()=>Mn,useRolesResourcesScopesSelectedRowKeys:()=>N8});var j={};n.r(j),n.d(j,{ACLActionParamsContext:()=>Nw,ACLActionProvider:()=>NT,ACLCollectionFieldProvider:()=>NM,ACLCollectionProvider:()=>Nk,ACLContext:()=>Nv,ACLMenuItemProvider:()=>ND,ACLPane:()=>Dn,ACLPlugin:()=>Do,ACLProvider:()=>Ng,ACLRolesCheckProvider:()=>Nb,ADMIN_SETTINGS_KEY:()=>T9,ADMIN_SETTINGS_PATH:()=>Ne,APIClient:()=>ey,APIClientContext:()=>eb,APIClientProvider:()=>eP,Action:()=>dT,ActionArea:()=>cu,ActionAreaPlayer:()=>cd,ActionAreaProvider:()=>ca,ActionAreaStub:()=>cc,ActionBar:()=>d_,ActionBarAssociationFilterAction:()=>g0,ActionBarProvider:()=>dD,ActionContext:()=>ce,ActionContextProvider:()=>ct,ActionDesigner:()=>dA,ActionInitializer:()=>gZ,ActionType:()=>am,AddCollection:()=>xq,AddCollectionAction:()=>x_,AddCollectionField:()=>xt,AddFieldAction:()=>xn,AddSubFieldAction:()=>fs,AdminLayout:()=>MV,AdminProvider:()=>Mg,AdminSettingsLayout:()=>MU,AdminTabs:()=>Mb,AfterSuccess:()=>dh,AntdAppProvider:()=>yb,AntdSchemaComponentPlugin:()=>w7,AppComponent:()=>Tj,AppNotFound:()=>qj,AppendsTreeSelect:()=>Fr,AppendsTreeSelectV2:()=>Fu,Application:()=>Nf,ApplicationContext:()=>oa,AssignedFieldValues:()=>dd,AssociatedFields:()=>vN,AssociationCascader:()=>Fp,AssociationField:()=>jL,AssociationFilter:()=>gX,AssociationFilterDesignerDelete:()=>g1,AssociationFilterDesignerDisplayField:()=>g2,AssociationFilterPlugin:()=>gJ,AssociationOrCollectionProvider:()=>t5,AssociationProvider:()=>tT,AssociationSelect:()=>j$,AsyncDataContext:()=>xH,AsyncDataProvider:()=>xY,AttachmentPreviewManager:()=>Tw,AutoComplete:()=>jU,BaseVariableProvider:()=>oz,BlankComponent:()=>TA,Block:()=>AG,BlockAssociationContext:()=>nb,BlockInitializer:()=>g6,BlockItem:()=>pr,BlockItemInitializer:()=>g3,BlockProvider:()=>nT,BlockRequestContext:()=>t1,BlockRequestContext_deprecated:()=>nC,BlockRequestProvider:()=>t2,BlockRequestProvider_deprecated:()=>nF,BlockResourceContext:()=>ny,BlockSchemaToolbar:()=>DH,BlockTemplateDetails:()=>ri,BlockTemplatePage:()=>rb,BlockTemplatesPane:()=>rC,BuiltInPlugin:()=>qA,ButtonEditor:()=>dc,CMConfigurationComponents:()=>g,CSSVariableProvider:()=>Ty,CardItem:()=>jY,Cascader:()=>jZ,Checkbox:()=>j4,CheckboxFieldInterface:()=>fT,CheckboxGroupFieldInterface:()=>fN,ChinaRegionFieldInterface:()=>fM,Collection:()=>e1,CollectionCategory:()=>fm,CollectionCategroriesContext:()=>hK,CollectionCategroriesProvider:()=>hW,CollectionContext:()=>tb,CollectionDeletedPlaceholder:()=>tu,CollectionField:()=>Tv,CollectionFieldContext:()=>tF,CollectionFieldInterface:()=>tR,CollectionFieldInterfaceManager:()=>e5,CollectionFieldInterfaceTag:()=>fp,CollectionFieldInternalField:()=>Tf,CollectionFieldProvider:()=>tj,CollectionFieldsToFormInitializerItems:()=>mJ,CollectionHistoryProvider:()=>hq,CollectionManager:()=>tD,CollectionManagerContext:()=>tx,CollectionManagerProvider:()=>tv,CollectionManagerProvider_deprecated:()=>h$,CollectionManagerSchemaComponentProvider:()=>hG,CollectionPlugin:()=>vC,CollectionProvider:()=>tC,CollectionProvider_deprecated:()=>hH,CollectionRecord:()=>tO,CollectionRecordContext:()=>tB,CollectionRecordProvider:()=>tE,CollectionSelect:()=>j7,CollectionSelectFieldInterface:()=>fD,CollectionTemplate:()=>tq,CollectionTemplateManager:()=>e4,CollectionTemplateTag:()=>fh,ColorFieldInterface:()=>fR,ColorPicker:()=>Al,ColorSelect:()=>Ai,ConfigSettingConsumer:()=>tH,ConfigSettingProvider:()=>tW,ContextMenuContext:()=>wh,CreateFilterActionInitializer:()=>g5,CreateFormBlockInitializer:()=>y5,CreateResetActionInitializer:()=>g4,CreatedAtFieldInterface:()=>fq,CreatedByFieldInterface:()=>f_,Cron:()=>Am,CronSet:()=>Ah,CurrentAppInfoContext:()=>uf,CurrentAppInfoProvider:()=>ug,CurrentUser:()=>uP,CurrentUserContext:()=>uy,CurrentUserProvider:()=>uS,CurrentUserSettingsMenuProvider:()=>n4,CustomCascader:()=>Aj,CustomizeActionInitializer:()=>g8,DEBOUNCE_WAIT:()=>300,DEFAULT_DATA_SOURCE_KEY:()=>e9,DEFAULT_DATA_SOURCE_TITLE:()=>te,DataBlockCollector:()=>nE,DataBlockContext:()=>t3,DataBlockInitializer:()=>vB,DataBlockProvider:()=>t4,DataBlockResourceContext:()=>t9,DataBlockResourceProvider:()=>ne,DataSource:()=>e8,DataSourceApplicationProvider:()=>t_,DataSourceCollectionCascader:()=>Ae,DataSourceContext:()=>ti,DataSourceContext_deprecated:()=>hE,DataSourceManager:()=>tt,DataSourceManagerContext:()=>to,DataSourceManagerProvider:()=>tl,DataSourceProvider:()=>ta,DataSourceProvider_deprecated:()=>hL,DataSourceSelect:()=>j9,DateFormatCom:()=>sX,DatePicker:()=>AD,DatePickerProvider:()=>AT,DatetimeFieldInterface:()=>fO,DefaultValueProvider:()=>sV,DeleteCollection:()=>fe,DeleteCollectionAction:()=>fi,DeleteEventActionInitializer:()=>g7,Designable:()=>eW,DesignableSwitch:()=>i3,Details:()=>AR,DetailsBlockContext:()=>oC,DetailsBlockProvider:()=>ow,DetailsDesigner:()=>S6,DndContext:()=>SM,DocumentTitleContext:()=>wk,DocumentTitleProvider:()=>wI,DragHandler:()=>SV,DraggableContext:()=>Sq,DropdownVisibleContext:()=>uk,DynamicComponent:()=>dU,DynamicSchemaProps:()=>Ti,EditCollection:()=>xE,EditCollectionAction:()=>xV,EditCollectionField:()=>xi,EditComponent:()=>pb,EditCustomDefaultValue:()=>Cs,EditDefaultValue:()=>py,EditDescription:()=>px,EditFieldAction:()=>xa,EditFormulaTitleField:()=>y8,EditOperator:()=>pw,EditPattern:()=>pC,EditRequired:()=>pv,EditSortField:()=>I7,EditSubFieldAction:()=>fd,EditTitle:()=>ph,EditTitleField:()=>pF,EditTooltip:()=>pf,EditValidationRules:()=>pg,Editable:()=>IP,EllipsisWithTooltip:()=>gi,EmailFieldInterface:()=>fB,EnabledToggle:()=>Pl,Expand:()=>AB,ExpiresRadio:()=>sQ,ExtendCollectionFields:()=>vT,ExtendCollectionsContext:()=>tp,ExtendCollectionsProvider:()=>tm,FieldSummary:()=>fu,FileSelector:()=>gN,Filter:()=>dJ,FilterAction:()=>dK,FilterActionContext:()=>dL,FilterAssociatedFields:()=>vD,FilterBlockProvider:()=>nB,FilterBlockType:()=>pj,FilterCustomItemInitializer:()=>yI,FilterCustomVariableInput:()=>Cc,FilterFormBlockProvider:()=>oA,FilterFormItem:()=>yM,FilterFormItemCustom:()=>yP,FilterItemCustomDesigner:()=>yT,FilterItemCustomSettings:()=>y9,FilterParentCollectionFields:()=>vM,FixedBlockDesignerItem:()=>bM,FixedBlockWrapper:()=>bI,FlagContext:()=>lc,FlagProvider:()=>ld,ForeignKey:()=>h4,Form:()=>SU,FormActiveFieldsProvider:()=>uN,FormBlockContext:()=>Ta,FormBlockInitializer:()=>be,FormBlockProvider:()=>Tu,FormDataTemplates:()=>im,FormDialog:()=>AE,FormField:()=>wc,FormFieldContext:()=>ok,FormFieldProvider:()=>oT,FormItem:()=>pu,FormItemSchemaToolbar:()=>bn,FormLinkageRules:()=>aT,FormProvider:()=>ae,FormTab:()=>AL,FormV2:()=>S1,G2PlotInitializer:()=>g9,GeneralSchemaDesigner:()=>sP,GeneralSchemaItems:()=>dn,GlobalThemeProvider:()=>yw,Grid:()=>A3,GridCard:()=>ky,GridRowContext:()=>A$,HTMLEncode:()=>pi,I18nContext:()=>eT.I18nContext,I18nextProvider:()=>eT.I18nextProvider,Icon:()=>i6,IconFieldInterface:()=>fE,IconFilterInput:()=>kb,IconFilterList:()=>kC,IconPicker:()=>kS,IcuTrans:()=>eT.IcuTrans,IcuTransWithoutContext:()=>eT.IcuTransWithoutContext,IdFieldInterface:()=>fV,ImportCollectionMetaAction:()=>xC,InheritanceCollectionMixin:()=>vp,InitializerWithSwitch:()=>gQ,Input:()=>gd,InputFieldInterface:()=>f$,InputNumber:()=>kF,InputReadPretty:()=>gs,InputRecordPicker:()=>gE,IntegerFieldInterface:()=>fU,InternalCheckbox:()=>j3,InternalRadioGroup:()=>j5,IsDownLoad:()=>dS,Json:()=>go,JsonFieldInterface:()=>fW,LinkToFieldInterface:()=>fH,List:()=>kO,LocalDataSource:()=>e7,M2MFieldInterface:()=>fJ,M2OFieldInterface:()=>fQ,Markdown:()=>k$,MarkdownFieldInterface:()=>fZ,MarkdownReadPretty:()=>kU,MaybeCollectionProvider:()=>nw,MediaCard:()=>Tn,Menu:()=>Im,MenuConfigure:()=>NG,MenuEditor:()=>MF,MobileContext:()=>oD,MobileProvider:()=>oR,MultipleSelectFieldInterface:()=>f0,NanoIDInput:()=>Ix,NanoidFieldInterface:()=>vd,NavigateIfNotSignIn:()=>uw,NoticeArea:()=>ME,NoticeDuration:()=>TD,NoticeLevel:()=>TN,NoticeManager:()=>TB,NoticeManagerContext:()=>TR,NoticeManagerProvider:()=>Tq,NoticeType:()=>TM,NumberFieldInterface:()=>f1,O2MFieldInterface:()=>fY,O2OFieldInterface:()=>f2,OBOFieldInterface:()=>f3,OHOFieldInterface:()=>f6,OverridingCollectionField:()=>xc,OverridingFieldAction:()=>xd,PMPlugin:()=>M4,Page:()=>wH,PageExtendComponentContext:()=>w5,PageExtendComponentProvider:()=>w4,PageHeader:()=>rl.z,Pagination:()=>Iv,ParentCollectionFields:()=>vP,Password:()=>IF,PasswordFieldInterface:()=>f5,Percent:()=>IA,PercentFieldInterface:()=>f4,PermissionContext:()=>N$,PermissionProvider:()=>NU,PhoneFieldInterface:()=>f8,PinnedPluginList:()=>Mv,PinnedPluginListContext:()=>Mm,PinnedPluginListProvider:()=>Mx,Plugin:()=>eR,PluginContextMenu:()=>TE,PluginManager:()=>M5,PoweredBy:()=>qP,Preview:()=>gT,QuickEdit:()=>IT,REGEX_OF_VARIABLE:()=>oH,Radio:()=>IN,RadioGroupFieldInterface:()=>f7,ReadPretty:()=>gs,ReadPrettyRecordPicker:()=>gG,RecordAssociationBlockInitializer:()=>yt,RecordAssociationDetailsBlockInitializer:()=>yo,RecordAssociationFormBlockInitializer:()=>yi,RecordAssociationGridCardBlockInitializer:()=>ys,RecordAssociationListBlockInitializer:()=>yd,RecordContext_deprecated:()=>mZ,RecordFormBlockInitializer:()=>bl,RecordIndexContext:()=>m0,RecordIndexProvider:()=>m6,RecordLink:()=>n_,RecordPicker:()=>gK,RecordPickerContext:()=>g_,RecordPickerProvider:()=>gV,RecordProvider:()=>m1,RecordReadPrettyAssociationFormBlockInitializer:()=>yp,RecordSimpleProvider:()=>m2,RemoteCollectionManagerProvider:()=>hU,RemoteDocumentTitlePlugin:()=>wM,RemoteDocumentTitleProvider:()=>wP,RemoteSchemaComponent:()=>aa,RemoteSchemaTemplateManagerPlugin:()=>rv,RemoteSchemaTemplateManagerProvider:()=>rf,RemoteSelect:()=>wo,RemoveButton:()=>dx,RenderChildrenWithAssociationFilter:()=>nk,RequestSettings:()=>du,Resizable:()=>bg,ResourceActionContext:()=>m8,ResourceActionProvider:()=>ht,RichText:()=>Iq,RichTextFieldInterface:()=>f9,RoleConfigure:()=>NH,RoleResourceCollectionContext:()=>N9,RoleTable:()=>N2,RolesResourcesActions:()=>Me,RouteSchemaComponent:()=>Da,RouterContextCleaner:()=>TP,RouterManager:()=>T8,SNIPPET_PREFIX:()=>Nt,SchemaComponent:()=>al,SchemaComponentContext:()=>eV,SchemaComponentOptions:()=>i8,SchemaComponentPlugin:()=>i5,SchemaComponentProvider:()=>au,SchemaInitializer:()=>mL,SchemaInitializerActionModal:()=>mN,SchemaInitializerActionModalInternal:()=>mM,SchemaInitializerChild:()=>mj,SchemaInitializerChildren:()=>mb,SchemaInitializerContext:()=>p9,SchemaInitializerDivider:()=>mk,SchemaInitializerItem:()=>mf,SchemaInitializerItemContext:()=>mt,SchemaInitializerItemGroup:()=>mI,SchemaInitializerItemGroupInternal:()=>mP,SchemaInitializerItemInternal:()=>mv,SchemaInitializerItems:()=>mT,SchemaInitializerManager:()=>mG,SchemaInitializerMenu:()=>mm,SchemaInitializerOpenModeSchemaItems:()=>c2,SchemaInitializerPlugin:()=>Cr,SchemaInitializerSelect:()=>mD,SchemaInitializerSelectInternal:()=>mR,SchemaInitializerSubMenu:()=>mh,SchemaInitializerSubMenuInternal:()=>mx,SchemaInitializerSwitch:()=>mg,SchemaInitializerSwitchInternal:()=>my,SchemaSettingCollection:()=>vk,SchemaSettingComponent:()=>Ci,SchemaSettingItemContext:()=>a9,SchemaSettingOpenModeSchemaItems:()=>c6,SchemaSettings:()=>or,SchemaSettingsActionModalItem:()=>aJ,SchemaSettingsBlockTitleItem:()=>aZ,SchemaSettingsCascaderItem:()=>aH,SchemaSettingsChild:()=>sa,SchemaSettingsChildren:()=>sn,SchemaSettingsConnectDataBlocks:()=>aU,SchemaSettingsDataScope:()=>il,SchemaSettingsDataTemplates:()=>a6,SchemaSettingsDateFormat:()=>s6,SchemaSettingsDefaultSortingRules:()=>a0,SchemaSettingsDefaultValue:()=>sq,SchemaSettingsDivider:()=>aK,SchemaSettingsDropdown:()=>aO,SchemaSettingsEnableChildCollections:()=>a3,SchemaSettingsFormItemTemplate:()=>aV,SchemaSettingsItem:()=>az,SchemaSettingsItemGroup:()=>aL,SchemaSettingsLinkageRules:()=>a1,SchemaSettingsManager:()=>oi,SchemaSettingsModalItem:()=>aQ,SchemaSettingsPlugin:()=>SS,SchemaSettingsPopupItem:()=>aX,SchemaSettingsProvider:()=>a_,SchemaSettingsRemove:()=>a$,SchemaSettingsSelectItem:()=>aW,SchemaSettingsSortField:()=>a4,SchemaSettingsSortingRule:()=>s3,SchemaSettingsSubMenu:()=>aG,SchemaSettingsSwitchItem:()=>aY,SchemaSettingsTemplate:()=>aB,SchemaSettingsWrapper:()=>su,SchemaTemplateManagerContext:()=>ru,SchemaTemplateManagerProvider:()=>rp,SchemaToolbar:()=>sN,SchemaToolbarContext:()=>sC,SchemaToolbarProvider:()=>sS,ScopeSelect:()=>N7,ScrollArea:()=>IO,SearchCollections:()=>vq,SecondConFirm:()=>dC,SecondLevelSelect:()=>Sg,Select:()=>wt,SelectActionInitializer:()=>yh,SelectFieldInterface:()=>ve,SelectWithTitle:()=>ol,SetDataLoadingMode:()=>t0,SetFilterScope:()=>dy,SettingCenterPermissionProvider:()=>NK,SettingCenterProvider:()=>M9,SettingDownTitle:()=>dF,SettingsCenterConfigure:()=>De,SettingsCenterContext:()=>M$,SettingsCenterDropdown:()=>MH,SettingsMenu:()=>uA,ShowData:()=>dw,SingleValueCascader:()=>Fm,SkipValidation:()=>dp,Slider:()=>AC,SortFieldInterface:()=>vs,Sortable:()=>SB,SortableContext:()=>S_,SortableItem:()=>SE,SortableProvider:()=>SO,SourceCollection:()=>h6,SourceForeignKey:()=>h0,SourceKey:()=>h3,Space:()=>IB,StablePopover:()=>dE,StrategyActions:()=>Mn,SubFieldDataSourceProvider_deprecated:()=>hz,SubTableFieldInterface:()=>vt,SubmitActionInitializer:()=>yx,SyncFieldsAction:()=>x$,SyncFieldsActionCom:()=>xU,SyncSQLFieldsAction:()=>x4,SystemSettingsContext:()=>wv,SystemSettingsManager:()=>Nn,SystemSettingsPane:()=>wj,SystemSettingsPlugin:()=>wA,SystemSettingsProvider:()=>wy,TabPaneInitializers:()=>v2,TabPaneInitializersForBulkEditFormBlock:()=>v3,TabPaneInitializersForCreateFormBlock:()=>v6,Table:()=>I8,TableActionColumnInitializer:()=>yf,TableBlockContext:()=>lO,TableBlockDesigner:()=>I9,TableBlockInitializer:()=>bC,TableBlockProvider:()=>lV,TableColumnDesigner:()=>ue,TableColumnSchemaToolbar:()=>bw,TableField:()=>Pe,TableFieldContext:()=>lL,TableFieldProvider:()=>lU,TableFieldResource:()=>lK,TableSelectorContext:()=>lY,TableSelectorDesigner:()=>Pt,TableSelectorInitializer:()=>b_,TableSelectorParamsProvider:()=>lQ,TableSelectorProvider:()=>l1,TableV2:()=>Pr,TableoidFieldInterface:()=>vn,Tabs:()=>Pu,TabsContextProvider:()=>Pa,TargetForeignKey:()=>h2,TargetKey:()=>h5,TemplateSummary:()=>xf,TextAreaWithGlobalScope:()=>P9,TextareaFieldInterface:()=>vo,ThroughCollection:()=>h8,ThroughForeignKey:()=>h1,TimeFieldInterface:()=>vl,TimePicker:()=>Px,TrackingLink:()=>To,Trans:()=>eT.Trans,TransWithoutContext:()=>eT.TransWithoutContext,Translation:()=>eT.Translation,Tree:()=>Py,TreeBlockContext:()=>l3,TreeBlockProvider:()=>l4,TreeSelect:()=>Pv,UUIDFieldInterface:()=>vc,UnixTimestamp:()=>PC,UnixTimestampFieldInterface:()=>vu,UpdatedAtFieldInterface:()=>vr,UpdatedByFieldInterface:()=>vi,Upload:()=>PS,UploadReadFile:()=>Pw,UrlFieldInterface:()=>va,Variable:()=>P7,VariableInput:()=>rW,VariableScopeProvider:()=>P4,VariablesContext:()=>o2,VariablesProvider:()=>o4,VerificationCode:()=>n0,ViewCollectionField:()=>xu,ViewFieldAction:()=>xp,WithoutFormFieldResource:()=>oP,WithoutTableFieldResource:()=>l$,WorkflowConfig:()=>dv,WorkflowSelect:()=>df,__esModule:()=>eT.__esModule,actionSettings:()=>dj,actionSettingsItems:()=>db,autoIncrement:()=>fg,canMakeAssociationBlock:()=>vZ,collectFieldStateOfLinkageRules:()=>de,collectionDataSource:()=>fA,compatibleDataId:()=>ip,compose:()=>Ns,composeInitialProps:()=>eT.composeInitialProps,constraintsProps:()=>fb,createCreateFormBlockUISchema:()=>yr,createDesignable:()=>ez,createDetailsBlockSchema:()=>p6,createEditFormBlockUISchema:()=>bo,createFormActionInitializers:()=>bi,createFormBlockSchema:()=>p3,createFormBlockSettings:()=>bs,createGlobalStyle:()=>nu.DU,createReadPrettyFormBlockSchema:()=>p5,createRouterManager:()=>T7,createStyles:()=>nu.rU,createTableBlockSchema:()=>p4,createTableBlockUISchema:()=>ye,creationFormBlockSettings:()=>ba,css:()=>iS.css,customFormItemInitializers:()=>vI,cx:()=>iS.cx,dataSource:()=>fw,date:()=>eT.date,dateTimeProps:()=>fS,defaultAppComponents:()=>TI,defaultFieldNames:()=>Sm,defaultProps:()=>fF,defaultTheme:()=>yv,ds:()=>hV,editFormBlockSettings:()=>bc,fetchTemplateData:()=>wr,fieldComponentSettingsItem:()=>mQ,fieldSettingsFormItem:()=>bd,filterByCleanedFields:()=>uR,filterFormItemSettings:()=>Su,findByUid:()=>Ir,findFilterOperators:()=>pm,findFilterTargets:()=>u$,findFormBlock:()=>Tx,findKanbanFormItem:()=>mX,findKeysByUid:()=>Ia,findMenuItem:()=>Ii,findParentFieldSchema:()=>a5,findSchema:()=>dm,findSchemaUtils:()=>pJ,formActionInitializers:()=>bu,formDetailsSettings:()=>ws,formItemInitializers:()=>bp,formItemSettings:()=>ut,formSettings:()=>wi,formV1Settings:()=>SW,formatVariableScop:()=>rX,genStyleHook:()=>cP,getAfterWorkflows:()=>uz,getAssociationPath:()=>u9,getBeforeWorkflows:()=>uL,getConfigurableProperties:()=>fP,getCurrentOptions:()=>Sh,getCustomCondition:()=>d3,getDatePickerLabels:()=>gR,getDefaults:()=>eT.getDefaults,getFieldDefaultValue:()=>a7,getFormValues:()=>uq,getI18n:()=>eT.getI18n,getIdsWithChildren:()=>lB,getInitialProps:()=>eT.getInitialProps,getLabel:()=>ih,getLabelFormatValue:()=>gq,getShouldChange:()=>rH,getSupportFieldsByAssociation:()=>pk,getSupportFieldsByForeignKey:()=>pI,getTempFieldState:()=>c9,getUniqueKeyFromCollection:()=>fX,gridRowColWrap:()=>pO,hasIcon:()=>i1,i18n:()=>fG,icons:()=>iZ,initReactI18next:()=>eT.initReactI18next,injectGlobal:()=>iS.injectGlobal,interfacesOfUnsupportedDefaultValue:()=>sL,interfacesProperties:()=>y,isAssocField:()=>pM,isDeleteButtonDisabled:()=>hN,isFileCollection:()=>pp,isInFilterFormBlock:()=>pq,isPatternDisabled:()=>sB,isSameCollection:()=>pD,isShowFilePicker:()=>gL,isSubMode:()=>nW,isSystemField:()=>a8,isTitleField:()=>tK,isVariable:()=>oY,itemsMerge:()=>p_,joinCollectionName:()=>vw,keyframes:()=>iS.keyframes,locale:()=>on,mergeFilter:()=>pA,mockAPIClient:()=>qN,normalizeContainer:()=>Na,number:()=>eT.number,operators:()=>m,pageSettings:()=>w3,pageTabSettings:()=>w2,parseCollectionName:()=>vS,plural:()=>eT.plural,primaryKey:()=>fv,readPrettyFormSettings:()=>wa,recordBlockInitializers:()=>v0,recordPickerViewer:()=>fj,recursiveParent:()=>l0,regenerateUid:()=>rm,registerIcon:()=>i0,registerIcons:()=>i2,relationshipType:()=>fy,removeGridFormItem:()=>pE,removeNullCondition:()=>d5,reverseFieldProperties:()=>fC,select:()=>eT.select,selectOrdinal:()=>eT.selectOrdinal,setDataLoadingModeSettingsItem:()=>tQ,setDefaults:()=>eT.setDefaults,setI18n:()=>eT.setI18n,splitWrapSchema:()=>e$,subTableActionInitializers:()=>v1,systemKeys:()=>vF,tabPaneInitializers:()=>v4,tabPaneInitializersForBulkEditFormBlock:()=>v7,tabPaneInitializersForRecordBlock:()=>v8,tabPaneInitializers_deprecated:()=>v5,tableActionColumnInitializers:()=>by,tableActionInitializers:()=>bb,tableBlockSettings:()=>bD,tableColumnInitializers:()=>bq,tableColumnSettings:()=>bR,tableSelectorBlockSettings:()=>CG,time:()=>eT.time,transformToFilter:()=>pT,transformVariableValue:()=>lM,tval:()=>fL,type:()=>fx,unique:()=>ff,updateFilterTargets:()=>uU,updateFormActionInitializers:()=>bm,useA:()=>cn,useACLActionParamsContext:()=>NI,useACLContext:()=>NS,useACLFieldWhitelist:()=>NN,useACLRoleContext:()=>NA,useACLRolesCheck:()=>NF,useAPIClient:()=>eC,useActionAreaStub:()=>cs,useActionBarContext:()=>dR,useActionContext:()=>co,useAdminSchemaUid:()=>NR,useApp:()=>os,useAriaAttributeOfMenuItem:()=>mO,useAssociatedFields:()=>pN,useAssociatedFormItemInitializerFields:()=>pW,useAssociatedTableColumnInitializerFields:()=>pK,useAssociationCreateActionProps:()=>uK,useAssociationFilterBlockProps:()=>u7,useAssociationFilterProps:()=>u5,useAssociationName:()=>tN,useAssociationNames:()=>pe,useAsyncData:()=>xX,useAttach:()=>e_,useBaseVariable:()=>oL,useBlockAssociationContext:()=>nN,useBlockContext:()=>nP,useBlockRequestContext:()=>nj,useBlockResource:()=>nS,useBuiltinVariables:()=>o$,useBulkDestroyAction:()=>fr,useBulkDestroyActionAndRefreshCM:()=>fn,useBulkDestroyActionProps:()=>u2,useCancelAction:()=>hr,useCancelActionProps:()=>uV,useCloseAction:()=>cl,useCollectValuesToSubmit:()=>u_,useCollection:()=>tS,useCollectionDataSource:()=>hX,useCollectionDataSourceItems:()=>p2,useCollectionField:()=>tA,useCollectionFieldFormValues:()=>h9,useCollectionField_deprecated:()=>hY,useCollectionFields:()=>tw,useCollectionFieldsOptions:()=>hf,useCollectionFilterOptions:()=>hm,useCollectionFilterOptionsV2:()=>hh,useCollectionHistory:()=>hO,useCollectionJoinFieldTitle:()=>yN,useCollectionManager:()=>tg,useCollectionManager_deprecated:()=>sO,useCollectionParentRecord:()=>tL,useCollectionParentRecordData:()=>tG,useCollectionRecord:()=>tV,useCollectionRecordData:()=>tz,useCollectionState:()=>vj,useCollection_deprecated:()=>tJ,useCollections:()=>ty,useColorFields:()=>d9,useColumnSchema:()=>sb,useCompatOldVariables:()=>rY,useCompile:()=>eB,useComponent:()=>eE,useContextConfigSetting:()=>tY,useContextMenu:()=>wx,useContextVariable:()=>o9,useCreateActionProps:()=>uG,useCreateAssociationDetailsBlock:()=>yl,useCreateAssociationDetailsWithoutPagination:()=>ym,useCreateAssociationFormBlock:()=>ya,useCreateAssociationGridCardBlock:()=>yc,useCreateAssociationListBlock:()=>yu,useCreateAssociationTableBlock:()=>yn,useCreateEditFormBlock:()=>br,useCreateFormBlock:()=>bt,useCreateTableBlock:()=>bS,useCurrentAppInfo:()=>uv,useCurrentDocumentTitle:()=>wN,useCurrentRoles:()=>uC,useCurrentSchema:()=>p0,useCurrentUserContext:()=>ub,useCurrentUserSettingsMenu:()=>n5,useCurrentUserVariable:()=>rF,useCustomizeRequestActionProps:()=>uX,useCustomizeUpdateActionProps:()=>uY,useDataBlock:()=>t8,useDataBlockParentRecord:()=>nh,useDataBlockProps:()=>t7,useDataBlockRequest:()=>t6,useDataBlockResource:()=>nt,useDataLoadingMode:()=>tZ,useDataSource:()=>ts,useDataSourceFromRAC:()=>ho,useDataSourceHeaders:()=>t$,useDataSourceKey:()=>tc,useDataSourceManager:()=>tr,useDataTemplates:()=>a2,useDatePickerContext:()=>AP,useDatetimeVariable:()=>la,useDesignable:()=>eY,useDesigner:()=>SF,useDestroyAction:()=>fo,useDestroyActionAndRefreshCM:()=>ft,useDestroyActionProps:()=>uQ,useDetailPrintActionProps:()=>u1,useDetailsBlockContext:()=>oF,useDetailsBlockProps:()=>oj,useDetailsPaginationProps:()=>u3,useDialect:()=>hJ,useDisassociateActionProps:()=>u0,useDocumentTitle:()=>wT,useEnsureOperatorsValid:()=>pS,useExactDateVariable:()=>rB,useExactDateVariableContext:()=>rO,useExtendCollections:()=>th,useFieldComponentName:()=>ux,useFieldComponentOptions:()=>Sk,useFieldComponents:()=>yk,useFieldInterfaceOptions:()=>h7,useFieldMode:()=>ud,useFieldModeOptions:()=>SN,useFieldNames:()=>gM,useFieldProps:()=>Sj,useFieldServiceFilter:()=>jk,useFieldTitle:()=>SI,useFilterAPI:()=>pR,useFilterActionProps:()=>d4,useFilterBlock:()=>nV,useFilterBlockActionProps:()=>uW,useFilterByTk:()=>nM,useFilterFieldOptions:()=>d2,useFilterFieldProps:()=>d8,useFilterOptions:()=>d0,useFindComponent:()=>eH,useFixedBlock:()=>bk,useFixedSchema:()=>bA,useFlag:()=>lu,useFormActiveFields:()=>uM,useFormBlockContext:()=>Tp,useFormBlockProps:()=>Tm,useFormBlockType:()=>Tc,useFormFieldContext:()=>oN,useFormFieldProps:()=>oM,useFormItemInitializerFields:()=>pU,useFormulaTitleOptions:()=>y4,useFormulaTitleVisible:()=>y7,useGetAriaLabelOfAction:()=>dP,useGetAriaLabelOfDesigner:()=>sc,useGetAriaLabelOfDrawer:()=>cN,useGetAriaLabelOfModal:()=>cV,useGetAriaLabelOfPopover:()=>dO,useGetFilterFieldOptions:()=>d1,useGetFilterOptions:()=>dZ,useGetSchemaInitializerMenuItems:()=>mE,useGlobalTheme:()=>yS,useGlobalVariable:()=>ou,useGridContext:()=>A2,useGridRowContext:()=>A6,useHistoryCollectionsByNames:()=>h_,useHotkeys:()=>iz.vC,useInheritsTableColumnInitializerFields:()=>p$,useInsertSchema:()=>uE,useIsAddNewForm:()=>un,useIsAllowToSetDefaultValue:()=>sz,useIsAssociationField:()=>ui,useIsBlockInPage:()=>bN,useIsDetailBlock:()=>Td,useIsFieldReadPretty:()=>ul,useIsFileField:()=>uc,useIsFormReadPretty:()=>uo,useIsMobile:()=>uD,useIsMuiltipleAble:()=>us,useIsMultipleSelect:()=>ua,useIsSelectFieldMode:()=>uu,useIsShowMultipleSwitch:()=>sK,useLabelFields:()=>d7,useLabelUiSchema:()=>gD,useLinkageAction:()=>cr,useLinkageCollectionFieldOptions:()=>ak,useLinkageCollectionFilterOptions:()=>hx,useLocalVariables:()=>lT,useMenuSearch:()=>vO,useNoticeManager:()=>T_,useNoticeSub:()=>TO,useOptimizedMemo:()=>Nq,useOptionalFieldList:()=>u4,usePageExtendComponentContext:()=>w8,useParamsFromRecord:()=>nq,useParentCollection:()=>tP,useParentRecordCommon:()=>lR,useParseDataScopeFilter:()=>Cu,useParsedFilter:()=>lD,usePlugin:()=>oc,useProps:()=>iq,useRecord:()=>m3,useRecordCollectionDataSourceItems:()=>p1,useRecordIndex:()=>m5,useRecordIsOwn:()=>m4,useRecordPkValue:()=>NP,useRefreshActionProps:()=>u6,useRemoveActionProps:()=>uZ,useRemoveGridFormItem:()=>pV,useRequest:()=>ek,useResetBlockActionProps:()=>uH,useResource:()=>eI,useResourceActionContext:()=>hn,useResourceContext:()=>hl,useRoleRecheck:()=>NC,useRolesResourcesScopesSelectedRowKeys:()=>N8,useRouter:()=>od,useSSR:()=>eT.useSSR,useSchemaComponentContext:()=>SA,useSchemaInitializer:()=>me,useSchemaInitializerItem:()=>mn,useSchemaInitializerMenuItems:()=>mB,useSchemaInitializerRender:()=>mz,useSchemaInitializerStyles:()=>p7,useSchemaInitializerSubMenuContext:()=>mp,useSchemaOptionsContext:()=>i4,useSchemaSettings:()=>aR,useSchemaSettingsItem:()=>se,useSchemaSettingsRender:()=>sx,useSchemaTemplate:()=>rh,useSchemaTemplateManager:()=>rg,useSchemaToolbar:()=>sw,useSchemaToolbarRender:()=>sM,useSetFilterScopeVisible:()=>dg,useSortFields:()=>hd,useSourceIdFromParentRecord:()=>nR,useSourceIdFromRecord:()=>nD,useStyles:()=>bX,useSupportedBlocks:()=>pP,useSyncFromForm:()=>id,useSystemSettings:()=>wg,useTableBlockContext:()=>lz,useTableBlockDecoratorProps:()=>lq,useTableBlockParams:()=>l_,useTableColumnInitializerFields:()=>pG,useTableFieldContext:()=>lW,useTableFieldProps:()=>lH,useTableSelectorContext:()=>l2,useTableSelectorProps:()=>l6,useTableSize:()=>ST,useTabsContext:()=>Ps,useTitleFieldOptions:()=>uh,useToken:()=>iF,useTranslation:()=>eT.useTranslation,useTreeBlockContext:()=>l8,useTreeBlockProps:()=>l7,useUpdateActionProps:()=>uJ,useUpdateCollectionActionAndRefreshCM:()=>xB,useUserVariable:()=>rw,useValidateSchema:()=>up,useValuesFromRecord:()=>xO,useVariableScope:()=>P8,useVariables:()=>lN,useViewport:()=>N_,withDynamicSchemaProps:()=>Tr,withInitializer:()=>mi,withSSR:()=>eT.withSSR,withTranslation:()=>eT.withTranslation});var A=n(65723);n(32087);var k=n(58997);n(80636);var I=n(59300),P=n.n(I),T=n(73198),N=n.n(T),M=n(56773),D=n.n(M),R=n(29506),q=n.n(R),_=n(61483),O=n.n(_),B=n(91618),E=n.n(B),V=n(62780),z=n.n(V),L=n(1375),G=n.n(L),K=n(2497),$=n.n(K),U=n(78167),W=n.n(U),H=n(68446),Y=n.n(H),X=n(84860),J=n.n(X),Q=n(16396),Z=n.n(Q),ee=n(29445),et=n.n(ee),en=n(66885),eo=n.n(en),el=n(52847),er=n.n(el),ei=n(76882),ea=n.n(ei);P().extend(eo()),P().extend($()),P().extend(J()),P().extend(et()),P().extend(W()),P().extend(E()),P().extend(O()),P().extend(z()),P().extend(G()),P().extend(er()),P().extend(ea()),P().extend(q()),P().extend(N()),P().extend(D()),P().extend(Y()),P().extend(Z());var es=n(22155),ec=n(4965),ed=n(67918),eu=n.n(ed),ep=n(62837),em=n(56526),eh=n(20849),ex=n(57437);let ef=[/\bat\s+\S+\s+\(.+\)/i,/(TypeError|ReferenceError|SyntaxError|RangeError)\b/i,/(ENOENT|ECONNREFUSED|ECONNRESET|EPIPE|EAI_AGAIN)\b/i,/(node_modules|webpack|react(-dom)?\.development\.js)/i,/[/\\]\w+\.(js|ts|tsx|jsx):\d+:\d+/i,/https?:\/\/\S+/i];function ev(e,t,n){if(!(null==t?void 0:t.length))return;let o=t.map(e=>{let t="string"==typeof e?e:e.message,n=fG.t(t);return ef.some(e=>e.test(t))?(console.error("[TechError]",t),fG.t("The current operation was not successful. You can wait a moment or contact technical support.")):n});n[e]({message:o.map((e,t)=>es.createElement("div",{key:"".concat(t,"_").concat(e)},e))})}let eg=new Map;class ey extends eh.APIClient{cloneInstance(){let e=new ey(this.options);e.options=this.options,e.services=this.services,e.storage=this.storage,e.app=this.app,e.auth=this.auth,e.notification=this.notification;let t=[];for(let n of this.axios.interceptors.response.handlers)"handleNotificationError"===n.rejected._name?t.push({...n,rejected:e.handleNotificationError.bind(e)}):t.push(n);return e.axios.interceptors.response.handlers=t,e}getHeaders(){var e,t,n,o;let l,r,i=super.getHeaders(),a=null==(e=this.app)?void 0:e.getName();return a&&(i["X-App"]=a),i["X-Timezone"]=(l=Math.floor(Math.abs(o=-(new Date().getTimezoneOffset()/60))),r=Math.abs(o%1*60),(o>=0?"+":"-")+(l<10?"0":"")+l+":"+(r<10?"0":"")+r),i["X-Hostname"]=null==(n=window)||null==(t=n.location)?void 0:t.hostname,i}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(n=>{e.headers[n]=e.headers[n]||t[n]}),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,n,o,l,r,i,a;if("string"==typeof(null==e||null==(t=e.response)?void 0:t.data)){let t=document.createElement("div");return t.innerHTML=null==e||null==(a=e.response)?void 0:a.data,[{message:t.textContent||t.innerText}]}return(null==e||null==(o=e.response)||null==(n=o.data)?void 0:n.errors)||(null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.messages)||(null==e||null==(i=e.response)?void 0:i.error)||[{message:e.message||"Server error"}]}async handleNotificationError(e){var t,n,o,l,r,i,a,s,c,d,u,p;if(this.silence)throw e;let m=null==(t=e.config)?void 0:t.skipNotify;if(m&&("function"==typeof m&&m(e)||!0===m))throw e;let h=null==e||null==(o=e.response)||null==(n=o.data)?void 0:n.redirectTo;if(h)return window.location.href=h;if((null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.type)==="application/json"){let t;u=this.notification,(t=new FileReader).readAsText(null==e||null==(p=e.response)?void 0:p.data,"utf-8"),t.onload=function(){ev("error",JSON.parse(t.result).errors,u)}}else{eg.size>10&&eg.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==(d=e.response)||null==(c=d.data)?void 0:c.error,e;this.app.error&&(this.app.error=null);let n=this.toErrMessages(e);if(0===(n=n.filter(e=>{let t=eg.get(e.message);return!(t&&new Date().getTime()-t<500)&&(eg.set(e.message,new Date().getTime()),!0)})).length)throw e;ev("error",n,this.notification)}throw e}useNotificationMiddleware(){let e=this.handleNotificationError.bind(this);e._name="handleNotificationError",this.axios.interceptors.response.use(e=>{var t,n;return(null==(n=e.data)||null==(t=n.messages)?void 0:t.length)&&ev("success",e.data.messages.filter(e=>{let t=eg.get("string"==typeof e?e:e.message);return!(t&&new Date().getTime()-t<500)&&(eg.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),(0,em._)(this,"services",{}),(0,em._)(this,"silence",!1),(0,em._)(this,"app",void 0),(0,em._)(this,"notification",ex.Ay)}}let eb=(0,es.createContext)(new ey);function eC(){return(0,es.useContext)(eb)}eb.displayName="APIClientContext";var eS=n(54425),ew=n(1767),eF=n(74579),ej=n.n(eF);let eA=new Map;function ek(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[o,l]=(0,eS.A)({}),r=eC();t="function"==typeof e?e:e?async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{resource:n,url:o}=e,l=(0,ed.cloneDeep)(e);n||o?(l.params=l.params||{},function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(e=>t.propertyIsEnumerable(e)):[]).forEach(o=>{let l=n[o],r=eA.get("deepMerge");"function"==typeof l?r=l:"string"==typeof l&&eA.has(l)&&(r=eA.get(l)),e[o]=r(e[o],t[o])})}(l.params,t)):l=(0,ec.merge)(l,t);let i=await r.request(l);return null==i?void 0:i.data}:async()=>{};let i={...n,onSuccess(){for(var e,t=arguments.length,o=Array(t),l=0;l<t;l++)o[l]=arguments[l];null==(e=n.onSuccess)||e.call(n,...o),n.uid&&(r.services[n.uid]=a)}},a=(0,ew.A)(t,i);return{...a,state:o,setState:l}}function eI(e,t){return eC().resource(e,t)}eA.set("overwrite",(e,t)=>t),eA.set("andMerge",(e,t)=>{if(e||t)return e?t?{$and:[e,t]}:e:t}),eA.set("orMerge",(e,t)=>{if(e||t)return e?t?{$or:[e,t]}:e:t}),eA.set("deepMerge",(e,t)=>(0,eh.isPlainObject)(e)&&(0,eh.isPlainObject)(t)?ej()(e,t,{arrayMerge:(e,t)=>t}):t),eA.set("merge",(e,t)=>(0,eh.isPlainObject)(e)&&(0,eh.isPlainObject)(t)?Object.assign(e,t):t),eA.set("union",(e,t)=>("string"==typeof e&&(e=e.split(",")),"string"==typeof t&&(t=t.split(",")),(0,ed.uniq)((e||[]).concat(t||[])))),eA.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||[]);let eP=e=>{let{apiClient:t,children:n}=e;return(0,A.jsx)(eb.Provider,{value:t,children:n})};var eT=n(42923),eN=n(1235),eM=n(77800),eD=n(19689);class eR{get pluginManager(){return this.app.pluginManager}get pm(){return this.app.pm}get router(){return this.app.router}get systemSettingsManager(){return this.app.systemSettingsManager}get userSettingsManager(){return this.app.userSettingsManager}get schemaInitializerManager(){return this.app.schemaInitializerManager}get schemaSettingsManager(){return this.app.schemaSettingsManager}get dataSourceManager(){return this.app.dataSourceManager}get AttachmentPreviewManager(){return this.app.AttachmentPreviewManager}async afterAdd(){}async beforeLoad(){}async load(){}async afterLoad(){}t(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.app.i18n.t(e,{ns:null==(t=this.options)?void 0:t.packageName,...n})}constructor(e,t){(0,em._)(this,"options",void 0),(0,em._)(this,"app",void 0),this.options=e,this.app=t,this.options=e,this.app=t}}var eq=n(29070);let e_=e=>{let t=(0,es.useRef)(null);return(0,es.useEffect)(()=>(t.current&&e!==t.current&&t.current.onUnmount(),t.current=e,e.onMount(),()=>{e.onUnmount()}),[e]),e},eO={},eB=function(){let{noCache:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{noCache:!1},t=(0,es.useContext)(ec.SchemaOptionsContext),n=(0,es.useContext)(ec.SchemaExpressionScopeContext);return(o,l)=>{let r,i=!1;if("string"==typeof o&&o.startsWith("{{")&&(i=!0,r=o),o&&"object"==typeof o&&!(0,es.isValidElement)(o)&&(i=!0,r=JSON.stringify(o)),Array.isArray(o)&&(i=!0),i){let i={...t.scope,...n,...l};if(!r)return ec.Schema.compile(o,i);try{if(e)return ec.Schema.compile(o,i);return eO[r]=eO[r]||ec.Schema.compile(o,i),eO[r]}catch(e){return ec.Schema.compile(o,i)}}return o}},eE=(e,t)=>{let{components:n}=(0,es.useContext)(ec.SchemaOptionsContext);return e?"string"!=typeof e?e:(0,ed.get)(n,e)||t:t},eV=(0,es.createContext)({});function ez(e){return new eW(e)}eV.displayName="SchemaComponentContext.Provider";let eL=e=>{e["x-uid"]||(e["x-uid"]=(0,ec.uid)()),Object.keys(e.properties||{}).forEach(t=>{eL(e.properties[t])})},eG=e=>e,eK=(e,t)=>{if(e&&t){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]!==(null==e?void 0:e[n]))return!1;return!0}},e$=(e,t)=>{if(e["x-uid"]&&e["x-uid"]===t["x-uid"])return[null,e.toJSON()];let n=e.toJSON(),o={...n,properties:{}},l=null,r=(e,n)=>{Object.keys(e||{}).forEach(o=>{let i=e[o];if(i["x-uid"]===t["x-uid"]){l=e[o];return}n.properties[o]={...i,properties:{}},r(null==i?void 0:i.properties,n.properties[o])})};return r(n.properties,o),[o,l]},eU=e=>e;class eW{get model(){return this.options.model}get query(){return this.options.query}loadAPIClientEvents(){let{api:e,t=eU}=this.options;if(!e)return;let n=e=>{if(!e)return[];let t=Object.values(e.properties).length,n=[];return(e.mapProperties(e=>{e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].width=100/t,e["x-uid"]&&n.push({"x-uid":e["x-uid"],"x-component-props":e["x-component-props"]})}),e["x-uid"]&&n.length)?n:[]};this.on("insertAdjacent",async t=>{var o;let{onSuccess:l,current:r,position:i,schema:a,wrap:s,wrapped:c,removed:d}=t,u=[];if((null==c?void 0:c["x-component"])==="Grid.Col"&&(u=u.concat(n(c.parent))),(null==d?void 0:d["x-component"])==="Grid.Col"&&(u=u.concat(n(d.parent))),this.refresh(),!r["x-uid"])return;let p=await e.request({url:"/uiSchemas:insertAdjacent/".concat(r["x-uid"],"?position=").concat(i),method:"post",data:{schema:a,wrap:s}});u.length&&await e.request({url:"/uiSchemas:batchPatch",method:"post",data:u}),(null==d?void 0:d["x-uid"])&&await e.request({url:"/uiSchemas:remove/".concat(d["x-uid"]),method:"post"}),null==l||l(null==p||null==(o=p.data)?void 0:o.data)}),this.on("patch",async t=>{let{schema:n}=t;this.refresh(),(null==n?void 0:n["x-uid"])&&await e.request({url:"/uiSchemas:patch",method:"post",data:{...n}})}),this.on("batchPatch",async t=>{let{schemas:n}=t;this.refresh(),await e.request({url:"/uiSchemas:batchPatch",method:"post",data:n})}),this.on("remove",async t=>{let{removed:o}=t,l=[];(null==o?void 0:o["x-component"])==="Grid.Col"&&(l=n(o.parent)),this.refresh(),(null==o?void 0:o["x-uid"])&&(await e.request({url:"/uiSchemas:remove/".concat(o["x-uid"]),method:"post"}),l.length&&await e.request({url:"/uiSchemas:batchPatch",method:"post",data:l}))})}prepareProperty(e){e.type||(e.type="void"),e.name||(e.name=(0,ec.uid)()),this.current["x-uid"]&&eL(e)}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}async emit(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];if(!this.events[e])return;let[l,...r]=n;return Promise.all(this.events[e].map(e=>e.bind(this)({current:this.current,...l},...r)))}parentsIn(e){if(!e||!ec.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(){let{refresh:e}=this.options;return null==e?void 0: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"},n={"x-decorator-props":"decoratorProps","x-component-props":"componentProps","x-data":"data"};Object.keys(e).forEach(o=>{t[o]?(this.current[o]=e[o],this.updateModel(t[o],e[o])):n[o]?Object.keys(e[o]).forEach(t=>{(0,ed.set)(this.current,[o,t],e[o][t]),this.updateModel([n[o],t],e[o][t])}):this.current[o]=e[o]}),this.emit("patch",{schema:e})}getSchemaAttribute(e,t){return(0,ed.get)(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(n=>{this.current[n]=e[n],t[n]&&this.updateModel(t[n],e[n])}),this.emit("patch",{schema:e})}updateModel(e,t){let n=n=>{(0,ed.set)(n,e,t)};this.model&&n(this.model),this.query&&this.query.take(n)}async insertAdjacent(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(e){case"beforeBegin":return await this.insertBeforeBegin(t,n);case"afterBegin":return await this.insertAfterBegin(t,n);case"beforeEnd":return await this.insertBeforeEnd(t,n);case"afterEnd":return await this.insertAfterEnd(t,n)}}recursiveRemoveIfNoChildren(e,t){let n;if(!e)return;let o=e,l=null==t?void 0:t.breakRemoveOn;for(;o;){if("function"==typeof l){if(l(o))break}else if(eK(o,l))break;if(Object.keys(o.properties||{}).length>0)break;o.parent&&(n=o.parent.removeProperty(o.name)),o=o.parent}return n}async remove(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{breakRemoveOn:n,removeParentsIfNoChildren:o}=t,l=e||this.current,r=l.parent.removeProperty(l.name);if(o){let e=this.recursiveRemoveIfNoChildren(l.parent,{breakRemoveOn:n});e&&(r=e)}return await this.emit("remove",{removed:r})}removeWithoutEmit(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{breakRemoveOn:n,removeParentsIfNoChildren:o}=t,l=e||this.current,r=l.parent.removeProperty(l.name);if(o){let e=this.recursiveRemoveIfNoChildren(l.parent,{breakRemoveOn:n});e&&(r=e)}return r}async insertBeforeBeginOrAfterEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ec.Schema.isSchemaInstance(this.current)||!ec.Schema.isSchemaInstance(e)||this.current.parent!==e.parent)return;let n=0,o=0;return this.current.parent.mapProperties((t,l,r)=>{this.current.name===l&&(o=r),e.name===l&&(n=r)}),n>o?await this.insertBeforeBegin(e,t):await this.insertAfterEnd(e,t)}async insertBeforeBegin(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ec.Schema.isSchemaInstance(this.current))return;let n={onSuccess:t.onSuccess},{wrap:o=eG,breakRemoveOn:l,removeParentsIfNoChildren:r}=t;if(ec.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&&(n.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:l}))}else e&&(e=(0,ed.cloneDeep)(e));let i={},a=!1,s=0,c=0;this.current.parent.mapProperties((e,t)=>{t===this.current.name&&(c=s,a=!0,++s),e["x-index"]=s,++s,a&&(i[t]=e,this.current.parent.removeProperty(t))}),this.prepareProperty(e);let d=o(e),u=this.current.parent.addProperty(d.name||(0,ec.uid)(),d);u["x-index"]=c,u.parent=this.current.parent,this.current.parent.setProperties(i);let[p,m]=e$(u,e);await this.emit("insertAdjacent",{position:"beforeBegin",schema:m,wrapped:d,wrap:p,...n})}async insertAfterBegin(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ec.Schema.isSchemaInstance(this.current))return;let n={onSuccess:t.onSuccess},{wrap:o=eG,breakRemoveOn:l,removeParentsIfNoChildren:r}=t;if(ec.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&&(n.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:l}))}else e&&(e=(0,ed.cloneDeep)(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=o(e),c=this.current.addProperty(s.name||(0,ec.uid)(),s);c["x-index"]=0,c.parent=this.current,this.current.setProperties(i);let[d,u]=e$(c,e);await this.emit("insertAdjacent",{position:"afterBegin",schema:u,wrap:d,wrapped:s,...n})}async insertBeforeEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ec.Schema.isSchemaInstance(this.current))return;delete e["x-index"];let n={onSuccess:t.onSuccess},{wrap:o=eG,breakRemoveOn:l,removeParentsIfNoChildren:r}=t;if(ec.Schema.isSchemaInstance(e)){if(this.parentsIn(e))return void await this.emit("error",{code:"parent_is_not_allowed",schema:e});e.parent.removeProperty(e.name),r&&(n.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:l}))}else e&&(e=(0,ed.cloneDeep)(e));this.prepareProperty(e);let i=o(e),a=this.current.addProperty(i.name||(0,ec.uid)(),i);a.parent=this.current;let[s,c]=e$(a,e);return await this.emit("insertAdjacent",{position:"beforeEnd",schema:c,wrap:s,wrapped:i,...n})}async insertAfterEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ec.Schema.isSchemaInstance(this.current))return;let n={onSuccess:null==t?void 0:t.onSuccess},{wrap:o=eG,breakRemoveOn:l,removeParentsIfNoChildren:r}=t,i=0,a=0,s=!1,c={};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&&(c[t]=e,this.current.parent.removeProperty(t))}),ec.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&&(n.removed=this.recursiveRemoveIfNoChildren(e.parent,{breakRemoveOn:l})),e.parent=null}else e&&(e=(0,ed.cloneDeep)(e));this.prepareProperty(e);let d=o(e),u=this.current.parent.addProperty(d.name||(0,ec.uid)(),d);u.parent=this.current.parent,u["x-index"]=a,this.current.parent.setProperties(c);let[p,m]=e$(u,e);await this.emit("insertAdjacent",{position:"afterEnd",schema:m,wrap:p,wrapped:d,...n})}constructor(e){(0,em._)(this,"current",void 0),(0,em._)(this,"options",void 0),(0,em._)(this,"events",{}),this.options=e,this.current=e.current}}function eH(){let e=(0,es.useContext)(ec.SchemaOptionsContext),t=(0,es.useMemo)(()=>(null==e?void 0:e.components)||{},[e]);return e=>{if(!e)return null;if("string"!=typeof e)return e;let n=(0,ed.get)(t,e);return n||console.error('[tachybase]: Component "'.concat(e,'" not found')),n}}function eY(){let{designable:e,setDesignable:t,refresh:n,reset:o}=(0,es.useContext)(eV),l=(0,es.useContext)(ec.SchemaOptionsContext),r=(0,es.useMemo)(()=>(null==l?void 0:l.components)||{},[l]),i=(0,es.useMemo)(()=>()=>(0,A.jsx)(A.Fragment,{}),[]),a=(0,ec.useField)(),s=(0,ec.useFieldSchema)(),c=eC(),{t:d}=(0,eT.useTranslation)(),u=(0,es.useMemo)(()=>ez({t:d,api:c,refresh:n,current:s,model:a}),[d,c,n,s,a]);return(0,es.useEffect)(()=>{u.loadAPIClientEvents()},[u]),{dn:u,designable:e,reset:o,refresh:n,setDesignable:t,DesignableBar:i,findComponent:(0,es.useCallback)(e=>e?"string"!=typeof e?e:(0,ed.get)(r,e):null,[ed.get]),on:u.on.bind(u),patch:(0,es.useCallback)((e,t)=>{let o=e=>{Object.keys(e).forEach(t=>{let n=e[t];"title"===t&&(a.title=n,s.title=n),"x-decorator-props"===t&&(a.decoratorProps||(a.decoratorProps={}),s["x-decorator-props"]||(s["x-decorator-props"]={}),Object.keys(n).forEach(e=>{a.decoratorProps[e]=n[e],s["x-decorator-props"][e]=n[e]})),"x-component-props"===t&&(a.componentProps||(a.componentProps={}),s["x-component-props"]||(s["x-component-props"]={}),Object.keys(n).forEach(e=>{a.componentProps[e]=n[e],s["x-component-props"][e]=n[e]}))})};if("string"==typeof e){let n={};return(0,ed.set)(n,e,t),o(n)}o(e),n()},[u]),shallowMerge:(0,es.useCallback)(e=>{u.shallowMerge(e)},[u]),deepMerge:(0,es.useCallback)(e=>{u.deepMerge(e)},[u]),remove:(0,es.useCallback)((e,t)=>{u.remove(e,t)},[u]),insertAdjacent:(0,es.useCallback)((e,t,n)=>{u.insertAdjacent(e,t,n)},[u]),insertBeforeBegin:(0,es.useCallback)(e=>{u.insertBeforeBegin(e)},[u]),insertAfterBegin:(0,es.useCallback)(e=>{u.insertAfterBegin(e)},[u]),insertBeforeEnd:(0,es.useCallback)(e=>{u.insertBeforeEnd(e)},[u]),insertAfterEnd:(0,es.useCallback)(e=>{u.insertAfterEnd(e)},[u])}}var eX=n(28890),eJ=n(89136),eQ=n.n(eJ),eZ=n(64234),e0=n.n(eZ);class e1{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}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}getOptions(){return this.options}getOption(e){return this.options[e]}getFields(e){return e?(0,ed.filter)(this.fields,e):this.fields}getFieldsMap(){return this.fieldsMap||(this.fieldsMap=this.getFields().reduce((e,t)=>(e[t.name]=t,e),{})),this.fieldsMap}getFieldByAssociationName(e){let t=this.getFieldsMap(),[n,...o]=String(e).split("."),l=t[n];if(!l)return;let r=null==l?void 0:l.target;if(!r)return;let i=this.collectionManager.getCollection(r);if(i)return i.getField(o.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("".concat(this.name,"."))?(e=e.replace("".concat(this.name,"."),""),this.getField(e)):void 0)}return t[e]}hasField(e){return!!this.getField(e)}constructor(e,t){(0,em._)(this,"options",void 0),(0,em._)(this,"collectionManager",void 0),(0,em._)(this,"fieldsMap",void 0),(0,em._)(this,"primaryKey",void 0),this.options=e,this.collectionManager=t}}var e2=n(64370),e6=n(31654),e3=n(67808);class e5{addFieldInterfaces(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.reduce((e,t)=>{let n=new t(this);return e[n.name]=n,Array.isArray(this.actionList[n.name])&&(this.actionList[n.name].forEach(e=>{n[e.type](e.data)}),this.actionList[n.name]=void 0),e},{});Object.assign(this.collectionFieldInterfaceInstances,t)}getFieldInterface(e){return this.collectionFieldInterfaceInstances[e]}getFieldInterfaces(e){return Object.values(this.collectionFieldInterfaceInstances).filter(t=>{var n,o;return!e||!t.supportDataSourceType&&!t.notSupportDataSourceType||(t.supportDataSourceType?null==(n=t.supportDataSourceType)?void 0:n.includes(e):!t.notSupportDataSourceType||!(null==(o=t.notSupportDataSourceType)?void 0:o.includes(e)))})}addFieldInterfaceGroups(e){Object.assign(this.collectionFieldGroups,e)}getFieldInterfaceGroups(){return this.collectionFieldGroups}getFieldInterfaceGroup(e){return this.collectionFieldGroups[e]}addFieldInterfaceComponentOption(e,t){let n=this.getFieldInterface(e);if(!n){this.actionList[e]||(this.actionList[e]=[]),this.actionList[e].push({type:"addComponentOption",data:t});return}n.addComponentOption(t)}constructor(e,t,n){(0,em._)(this,"dataSourceManager",void 0),(0,em._)(this,"collectionFieldInterfaceInstances",void 0),(0,em._)(this,"collectionFieldGroups",void 0),(0,em._)(this,"actionList",void 0),this.dataSourceManager=n,this.collectionFieldInterfaceInstances={},this.collectionFieldGroups={},this.actionList={},this.addFieldInterfaces(e),this.addFieldInterfaceGroups(t)}}class e4{addCollectionTemplates(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.reduce((e,t)=>{let n=new t(this);return e[n.name]=n,e},{});return Object.assign(this.collectionTemplateInstances,t),this.dataSourceManager.getDataSources().forEach(e=>{let n=e.collectionManager.getCollections(e=>t[e.template]);e.collectionManager.reAddCollections(n)}),t}getCollectionTemplate(e){return this.collectionTemplateInstances[e]}getCollectionTemplates(e){return Object.values(this.collectionTemplateInstances).filter(t=>{var n,o;return!e||!t.supportDataSourceType&&!t.notSupportDataSourceType||(t.supportDataSourceType?null==(n=t.supportDataSourceType)?void 0:n.includes(e):!t.notSupportDataSourceType||!(null==(o=t.notSupportDataSourceType)?void 0:o.includes(e)))}).sort((e,t)=>(e.order||0)-(t.order||0))}constructor(e,t){(0,em._)(this,"dataSourceManager",void 0),(0,em._)(this,"collectionTemplateInstances",void 0),this.dataSourceManager=t,this.collectionTemplateInstances={},this.addCollectionTemplates(e)}}class e8{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)}async reload(){let e=await this.getDataSource();return this.setOptions(e),this.collectionManager.setCollections(e.collections||[]),this.reloadCallbacks.forEach(t=>t(e.collections)),this.options}constructor(e,t){(0,em._)(this,"options",void 0),(0,em._)(this,"dataSourceManager",void 0),(0,em._)(this,"collectionManager",void 0),(0,em._)(this,"reloadCallbacks",void 0),this.options=e,this.dataSourceManager=t,this.reloadCallbacks=[],this.collectionManager=new tD(e.collections,this)}}class e7 extends e8{getDataSource(){return{collections:this.collections}}}let e9="main",te='{{t("Main")}}';class tt{addCollectionMixins(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.filter(e=>!this.collectionMixins.includes(e));t.length&&(this.collectionMixins.push(...t),this.getDataSources().forEach(e=>e.collectionManager.reAddCollections()))}getDataSources(e){let t=Object.values(this.dataSourceInstancesMap);return e?eu().filter(t,e):t}getDataSource(e){return e?this.dataSourceInstancesMap[e]:this.dataSourceInstancesMap[e9]}removeDataSources(e){e.forEach(e=>{delete this.dataSourceInstancesMap[e]})}addDataSource(e,t){let n=new e(t,this);return this.dataSourceInstancesMap[n.key]=n,n}async addDataSources(e,t){this.multiDataSources.some(n=>{let[o,l]=n;return o===e&&l===t})||this.multiDataSources.push([e,t])}getAllCollections(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{filterCollection:t,filterDataSource:n}=e;return this.getDataSources(n).reduce((e,n)=>(e.push({...n.getOptions(),collections:n.collectionManager.getCollections(t)}),e),[])}addFieldInterfaceGroups(e){this.collectionFieldInterfaceManager.addFieldInterfaceGroups(e)}addCollectionTemplates(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.collectionTemplateManager.addCollectionTemplates(e)}addFieldInterfaces(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.collectionFieldInterfaceManager.addFieldInterfaces(e)}async reload(){return await Promise.all(this.multiDataSources.map(async e=>{let[t,n]=e;(await t()).map(e=>this.addDataSource(n,e))})),Promise.all(this.getDataSources().map(e=>e.reload()))}constructor(e={},t){(0,em._)(this,"options",void 0),(0,em._)(this,"app",void 0),(0,em._)(this,"dataSourceInstancesMap",void 0),(0,em._)(this,"multiDataSources",void 0),(0,em._)(this,"collectionMixins",void 0),(0,em._)(this,"collectionTemplateManager",void 0),(0,em._)(this,"collectionFieldInterfaceManager",void 0),this.options=e,this.app=t,this.dataSourceInstancesMap={},this.multiDataSources=[],this.collectionMixins=[],this.collectionTemplateManager=new e4(e.collectionTemplates,this),this.collectionFieldInterfaceManager=new e5(e.fieldInterfaces,e.fieldInterfaceGroups,this),this.collectionMixins.push(...e.collectionMixins||[]),this.addDataSource(e7,{key:e9,displayName:te,collections:e.collections||[]}),(e.dataSources||[]).forEach(e=>{this.addDataSource(e7,e)})}}var tn=n(99944);let to=(0,es.createContext)(null);to.displayName="DataSourceManagerContext";let tl=e=>{let{children:t,dataSourceManager:n}=e;return(0,A.jsx)(to.Provider,{value:n,children:t})};function tr(){return(0,es.useContext)(to)}let ti=(0,es.createContext)(null);ti.displayName="DataSourceContext";let ta=e=>{let{children:t,dataSource:n}=e,o=tr(),{t:l}=(0,eT.useTranslation)(),{refresh:r}=SA(),[i,a]=es.useState(0),s=o.getDataSource(n);return s?"loading-failed"===s.status?(0,A.jsx)(tu,{type:"DataSource",name:s.displayName||n,message:s.errorMessage||"loading failed"}):"loading"===s.status||"reloading"===s.status?(0,A.jsx)(jY,{children:(0,A.jsx)(e6.Ay,{icon:(0,A.jsx)(tn.A,{}),title:"".concat(s.displayName||n," ").concat(l("data source")," ").concat(l("loading"),"..."),extra:(0,A.jsx)(e3.Ay,{type:"primary",onClick:()=>s.reload().then(()=>{r(),a(Math.random())}),children:l("Refresh")})})}):(0,A.jsx)(ti.Provider,{value:s,children:t}):(0,A.jsx)(tu,{type:"DataSource",name:n})};function ts(){return(0,es.useContext)(ti)}function tc(){let e=(0,es.useContext)(ti);return null==e?void 0:e.key}let{Text:td}=e2.A,tu=e=>{let{type:t,name:n,message:o}=e,{designable:l,dn:r}=eY(),{modal:i}=eX.A.useApp(),{t:a}=(0,eT.useTranslation)(),s=ts(),c=eB(),d=tS(),u=tr(),p=(0,es.useMemo)(()=>{if("DataSource"===t)return n;let e=(null==u?void 0:u.getDataSources().length)>=1&&s&&s.key!==e9?"".concat(c(s.displayName||s.key)," > "):"";if("Collection"===t)return"".concat(e).concat(n);let o=d?"".concat(c(d.title)||d.name||d.tableName," > "):"";return"".concat(e).concat(o).concat(n)},[]),m=(0,es.useMemo)(()=>"Field"===t?"Field":"Block",[t]),h=(0,es.useMemo)(()=>n?o?"".concat(a(t),' "').concat(p,'" ').concat(o):a('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.',{type:a(t).toLocaleLowerCase(),name:p,blockType:a(m)}).replaceAll("&gt;",">"):"".concat(a(t)," ","name is required"),[o,p,t,a,m]);return l?"Field"===t?(0,A.jsx)(gi,{ellipsis:!0,children:(0,A.jsx)(td,{type:"secondary",children:h})}):(0,A.jsx)(jY,{children:(0,A.jsx)(e6.Ay,{status:"404",subTitle:h,extra:(0,A.jsx)(e3.Ay,{onClick:()=>i.confirm({title:a("Delete block"),content:a("Are you sure you want to delete it?"),...confirm,onOk(){r.remove(null,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}}),children:a("Delete")},"Delete")})}):null},tp=(0,es.createContext)(null);tp.displayName="ExtendCollectionsContext";let tm=e=>{let{children:t,collections:n}=e,o=th(),l=(0,es.useMemo)(()=>o?[...o,...n]:n,[o,n]),r=tc();return(0,A.jsx)(tp.Provider,{value:l,children:(0,A.jsx)(tv,{dataSource:r,children:t})})};function th(){return(0,es.useContext)(tp)}let tx=(0,es.createContext)(null);tx.displayName="CollectionManagerContext";let tf=e=>{let{instance:t,children:n}=e,o=ts(),l=th(),r=(0,es.useMemo)(()=>{let e=t||(null==o?void 0:o.collectionManager);return(null==l?void 0:l.length)?e.clone(l):e},[t,l,o]);return(0,A.jsx)(tx.Provider,{value:r,children:n})},tv=e=>{let{instance:t,dataSource:n,children:o}=e;return(0,A.jsx)(ta,{dataSource:n,children:(0,A.jsx)(tf,{instance:t,children:o})})};function tg(){return(0,es.useContext)(tx)}let ty=e=>{let t=tg();return(0,es.useMemo)(()=>t.getCollections(e),[t,e])},tb=(0,es.createContext)(null);tb.displayName="CollectionContext";let tC=e=>{let{name:t,children:n,allowNull:o}=e,l=tg(),r=(0,es.useMemo)(()=>null==l?void 0:l.getCollection(t),[l,t]);return!r&&o?(0,A.jsx)(A.Fragment,{children:e.children}):r||o?(0,A.jsx)(tb.Provider,{value:r,children:n}):(0,A.jsx)(tu,{type:"Collection",name:t})};function tS(){return(0,es.useContext)(tb)}let tw=e=>{let t=tS();return(0,es.useMemo)(()=>t.getFields(e),[t,e])},tF=(0,es.createContext)(null);tF.displayName="CollectionFieldContext";let tj=e=>{let{name:t,children:n,allowNull:o}=e,l=(0,ec.useFieldSchema)(),r=tS(),i=tg(),a=(0,es.useMemo)(()=>{var e;if(!r)return null;let n=null==l||null==(e=l["x-component-props"])?void 0:e.field;return i.getCollectionField(null==l?void 0:l["x-collection-field"])||n||r.getField((null==n?void 0:n.name)||t)},[r,l,t,i]);return!a&&o?(0,A.jsx)(A.Fragment,{children:n}):a?(0,A.jsx)(tF.Provider,{value:a,children:n}):(0,A.jsx)(tu,{type:"Field",name:t})},tA=()=>(0,es.useContext)(tF),tk=(0,es.createContext)(null);tk.displayName="ParentCollectionContext";let tI=e=>{let t=tS();return(0,A.jsx)(tk.Provider,{value:t,children:e.children})},tP=()=>(0,es.useContext)(tk),tT=e=>{let{name:t,children:n}=e,o=tg().getCollectionName(t);return o?(0,A.jsx)(tC,{name:String(t).split(".")[0],children:(0,A.jsx)(tI,{children:(0,A.jsx)(tj,{name:t,children:(0,A.jsx)(tC,{name:o,children:n})})})}):(0,A.jsx)(tu,{type:"Collection",name:t})},tN=()=>{let e=tA();return e?"".concat(e.collectionName,".").concat(e.name):null},tM=(e,t)=>{let{rawTitle:n,title:o,fields:l=[],...r}=e;return{...r,title:n?o:t.i18n.t(o),rawTitle:n||o,fields:null==l?void 0:l.map(e=>{let{uiSchema:n,...o}=e;if(null==n?void 0:n.title){let e=n.title;n.title=n.rawTitle?e:t.i18n.t(e,{ns:"lm-collections"}),n.rawTitle=n.rawTitle||e}return Array.isArray(null==n?void 0:n.enum)&&(n.enum=n.enum.map(e=>({...e,value:(null==e?void 0:e.value)===void 0?e:e.value,label:e.rawLabel?e.label:t.i18n.t(e.label,{ns:"lm-collections"}),rawLabel:e.rawLabel||e.label}))),{uiSchema:n,...o}})}};class tD{get dataSourceManager(){return this.dataSource.dataSourceManager}get app(){return this.dataSourceManager.app}getCollectionInstance(e){var t,n;let o,l=this.dataSource.dataSourceManager.collectionTemplateManager.getCollectionTemplate(e.template),r=(null==l?void 0:l.Collection)||e1,i=null==l?void 0:l.transform,a={...i?i(tM(e,this.app),this.app):tM(e,this.dataSource.dataSourceManager.app),dataSource:this.dataSource.key};return t=this.dataSourceManager.collectionMixins,n=this,o=new r(a,n),t.forEach(e=>{let t=new e(a,n);Object.getOwnPropertyNames(t).forEach(e=>{let n=Object.getOwnPropertyDescriptor(t,e);n?Object.defineProperty(o,e,n):o[e]=t[e]}),Object.getOwnPropertyNames(e.prototype).forEach(t=>{"constructor"!==t&&(o.__proto__[t]=e.prototype[t])})}),o}getInstancesMap(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>this.getCollectionInstance(e)).reduce((e,t)=>(e[t.name]=t,e),{})}addCollections(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=this.getInstancesMap(e);this.collectionInstancesMap={...this.collectionInstancesMap,...t},this.collectionInstancesArr=Object.values(this.collectionInstancesMap)}setCollections(e){this.collectionInstancesMap=this.getInstancesMap(e),this.collectionInstancesArr=Object.values(this.collectionInstancesMap)}reAddCollections(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.collectionInstancesArr,t=e.map(e=>e.getOptions());this.addCollections(t)}getCollection(e){if(e){if("object"==typeof e)return this.getCollectionInstance(e);if(String(e).split(".").length>1){let t=this.getCollectionField(e);if(!t)return;return this.getCollection(t.target)}return this.collectionInstancesMap[e]}}getCollections(e){return e?this.collectionInstancesArr.filter(e):this.collectionInstancesArr}getCollectionName(e){let t=this.getCollection(e);return null==t?void 0:t.name}getCollectionField(e){if(!e)return;if("object"==typeof e)return e;if(String(e).split(".").length<2)return void console.error('[@tachybase/client]: CollectionManager.getField() path "'.concat(e,'" is invalid'));let[t,...n]=String(e).split("."),o=this.getCollection(t);if(o)return o.getField(n.join("."))}getCollectionFields(e,t){var n;return(null==(n=this.getCollection(e))?void 0:n.getFields(t))||[]}getSourceKeyByAssocation(e){if(!e)return;let t=this.getCollectionField(e);if(!t)return;if(t.sourceKey)return t.sourceKey;let n=this.getCollection(e.split(".")[0]);if(n)return n.filterTargetKey||n.getPrimaryKey()||"id"}clone(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new tD([],this.dataSource);return t.collectionInstancesArr=this.collectionInstancesArr,t.collectionInstancesMap=this.collectionInstancesMap,t.addCollections(e),t}constructor(e,t){(0,em._)(this,"dataSource",void 0),(0,em._)(this,"collectionInstancesMap",void 0),(0,em._)(this,"collectionInstancesArr",void 0),this.dataSource=t,this.collectionInstancesMap={},this.collectionInstancesArr=[],this.addCollections(e)}}class tR{addComponentOption(e){this.componentOptions||(this.componentOptions=[]),this.componentOptions.push(e)}constructor(e){(0,em._)(this,"collectionFieldInterfaceManager",void 0),(0,em._)(this,"name",void 0),(0,em._)(this,"group",void 0),(0,em._)(this,"title",void 0),(0,em._)(this,"icon",void 0),(0,em._)(this,"description",void 0),(0,em._)(this,"order",void 0),(0,em._)(this,"default",void 0),(0,em._)(this,"sortable",void 0),(0,em._)(this,"availableTypes",void 0),(0,em._)(this,"componentOptions",void 0),(0,em._)(this,"supportDataSourceType",void 0),(0,em._)(this,"notSupportDataSourceType",void 0),(0,em._)(this,"hasDefaultValue",void 0),(0,em._)(this,"isAssociation",void 0),(0,em._)(this,"operators",void 0),(0,em._)(this,"filterable",void 0),(0,em._)(this,"titleUsable",void 0),this.collectionFieldInterfaceManager=e}}class tq{constructor(e){(0,em._)(this,"collectionTemplateManager",void 0),(0,em._)(this,"name",void 0),(0,em._)(this,"Collection",void 0),(0,em._)(this,"title",void 0),(0,em._)(this,"color",void 0),(0,em._)(this,"order",void 0),(0,em._)(this,"default",void 0),(0,em._)(this,"events",void 0),(0,em._)(this,"configurableProperties",void 0),(0,em._)(this,"availableFieldInterfaces",void 0),(0,em._)(this,"divider",void 0),(0,em._)(this,"description",void 0),(0,em._)(this,"configureActions",void 0),(0,em._)(this,"forbidDeletion",void 0),(0,em._)(this,"supportDataSourceType",void 0),(0,em._)(this,"notSupportDataSourceType",void 0),this.collectionTemplateManager=e}}let t_=e=>{let{children:t,dataSourceManager:n,...o}=e;return(0,A.jsx)(tl,{dataSourceManager:n,children:(0,A.jsx)(tv,{...o,children:t})})};class tO{setData(e){this.data=e}setParentRecord(e){this.parentRecord=e}constructor(e){(0,em._)(this,"data",void 0),(0,em._)(this,"parentRecord",void 0),(0,em._)(this,"isNew",void 0);const{data:t,parentRecord:n,isNew:o}=e;this.isNew=o,this.data=t,this.parentRecord=n}}let tB=(0,es.createContext)(null);tB.displayName="CollectionRecordContext";let tE=e=>{let{isNew:t,record:n,parentRecord:o,children:l}=e,r=(0,es.useMemo)(()=>o?o instanceof tO?o:new tO({data:o}):n instanceof tO?n.parentRecord:void 0,[o,n]),i=(0,es.useMemo)(()=>{let e;return n?n instanceof tO?(e=n).isNew=n.isNew||t:e=new tO({data:n,isNew:t}):e=new tO({isNew:t}),e.setParentRecord(r),e},[n,r,t]);return(0,A.jsx)(tB.Provider,{value:i,children:l})};function tV(){return(0,es.useContext)(tB)}function tz(){let e=tV();return null==e?void 0:e.data}function tL(){let e=tV();return null==e?void 0:e.parentRecord}function tG(){var e;let t=tV();return null==t||null==(e=t.parentRecord)?void 0:e.data}let tK=(e,t)=>{var n;return!t.isForeignKey&&(null==(n=e.collectionFieldInterfaceManager.getFieldInterface(t.interface))?void 0:n.titleUsable)},t$=e=>(0,es.useMemo)(()=>{if(e&&e!==e9)return{"x-data-source":e}},[e]),tU=(0,es.createContext)({layoutDirection:"column"}),tW=tU.Provider,tH=tU.Consumer;function tY(){return(0,es.useContext)(tU)}var tX=n(85092);let tJ=()=>{var e;let t=tS(),n=eC(),o=null==n?void 0:n.resource(null==t?void 0:t.name),l=(0,es.useMemo)(()=>(null==t?void 0:t.fields)||[],[t]),r=(0,es.useMemo)(()=>{var e;return(null==t||null==(e=t.getInheritedFields)?void 0:e.call(t))||[]},[t]),i=(0,es.useMemo)(()=>{var e,n;return(null==t||null==(e=t.getAllFields)?void 0:e.call(t))||(null==t||null==(n=t.getFields)?void 0:n.call(t))||[]},[t]),a=(0,es.useMemo)(()=>{var e;return(null==t||null==(e=t.getForeignKeyFields)?void 0:e.call(t))||[]},[t]),s=(0,es.useCallback)(()=>null==i?void 0:i.find(e=>e.treeParent),[i]),c=(0,es.useCallback)(e=>{var n;return null==t||null==(n=t.getField)?void 0:n.call(t,e)},[t]),d=(0,es.useCallback)(()=>null==t?void 0:t.getPrimaryKey(),[t]);return{...null==t||null==(e=t.getOptions)?void 0:e.call(t),resource:o,getTreeParentField:s,fields:i,getField:c,getPrimaryKey:d,currentFields:l,inheritedFields:r,foreignKeyFields:a}},tQ={name:"setDataLoadingMode",Component:t0};function tZ(){let{dataLoadingMode:e}=t7()||{};return e||"auto"}function t0(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{name:r}=tJ(),{getEnableFieldTree:i,getOnLoadData:a}=vj(r),s=t6();return(0,A.jsx)(aQ,{title:n("Set data loading mode"),scope:{getEnableFieldTree:i,name:r,getOnLoadData:a},schema:{type:"object",title:n("Data loading mode"),properties:{dataLoadingMode:{"x-decorator":"FormItem","x-component":"Radio.Group",default:(null==(e=l["x-decorator-props"])?void 0:e.dataLoadingMode)||"auto",enum:[{value:"auto",label:n("Automatically load data")},{value:"manual",label:n("Load data after filtering")}]}}},onSubmit:e=>{let{dataLoadingMode:n}=e;eu().set(l,"x-decorator-props.dataLoadingMode",n),o.decoratorProps.dataLoadingMode=n,t.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":{...l["x-decorator-props"]}}}),t.refresh(),"auto"===n?s.run():s.mutate(void 0)}})}let t1=(0,es.createContext)(null);t1.displayName="BlockRequestContext";let t2=e=>{var t,n;let{children:o}=e,{action:l,filterByTk:r,sourceId:i,params:a={},association:s,collection:c,record:d,parentRecord:u,requestOptions:p,requestService:m}=t7(),h=function(e){let t=tZ(),n=nt(),{action:o,params:l={},record:r,requestService:i,requestOptions:a}=e;void 0===l.filterByTk&&delete l.filterByTk;let s=ek(i||(e=>{if(r)return Promise.resolve({data:r});if(!o)throw Error("[tachybase]: The 'action' parameter is missing in the 'DataBlockRequestProvider' component");return n[o]({...l,...e}).then(e=>e.data)}),{...a,manual:!0});return(0,eM.A)(()=>{o&&"auto"===t&&s.run()},[l,o,r]),(0,tX.A)(()=>{o&&"auto"===t&&s.run()},[n]),s}({action:l,sourceId:i,record:d,association:s,collection:c,requestOptions:p,requestService:m,params:{...a,filterByTk:r||a.filterByTk}}),x=function(e){let{sourceId:t,association:n,parentRecord:o}=e,l=eC(),r=t$(t7().dataSource),i=tg().getSourceKeyByAssocation(n);return ek(async()=>{if(o)return Promise.resolve({data:o});if(!n||!i)return Promise.resolve({data:void 0});let e=n.split("."),a="".concat(e[0],":get?filter[").concat(i,"]=").concat(t);return(await l.request({url:a,headers:r})).data},{refreshDeps:[n,o,t]})}({sourceId:i,association:s,parentRecord:u}),f=(0,es.useMemo)(()=>{var e,t;return(null==(e=x.data)?void 0:e.data)&&new tO({isNew:!1,data:null==(t=x.data)?void 0:t.data})},[null==(t=x.data)?void 0:t.data]);return(0,A.jsx)(t1.Provider,{value:h,children:"list"!==l?(0,A.jsx)(tE,{isNew:null==l,record:null==(n=h.data)?void 0:n.data,parentRecord:f,children:o}):(0,A.jsx)(tE,{isNew:!1,record:null,parentRecord:f,children:o})})},t6=()=>(0,es.useContext)(t1),t3=(0,es.createContext)({});t3.displayName="DataBlockContext";let t5=e=>{let{collection:t,association:n,allowNull:o=!1}=e,l=(0,es.useMemo)(()=>n?{Component:tT,name:n}:{Component:tC,name:t},[t,n]);return(0,A.jsx)(l.Component,{name:l.name,allowNull:o,children:e.children})},t4=Tr(e=>{let{collection:t,association:n,dataSource:o,children:l,layoutDirection:r,...i}=e,{dn:a}=eY();return(0,A.jsx)(t3.Provider,{value:{dn:a,props:{...i,collection:t,association:n,dataSource:o}},children:(0,A.jsx)(tW,{value:{layoutDirection:r},children:(0,A.jsx)(tv,{dataSource:o,children:(0,A.jsx)(t5,{collection:t,association:n,children:(0,A.jsx)(Nk,{children:(0,A.jsx)(ne,{children:(0,A.jsx)(t2,{children:l})})})})})})})},{displayName:"DataBlockProvider"}),t8=()=>{let e=(0,es.useContext)(t3);if(!e)throw Error("useDataBlock() must be used within a DataBlockProvider");return e},t7=()=>t8().props,t9=(0,es.createContext)(null);t9.displayName="DataBlockResourceContext";let ne=e=>{let{children:t}=e,n=t7(),o=tg(),{association:l,collection:r,dataSource:i,sourceId:a,parentRecord:s}=n,c=eC(),d=t$(i),u=(0,es.useMemo)(()=>"string"==typeof r?r:null==r?void 0:r.name,[r]),p=(0,es.useMemo)(()=>{if(a)return a;if(l&&s){let e=o.getSourceKeyByAssocation(l);return(s instanceof tO?s.data:s)[e]}},[l,a,s]),m=(0,es.useMemo)(()=>{var e;return l?c.resource(l,p,d):c.resource(null!=(e=n.resource_deprecated)?e:u,void 0,d)},[c,l,r,p,d,n.resource_deprecated]);return(0,A.jsx)(t9.Provider,{value:m,children:t})};function nt(){let e=(0,es.useContext)(t9);if(!e)throw Error("useDataBlockResource() must be used within a DataBlockResourceProvider");return e}var nn=n(3759),no=n.n(nn),nl=n(75887),nr=n.n(nl),ni=n(34364);class na{static getInstance(){return na.instance||(na.instance=new na),na.instance}parse(e,t){if(!t)throw Error("schemaId is required.");let n=e.split("/").filter(Boolean),o=!1,l={schemaId:t};for(let e=0;e<n.length;e+=2){let t=n[e],r=n[e+1];if(!r)continue;let i=!0;switch(t){case"collection":l.collection=r;break;case"filter-by-tk":l.filterByTk=r;break;case"source-id":l.sourceId=r;break;case"tab":l.tab=r;break;default:i=!1,console.warn("Unknown key: ".concat(t))}i&&(o=!0)}return!!o&&l}toWildcardPath(e){let{collection:t,filterByTk:n,sourceId:o,tab:l}=e,r=[];return t&&r.push("collection",t),n&&r.push("filter-by-tk",n),o&&r.push("source-id",o),l&&r.push("tab",l),r.join("/")}constructor(){}}(0,em._)(na,"instance",void 0);var ns=n(13052),nc=n(43110),nd=n(10100),nu=n(322),np=n(88505),nm=n.n(np);let nh=e=>{var t;let{association:n}=e,o=tz(),l=tG(),r=tg(),i=tS();if(!n)return;let a=r.getCollection(n.split(".")[0]);return i.name===a.name||(null==(t=i.getParentCollectionsName)?void 0:t.call(i).includes(a.name))?o:l};function nx(){let e=(0,ns._)(["\n height: 100%;\n "]);return nx=function(){return e},e}function nf(){let e=(0,ns._)(["\n width: 200px;\n flex: 0 0 auto;\n "]);return nf=function(){return e},e}function nv(){let e=(0,ns._)(["\n flex: 1 1 auto;\n min-width: 0;\n "]);return nv=function(){return e},e}function ng(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n "]);return ng=function(){return e},e}let ny=(0,es.createContext)(null);ny.displayName="BlockResourceContext";let nb=(0,es.createContext)(null);nb.displayName="BlockAssociationContext";let nC=(0,es.createContext)({});nC.displayName="BlockRequestContext_deprecated";let nS=()=>{let e=nt();return(0,es.useContext)(ny)||e},nw=e=>{let{collection:t}=e;return t?(0,A.jsx)(hH,{collection:t,children:(0,A.jsx)(Nk,{children:e.children})}):e.children},nF=e=>{var t,n;let o=(0,ec.useField)(),l=nt(),[r,i]=(0,es.useState)({}),a=t6(),s=tV(),c=tL(),d=null==a||null==(n=a.data)||null==(t=n.meta)?void 0:t.allowedActions;(0,es.useEffect)(()=>{d&&i(e=>ej()(e,null!=d?d:{}))},[d]);let u=nj();return(0,A.jsx)(nC.Provider,{value:{allowedActions:r,block:e.block,props:e,field:o,service:a,resource:l,__parent:u,updateAssociationValues:(null==e?void 0:e.updateAssociationValues)||[]},children:(0,A.jsx)(m1,{isNew:null==s?void 0:s.isNew,record:null==s?void 0:s.data,parent:null==c?void 0:c.data,children:e.children})})},nj=()=>(0,es.useContext)(nC),nA=(0,nu.rU)(e=>{let{css:t}=e;return{row:t(nx()),left:t(nf()),right:t(nv()),rightContainer:t(ng())}}),nk=e=>{var t;let n=(0,ec.useFieldSchema)(),{findComponent:o}=eY(),{styles:l}=nA(),r=(0,ec.useField)(),i=o(null==(t=r.component)?void 0:t[0])||es.Fragment;return n.reduceProperties((e,t)=>"AssociationFilter"===t["x-component"]?t:e,null)?(0,A.jsx)(i,{...r.componentProps,children:(0,A.jsxs)(nc.A,{className:l.row,gutter:16,wrap:!1,children:[(0,A.jsx)(nd.A,{className:l.left,style:e.associationFilterStyle,children:(0,A.jsx)(ec.RecursionField,{schema:n,onlyRenderProperties:!0,filterProperties:e=>"AssociationFilter"===e["x-component"]})}),(0,A.jsx)(nd.A,{className:l.right,children:(0,A.jsx)("div",{className:l.rightContainer,children:(0,A.jsx)(ec.RecursionField,{schema:n,onlyRenderProperties:!0,filterProperties:e=>"AssociationFilter"!==e["x-component"]})})})]})}):e.children},nI=(0,es.createContext)(null);nI.displayName="BlockContext";let nP=()=>(0,es.useContext)(nI),nT=e=>{let{name:t,dataSource:n,useParams:o,parentRecord:l}=e,r=(0,ec.useFieldSchema)()["x-use-decorator-props"]?e.parentRecord:nh(e),i=null==o?void 0:o(),{getAssociationAppends:a}=pe(n),{appends:s,updateAssociationValues:c}=a(),d=(0,es.useMemo)(()=>{var t;return(null==(t=e.params)?void 0:t.appends)?{...e.params,...i}:{...e.params,appends:s,...i}},[s,i,e.params]),u=(0,es.useMemo)(()=>({name:t}),[t]);return(0,A.jsx)(nI.Provider,{value:u,children:(0,A.jsx)(t4,{...e,params:d,parentRecord:l||r,children:(0,A.jsx)(nF,{...e,updateAssociationValues:c,params:d,children:(0,A.jsx)(nE,{...e,params:d,children:e.children})})})})},nN=()=>{let{association:e}=t7()||{};return(0,es.useContext)(nb)||e},nM=()=>{let{resource:e,__parent:t}=nj(),n=m5(),o=m3(),l=tJ(),{getCollectionField:r}=sO(),i=nN();if(!(0,es.useContext)(l$)&&(e instanceof lK||(null==t?void 0:t.block)==="TableField"))return n;if(i){let e=r(i);return null==o?void 0:o[e.targetKey||"id"]}return null==o?void 0:o[l.filterTargetKey||"id"]},nD=()=>{let e=m3(),{getCollectionField:t}=sO(),n=nN();if(n){let o=t(n);return null==e?void 0:e[o.sourceKey||"id"]}},nR=()=>{let e=tg(),t=tG(),{getCollectionField:n}=sO(),o=nN();if(o){let l=n(o),r=e.getCollection(l.collectionName);return null==t?void 0:t[l.sourceKey||r.filterTargetKey||r.getPrimaryKey()||"id"]}},nq=()=>{var e,t;let n=nM(),o=m3(),{fields:l}=tJ(),r=(0,ec.useFieldSchema)(),{getCollectionJoinField:i}=sO(),a=i((null==r||null==(e=r["x-decorator-props"])?void 0:e.resource)||(null==r||null==(t=r["x-decorator-props"])?void 0:t.association)),s=l.filter(e=>["boolean","date","integer","radio","sort","string","time","uid","uuid"].includes(e.type)).map(e=>e.name),c=Object.keys(o).filter(e=>s.includes(e)).reduce((e,t)=>(e[t]=o[t],e),{}),d={filterByTk:n};return o.__collection&&a&&!["oho","m2o","obo"].includes(a.interface)&&(d.targetCollection=o.__collection),!n&&Object.keys(c).length>0&&(d.filter=c),d},n_=e=>{let t=(0,ec.useField)(),n=m3(),{title:o,to:l,...r}=e,i=nm()(l||"");return(0,A.jsx)(eN.Link,{...r,to:i({record:n||{}}),children:t.title})},nO=(0,es.createContext)(null);nO.displayName="FilterContext";let nB=e=>{let{children:t}=e,[n,o]=es.useState([]);return(0,A.jsx)(nO.Provider,{value:{dataBlocks:n,setDataBlocks:o},children:t})},nE=e=>{let{children:t,params:n}=e,o=tJ(),{recordDataBlocks:l,removeDataBlock:r}=nV(),{service:i}=nj(),a=(0,ec.useField)(),s=(0,ec.useFieldSchema)(),c=pN(),d=(0,es.useRef)(null),u=tZ(),p="FilterFormBlockProvider"!==a.decoratorType&&"FormBlockProvider"!==a.decoratorType&&"filter"!==a.decoratorProps.blockType,m=(0,es.useCallback)(()=>{l({uid:s["x-uid"],title:a.componentProps.title,doFilter:i.runAsync,collection:o,associatedFields:c,foreignKeyFields:o.foreignKeyFields,defaultFilter:(null==n?void 0:n.filter)||{},service:i,dom:d.current,dataLoadingMode:u,clearFilter(e){var t,o,l;let r=(null==(t=this.service.params)?void 0:t[0])||{},i=(null==(l=this.service.params)||null==(o=l[1])?void 0:o.filters)||{};delete i[e];let a=pA([...Object.values(i).map(e=>d5(e)),(null==n?void 0:n.filter)||{}]);this.service.run({...r,page:1,filter:a},{filters:i})},clearData(){this.service.mutate(void 0)}})},[c,o,u,a,s,null==n?void 0:n.filter,l,i]);return(0,es.useEffect)(()=>{p&&m()},[n.filter,i,u,p,m]),(0,es.useEffect)(()=>()=>{r(s["x-uid"])},[]),(0,A.jsx)("div",{ref:d,children:t})},nV=()=>{let e=es.useContext(nO);if(!e)return{inProvider:!1,recordDataBlocks:()=>{},getDataBlocks:()=>[],removeDataBlock:()=>{}};let{dataBlocks:t,setDataBlocks:n}=e;return{recordDataBlocks:e=>{let o=t.find(t=>t.uid===e.uid);if(o){o.service=e.service,o.defaultFilter=e.defaultFilter,o.dataLoadingMode=e.dataLoadingMode;return}n(t=>(0,ed.uniqBy)([...t,e],"uid"))},getDataBlocks:()=>t,removeDataBlock:e=>{n(t=>t.filter(t=>t.uid!==e))},inProvider:!0}};var nz=n(17766);let nL=(e,t)=>{let{getCollectionJoinField:n}=sO();if(!e)return;let o=n("".concat(e,".").concat(t));return null==o?void 0:o.uiSchema},nG=e=>{let t=(0,eh.getDefaultFormat)(e),n=(0,eh.str2moment)(e.value,e),o=n&&n.isValid()?n.format(t):e.value;return(0,ec.isArr)(o)?o.join("~"):o},nK=e=>e?Array.isArray(e)?e:[e]:[],n$=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=null==e?void 0:e.enum;if(Array.isArray(o)&&t){let e=nK(t).map(e=>{let t=o.find(t=>t.value===e);return n?es.createElement(nz.A,{color:null==t?void 0:t.color},null==t?void 0:t.label):null==t?void 0:t.label});return n?e:e.join(", ")}return(null==e?void 0:e["x-component"])==="DatePicker"?nG({...null==e?void 0:e["x-component-props"],value:t}):t};function nU(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n].children;Array.isArray(o)&&t.push(...nU(o)),t.push({...e[n]})}return t}function nW(e){var t,n;return["Nester","SubTable","PopoverNester"].includes((null==(t=e["x-component-props"])?void 0:t.mode)||(null==(n=e.componentProps)?void 0:n.mode))}var nH=n(2712),nY=n(81314),nX=n(7102),nJ=n(43500);function nQ(){let e=(0,ns._)(["\n display: flex;\n gap: 0.5em;\n "]);return nQ=function(){return e},e}let nZ=(0,nu.rU)(e=>{let{css:t}=e;return{field:t(nQ())}});function n0(e){let{targetFieldName:t="phone",actionType:n,value:o,onChange:l}=e,{message:r}=eX.A.useApp(),{t:i}=(0,eT.useTranslation)(),{styles:a}=nZ(),s=eC(),c=(0,ec.useForm)(),[d,u]=(0,es.useState)(0),p=(0,es.useRef)(null);async function m(){if(!(d>0))try{let{data:{data:e}}=await s.resource("verifications").create({values:{type:n,phone:c.values[t]}});r.success(i("Operation succeeded")),o&&l("");let a=e.expiresAt?Math.ceil((Date.parse(e.expiresAt)-Date.now())/1e3):60;u(a),p.current=setInterval(()=>{u(e=>e-1)},1e3)}catch(e){console.error(e)}}return(0,es.useEffect)(()=>{d<=0&&p.current&&clearInterval(p.current)},[d]),(0,A.jsxs)("fieldset",{className:a.field,children:[(0,A.jsx)(nJ.A,{value:o,onChange:l,placeholder:i("Verification code")}),(0,A.jsx)(e3.Ay,{onClick:m,disabled:d>0,children:d>0?i("Retry after {{count}} seconds",{count:d}):i("Send code")})]})}let n1=()=>{let{setVisible:e}=co(),t=(0,ec.useForm)();return{async run(){e(!1),t.submit(e=>{console.warn(e)})}}},n2=()=>{var e,t;let{setVisible:n}=co(),o=(0,ec.useForm)(),l=eC(),r=ub(),i=(null==r||null==(t=r.data)||null==(e=t.data)?void 0:e.password)===null;return{async run(){await o.submit(),await l.resource("auth").changePassword({values:o.values}),i&&r.mutate({data:{...r.data.data,password:""}}),await o.reset(),n(!1)}}},n6={type:"object",properties:{[(0,ec.uid)()]:{"x-decorator":"Form","x-component":"Action.Drawer",type:"void",title:'{{t("Change password")}}',properties:{verifyMethod:{type:"string",required:!0,title:'{{t("Verify method")}}',enum:[{label:'{{t("Use old password")}}',value:"password"},{label:'{{t("Use verification code")}}',value:"code"}],"x-component":"Radio.Group","x-decorator":"FormItem","x-reactions":[{dependencies:[".phoneExist",".oldPasswordExist"],fulfill:{state:{hidden:"{{ !($deps[0] && $deps[1] && smsVerifyEnabled) }}",value:"{{ undefined }}"}}}]},phoneExist:{type:"boolean",default:"{{ !!phoneNumber }}","x-hidden":!0},phone:{type:"string",title:'{{t("Phone")}}',default:"{{ phoneNumber }}","x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-hidden":!0},code:{type:"string",title:'{{t("Verification code")}}',description:"{{codeDescription}}","x-component":"VerificationCode","x-component-props":{actionType:"auth:changePassword",targetFieldName:"phone"},required:!0,"x-decorator":"FormItem","x-reactions":[{dependencies:[".verifyMethod",".phoneExist",".phone"],fulfill:{state:{hidden:"{{\n !$deps[1] ||\n !smsVerifyEnabled ||\n ($deps[0] !== 'code' && $deps[0] !== undefined) // 有 verifyMethod 但未选 code\n }}"}}}]},oldPasswordExist:{type:"boolean",default:"{{ oldPassword }}","x-hidden":!0},oldPassword:{type:"string",title:'{{t("Old password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem","x-reactions":[{dependencies:[".verifyMethod",".oldPasswordExist"],fulfill:{state:{hidden:"{{\n !$deps[1] ||\n (smsVerifyEnabled && $deps[0] !== 'password' && $deps[0] !== undefined)\n }}"}}}]},newPassword:{type:"string",title:'{{t("New password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirmPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirmPassword:{type:"string",required:!0,title:'{{t("Confirm password")}}',"x-component":"Password","x-decorator":"FormItem","x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".newPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},footer:{"x-component":"Action.Drawer.Footer",type:"void",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCloseAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSaveCurrentUserValues }}"}}}}}}}},n3=(0,es.createContext)(null);n3.displayName="CurrentUserSettingsMenuContext";let n5=()=>{let{menuItems:e}=(0,es.useContext)(n3)||{},t=(0,es.useCallback)(()=>e.current,[e]),n=(0,es.useCallback)((t,n)=>{let o;if(n&&(t._options=n),-1!==(o=e.current.findIndex(e=>e.key===t.key))){e.current[o]=t,e.current=[...e.current];return}if(n){if(n.before){let o=e.current.findIndex(e=>e.key===n.before);e.current.splice(o,0,t);return}if(n.after){let o=e.current.findIndex(e=>e.key===n.after);e.current.splice(o+1,0,t);return}}let l=e.current;e.current=l.filter(e=>{var n,o;return t.key!==(null==(n=e._options)?void 0:n.before)&&t.key!==(null==(o=e._options)?void 0:o.after)}),e.current.push(...l.filter(e=>{var n;return(null==(n=e._options)?void 0:n.before)===t.key})),e.current.push(t),e.current.push(...l.filter(e=>{var n;return(null==(n=e._options)?void 0:n.after)===t.key}))},[e]);if(!e)throw(0,eh.error)("CurrentUser: You should use `CurrentUserSettingsMenuProvider` in the root of your app."),Error("CurrentUser: You should use `CurrentUserSettingsMenuProvider` in the root of your app.");return{getMenuItems:t,addMenuItem:n}},n4=e=>{let{children:t}=e,n=(0,es.useRef)([]);return(0,A.jsx)(n3.Provider,{value:{menuItems:n},children:t})},n8=()=>{let{setVisible:e}=co(),t=(0,ec.useForm)();return{async run(){e(!1),t.submit(e=>{console.warn(e)})}}},n7=e=>{let t=ub();return ek(()=>Promise.resolve(t.data),e)},n9=()=>{let e=ub(),{setVisible:t}=co(),n=(0,ec.useForm)(),o=eC();return{async run(){var l;let r=await n.submit();t(!1),await o.resource("users").updateProfile({values:r}),e.mutate({data:{...null==e||null==(l=e.data)?void 0:l.data,...r}})}}},oe={type:"object",properties:{[(0,ec.uid)()]:{"x-decorator":"Form","x-decorator-props":{useValues:"{{ useCurrentUserValues }}"},"x-component":"Action.Drawer",type:"void",title:'{{t("Edit profile")}}',properties:{nickname:{type:"string",title:"{{t('Nickname')}}","x-decorator":"FormItem","x-component":"Input"},username:{type:"string",title:'{{t("Username")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":{username:!0},required:!0},email:{type:"string",title:'{{t("Email")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":"email"},phone:{type:"string",title:'{{t("Phone")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":"phone"},footer:{"x-component":"Action.Drawer.Footer",type:"void",properties:{cancel:{title:"Cancel","x-component":"Action","x-component-props":{useAction:"{{ useCloseAction }}"}},submit:{title:"Submit","x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSaveCurrentUserValues }}"}}}}}}}},ot={"ar-EG":"ar","az-AZ":"az","bg-BG":"bg","bn-BD":"bn-bd","by-BY":"en","ca-ES":"ca","cs-CZ":"cs","da-DK":"da","de-DE":"de","el-GR":"el","en-GB":"en-gb","en-US":"en","es-ES":"es","et-EE":"et","fa-IR":"fa","fi-FI":"fi","fr-BE":"fr","fr-CA":"fr","fr-FR":"fr","ga-IE":"ga","gl-ES":"gl","he-IL":"he","hi-IN":"hi","hr-HR":"hr","hu-HU":"hu","hy-AM":"hy-am","id-ID":"id","is-IS":"is","it-IT":"it","ja-JP":"ja","ka-GE":"ka","kk-KZ":"kk","km-KH":"km","kn-IN":"kn","ko-KR":"ko","ku-IQ":"ku","lt-LT":"lt","lv-LV":"lv","mk-MK":"mk","ml-IN":"ml","mn-MN":"mn","ms-MY":"ms","nb-NO":"nb","ne-NP":"ne","nl-BE":"nl-be","nl-NL":"nl","pl-PL":"pl","pt-BR":"pt-br","pt-PT":"pt","ro-RO":"ro","ru-RU":"ru","si-LK":"si","sk-SK":"sk","sl-SI":"sl","sr-RS":"sr","sv-SE":"sv","ta-IN":"ta","th-TH":"th","tk-TK":"tk","tr-TR":"tr","uk-UA":"uk","ur-PK":"ur","vi-VN":"vi","zh-CN":"zh-cn","zh-HK":"zh-hk","zh-TW":"zh-tw"},on={"ar-EG":{label:"العربية"},"az-AZ":{label:"Azərbaycan dili"},"bg-BG":{label:"Български"},"bn-BD":{label:"Bengali"},"by-BY":{label:"Беларускі"},"ca-ES":{label:"Сatal\xe0/Espanya"},"cs-CZ":{label:"Česky"},"da-DK":{label:"Dansk"},"de-DE":{label:"Deutsch"},"el-GR":{label:"Ελληνικά"},"en-GB":{label:"English(GB)"},"en-US":{label:"English"},"es-ES":{label:"Espa\xf1ol"},"et-EE":{label:"Estonian (Eesti)"},"fa-IR":{label:"فارسی"},"fi-FI":{label:"Suomi"},"fr-BE":{label:"Fran\xe7ais(BE)"},"fr-CA":{label:"Fran\xe7ais(CA)"},"fr-FR":{label:"Fran\xe7ais"},"ga-IE":{label:"Gaeilge"},"gl-ES":{label:"Galego"},"he-IL":{label:"עברית"},"hi-IN":{label:"हिन्दी"},"hr-HR":{label:"Hrvatski jezik"},"hu-HU":{label:"Magyar"},"hy-AM":{label:"Հայերեն"},"id-ID":{label:"Bahasa Indonesia"},"is-IS":{label:"\xcdslenska"},"it-IT":{label:"Italiano"},"ja-JP":{label:"日本語"},"ka-GE":{label:"ქართული"},"kk-KZ":{label:"Қазақ тілі"},"km-KH":{label:"ភាសាខ្មែរ"},"kn-IN":{label:"ಕನ್ನಡ"},"ko-KR":{label:"한국어"},"ku-IQ":{label:"کوردی"},"lt-LT":{label:"lietuvių"},"lv-LV":{label:"Latviešu valoda"},"mk-MK":{label:"македонски јазик"},"ml-IN":{label:"മലയാളം"},"mn-MN":{label:"Монгол хэл"},"ms-MY":{label:"بهاس ملايو"},"nb-NO":{label:"Norsk bokm\xe5l"},"ne-NP":{label:"नेपाली"},"nl-BE":{label:"Vlaams"},"nl-NL":{label:"Nederlands"},"pl-PL":{label:"Polski"},"pt-BR":{label:"Portugu\xeas brasileiro"},"pt-PT":{label:"Portugu\xeas"},"ro-RO":{label:"Rom\xe2nia"},"ru-RU":{label:"Русский"},"si-LK":{label:"සිංහල"},"sk-SK":{label:"Slovenčina"},"sl-SI":{label:"Slovenščina"},"sr-RS":{label:"српски језик"},"sv-SE":{label:"Svenska"},"ta-IN":{label:"Tamil"},"th-TH":{label:"ภาษาไทย"},"tk-TK":{label:"Turkmen"},"tr-TR":{label:"T\xfcrk\xe7e"},"uk-UA":{label:"Українська"},"ur-PK":{label:"Oʻzbekcha"},"vi-VN":{label:"Tiếng Việt"},"zh-CN":{label:"简体中文"},"zh-HK":{label:"繁體中文(香港)"},"zh-TW":{label:"繁體中文(台湾)"}};var oo=n(9994);function ol(e){let{title:t,defaultValue:n,onChange:o,options:l,fieldNames:r}=e,[i,a]=(0,es.useState)(!1),s=(0,es.useRef)(null);return(0,A.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},onClick:e=>{e.stopPropagation(),a(e=>!e)},onMouseLeave:()=>{s.current=setTimeout(()=>{a(!1)},200)},children:[t,(0,A.jsx)(oo.A,{open:i,popupMatchSelectWidth:!1,variant:"borderless",defaultValue:n,onChange:o,fieldNames:r,options:l,style:{textAlign:"right",minWidth:100},onMouseEnter:()=>{clearTimeout(s.current)}})]})}class or{get items(){return this.options.items}add(e,t,n){let o=e.split("."),l={...t,name:o[o.length-1]};if(1===o.length){let t=this.items.findIndex(t=>t.name===e);-1===t?n?this.items.splice(n,0,l):this.items.push(l):this.items[t]=l;return}let r=o.slice(0,-1).join("."),i=this.get(r);if(i){i.children||(i.children=[]);let t=i.children.findIndex(t=>t.name===e);-1===t?n?i.children.splice(n,0,l):i.children.push(l):i.children[t]=l}}get(e){let t=e.split("."),n=this.items;for(let e=0;e<t.length;e++){let o=t[e];if(!(n=n.find(e=>e.name===o))||e===t.length-1)break;if(!n.children)return;n=n.children}return n}remove(e){let t=e.split(".");if(1===t.length){let e=this.items.findIndex(e=>e.name===t[0]);-1!==e&&this.items.splice(e,1);return}let n=this.get(t.slice(0,-1).join("."));if(n&&n.children){let e=t[t.length-1],o=n.children.findIndex(t=>t.name===e);-1!==o&&n.children.splice(o,1)}}constructor(e){(0,em._)(this,"options",void 0),(0,em._)(this,"name",void 0),this.options=Object.assign({items:[]},e),this.name=e.name}}class oi{add(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach(e=>{this.schemaSettings[e.name]=e,Array.isArray(this.actionList[e.name])&&(this.actionList[e.name].forEach(t=>{e[t.type](t.itemName,t.data)}),this.actionList[e.name]=void 0)})}addItem(e,t,n){if(Array.isArray(e))return void e.forEach(e=>{this.addItem(e,t,n)});let o=this.get(e);o?o.add(t,n):(this.actionList[e]||(this.actionList[e]=[]),this.actionList[e].push({type:"add",itemName:t,data:n}))}addItemWithIndex(e){let{schemaSettingName:t,itemName:n,index:o,data:l}=e;if(Array.isArray(t))return void t.forEach((e,t)=>{this.addItemWithIndex({schemaSettingName:e,itemName:n,index:Array.isArray(o)?o[t]:o,data:l})});let r=this.get(t);if(!r)return;let i=Array.isArray(o)?o[0]:o;r.add(n,l,i)}get(e){return this.schemaSettings[e]}getAll(){return this.schemaSettings}has(e){return!!this.get(e)}remove(e){delete this.schemaSettings[e]}removeItem(e,t){let n=this.get(e);n?n.remove(t):(this.actionList[e]||(this.actionList[e]=[]),this.actionList[e].push({type:"remove",itemName:t}))}constructor(e=[],t){(0,em._)(this,"_schemaSettings",void 0),(0,em._)(this,"app",void 0),(0,em._)(this,"schemaSettings",void 0),(0,em._)(this,"actionList",void 0),this._schemaSettings=e,this.app=t,this.schemaSettings={},this.actionList={},this.app=t,this.add(...e)}}let oa=(0,es.createContext)(null);oa.displayName="ApplicationContext";let os=()=>(0,es.useContext)(oa)||{};function oc(e){return os().pm.get(e)}let od=()=>os().router,ou=e=>{let t=os(),n=(0,es.useMemo)(()=>t.getGlobalVar(e),[t,e]);if((0,ed.isFunction)(n))try{return n()}catch(t){console.error("Error calling global variable function for key: ".concat(e),t);return}return n};var op=n(54763),om=n(47738),oh=n(2228),ox=n(94723),of=n(21880),ov=n(56617),og=n(33023),oy=n(70316),ob=n.t(oy,2);let oC=(0,es.createContext)({});oC.displayName="DetailsBlockContext";let oS=e=>{var t,n,o,l,r;let{action:i,readPretty:a}=e,s=(0,ec.useField)(),c=(0,es.useMemo)(()=>(0,ec.createForm)({readPretty:a}),[a]),{resource:d,service:u}=nj(),p=tL(),m=("list"===i?null==u||null==(n=u.data)||null==(t=n.data)?void 0:t[0]:null==u||null==(o=u.data)?void 0:o.data)||{},h=(0,es.useRef)(),x=(0,es.useMemo)(()=>({action:i,form:c,field:s,service:u,resource:d,formBlockRef:h}),[i,s,c,d,u]),{filter:f}=lD({filterOption:null==u||null==(r=u.params)||null==(l=r[0])?void 0:l.filter});return((0,es.useEffect)(()=>{if(!eu().isEmpty(f)&&!u.loading){var e;null==u||u.run({...null==u||null==(e=u.params)?void 0:e[0],filter:f})}},[JSON.stringify(f)]),u.loading&&!s.loaded)?(0,A.jsx)(eD.A,{}):(s.loaded=!0,(0,A.jsx)(oC.Provider,{value:x,children:(0,A.jsx)("div",{ref:h,children:(0,A.jsx)(m1,{isNew:!1,record:m,parent:null==p?void 0:p.data,children:e.children})})}))},ow=Tr(e=>(0,A.jsx)(nT,{name:"details",...e,children:(0,A.jsx)(oS,{...e})})),oF=()=>(0,es.useContext)(oC),oj=()=>{var e,t;let n=oF();return(0,es.useEffect)(()=>{if(!n.service.loading){var e,t,o,l,r;let i="list"===n.action?null==(o=n.service)||null==(t=o.data)||null==(e=t.data)?void 0:e[0]:null==(r=n.service)||null==(l=r.data)?void 0:l.data;n.form.reset().then(()=>{n.form.setValues(i||{})}).catch(console.error)}},[n.action,n.form,null==(t=n.service)||null==(e=t.data)?void 0:e.data,n.service.loading]),{form:n.form}},oA=Tr(e=>(0,A.jsx)(AT,{value:{utc:!0},children:(0,A.jsx)(sV,{isAllowToSetDefaultValue:()=>!1,children:(0,A.jsx)(Tu,{name:"filter-form",...e})})})),ok=(0,es.createContext)({});ok.displayName="FormFieldContext";let oI=e=>{var t,n,o;let{action:l,readPretty:r,fieldName:i}=e,a=Tp(),s=tG();(null==a||null==(t=a.updateAssociationValues)?void 0:t.includes(i))||null==a||null==(o=a.updateAssociationValues)||o.push(i);let c=(0,ec.useField)(),d=(0,es.useMemo)(()=>(0,ec.createForm)({effects(){(0,ec.onFormValuesChange)(e=>{var t;null==a||null==(t=a.form)||t.setValuesIn(i,e.values)})},readPretty:r}),[]);(0,es.useEffect)(()=>(0,ec.autorun)(()=>{var e;let t=(null==a||null==(e=a.form)?void 0:e.values[i])||{};d.reset(),(0,eh.forEach)(t,(e,t)=>{e&&(d.values[t]=e)})}),[]);let{resource:u,service:p}=nj();return p.loading?(0,A.jsx)(eD.A,{}):(0,A.jsx)(m1,{record:null==p||null==(n=p.data)?void 0:n.data,parent:s,children:(0,A.jsx)(ok.Provider,{value:{action:l,form:d,field:c,service:p,resource:u,fieldName:i},children:e.children})})},oP=(0,es.createContext)(null);oP.displayName="WithoutFormFieldResource";let oT=e=>(0,A.jsx)(oP.Provider,{value:!1,children:(0,A.jsx)(nT,{name:"form-field",block:"FormField",...e,children:(0,A.jsx)(oI,{...e})})}),oN=()=>(0,es.useContext)(ok),oM=()=>{let e=oN();return(0,es.useEffect)(()=>{var t,n,o;null==e||null==(o=e.form)||o.setInitialValues(null==(n=e.service)||null==(t=n.data)?void 0:t.data)},[]),{form:e.form}},oD=(0,es.createContext)({isMobile:!1}),oR=e=>{let{children:t}=e;return(0,A.jsx)(oD.Provider,{value:{isMobile:!0},children:t})},oq=Symbol("isNewRecord"),o_=e=>!!(null==e?void 0:e[oq]),oO=e=>{if(!(0,ed.isObject)(e))throw Error("markRecordAsNew: record must be an object");return e[oq]=!0,e};function oB(e){for(;(null==e?void 0:e.parent)&&!nW(e=e.parent););return e}function oE(e){let{collectionField:t,fieldSchema:n,getCollectionField:o}=e;if(t&&["hasOne","belongsTo"].includes(t.type)&&n){let e=oB(n);if(e&&e["x-collection-field"]){let t=o(e["x-collection-field"]);if(["hasMany","belongsToMany"].includes(null==t?void 0:t.type))return!0}}return!1}let oV=es.createContext(null),oz=e=>(0,A.jsx)(oV.Provider,{value:e,children:e.children}),oL=e=>{let{collectionField:t,uiSchema:n,targetFieldSchema:o,maxDepth:l=3,name:r,title:i,collectionName:a,noChildren:s=!1,noDisabled:c=!0,dataSource:d,returnFields:u=e=>e}=e,p=eB(),m=dZ(),{isDisabled:h}=(0,es.useContext)(oV)||{},{getCollectionField:x}=sO(d),f=e=>{var r;if(!(null==(r=e.field)?void 0:r.target))return Promise.resolve(void 0);let i=e.field.target;return new Promise(r=>{setTimeout(()=>{let a=(((e,t)=>{let{collectionField:n,uiSchema:o,depth:l,maxDepth:r,noDisabled:i,loadChildren:a,compile:s,isDisabled:c,targetFieldSchema:d,getCollectionField:u}=t;return e.map(e=>e.target?l>=r?null:{key:e.name,value:e.name,label:s(e.title),isLeaf:!1,field:e,depth:l,disabled:!i&&c({option:e,collectionField:n,uiSchema:o,targetFieldSchema:d,getCollectionField:u}),loadChildren:a}:{key:e.name,value:e.name,label:s(e.title),disabled:!i&&c({option:e,collectionField:n,uiSchema:o,targetFieldSchema:d,getCollectionField:u}),isLeaf:!0,depth:l}).filter(Boolean)})(u(m(i,d),e),{collectionField:t,uiSchema:n,targetFieldSchema:o,depth:e.depth+1,maxDepth:l,noDisabled:c,loadChildren:f,compile:p,isDisabled:h||oG,getCollectionField:x})||[]).sort((e,t)=>e.isLeaf&&!t.isLeaf?-1:!e.isLeaf&&t.isLeaf?1:0).sort((e,t)=>e.disabled&&!t.disabled?1:!e.disabled&&t.disabled?-1:0);if(0===a.length){e.disabled=!0,e.isLeaf=!0,r();return}e.children=a,r()},5)})};return(0,es.useMemo)(()=>({label:i,value:r,key:r,isLeaf:s,field:{target:a},depth:0,loadChildren:f,children:[]}),[null==n?void 0:n["x-component"]])};function oG(e){var t,n;let{option:o,collectionField:l,uiSchema:r,targetFieldSchema:i,getCollectionField:a}=e;return!r||!l||"json"!==l.interface&&(!!(!l.target&&["hasMany","belongsToMany"].includes(o.type))||!(!l.target&&["hasOne","belongsTo"].includes(o.type)||o.target&&oE({collectionField:l,fieldSchema:i,getCollectionField:a}))&&(!!(["hasOne","belongsTo"].includes(l.type)&&["hasMany","belongsToMany"].includes(o.type))||!(["hasOne","belongsTo"].includes(l.type)&&["hasOne","belongsTo"].includes(o.type)||["hasMany","belongsToMany"].includes(l.type)&&o.target)&&(["input","markdown","richText","textarea","username"].includes(l.interface)?!["string","number"].includes(null==(n=o.schema)?void 0:n.type):l.interface&&o.interface?l.interface!==o.interface:(null==r?void 0:r["x-component"])!==(null==(t=o.schema)?void 0:t["x-component"]))))}let oK=function(){var e;let{collectionField:t,uiSchema:n,noDisabled:o,targetFieldSchema:l,maxDepth:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{t:i}=(0,eT.useTranslation)(),a=eC();return{currentRoleSettings:oL({collectionField:t,uiSchema:n,maxDepth:r,name:"$nRole",title:i("Current role"),collectionName:"roles",noDisabled:o,targetFieldSchema:l,noChildren:!0}),currentRoleCtx:null==(e=a.auth)?void 0:e.role}},o$=()=>{let{currentUserCtx:e}=rF(),{currentRoleCtx:t}=oK(),{datetimeCtx:n}=la(),{exactDateTimeCtx:o}=rB();return{builtinVariables:(0,es.useMemo)(()=>[{name:"$user",ctx:e,collectionName:"users"},{name:"$nRole",ctx:t,collectionName:"roles"},{name:"currentUser",ctx:e,collectionName:"users"},{name:"$nDate",ctx:n},{name:"$date",ctx:n},{name:"$nExactDate",ctx:o},{name:"$system",ctx:{now:()=>P()().toISOString()}},{name:"currentTime",ctx:()=>P()().toISOString()}],[e,o])}},oU={hasMany:"list?pageSize=9999",belongsTo:"get",hasOne:"get",belongsToMany:"list?pageSize=9999"},oW=e=>oU[e],oH=/\{\{\s*([a-zA-Z0-9_$-.]+?)\s*\}\}/g,oY=e=>"string"==typeof e&&!!e.match(oH),oX=e=>e?e.match(oH)[0].replace(oH,"$1"):e,oJ={},oQ=e=>!!oJ[e],oZ=e=>oJ[e],o0=(e,t)=>{oJ[e]=t},o1=e=>{delete oJ[e]},o2=(0,es.createContext)(null);o2.displayName="VariablesContext";let o6={},o3=(e,t)=>e.split(".").map(e=>t[e]?t[e]:e).join("."),o5=e=>{let{children:t}=e,n=(0,es.useRef)({}),o=eC(),{getCollectionJoinField:l}=sO(),r=eB(),{builtinVariables:i}=o$(),a=(0,es.useCallback)(e=>{eu().isFunction(e)?n.current=e(n.current):n.current=e},[]),s=(0,es.useCallback)(async(e,t,i)=>{var a,s;let c=e.split("."),d=c[0],u=o7(o6,t),p=(a=n.current,s=t,a={...a},null==s||s.forEach(e=>{a[e.name]=e.ctx}),a),m=o3(d,u);if(!(d in p))throw Error("VariablesProvider: ".concat(d," is not found"));for(let e=0;e<c.length;e++){if(null==p)return p;"$nParentRecord"===c[e]&&!(c[e+1]in p[c[e]])&&"__parent"in p[c[e]]&&c.splice(1,0,"__parent");let t=c[e],n=l(o3(c.slice(0,e+1).join("."),u));if(Array.isArray(p)){let e=p.map(e=>{if(o8(null==e?void 0:e[t])&&(null==e?void 0:e.id)!=null&&(null==n?void 0:n.target)){let l="/".concat(m,"/").concat(e.id,"/").concat(t,":").concat(oW(n.type));if(oQ(l))return oZ(l);let r=o.request({url:l,params:{appends:null==i?void 0:i.appends}}).then(n=>(o1(l),e[t]=n.data.data,e[t]));return o0(l,r),r}return null==e?void 0:e[t]});p=eu().flatten(await Promise.all(e))}else if(o8(p[t])&&null!=p.id&&(null==n?void 0:n.target)&&(null==n?void 0:n.type)!=="virtual"){let e="/".concat(m,"/").concat(p.id,"/").concat(t,":").concat(oW(n.type)),l=null;if(oQ(e))l=await oZ(e);else{let t=o.request({url:e,params:{appends:null==i?void 0:i.appends}});o0(e,t),l=await t,o1(e)}(0,ec.raw)(p)[t]||((0,ec.raw)(p)[t]=l.data.data),p=(0,eh.getValuesByPath)(p,t)}else p=(0,eh.getValuesByPath)(p,t);(null==n?void 0:n.target)&&(m=n.target)}return r(eu().isFunction(p)?p():p)},[l]),c=(0,es.useCallback)(e=>{if(!oY("{{".concat(e.name,"}}")))throw Error("VariablesProvider: ".concat(e.name," is not a valid name"));a(t=>({...t,[e.name]:e.ctx})),e.collectionName&&(o6[e.name]=e.collectionName)},[a]),d=(0,es.useCallback)(e=>n.current[e]?{name:e,ctx:n.current[e],collectionName:o6[e]}:null,[]),u=(0,es.useCallback)(e=>{a(t=>{let n={...t};return delete n[e],n}),delete o6[e]},[a]),p=(0,es.useCallback)(async(e,t,n)=>{var o,l;if(!oY(e))return e;t&&(t=eu().isArray(t)?t:[t]);let r=oX(e);return Array.isArray(l=Array.isArray(o=await s(r,t,n))?o.filter(e=>0===e||!1===e||e):o)&&eu().isObject(l[0])?eu().uniqBy(l,e=>"id"in e?e.id:JSON.stringify(e)):l},[s]),m=(0,es.useCallback)(async(e,t)=>{if(!oY(e))throw Error("VariablesProvider: ".concat(e," is not a variable string"));t&&(t=eu().isArray(t)?t:[t]);let n=oX(e),o=l(o3(n,o7(o6,t)));return o||n.includes(".")||(o={target:o6[n]}),o},[l]);(0,es.useEffect)(()=>{i.forEach(e=>{c(e)})},[i,c]);let h=(0,es.useMemo)(()=>({ctxRef:n,setCtx:a,parseVariable:p,registerVariable:c,getVariable:d,getCollectionField:m,removeVariable:u}),[m,d,p,c,u,a]);return(0,A.jsx)(o2.Provider,{value:h,children:t})};o5.displayName="VariablesProvider";let o4=o5;function o8(e){let t=!1;return(0,ec.untracked)(()=>{if("[{}]"===JSON.stringify(e)||"{}"===JSON.stringify(e)){t=!0;return}t=eu().isEmpty(e)}),t}function o7(e,t){return e={...e},null==t||t.forEach(t=>{t.collectionName&&(e[t.name]=t.collectionName)}),e}let o9=()=>{var e,t;let{field:n,service:o,rowKey:l,collection:r}=lz(),i=(0,es.useMemo)(()=>{var e,t;return null==o||null==(t=o.data)||null==(e=t.data)?void 0:e.filter(e=>{var t,o;return null==(t=(null==n||null==(o=n.data)?void 0:o.selectedRowKeys)||[])?void 0:t.includes(e[l])})},[null==n||null==(e=n.data)?void 0:e.selectedRowKeys,l,null==o||null==(t=o.data)?void 0:t.data]);return(0,es.useMemo)(()=>({name:"$context",ctx:i,collectionName:r}),[r,i])},le=()=>{var e,t;let n=nj();return{name:(null==(e=n.props)?void 0:e.collection)||(null==(t=n.props)?void 0:t.resource)}},lt=(e,t,n)=>{if(!P().isDayjs(e))return e;if("local"===n){let n=new Date().getTimezoneOffset();return P()(lt(e,t,"gmt")).add(n,"minutes").toISOString()}return"year"===t?e.format("YYYY")+"-01-01T00:00:00.000Z":"month"===t?e.format("YYYY-MM")+"-01T00:00:00.000Z":"quarter"===t?e.startOf("quarter").format("YYYY-MM")+"-01T00:00:00.000Z":"week"===t?e.startOf("week").add(1,"day").format("YYYY-MM-DD")+"T00:00:00.000Z":e.format("YYYY-MM-DDTHH:mm:ss.SSS")+"Z"},ln=(e,t)=>e&&P().isDayjs(e)?lt(e,t,"gmt"):e,lo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{showTime:n,gmt:o,picker:l,utc:r=!0}=t;if(!e)return e;if(!r)return e.format(n?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD");if(n)return o?(0,eh.toGmt)(e):(0,eh.toLocal)(e);if("boolean"==typeof o)return o?ln(e,l):e&&P().isDayjs(e)?lt(e,l,"local"):e;return ln(e,l)},ll=(e,t)=>P()().add(e,"isoWeek"===t?"week":t).startOf(t),lr=(e,t)=>P()().add(e,"isoWeek"===t?"week":t).endOf(t),li=()=>({now:()=>P()().toISOString(),today:()=>[ll(0,"day"),lr(0,"day")],yesterday:()=>[ll(-1,"day"),lr(-1,"day")],tomorrow:()=>[ll(1,"day"),lr(1,"day")],thisWeek:()=>[ll(0,"isoWeek"),lr(0,"isoWeek")],lastWeek:()=>[ll(-1,"isoWeek"),lr(-1,"isoWeek")],nextWeek:()=>[ll(1,"isoWeek"),lr(1,"isoWeek")],thisIsoWeek:()=>[ll(0,"isoWeek"),lr(0,"isoWeek")],lastIsoWeek:()=>[ll(-1,"isoWeek"),lr(-1,"isoWeek")],nextIsoWeek:()=>[ll(1,"isoWeek"),lr(1,"isoWeek")],thisMonth:()=>[ll(0,"month"),lr(0,"month")],lastMonth:()=>[ll(-1,"month"),lr(-1,"month")],nextMonth:()=>[ll(1,"month"),lr(1,"month")],thisQuarter:()=>[ll(0,"quarter"),lr(0,"quarter")],lastQuarter:()=>[ll(-1,"quarter"),lr(-1,"quarter")],nextQuarter:()=>[ll(1,"quarter"),lr(1,"quarter")],thisYear:()=>[ll(0,"year"),lr(0,"year")],lastYear:()=>[ll(-1,"year"),lr(-1,"year")],nextYear:()=>[ll(1,"year"),lr(1,"year")],last7Days:()=>[ll(-6,"days"),lr(0,"days")],next7Days:()=>[ll(1,"day"),lr(7,"days")],last30Days:()=>[ll(-29,"days"),lr(0,"days")],next30Days:()=>[ll(1,"day"),lr(30,"days")],last90Days:()=>[ll(-89,"days"),lr(0,"days")],next90Days:()=>[ll(1,"day"),lr(90,"days")]}),la=function(){let{operator:e,schema:t,noDisabled:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{t:o}=(0,eT.useTranslation)();return{datetimeSettings:(0,es.useMemo)(()=>{let l=(null==e?void 0:e.value)||"",r=!n&&!["DatePicker","DatePicker.RangePicker"].includes(null==t?void 0:t["x-component"]),i=[{key:"now",value:"now",label:o("Current time"),disabled:!n&&((null==t?void 0:t["x-component"])!=="DatePicker"||"$dateBetween"===l)},{key:"yesterday",value:"yesterday",label:o("Yesterday"),disabled:r},{key:"today",value:"today",label:o("Today"),disabled:r},{key:"tomorrow",value:"tomorrow",label:o("Tomorrow"),disabled:r},{key:"lastIsoWeek",value:"lastIsoWeek",label:o("Last week"),disabled:r},{key:"thisIsoWeek",value:"thisIsoWeek",label:o("This week"),disabled:r},{key:"nextIsoWeek",value:"nextIsoWeek",label:o("Next week"),disabled:r},{key:"lastMonth",value:"lastMonth",label:o("Last month"),disabled:r},{key:"thisMonth",value:"thisMonth",label:o("This month"),disabled:r},{key:"nextMonth",value:"nextMonth",label:o("Next month"),disabled:r},{key:"lastQuarter",value:"lastQuarter",label:o("Last quarter"),disabled:r},{key:"thisQuarter",value:"thisQuarter",label:o("This quarter"),disabled:r},{key:"nextQuarter",value:"nextQuarter",label:o("Next quarter"),disabled:r},{key:"lastYear",value:"lastYear",label:o("Last year"),disabled:r},{key:"thisYear",value:"thisYear",label:o("This year"),disabled:r},{key:"nextYear",value:"nextYear",label:o("Next year"),disabled:r},{key:"last7Days",value:"last7Days",label:o("Last 7 days"),disabled:r},{key:"next7Days",value:"next7Days",label:o("Next 7 days"),disabled:r},{key:"last30Days",value:"last30Days",label:o("Last 30 days"),disabled:r},{key:"next30Days",value:"next30Days",label:o("Next 30 days"),disabled:r},{key:"last90Days",value:"last90Days",label:o("Last 90 days"),disabled:r},{key:"next90Days",value:"next90Days",label:o("Next 90 days"),disabled:r}];return{label:o("Date variables"),value:"$nDate",key:"$nDate",disabled:i.every(e=>e.disabled),children:i}},[null==t?void 0:t["x-component"]]),datetimeCtx:(0,es.useMemo)(()=>li(),[])}},ls=function(){let{collectionField:e,schema:t,noDisabled:n,targetFieldSchema:o,form:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{t:r}=(0,eT.useTranslation)(),{form:i,collectionName:a}=Tp(),s=oL({collectionField:e,uiSchema:t,targetFieldSchema:o,maxDepth:4,name:"$nForm",title:r("Current form"),collectionName:a,noDisabled:n,returnFields:(e,t)=>e}),c=l||i;return{currentFormSettings:s,currentFormCtx:null==c?void 0:c.values,shouldDisplayCurrentForm:c&&!c.readPretty}},lc=es.createContext(null),ld=e=>(0,A.jsx)(lc.Provider,{value:e,children:e.children}),lu=()=>(0,es.useContext)(lc)||{},lp=e=>eu().isString(e)?oX(e).split(".")[0]:e,lm=(0,es.createContext)({});lm.displayName="AssociationFieldContext";let lh=e=>{let t=(0,ec.useFieldSchema)(),{insertAfterBegin:n}=eY();return(0,es.useCallback)(o=>{t.reduceProperties((t,n)=>n["x-component"]==="AssociationField."+e?n:t,null)||n(eQ()(o))},[e])};function lx(){return(0,es.useContext)(lm)}function lf(e){var t,n,o,l;let{action:r="list",service:i,useOriginalFilter:a}=e,s=(0,ec.useFieldSchema)(),c=(0,ec.useField)(),{getField:d}=tJ(),{getCollectionJoinField:u}=sO(),p=m3(),{parseFilter:m,findVariable:h}=Cu(),[x,f]=(0,es.useState)(null);(0,es.useEffect)(()=>{var e,t,n,o,l,r,a,d,u;let p=(0,ed.isString)(null==s||null==(n=s["x-component-props"])||null==(t=n.service)||null==(e=t.params)?void 0:e.filter)?null==(r=c.componentProps)||null==(l=r.service)||null==(o=l.params)?void 0:o.filter:null==s||null==(u=s["x-component-props"])||null==(d=u.service)||null==(a=d.params)?void 0:a.filter,x=async()=>{var e;f(await m(pA([p||(null==i||null==(e=i.params)?void 0:e.filter)])))},v=eu().debounce(x,300);return x(),(0,ec.reaction)(()=>(0,eh.flatten)(p,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if(!oY(e))return e;let t=lp(e),n=h(t);return(0,eh.getValuesByPath)({[t]:(null==n?void 0:n.ctx)||{}},oX(e))}}),v)},[null==(o=c.componentProps)||null==(n=o.service)||null==(t=n.params)?void 0:t.filter,s,h,m,p,null==i||null==(l=i.params)?void 0:l.filter]);let v=(0,es.useMemo)(()=>d(s.name)||u(null==s?void 0:s["x-collection-field"]),[s]),g=null==p?void 0:p[null==v?void 0:v.sourceKey],y=(0,es.useMemo)(()=>{let e=["oho","o2m"].includes(null==v?void 0:v.interface);return pA([pA([e&&!pq(s)&&(null==v?void 0:v.foreignKey)&&!a?{[v.foreignKey]:{$is:null}}:null,x]),e&&null!=g&&!pq(s)&&(null==v?void 0:v.foreignKey)&&!a?{[v.foreignKey]:{$eq:g}}:null],"$or")},[null==v?void 0:v.interface,null==v?void 0:v.foreignKey,s,x,g,a]);return(0,es.useMemo)(()=>({resource:null==v?void 0:v.target,action:r,...i,params:{...null==i?void 0:i.params,filter:y}}),[null==v?void 0:v.target,r,y,i])}let lv=e=>{var t,n,o,l,r;let i=(0,ec.useFieldSchema)();return{label:"label",value:"value",...(null==(l=i["x-component-props"])||null==(o=l.field)||null==(n=o.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames)||(null==i||null==(r=i["x-component-props"])?void 0:r.fieldNames)||e.fieldNames}},lg=(0,es.createContext)(null);lg.displayName="SubFormContext";let ly=lg.Provider,lb=()=>{let{value:e,collection:t}=(0,es.useContext)(lg)||{};return{formValue:e,collection:t}},lC=(e,t)=>{var n,o,l;let r,i=/{{(.*?)}}/g,a={},s=null==(o=t["x-component-props"])||null==(n=o.fieldNames)?void 0:n.formula;for(;r=i.exec(s);)if(r[1].includes(".")){let t=r[1].split("."),n={currRecord:e,value:""};t.forEach((e,o)=>{var l,r;if(t.length-1!==o){n.currRecord=null==(r=n.currRecord)?void 0:r[e];return}n.value=null==(l=n.currRecord)?void 0:l[e]}),a[r[1]]=null!=(l=n.value)?l:""}else a[r[1]]=e[r[1]]||"";return lS(s,a)},lS=(e,t)=>e.replace(/{{(.*?)}}/g,function(e,n){return Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}),lw=function(){let{collectionField:e,schema:t,noDisabled:n,targetFieldSchema:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=tS(),{formValue:r,collection:i}=lb(),{isInSubForm:a,isInSubTable:s}=lu()||{},{t:c}=(0,eT.useTranslation)();return{shouldDisplayCurrentObject:a||s,currentObjectCtx:r,currentObjectSettings:oL({collectionField:e,uiSchema:t,targetFieldSchema:o,maxDepth:4,name:"$iteration",title:c("Current object"),collectionName:(null==i?void 0:i.name)||(null==l?void 0:l.name),noDisabled:n,returnFields:(e,t)=>e})}},lF=function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{t:o}=(0,eT.useTranslation)(),l=tV(),{name:r}=tP()||{},{isInSubForm:i,isInSubTable:a}=lu()||{};return{currentParentRecordSettings:oL({collectionField:n.collectionField,uiSchema:n.schema,name:"$nParentRecord",title:o("Parent record"),collectionName:r,noDisabled:n.noDisabled,targetFieldSchema:n.targetFieldSchema}),currentParentRecordCtx:null==l||null==(e=l.parentRecord)?void 0:e.data,shouldDisplayCurrentParentRecord:!!(null==l||null==(t=l.parentRecord)?void 0:t.data)&&!i&&!a,collectionName:r}},lj=(0,es.createContext)(null),lA=e=>{let{name:t,value:n,title:o,collection:l}=e;return(0,A.jsx)(lj.Provider,{value:{name:t,value:n,title:o,collection:l},children:e.children})},lk=e=>{let{name:t,value:n,title:o,collection:l}=(0,es.useContext)(lj)||{};return t===e?{value:n,title:o,collection:l}:{}},lI=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{value:t,title:n,collection:o}=lk("$nPopupRecord");return{settings:oL({collectionField:e.collectionField,uiSchema:e.schema,name:"$nPopupRecord",title:n,collectionName:null==o?void 0:o.name,noDisabled:e.noDisabled,targetFieldSchema:e.targetFieldSchema,dataSource:null==o?void 0:o.dataSource}),popupRecordCtx:t,shouldDisplayPopupRecord:!!t,collectionName:null==o?void 0:o.name,dataSource:null==o?void 0:o.dataSource}},lP=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{t}=(0,eT.useTranslation)(),{formRecord:n,collectionName:o}=Tp();return{currentRecordSettings:oL({collectionField:e.collectionField,uiSchema:e.schema,name:"$nRecord",title:t("Current record"),collectionName:o,noDisabled:e.noDisabled,targetFieldSchema:e.targetFieldSchema}),currentRecordCtx:null==n?void 0:n.data,shouldDisplayCurrentRecord:!(null==n?void 0:n.isNew)&&!eu().isEmpty(null==n?void 0:n.data),collectionName:o}},lT=e=>{let{currentObjectCtx:t,shouldDisplayCurrentObject:n}=lw(),{currentRecordCtx:o,collectionName:l}=lP(),{popupRecordCtx:r,collectionName:i}=lI(),{currentParentRecordCtx:a,collectionName:s}=lF(),{datetimeCtx:c}=la(),{currentFormCtx:d}=ls({form:null==e?void 0:e.currentForm}),u=tS(),{name:p}=le();return(null==e?void 0:e.collectionName)&&(p=e.collectionName),(0,es.useMemo)(()=>[{name:"$nRecord",ctx:o,collectionName:l},{name:"$nParentRecord",ctx:a,collectionName:s},{name:"$nPopupRecord",ctx:r,collectionName:i},{name:"$nForm",ctx:d,collectionName:p},{name:"$nDate",ctx:c},n&&{name:"$iteration",ctx:t,collectionName:null==u?void 0:u.name}].filter(Boolean),[o,l,p,d,a,s,r,i,c,n,t,null==u?void 0:u.name])},lN=()=>(0,es.useContext)(o2),lM=(e,t)=>{let{targetCollectionField:n}=t;return null!=e&&n?"chinaRegion"===n.interface&&Array.isArray(e)?e.map(e=>(eu().isObject(e),Object.keys(e={...e}).forEach(t=>{eu().isObjectLike(e[t])&&delete e[t]}),e)):["hasMany","belongsToMany"].includes(n.type)?Array.isArray(e)?e:[e]:(n.interface,e):e};function lD(e){let{filterOption:t}=e,{parseFilter:n,findVariable:o}=Cu(),[l,r]=(0,es.useState)({});return(0,eM.A)(()=>{if(!t)return;let e=async()=>{r(await n(t))};e();let l=eu().debounce(e,300);(0,ec.reaction)(()=>(0,eh.flatten)(t,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if(!oY(e))return e;let t=lp(e),n=o(t);return(0,eh.getValuesByPath)({[t]:(null==n?void 0:n.ctx)||{}},oX(e))}}),l)},[t]),{filter:l}}let lR=e=>{let t=tz();if(e)return t},lq=e=>({params:l_(e),parentRecord:lR(e.association)});function l_(e){var t;let n=(0,ec.useFieldSchema)(),{filter:o}=lD({filterOption:null==(t=e.params)?void 0:t.filter});return(0,es.useMemo)(()=>{let t=e.params||{},{dragSortBy:l}=(null==n?void 0:n["x-decorator-props"])||{};return e.dragSort&&l&&(t.sort=l),{...t,filter:o}},[n,o,e.dragSort,e.params])}let lO=(0,es.createContext)({});function lB(e){let t=[];if(e)for(let n of e)(null==n?void 0:n.children)&&n.children.length>0&&(t.push(n.id),t.push(...lB(null==n?void 0:n.children)));return t}lO.displayName="TableBlockContext";let lE=e=>{let{params:t,showIndex:n,dragSort:o,rowKey:l,childrenColumnName:r,fieldNames:i,...a}=e,s=(0,ec.useField)(),{resource:c,service:d}=nj(),u=(0,ec.useFieldSchema)(),{treeTable:p}=(null==u?void 0:u["x-decorator-props"])||{},[m,h]=(0,es.useState)(!!i),x=(0,es.useMemo)(()=>{if(!1!==p){var e;return lB(null==d||null==(e=d.data)?void 0:e.data)||[]}},[null==d?void 0:d.loading]);return(0,A.jsx)(bI,{children:(0,A.jsx)(lO.Provider,{value:{...a,field:s,service:d,resource:c,params:t,showIndex:n,dragSort:o,rowKey:l,expandFlag:m,childrenColumnName:r,allIncludesChildren:x,setExpandFlag:()=>h(!m)},children:(0,A.jsx)(nk,{...e})})})},lV=Tr(e=>{let t=e.resource||e.association,n=(0,ec.useFieldSchema)(),{getCollection:o,getCollectionField:l}=sO(e.dataSource),r=o(e.collection,e.dataSource),{treeTable:i}=(null==n?void 0:n["x-decorator-props"])||{},a=((0,ec.useFieldSchema)()["x-use-decorator-props"]?e.params:l_(e))||{},s="children";if((null==r?void 0:r.tree)&&!1!==i)if(null==t?void 0:t.includes(".")){let e=l(t);(null==e?void 0:e.treeChildren)&&(s=e.name,a.tree=!0)}else{let e=r.fields.find(e=>e.treeChildren);e&&(s=e.name),a.tree=!0}let c=(0,es.useMemo)(()=>(0,ec.createForm)(),[i]);return(0,A.jsx)(i8,{scope:{treeTable:i},children:(0,A.jsx)(ec.FormContext.Provider,{value:c,children:(0,A.jsx)(nT,{name:e.name||"table",...e,params:a,runWhenParamsChanged:!0,children:(0,A.jsx)(lE,{...e,childrenColumnName:s,params:a})})})})}),lz=()=>(0,es.useContext)(lO),lL=(0,es.createContext)({});lL.displayName="TableFieldContext";let lG=e=>{var t,n;let{params:o={},showIndex:l,dragSort:r,fieldName:i}=e,a=(0,ec.useField)(),s=(0,ec.useFieldSchema)(),{resource:c,service:d}=nj(),u=Tp(),p=oN(),m=p&&p.fieldName?"".concat(p.fieldName,".").concat(i):i;return(null==u||null==(t=u.updateAssociationValues)?void 0:t.includes(m))||null==u||null==(n=u.updateAssociationValues)||n.push(m),(0,A.jsx)(lL.Provider,{value:{field:a,fieldSchema:s,service:d,resource:c,params:o,showIndex:l,dragSort:r},children:e.children})};class lK{async list(e){if(this.field.data=this.field.data||{},this.field.data.changed)return{data:{data:this.field.data.dataSource}};if(!this.sourceId)return this.field.data.dataSource=[],{data:{data:[]}};let t=await this.resource.list(e);return this.field.data.dataSource=t.data.data,{data:{data:t.data.data}}}async get(e){let{filterByTk:t}=e;return{data:{data:this.field.data.dataSource[t]}}}async create(e){let{values:t}=e;this.field.data.dataSource.push(t),this.field.data.changed=!0}async update(e){let{filterByTk:t,values:n}=e;this.field.data.dataSource[t]=n,this.field.data.changed=!0}async destroy(e){let{filterByTk:t}=e;Array.isArray(t)||(t=[t]),this.field.data.dataSource=this.field.data.dataSource.filter((e,n)=>!t.includes(n)),this.field.data.changed=!0}constructor(e){(0,em._)(this,"field",void 0),(0,em._)(this,"api",void 0),(0,em._)(this,"sourceId",void 0),(0,em._)(this,"resource",void 0),this.field=e.field,this.api=e.api,this.sourceId=e.sourceId,this.resource=this.api.resource(e.resource,this.sourceId)}}let l$=(0,es.createContext)(null);l$.displayName="WithoutTableFieldResource";let lU=e=>(0,A.jsx)(l$.Provider,{value:!1,children:(0,A.jsx)(nT,{name:"table-field",block:"TableField",...e,children:(0,A.jsx)(lG,{...e})})}),lW=()=>(0,es.useContext)(lL),lH=()=>{var e,t,n,o,l,r,i,a;let s=(0,ec.useField)(),c=lW();return(0,es.useEffect)(()=>{var e,t,n,o,l;(null==c||null==(e=c.service)?void 0:e.loading)||(s.value=null==c||null==(n=c.service)||null==(t=n.data)?void 0:t.data,s.data=s.data||{},s.data.selectedRowKeys=null==c||null==(l=c.field)||null==(o=l.data)?void 0:o.selectedRowKeys)},[null==c||null==(t=c.field)||null==(e=t.data)?void 0:e.selectedRowKeys,null==c||null==(o=c.service)||null==(n=o.data)?void 0:n.data,null==c||null==(l=c.service)?void 0:l.loading,s]),{size:"middle",loading:null==c||null==(r=c.service)?void 0:r.loading,showIndex:c.showIndex,dragSort:c.dragSort,pagination:!1,required:null==c||null==(a=c.fieldSchema)||null==(i=a.parent)?void 0:i.required,rowKey:e=>{var t,n;return null==(n=s.value)||null==(t=n.indexOf)?void 0:t.call(n,e)},onRowSelectionChange(e){var t;c.field.data=(null==c||null==(t=c.field)?void 0:t.data)||{},c.field.data.selectedRowKeys=e},onChange(e){let{current:t,pageSize:n}=e;c.service.run({page:t,pageSize:n})}}},lY=(0,es.createContext)({});lY.displayName="TableSelectorContext";let lX=(0,es.createContext)({});lX.displayName="TableSelectorParamsContext";let lJ=()=>(0,es.useContext)(lX),lQ=e=>{let{params:t,children:n}=e,o=lJ();try{t.filter=pA([o.filter,t.filter]),t={...o,...t}}catch(e){console.error(e)}return(0,A.jsx)(lX.Provider,{value:t,children:n})},lZ=e=>{let{params:t,rowKey:n,extraFilter:o}=e,l=(0,ec.useField)(),{resource:r,service:i}=nj(),[a,s]=(0,es.useState)(!1),c=tG();return(0,A.jsx)(m1,{record:{},parent:c,children:(0,A.jsx)(lY.Provider,{value:{field:l,service:i,resource:r,params:t,extraFilter:o,rowKey:n,expandFlag:a,setExpandFlag:()=>{s(!a)}},children:(0,A.jsx)(nk,{...e})})})},l0=(e,t)=>e["x-component"]===t?e:e.parent?l0(e.parent,t):null,l1=Tr(e=>{let t,n=lJ(),o=(0,ec.useFieldSchema)(),{getCollectionJoinField:l,getCollectionFields:r}=sO(),i=m3(),{getCollection:a}=sO(),{treeTable:s}=(null==o?void 0:o["x-decorator-props"])||{},c=l0(o,"CollectionField"),d=l(null==c?void 0:c["x-collection-field"]),u=a(null==d?void 0:d.collectionName),p=null==u?void 0:u.getPrimaryKey(),m=(e=>{let{getCollectionFields:t}=sO(),n=t(e),o=new Set;for(let e of n)if(e.target)for(let n of(o.add(e.name),t(e.target)))n.target&&o.add("".concat(e.name,".").concat(n.name));let l=(0,ec.useFieldSchema)().reduceProperties((e,t)=>"TableV2.Selector"===t["x-component"]?t:e,new ec.Schema({}));return(0,ed.uniq)(l.reduceProperties((e,t)=>{if("TableV2.Column"===t["x-component"]){let n=t.reduceProperties((e,t)=>{let[n]=t.name.split(".");return t["x-collection-field"]&&o.has(n)?t:e},null);if(n){let[t]=n.name.split(".");o.has(n.name)?e.push(n.name):o.has(t)&&e.push(t)}}return e},[]))})(e.collection),h={...e.params};if(e.dragSort&&(h.sort=["sort"]),(null==d?void 0:d.target)===(null==d?void 0:d.collectionName)&&(null==u?void 0:u.tree)&&!1!==s&&(h.tree=!0,"parent"===c.name)){var x;h.filter={...null!=(x=h.filter)?x:{},id:i[p]&&{$ne:i[p]}}}if(Object.keys(h).includes("appends")||(h.appends=m),d&&(["oho","o2m"].includes(d.interface)&&!pq(o)&&(t=(null==i?void 0:i[d.sourceKey])?{$or:[{[d.foreignKey]:{$is:null}},{[d.foreignKey]:{$eq:null==i?void 0:i[d.sourceKey]}}]}:{[d.foreignKey]:{$is:null}}),["obo"].includes(d.interface)&&!pq(o))){let e=r(d.target).find(e=>e.foreignKey&&e.foreignKey===d.foreignKey);e&&(t=(null==i?void 0:i[d.foreignKey])?{$or:[{["".concat(e.name,".").concat(e.foreignKey)]:{$is:null}},{["".concat(e.name,".").concat(e.foreignKey)]:{$eq:null==i?void 0:i[d.foreignKey]}}]}:{["".concat(e.name,".").concat(e.foreignKey)]:{$is:null}})}t&&((null==h?void 0:h.filter)?h.filter={$and:[t,h.filter]}:h.filter=t);try{h.filter=pA([n.filter,h.filter]),h={...n,...h}}catch(e){console.error(e)}let{filter:f}=lD({filterOption:null==h?void 0:h.filter});return!eu().isEmpty(null==h?void 0:h.filter)&&eu().isEmpty(f)?null:((null==h?void 0:h.filter)&&(h.filter=f),(0,A.jsx)(i8,{scope:{treeTable:s},children:(0,A.jsx)(nT,{name:"table-selector",...e,params:h,children:(0,A.jsx)(lZ,{...e,params:h,extraFilter:t})})}))}),l2=()=>(0,es.useContext)(lY),l6=()=>{var e,t,n,o,l,r,i,a,s,c,d,u,p,m,h,x,f,v;let g=(0,ec.useField)(),y=l2(),b=(0,ec.useFieldSchema)(),{getCollectionJoinField:C}=sO(),S=l0(b,"CollectionField"),w=C(null==S?void 0:S["x-collection-field"]);return(0,es.useEffect)(()=>{var e,t,n,o,l,r,i,a,s,c,d,u,p,m,h;if(!(null==y||null==(e=y.service)?void 0:e.loading)){let e=null==y||null==(n=y.service)||null==(t=n.data)?void 0:t.data.map(e=>eu().omit(e,null==w?void 0:w.foreignKey));g.value=e,null==g||null==(o=g.setInitialValue)||o.call(g,e),g.data=g.data||{},g.data.selectedRowKeys=null==y||null==(r=y.field)||null==(l=r.data)?void 0:l.selectedRowKeys,g.componentProps.pagination=g.componentProps.pagination||{},g.componentProps.pagination.pageSize=null==y||null==(s=y.service)||null==(a=s.data)||null==(i=a.meta)?void 0:i.pageSize,g.componentProps.pagination.total=null==y||null==(u=y.service)||null==(d=u.data)||null==(c=d.meta)?void 0:c.count,g.componentProps.pagination.current=null==y||null==(h=y.service)||null==(m=h.data)||null==(p=m.meta)?void 0:p.page}},[null==w?void 0:w.foreignKey,null==y||null==(t=y.field)||null==(e=t.data)?void 0:e.selectedRowKeys,null==y||null==(o=y.service)||null==(n=o.data)?void 0:n.data,null==y||null==(i=y.service)||null==(r=i.data)||null==(l=r.meta)?void 0:l.count,null==y||null==(c=y.service)||null==(s=c.data)||null==(a=s.meta)?void 0:a.page,null==y||null==(p=y.service)||null==(u=p.data)||null==(d=u.meta)?void 0:d.pageSize,null==y||null==(m=y.service)?void 0:m.loading,g]),{loading:null==y||null==(h=y.service)?void 0:h.loading,showIndex:!1,dragSort:!1,rowKey:y.rowKey||"id",pagination:(null==y||null==(x=y.params)?void 0:x.paginate)!==!1&&{defaultCurrent:(null==y||null==(f=y.params)?void 0:f.page)||1,defaultPageSize:null==y||null==(v=y.params)?void 0:v.pageSize},onRowSelectionChange(e,t){var n;y.field.data=(null==y||null==(n=y.field)?void 0:n.data)||{},y.field.data.selectedRowKeys=e},async onRowDragEnd(e){let{from:t,to:n}=e;await y.resource.move({sourceId:t[y.rowKey||"id"],targetId:n[y.rowKey||"id"]}),y.service.refresh()},onChange(e){var t;let{current:n,pageSize:o}=e;y.service.run({...null==(t=y.service.params)?void 0:t[0],page:n,pageSize:o})}}},l3=(0,es.createContext)({}),l5=e=>{let{params:t,showIndex:n,fieldNames:o,...l}=e,r=(0,ec.useField)(),{resource:i,service:a}=nj(),[s,c]=(0,es.useState)(!1);return(0,A.jsx)(bI,{children:(0,A.jsx)(l3.Provider,{value:{...l,field:r,service:a,resource:i,params:t,expandFlag:s,setExpandFlag:()=>c(!s)},children:(0,A.jsx)(nk,{...e})})})},l4=e=>{let t={...e.params};return t.tree=!0,(0,A.jsx)(nT,{...e,params:t,runWhenParamsChanged:!0,children:(0,A.jsx)(l5,{...e,params:t})})},l8=()=>(0,es.useContext)(l3),l7=()=>{var e,t;let n=(0,ec.useField)(),o=l8(),l=(0,ec.useFieldSchema)(),{getDataBlocks:r}=nV();return(0,es.useEffect)(()=>{var e,t,l;(null==o||null==(e=o.service)?void 0:e.loading)||(n.data=n.data||{},n.data.treeData=function e(t){return null==t||t.forEach(t=>{t.title=t.id,t.key=t.id,e((null==t?void 0:t.children)||[])}),t}((null==o||null==(l=o.service)||null==(t=l.data)?void 0:t.data)||[]))},[null==o||null==(e=o.service)?void 0:e.loading]),{loading:null==o||null==(t=o.service)?void 0:t.loading,onSelectNode:(e,t)=>{let{selected:o}=t,{targets:i,uid:a}=u$(l),s=r();null==s||s.forEach(t=>{var l,r,s;let c=i.find(e=>e.uid===t.uid);if(!c)return;let d=(null==(l=t.service.params)?void 0:l[0])||{},u=(null==(s=t.service.params)||null==(r=s[1])?void 0:r.filters)||{},p=function(e,t){let n=[];for(let o of e)!function e(o,l){if(o.id===l){if(n.push(o.id),o.children)for(let t of o.children)e(t,t.id)}else if(o.children)for(let n of o.children)e(n,t)}(o,t);return n}(n.data.treeData,e[0]);u[a]={$or:o?p.map(e=>({[c.field||"id"]:{$eq:e}})):[]};let m=pA([...Object.values(u).map(e=>d5(e)),t.defaultFilter]);return t.doFilter({...d,page:1,filter:m},{filters:u})})}}},l9=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,es.useRef)(0);return(0,es.useEffect)(()=>{let e=e=>{let{clientY:n}=e;t.current=Math.max(n,window.innerHeight-n)};return window.addEventListener("mousemove",e),()=>{window.removeEventListener("mousemove",e)}},[]),(0,es.useMemo)(()=>t.current-40,e)},re=(0,es.createContext)(null);re.displayName="GetMenuItemContext";let rt=(0,es.createContext)(null);rt.displayName="GetMenuItemsContext";let rn=()=>(0,es.useContext)(rt)||{},ro=()=>{let e=(0,es.useRef)([]),t=(0,es.useRef)(null),n=(0,es.useRef)(!1),o=(0,es.useCallback)(o=>{let{limitCount:l}=o;return n.current?(n.current=!1,t.current)?t.current():l&&e.current.length>l?(0,A.jsx)(A.Fragment,{children:e.current.slice(0,l).map((e,t)=>(0,A.jsx)(e,{},t))}):(0,A.jsx)(A.Fragment,{children:e.current.map((e,t)=>(0,A.jsx)(e,{},t))}):null},[]),l=(0,es.useCallback)(e=>{let o=[],l=e=>{o.push(e),o.sort((e,t)=>(e.order||0)-(t.order||0))};return n.current=!0,t.current=()=>{let t=o.filter(e=>e.notdelete).map(e=>eu().omit(e,"notdelete"));return o.length=0,o.push(...t),(0,A.jsx)(rt.Provider,{value:{pushMenuItem:l},children:e()})},o},[]);return{Component:o,getMenuItems:l,getMenuItem:(0,es.useCallback)(t=>{let o={},l=e=>{Object.assign(o,e)};return n.current=!0,e.current.push(()=>(0,A.jsx)(re.Provider,{value:{collectMenuItem:l},children:t()})),o},[]),clean:(0,es.useCallback)(()=>{e.current=[]},[])}};var rl=n(84755);let rr=e=>{let[t,n]=(0,es.useState)(e.title),[o,l]=(0,es.useState)(!1),{refresh:r}=rg(),{run:i}=ek({resource:"uiSchemaTemplates",action:"update",params:{filterByTk:e.filterByTk}},{manual:!0,debounceWait:500,onSuccess(){r()}});return(0,A.jsx)("div",{children:o?(0,A.jsx)(nJ.A,{defaultValue:t,size:"large",onBlur:()=>{l(!1)},onChange:t=>{n(t.target.value),i({filterByTk:e.filterByTk,values:{name:t.target.value}})}}):(0,A.jsx)("div",{onClick:()=>{l(!0)},children:t||(0,A.jsx)("span",{style:{color:"#bbb"},children:"未命名"})})})},ri=()=>{var e,t;let n=(0,ep.useNavigate)(),o=(0,ep.useParams)(),l=null==o?void 0:o.key,r=(0,es.useContext)(eV),{data:i,loading:a}=ek({resource:"uiSchemaTemplates",action:"get",params:{filterByTk:l}});return a?(0,A.jsx)(eD.A,{}):(0,A.jsxs)("div",{children:[(0,A.jsx)(rl.z,{style:{backgroundColor:"white"},onBack:()=>{n("/admin/plugins/block-templates")},ghost:!1,title:(0,A.jsx)(rr,{filterByTk:l,title:null==i||null==(e=i.data)?void 0:e.name})}),(0,A.jsx)("div",{style:{margin:"var(--tb-spacing)"},children:(0,A.jsx)(eV.Provider,{value:{...r,designable:!0},children:(0,A.jsx)(aa,{uid:null==i||null==(t=i.data)?void 0:t.uid})})})]})},ra={name:"uiSchemaTemplates",filterTargetKey:"key",targetKey:"key",fields:[{type:"integer",name:"name",interface:"input",uiSchema:{title:'{{ t("Template name") }}',type:"number","x-component":"Input",required:!0}}]},rs=(0,es.createContext)({});rs.displayName="BlockTemplateContext";let rc=()=>(0,es.useContext)(rs),rd=e=>{let{templateId:t}=e,{getTemplateById:n}=rg(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{dn:r}=eY(),i=(0,es.useMemo)(()=>n(t),[t]),{refresh:a}=SA(),s=(0,es.useCallback)(e=>{var t,n;l["x-linkage-rules"]=(null==e||null==(t=e.data)?void 0:t["x-linkage-rules"])||[],l.setProperties(null==e||null==(n=e.data)?void 0:n.properties),a()},[i]);return i?(0,A.jsx)(rs.Provider,{value:{dn:r,field:o,fieldSchema:l,template:i},children:(0,A.jsx)(aa,{noForm:!0,uid:null==i?void 0:i.uid,onSuccess:s})}):null},ru=(0,es.createContext)({});ru.displayName="SchemaTemplateManagerContext";let rp=e=>{let{templates:t,refresh:n}=e;return(0,A.jsx)(ru.Provider,{value:{templates:t,refresh:n},children:e.children})},rm=e=>{e.name=e["x-uid"]=(0,ec.uid)(),Object.keys(e.properties||{}).forEach(t=>{rm(e.properties[t])})},rh=()=>{let{getTemplateBySchema:e}=rg(),t=(0,ec.useFieldSchema)(),n=t["x-uid"],o=t["x-template-key"];return(0,es.useMemo)(()=>e(t),[n,o])},rx=e=>{var t;let n=eC(),o={resource:"uiSchemaTemplates",action:"list",params:{paginate:!1}},l=ek(o);if(!l.loading||l.data)return(0,A.jsx)(rp,{refresh:async()=>{let{data:e}=await n.request(o);l.mutate(e)},templates:null==l||null==(t=l.data)?void 0:t.data,children:e.children})},rf=e=>(0,A.jsx)(rx,{children:e.children});class rv extends eR{async load(){this.addComponents(),this.app.addProviders([rf])}addComponents(){this.app.addComponents({BlockTemplate:rd})}}let rg=()=>{let{getInheritCollections:e}=sO(),{refresh:t,templates:n=[]}=(0,es.useContext)(ru),o=eC();return{templates:n,refresh:t,async getTemplateSchemaByMode(e){let{mode:t,template:n}=e;if("copy"===t){let{data:e}=await o.request({url:"/uiSchemas:getJsonSchema/".concat(n.uid,"?includeAsyncNode=true")}),t=(null==e?void 0:e.data)||{};return rm(t),(0,ed.cloneDeep)(t)}if("reference"===t)return{type:"void","x-component":"BlockTemplate","x-component-props":{templateId:n.key}}},async copyTemplateSchema(e){let{data:t}=await o.request({url:"/uiSchemas:getJsonSchema/".concat(e.uid,"?includeAsyncNode=true")}),n=(null==t?void 0:t.data)||{};return rm(n),(0,ed.cloneDeep)(n)},async saveAsTemplate(e){let{uid:n}=e,l=(0,ec.uid)();return await o.resource("uiSchemas").saveAsTemplate({filterByTk:n,values:{key:l,...e}}),await t(),{key:l}},getTemplateBySchema:(0,es.useCallback)(e=>{if(!e)return;let t=e["x-template-key"];if(t)return null==n?void 0:n.find(e=>e.key===t);let o=e["x-uid"];if(o)return null==n?void 0:n.find(e=>e.uid===o)},[n]),getTemplateBySchemaId:e=>e?null==n?void 0:n.find(t=>t.uid===e):null,getTemplateById:e=>null==n?void 0:n.find(t=>t.key===e),getTemplatesByCollection(t,o){var l;let r=e(o,t).concat([o]);return(null==n||null==(l=n.filter)?void 0:l.call(n,e=>(e.dataSourceKey||e9)===t&&r.includes(e.collectionName)))||[]},getTemplatesByComponentName(e){var t;return(null==n||null==(t=n.filter)?void 0:t.call(n,t=>t.componentName===e))||[]}}},ry={type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:ra,resource:"uiSchemaTemplates",action:"list",params:{pageSize:20,sort:["-createdAt"]},rowKey:"key",showIndex:!0,dragSort:!1},"x-component":"CardItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-use-component-props":()=>{let e=u2(),{refresh:t}=rg();return{async onClick(){await e.onClick(),t()}}},"x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}},[(0,ec.uid)()]:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowSelection:{type:"checkbox"}},properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{form:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"uiSchemaTemplates",collection:ra,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{[(0,ec.uid)()]:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"uiSchemaTemplates.name",required:!0},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":()=>{let e=uJ(),{refresh:t}=rg();return{async onClick(){await e.onClick(),t()}}},"x-component-props":{type:"primary",htmlType:"submit"},type:"void"}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":()=>{let e=uQ(),{refresh:t}=rg();return{async onClick(){await e.onClick(),t()}}},"x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}},column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-collection-field":"uiSchemaTemplates.name","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column2:{type:"void",title:'{{t("Collection display name")}}',"x-component":"TableV2.Column",properties:{"collection.title":{type:"string","x-component":()=>{let{dataSourceKey:e="main",collectionName:t}=tz(),n=tr(),o=eB(),[l,r]=(0,es.useMemo)(()=>{let o=n.getDataSource(e);if(o){let e=o.collectionManager.getCollection(t);return[o.displayName,(null==e?void 0:e.title)||t]}return[e,null]},[n,e,t]);return(0,A.jsxs)(A.Fragment,{children:[o(l)," ",">"," ",o(r)]})},"x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}}}}}}}},rb=()=>{let{t:e}=(0,eT.useTranslation)();return(0,A.jsxs)("div",{children:[(0,A.jsx)(rl.z,{style:{backgroundColor:"white"},ghost:!1,title:e("Block templates")}),(0,A.jsx)("div",{style:{margin:"var(--tb-spacing)"},children:(0,A.jsx)(al,{schema:ry})})]})},rC=()=>(0,A.jsx)(al,{schema:ry});var rS=n(53818);let rw=e=>{let{collectionField:t,uiSchema:n,noDisabled:o,targetFieldSchema:l,maxDepth:r=3}=e,{t:i}=(0,eT.useTranslation)();return oL({collectionField:t,uiSchema:n,maxDepth:r,name:"$user",title:i("Current user"),collectionName:"users",dataSource:e9,noDisabled:o,targetFieldSchema:l})},rF=function(){var e;let{collectionField:t,uiSchema:n,noDisabled:o,targetFieldSchema:l,maxDepth:r=3}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{t:i}=(0,eT.useTranslation)(),a=ub();return{currentUserSettings:oL({collectionField:t,uiSchema:n,maxDepth:r,name:"$user",title:i("Current user"),collectionName:"users",noDisabled:o,targetFieldSchema:l}),currentUserCtx:null==a||null==(e=a.data)?void 0:e.data}},rj=[{label:'{{t("contains")}}',value:"$includes",selected:!0},{label:'{{t("does not contain")}}',value:"$notIncludes"},{label:'{{t("is")}}',value:"$eq"},{label:'{{t("is not")}}',value:"$ne"},{label:'{{t("is empty")}}',value:"$empty",noValue:!0},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0}],rA=[{label:'{{t("is")}}',value:"$match",selected:!0,schema:{"x-component":"Select","x-component-props":{mode:"tags"}}},{label:'{{t("is not")}}',value:"$notMatch",schema:{"x-component":"Select","x-component-props":{mode:"tags"}}},{label:'{{t("contains")}}',value:"$anyOf",schema:{"x-component":"Select","x-component-props":{mode:"tags"}}},{label:'{{t("does not contain")}}',value:"$noneOf",schema:{"x-component":"Select","x-component-props":{mode:"tags"}}},{label:'{{t("is empty")}}',value:"$empty",noValue:!0},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0}],rk=[{label:'{{t("is")}}',value:"$eq",selected:!0},{label:'{{t("is not")}}',value:"$ne"}],rI=[{label:"{{ t('is') }}",value:"$dateOn",selected:!0},{label:"{{ t('is not') }}",value:"$dateNotOn"},{label:"{{ t('is before') }}",value:"$dateBefore"},{label:"{{ t('is after') }}",value:"$dateAfter"},{label:"{{ t('is on or after') }}",value:"$dateNotBefore"},{label:"{{ t('is on or before') }}",value:"$dateNotAfter"},{label:"{{ t('is between') }}",value:"$dateBetween",schema:{"x-component":"DatePicker.RangePicker"}},{label:"{{ t('is empty') }}",value:"$empty",noValue:!0},{label:"{{ t('is not empty') }}",value:"$notEmpty",noValue:!0}],rP=[{label:'{{t("=")}}',value:"$eq",selected:!0},{label:'{{t("≠")}}',value:"$ne"},{label:'{{t(">")}}',value:"$gt"},{label:'{{t("≥")}}',value:"$gte"},{label:'{{t("<")}}',value:"$lt"},{label:'{{t("≤")}}',value:"$lte"},{label:'{{t("is empty")}}',value:"$empty",noValue:!0},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0}],rT=[{label:'{{t("is")}}',value:"$eq",selected:!0},{label:'{{t("is not")}}',value:"$ne"},{label:'{{t("exists")}}',value:"$exists",noValue:!0},{label:'{{t("not exists")}}',value:"$notExists",noValue:!0}],rN=[{label:'{{t("is")}}',value:"$eq",selected:!0,schema:{"x-component":"Select"}},{label:'{{t("is not")}}',value:"$ne",schema:{"x-component":"Select"}},{label:'{{t("contains")}}',value:"$in",schema:{"x-component":"Select","x-component-props":{mode:"tags"}}},{label:'{{t("does not contain")}}',value:"$notIn",schema:{"x-component":"Select","x-component-props":{mode:"tags"}}},{label:'{{t("is empty")}}',value:"$empty",noValue:!0},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0}],rM=[{label:'{{t("is")}}',value:"$eq",selected:!0},{label:'{{t("is not")}}',value:"$neq"},{label:'{{t("is empty")}}',value:"$empty",noValue:!0},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0}],rD=[{label:'{{t("Yes")}}',value:"$isTruly",selected:!0,noValue:!0},{label:'{{t("No")}}',value:"$isFalsy",noValue:!0}],rR=[{label:'{{t("contains")}}',value:"$childIn",schema:{"x-component":"CollectionSelect","x-component-props":{mode:"tags"}}},{label:'{{t("does not contain")}}',value:"$childNotIn",schema:{"x-component":"CollectionSelect","x-component-props":{mode:"tags"}}}],rq=[{label:'{{t("is")}}',value:"$eq",selected:!0,schema:{"x-component":"CollectionSelect"}},{label:'{{t("is not")}}',value:"$ne",schema:{"x-component":"CollectionSelect"}},{label:'{{t("contains")}}',value:"$in",schema:{"x-component":"CollectionSelect","x-component-props":{mode:"tags"}}},{label:'{{t("does not contain")}}',value:"$notIn",schema:{"x-component":"CollectionSelect","x-component-props":{mode:"tags"}}},{label:'{{t("is empty")}}',value:"$empty",noValue:!0},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0}],r_=[{label:'{{t("is")}}',value:"$eq",selected:!0},{label:'{{t("is not")}}',value:"$ne"},{label:'{{t("is empty")}}',value:"$empty",noValue:!0},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0}],rO=()=>({exactDateTimeCtx:(0,es.useMemo)(()=>({nowUtc:()=>P()().toISOString(),nowLocal:()=>P()().format("YYYY-MM-DD HH:mm:ss"),todayUtc:()=>P()().startOf("day").utc().toISOString(),todayLocal:()=>P()().startOf("day").format("YYYY-MM-DD HH:mm:ss"),todayDate:()=>P()().format("YYYY-MM-DD"),yesterdayUtc:()=>P()().subtract(1,"day").startOf("day").utc().toISOString(),yesterdayLocal:()=>P()().subtract(1,"day").startOf("day").format("YYYY-MM-DD HH:mm:ss"),yesterdayDate:()=>P()().subtract(1,"day").format("YYYY-MM-DD"),tomorrowUtc:()=>P()().add(1,"day").startOf("day").utc().toISOString(),tomorrowLocal:()=>P()().add(1,"day").startOf("day").format("YYYY-MM-DD HH:mm:ss"),tomorrowDate:()=>P()().add(1,"day").format("YYYY-MM-DD")}),[])}),rB=function(){var e;let{schema:t,targetFieldSchema:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{collectionField:o}=lu(),{dateOnly:l,utc:r,accuracy:i,picker:a}=(null==o||null==(e=o.uiSchema)?void 0:e["x-component-props"])||{},{t:s}=(0,eT.useTranslation)(),c=(0,es.useMemo)(()=>{let e=e=>{if(!a){if("now"===e)return"nowLocal";if("today"===e)return"todayDate";if("yesterday"===e)return"yesterdayDate";if("tomorrow"===e)return"tomorrowDate"}return l?"now"===e?null:"".concat(e,"Date"):"".concat(e).concat(r||i?"Utc":"Local")},t=[{key:"now",value:e("now"),label:s("Now"),operators:rI},{key:"today",value:e("today"),label:s("Today"),operators:rI},{key:"yesterday",value:e("yesterday"),label:s("Yesterday"),operators:rI},{key:"tomorrow",value:e("tomorrow"),label:s("Tomorrow"),operators:rI}].filter(e=>e.value);return{label:s("Date variables"),value:"$nExactDate",key:"$nExactDate",children:t}},[null==t?void 0:t["x-component"],n]),{exactDateTimeCtx:d}=rO();return{exactDateTimeSettings:c,exactDateTimeCtx:d,shouldDisplayExactDate:!!o}},rE=(0,es.createContext)(null);rE.displayName="RemoveConditionContext";let rV=(0,es.createContext)(null);rV.displayName="FilterContext";let rz=(0,es.createContext)(null);rz.displayName="FilterLogicContext";let rL=function(){var e;let t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1?arguments[1]:void 0,l=o;return null==n||null==(e=n.forEach)||e.call(n,e=>{let n=l.find(t=>t.name===e);n&&(t=n),l=(null==n?void 0:n.children)||[]}),t},rG=()=>{let{name:e}=tJ(),{getCollectionJoinField:t}=sO(),n=(0,ec.useField)(),{options:o,collectionName:l,field:r}=(0,es.useContext)(rV)||{},i=Object.keys(no()(n.value||{})).shift()||"",a=(0,es.useMemo)(()=>{let[n=""]=i.split(".$");return t("".concat(l||e,".").concat(n))},[e,i]),s=(0,es.useCallback)(()=>{var e,t,o,l;n.value=no().unflatten({["".concat(null==(e=n.data.dataIndex)?void 0:e.join("."),".").concat(null==(o=n.data)||null==(t=o.operator)?void 0:t.value)]:null==(l=n.data)?void 0:l.value})},[n]);(0,es.useEffect)(()=>{var l;if(n.data=n.data||{},!i||!o)return;let[a="",s=""]=i.split(".$"),[c]=s.split(".",2),d=a.split("."),u=rL(d,o),p=null==u?void 0:u.operators,m=null==p||null==(l=p.find)?void 0:l.call(p,e=>e.value==="$".concat(c));if(n.data.dataIndex=d,(null==d?void 0:d.length)>1){let n=d.concat();n.pop();let o=t("".concat(e,".").concat(n.join(".")));r.collectionName=null==o?void 0:o.target}else r.collectionName=null;n.data.operators=p,n.data.operator=m,n.data.schema=(0,ec.merge)(null==u?void 0:u.schema,null==m?void 0:m.schema),n.data.value=nr()((0,nn.unflatten)(n.value),"".concat(a,".$").concat(c))},[n.path]);let c=(0,es.useCallback)(l=>{var i;let a=rL(l,o),c=null==a||null==(i=a.operators)?void 0:i[0];n.data=n.data||{},n.data.operators=null==a?void 0:a.operators,n.data.operator=c;let d=eQ()(null==a?void 0:a.schema),u=eQ()(null==c?void 0:c.schema);if(n.data.schema=(0,ec.merge)(d,u),n.data.dataIndex=l,(null==l?void 0:l.length)>1){let n=l.concat();n.pop();let o=t("".concat(e,".").concat(n.join(".")));r.collectionName=null==o?void 0:o.target}else r.collectionName=null;n.data.value=(null==c?void 0:c.noValue)?c.default||!0:void 0,s()},[s,n,o]),d=(0,es.useCallback)(e=>{var t,l,r;let i=null==(r=n.data)||null==(l=r.operators)||null==(t=l.find)?void 0:t.call(l,t=>t.value===e);n.data.operator=i;let a=rL(n.data.dataIndex,o),c=eQ()(null==a?void 0:a.schema),d=eQ()(null==i?void 0:i.schema);n.data.schema=(0,ec.merge)(c,d),n.data.value=i.noValue?i.default||!0:void 0,s()},[s,n.data,o]),u=(0,es.useCallback)(e=>{n.data.value=e,s()},[s,n.data]);return{fields:o,...(null==n?void 0:n.data)||{},collectionField:a,setDataIndex:c,setOperator:d,setValue:u}};(0,es.createContext)(null);let rK=(0,es.createContext)(null);(0,es.createContext)(null);let r$=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,es.useContext)(rK),o=(0,ec.useField)(),{getActiveFieldsName:l}=uM(),r=l("form"),i=null==t||null==(e=t.form)?void 0:e.fields,{t:a}=(0,eT.useTranslation)();return{currentCustomFilterSetting:(0,es.useMemo)(()=>{let e=[];for(let t in i)e.push({key:t,...i[t]});let t=e.filter(e=>{var t;return null==e||null==(t=e.props)?void 0:t.name.includes("__custom.")}).map(e=>{var t,n,o;if(!r.includes(null==e||null==(t=e.props)?void 0:t.name))return null;{let t=null==e||null==(n=e.props)?void 0:n.name.replace(/^__custom\./,"");return{key:null==e||null==(o=e.props)?void 0:o.name,value:t,label:e.title}}}).filter(Boolean);return{label:a("Current filter"),value:"$nFilter",key:"$nFilter",children:t}},[i]),currentCustonFilterCtx:null==o?void 0:o.value,shouldDisplayCustomFilter:!!n}},rU=e=>{var t;let{collectionField:n,form:o,uiSchema:l,operator:r,noDisabled:i,targetFieldSchema:a,record:s}=e,{name:c=null==s?void 0:s.__collectionName}=le(),d=null==s||null==(t=s.__parent)?void 0:t.__collectionName,{currentUserSettings:u}=rF({maxDepth:3,uiSchema:l,collectionField:n,noDisabled:i,targetFieldSchema:a}),{currentRoleSettings:p}=oK({uiSchema:l,collectionField:n,noDisabled:i,targetFieldSchema:a}),{datetimeSettings:m}=la({operator:r,schema:l,noDisabled:i}),{exactDateTimeSettings:h,shouldDisplayExactDate:x}=rB({operator:r,schema:l,noDisabled:!0,targetFieldSchema:a}),{currentFormSettings:f,shouldDisplayCurrentForm:v}=ls({schema:l,collectionField:n,noDisabled:i,targetFieldSchema:a,form:o}),{currentObjectSettings:g,shouldDisplayCurrentObject:y}=lw({collectionField:n,schema:l,noDisabled:i,targetFieldSchema:a}),{currentRecordSettings:b,shouldDisplayCurrentRecord:C}=lP({schema:l,collectionField:n,noDisabled:i,targetFieldSchema:a}),{settings:S,shouldDisplayPopupRecord:w}=lI({schema:l,collectionField:n,noDisabled:i,targetFieldSchema:a}),{currentParentRecordSettings:F,shouldDisplayCurrentParentRecord:j}=lF({schema:l,collectionName:d,collectionField:n,noDisabled:i,targetFieldSchema:a}),{currentCustomFilterSetting:A,shouldDisplayCustomFilter:k}=r$({schema:l,form:o,collectionName:d,collectionField:n,targetFieldSchema:a});return(0,es.useMemo)(()=>[u,p,!x&&m,x&&h,v&&f,y&&g,C&&b,j&&F,w&&S,k&&A].filter(Boolean),[u,p,m,h,x,v,f,y,g,C,b,j,F,w,S,A,k])},rW=e=>{let{value:t,onChange:n,renderSchemaComponent:o,style:l,schema:r,className:i,contextCollectionName:a,collectionField:s,shouldChange:c,form:d,record:u,returnScope:p=eu().identity,targetFieldSchema:m}=e,{name:h}=le(),x=P8(),{operator:f,schema:v=null==s?void 0:s.uiSchema}=rG(),g=rU({collectionField:s,form:d,record:u,operator:f,uiSchema:v,targetFieldSchema:m}),y=(e=>{let{schema:t,maxDepth:n=3,contextCollectionName:o,collectionField:l}=e,{t:r}=(0,eT.useTranslation)(),i=eB(),a=dZ(),s=(()=>{let{getChildrenCollections:e}=sO();return(t,n)=>{if(t===n)return!0;let o=e(n);return null==o?void 0:o.some(e=>e.name===t)}})(),c=e=>{var o;if(!(null==(o=e.field)?void 0:o.target))return new Promise(t=>{(0,eh.error)("Must be set field target"),e.children=[],t(void 0)});let r=e.field.target;return new Promise(o=>{setTimeout(()=>{let d=((e,t,n,o)=>{let{schema:l,depth:r,maxDepth:i,loadChildren:a,compile:s}=t;return e.map(e=>{let t=!o(e.target,null==n?void 0:n.target);return e.target?r>=i?null:{key:e.name,value:e.name,label:s(e.title),disabled:t,isLeaf:!0,field:e,depth:r,loadChildren:a}:{key:e.name,value:e.name,label:s(e.title),disabled:t,isLeaf:!0,depth:r}}).filter(Boolean)})(a(r).filter(e=>["hasOne","hasMany","belongsTo","belongsToMany"].includes(e.type)),{schema:t,depth:e.depth+1,maxDepth:n,loadChildren:c,compile:i},l,s)||[];if(0===d.length){e.disabled=!0,e.children=[],o();return}e.children=d,o()},5)})};return(0,es.useMemo)(()=>({label:r("Table selected records"),value:"$context",key:"$context",isLeaf:!1,field:{target:o},depth:0,loadChildren:c}),[null==t?void 0:t["x-component"]])})({schema:r,maxDepth:2,contextCollectionName:a,collectionField:s}),{compatOldVariables:b}=rY({collectionField:s,uiSchema:v,targetFieldSchema:m,blockCollectionName:h});a&&g.every(e=>e.value!==y.value)&&g.push(y);let C=(0,es.useCallback)((e,t)=>{if(!c)return n(e);setTimeout(async()=>{await c(e,t)&&n(e)})},[n,c]);return(0,A.jsx)(P7.Input,{className:i,value:t,onChange:C,scope:p(b(eu().isEmpty(x)?g:x,{value:t})),style:l,changeOnSelect:!0,children:(0,A.jsx)(o,{value:t,onChange:n})})},rH=e=>{let{collectionField:t,variables:n,localVariables:o,getAllCollectionsInheritChain:l}=e,r=t?l(t.target):[];return async(e,l)=>{if(eu().isString(e)&&e.includes("$nRole")||!oY(e)||!n||!t||"json"===t.interface)return!0;let i=l[l.length-1];if(i&&eu().isEmpty(i.children)&&!i.loadChildren)return!0;let a=await n.getCollectionField(e,o);return!(!t||["o2o","o2m","oho"].includes(null==a?void 0:a.interface))&&(!!t.target||null==a||!a.target)&&(!t.target||!!(null==a?void 0:a.target))&&(!t.target||null==a||!a.target||!!r.includes(null==a?void 0:a.target))}};function rY(e){let{uiSchema:t,collectionField:n,noDisabled:o,targetFieldSchema:l,blockCollectionName:r}=e,{t:i}=(0,eT.useTranslation)(),{currentUserSettings:a}=rF({maxDepth:1,uiSchema:t,collectionField:n,noDisabled:o,targetFieldSchema:l}),{currentRecordSettings:s}=lP({schema:t,collectionField:n,noDisabled:o,targetFieldSchema:l});return{compatOldVariables:(0,es.useCallback)((e,t)=>{let{value:n}=t;if(!oY(n))return e;e=eu().cloneDeep(e);let o={value:"$system",key:"$system",label:i("System variables"),isLeaf:!1,children:[{value:"now",key:"now",label:i("Current time"),isLeaf:!0,depth:1}],depth:0},l={value:"currentTime",label:i("Current time"),children:null};if(n.includes("$system")&&e.push(o),n.includes("".concat(r,"."))){let t=e.find(e=>"$nForm"===e.value||"$nRecord"===e.value);t&&(t.value=r)}if(n.includes("$form")){let t=e.find(e=>"$nForm"===e.value);t&&(t.value="$form")}if(n.includes("currentUser")){let t=e.find(e=>"$user"===e.value);t?t.value="currentUser":e.unshift({...a,value:"currentUser"})}if(n.includes("currentRecord")){let t=e.find(e=>"$nRecord"===e.value);t?t.value="currentRecord":e.unshift({...s,value:"currentRecord"})}if(n.includes("currentTime")&&e.push(l),n.includes("$date")){let t=e.find(e=>"$nDate"===e.value);t&&(t.value="$date")}return e},[r])}}function rX(e){return e.map(e=>({...e,value:e.name,key:e.name,label:e.title,disabled:e.disabled,children:e.children?rX(e.children):void 0}))}let rJ=es.forwardRef((e,t)=>{var n;let o=eh.ArrayBase.useArray(),l=eh.ArrayBase.useIndex(e.index),{t:r}=(0,eT.useTranslation)();return(0,A.jsx)(oh.A,{...e,checkedChildren:r("Default"),unCheckedChildren:r("Default"),checked:null==o||null==(n=o.field)?void 0:n.value[l].default,style:{transition:"all 0.25s ease-in-out",color:"rgba(0, 0, 0, 0.8)",fontSize:16,marginLeft:6,marginBottom:3},onChange:(e,t)=>{var n;t.stopPropagation(),o.field.value.splice(l,1,{...null==o||null==(n=o.field)?void 0:n.value[l],default:e}),o.field.value.forEach((e,t)=>{if(t!==l){var n;o.field.value.splice(t,1,{...null==o||null==(n=o.field)?void 0:n.value[t],default:!1})}})},onClick:(e,t)=>{t.stopPropagation()}})});rJ.displayName="AsDefaultTemplate";var rQ=n(23663),rZ=n(25325),r0=n(16820),r1=n(57694),r2=n(30395),r6=n.n(r2);let r3=(0,nu.rU)(()=>({arrayCollapseItem:{marginBottom:"10px"}})),r5=(0,ec.observer)(e=>{var t;let n=eh.ArrayBase.useArray(),o=eh.ArrayBase.useIndex(e.index),{t:l}=(0,eT.useTranslation)(),r=null==n||null==(t=n.field)?void 0:t.value[o];return(0,es.useEffect)(()=>{if(r.key||(r.key=(0,ec.uid)()),!r.title){var e,t;r.title="".concat(l("Template name")," ").concat(null==n||null==(t=n.field)||null==(e=t.value)?void 0:e.length)}},[]),(0,A.jsx)(nJ.A.TextArea,{value:r.title,placeholder:l("Template name"),onChange:e=>{e.stopPropagation(),r.title=e.target.value},onBlur:e=>{e.stopPropagation(),r.title=e.target.value},autoSize:!0,style:{width:"70%",border:"none"},onClick:e=>{e.stopPropagation()}})}),r4=e=>{var t,n;return(null==(n=e["x-component"])||null==(t=n.indexOf)?void 0:t.call(n,"Addition"))>-1},r8=e=>{var t,n;return(null==(n=e["x-component"])||null==(t=n.indexOf)?void 0:t.call(n,"Index"))>-1},r7=e=>{var t,n,o,l,r,i,a,s;return r4(e)||(null==(n=e["x-component"])||null==(t=n.indexOf)?void 0:t.call(n,"Remove"))>-1||(null==(l=e["x-component"])||null==(o=l.indexOf)?void 0:o.call(l,"MoveDown"))>-1||(null==(i=e["x-component"])||null==(r=i.indexOf)?void 0:r.call(i,"MoveUp"))>-1||(null==(s=e["x-component"])||null==(a=s.indexOf)?void 0:a.call(s,"Copy"))>-1},r9=e=>Array.from({length:e}).map((e,t)=>t),ie=(e,t)=>e<t?r9(e):r9(t),it=(0,ec.observer)(e=>{let{styles:t}=r3(),n=(0,ec.useField)(),o=Array.isArray(n.value)?n.value:[],[l,r]=(0,es.useState)(ie(o.length,e.defaultOpenPanelCount)),i=(0,ec.useFieldSchema)();if((0,es.useEffect)(()=>{!n.modified&&o.length&&r(ie(o.length,e.defaultOpenPanelCount))},[o.length,n]),!i)throw Error("can not found schema object");return(0,A.jsxs)(eh.ArrayBase,{onAdd:e=>{r(l.length<=e?l.concat(e):l.reduce((t,n)=>n<e?t.concat(n):n===e?t.concat([n,n+1]):t.concat(n+1),[]))},onRemove:()=>{n.initialValue=n.value},children:[(()=>{if(!o.length)return(0,A.jsx)(rZ.A,{className:r6()("".concat(t.arrayCollapseItem),e.className),children:(0,A.jsx)(op.A,{})})})(),(0,A.jsx)(r0.A,{...e,activeKey:l,onChange:e=>r((0,ec.toArr)(e).map(Number)),className:r6()("".concat(t.arrayCollapseItem),e.className),children:o.map((e,t)=>{let o,l,r,a=Array.isArray(i.items)?i.items[t]||i.items[0]:i.items,s=n.query("".concat(n.address,".").concat(t)).get("componentProps"),c=a["x-component-props"],d=(0,A.jsxs)(eh.ArrayBase.Item,{index:t,record:e,children:[(0,A.jsx)(ec.RecursionField,{schema:a,name:t,filterProperties:e=>!!r7(e),onlyRenderProperties:!0}),null==s?void 0:s.extra]}),u=(0,A.jsx)(ec.RecursionField,{schema:a,name:t,filterProperties:e=>!(r8(e)||r7(e))});return(0,es.createElement)(r0.A.Panel,{...c,...s,forceRender:!0,key:t,header:(o="".concat((null==s?void 0:s.header)||c.header||n.title),l=n.address.concat(t),r=n.form.queryFeedbacks({type:"error",address:"".concat(l,".**")}),(0,A.jsxs)(eh.ArrayBase.Item,{index:t,record:()=>{var e;return null==(e=n.value)?void 0:e[t]},children:[(0,A.jsx)(ec.RecursionField,{schema:a,name:t,filterProperties:e=>!!r8(e),onlyRenderProperties:!0}),r.length?(0,A.jsx)(r1.A,{size:"small",className:"errors-badge",count:r.length,children:o}):(0,A.jsx)(r5,{item:e.initialValue||e,index:t})]})),extra:d},(0,A.jsx)(eh.ArrayBase.Item,{index:t,record:e,children:u},t))})}),i.reduceProperties((e,t,n)=>r4(t)?(0,A.jsx)(ec.RecursionField,{schema:t,name:n}):e,null)]})},{displayName:"ArrayCollapse"}),io=e=>{let{children:t}=e;return(0,A.jsx)(es.Fragment,{children:t})};io.displayName="CollapsePanel",it.defaultProps={defaultOpenPanelCount:5},it.displayName="ArrayCollapse",it.CollapsePanel=io,eh.ArrayBase.mixin(it),it.Copy=es.forwardRef((e,t)=>{var n;let o=(0,ec.useField)(),l=eh.ArrayBase.useArray(),r=eh.ArrayBase.useIndex(e.index);return l&&(null==(n=l.field)?void 0:n.pattern)==="editable"?(0,A.jsx)(rQ.A,{...e,style:{transition:"all 0.25s ease-in-out",color:"rgba(0, 0, 0, 0.8)",fontSize:"16px",marginLeft:6},ref:t,onClick:t=>{var n,i;if((null==o?void 0:o.disabled)||(t.stopPropagation(),null==(n=l.props)?void 0:n.disabled))return;let a=(0,ed.clone)(null==l||null==(i=l.field)?void 0:i.value[r]);l.field.push(a),e.onClick&&e.onClick(t)}}):null}),it.Copy.displayName="ArrayCollapse.Copy";let il=function(e){let{t}=(0,eT.useTranslation)(),{getFields:n}=hh(e.collectionName),o=m3(),{form:l}=Tp(),r=lN(),i=lT(),{getAllCollectionsInheritChain:a}=sO(),{isInSubForm:s,isInSubTable:c}=lu()||{},d=(0,es.useCallback)(e=>(0,A.jsx)(AT,{value:{utc:!1},children:(0,A.jsx)(rW,{...e,form:l,record:o,shouldChange:rH({collectionField:e.collectionField,variables:r,localVariables:i,getAllCollectionsInheritChain:a})})}),[l,a,i,o,r]);return(0,A.jsx)(aQ,{title:t("Set the data scope"),initialValues:{filter:e.defaultFilter},schema:()=>({type:"object",title:t("Set the data scope"),properties:{filter:{enum:e.collectionFilterOption||n(),"x-decorator":e=>(0,A.jsx)(oz,{...e,children:(0,A.jsx)(ld,{isInSubForm:s,isInSubTable:c,children:e.children})}),"x-decorator-props":{isDisabled:ir},"x-component":"Filter","x-component-props":{collectionName:e.collectionName,dynamicComponent:e.dynamicComponent||d}}}}),onSubmit:e.onSubmit})};function ir(e){var t,n;let{option:o,collectionField:l,uiSchema:r}=e;return!r||!l||"json"!==l.interface&&!o.target&&(["input","markdown","richText","textarea","username"].includes(l.interface)?!["string","number"].includes(null==(n=o.schema)?void 0:n.type):l.interface&&o.interface?l.interface!==o.interface:(null==r?void 0:r["x-component"])!==(null==(t=o.schema)?void 0:t["x-component"]))}function ii(e){return e?{id:{$eq:e}}:null}function ia(e){let{title:t,options:n,value:o,onChange:l,...r}=e;return(0,A.jsx)(az,{title:t,...r,children:(0,A.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},children:[t,(0,A.jsx)(oo.A,{popupMatchSelectWidth:!1,bordered:!1,value:o,onChange:l,options:n,style:{textAlign:"right",minWidth:100},...r})]})})}(0,ec.observer)(()=>{var e,t,n,o;let{getCollectionFields:l,getCollectionField:r,getCollection:i,isTitleField:a}=sO(),s=(0,ec.useField)(),c=(0,ec.useFieldSchema)(),{t:d}=(0,eT.useTranslation)(),{dn:u}=eY(),p=eB(),{formSchema:m,data:h}=c["x-designer-props"],{form:x}=Tp(),f=s.componentProps.service.resource,v=i(f),g=l(f);if(!h)return(0,eh.error)("data is required"),null;let y=g.filter(e=>a(e)).map(e=>{var t;return{value:null==e?void 0:e.name,label:p(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return(0,A.jsxs)(sP,{draggable:!1,children:[(0,A.jsx)(il,{collectionName:f,defaultFilter:(null==(t=h.config)||null==(e=t[f])?void 0:e.filter)||{},form:x,onSubmit:e=>{let{filter:t}=e;try{eu().set(h,"config.".concat(f,".filter"),d5(t))}catch(e){(0,eh.error)(e)}try{s.query("fieldReaction.items.*.layout.dataId").forEach(e=>{e.componentProps.service.resource===f&&(e.componentProps.service.params={filter:eu().isEmpty(t)?{}:d5(pA([t,ii(s.value)],"$or"))})})}catch(e){(0,eh.error)(e)}m["x-data-templates"]=h,u.emit("patch",{schema:{"x-uid":m["x-uid"],"x-data-templates":h}}),u.refresh()}}),(0,A.jsx)(ia,{title:d("Title field"),options:y,value:(null==(o=h.config)||null==(n=o[f])?void 0:n.titleField)||(null==v?void 0:v.titleField)||"id",onChange:e=>{try{eu().set(h,"config.".concat(f,".titleField"),e)}catch(e){(0,eh.error)(e)}try{s.query("fieldReaction.items.*.layout.dataId").forEach(t=>{t.componentProps.service.resource===f&&(t.componentProps.fieldNames.label=e,t.componentProps.targetField=r("".concat(f,".").concat(e||(null==v?void 0:v.titleField)||"id")))})}catch(e){console.error(e)}m["x-data-templates"]=h;let t={"x-uid":m["x-uid"],"x-data-templates":h};u.emit("patch",{schema:t}),u.refresh()}},"title-field")]})},{displayName:"Designer"});var is=n(10023);let ic=e=>{let{tag:t,type:n}=e;return(0,A.jsx)("div",{children:(0,A.jsxs)(nz.A,{color:{reference:"blue",duplicate:"green",preloading:"cyan"}[n],children:[(0,A.jsx)("span",{children:t})," (",{reference:"Reference",duplicate:"Duplicate",preloading:"Preloading"}[n],")"]})})},id=(e,t,n)=>{let o,l,{getCollectionJoinField:r,getCollectionFields:i}=sO(),{message:a}=eX.A.useApp(),s=eh.ArrayBase.useArray(),c=eh.ArrayBase.useIndex(),d=eh.ArrayBase.useRecord(),u=eB(),{t:p}=(0,eT.useTranslation)(),m=(0,ec.useForm)(),h=(o=new is.q({max:100}),(e,t,n)=>{let{exclude:l=[],depth:r=0,maxDepth:a,prefix:s="",disabled:c=!1}=t,d="".concat(e,"-").concat(l.join(","),"-").concat(r,"-").concat(a,"-").concat(s),p=o.get(d);if(p)return p;if(r>a)return[];let m=i(e).map(e=>{var t;if(l.includes(e.name)||!e.interface||["sort","password","sequence"].includes(e.type))return;let o={type:"duplicate",tag:u(null==(t=e.uiSchema)?void 0:t.title)||e.name},i={...o,title:es.createElement(ic,o),key:s?"".concat(s,".").concat(e.name):e.name,isLeaf:!0,field:e,disabled:c},d=n.find(e=>e.name===i.key);if(["belongsTo","belongsToMany"].includes(e.type)&&(!d||["Select","Picker"].includes(null==d?void 0:d.fieldMode)))o.type="reference",i.type="reference",i.title=es.createElement(ic,{...o,type:"reference"}),i.isLeaf=!1,i.children=x(e.target,{depth:r+1,maxDepth:a,prefix:i.key,exclude:vF});else if(["hasOne","hasMany"].includes(e.type)||["Nester","SubTable"].includes(null==d?void 0:d.fieldMode)){let t=!1;["hasOne","hasMany"].includes(e.type)&&["Select","Picker"].includes(null==d?void 0:d.fieldMode)&&(t=!0),i.disabled=!0,i.isLeaf=!1,i.children=h(e.target,{depth:r+1,maxDepth:a,prefix:i.key,exclude:["id",...vF],disabled:t},n)}return i}).filter(Boolean);return o.set(d,m),m}),x=(l=new is.q({max:100}),(e,t)=>{let{prefix:n,maxDepth:o,depth:r=0,exclude:a=[]}=t,s="".concat(e,"-").concat(a.join(","),"-").concat(r,"-").concat(o,"-").concat(n),c=l.get(s);if(c)return c;if(r>o)return[];let d=i(e).map(e=>{var t,l;if(!e.target||!e.interface||a.includes(e.name))return;let i={type:"preloading",tag:u(null==(t=e.uiSchema)?void 0:t.title)||e.name},s=n?"".concat(n,".").concat(e.name):e.name;return{type:"preloading",tag:u(null==(l=e.uiSchema)?void 0:l.title)||e.name,title:es.createElement(ic,i),key:s,isLeaf:!1,field:e,children:x(e.target,{prefix:s,depth:r+1,maxDepth:o,exclude:a})}}).filter(Boolean);return l.set(s,d),d}),f=(0,es.useCallback)((e,t)=>{if(!e)return[];try{return h(e,{exclude:["id",...vF],maxDepth:1,disabled:!1},t)}catch(e){return console.error(e),[]}},[]);return{async run(){let o=new Set([]),l=new Set([]),i=(e,t)=>{var n;null==e||null==(n=e.reduceProperties)||n.call(e,(e,n)=>{var a,s,c;let d=e||t,u=n["x-collection-field"]&&r(n["x-collection-field"]),p=n.name.includes("."),m=u&&["hasOne","hasMany","belongsTo","belongsToMany"].includes(u.type),h=!m&&p?u9(n.name):n.name,x=""!==d&&d?d+"."+h:h;if(u&&!(["hasOne","hasMany"].includes(u.type)||["SubForm","Nester"].includes(null==(a=n["x-component-props"])?void 0:a.mode))&&l.add(x),u&&(m||p)&&"TableField"!==n["x-component"]){if(o.add({name:x,fieldMode:(null==(s=n["x-component-props"])?void 0:s.mode)||"Select"}),["Nester","SubTable"].includes(null==(c=n["x-component-props"])?void 0:c.mode)){let e=d&&""!==d?d+"."+n.name:n.name;i(n,e)}}else["ActionBar","Action","Action.Link","Action.Modal","Selector","Viewer","AddNewer","AssociationField.Selector","AssociationField.AddNewer","TableField"].includes(n["x-component"])||i(n,t)},t)};i(e,"");let u=f((null==d?void 0:d.collection)||t,[...o]);if(n)n(u,[...l],m);else{var h;null==s||s.field.form.query("fieldReaction.items.".concat(c,".layout.fields")).take(e=>{e.componentProps.treeData=[],setTimeout(()=>e.componentProps.treeData=u)}),null==s||s.field.value.splice(c,1,{...null==s||null==(h=s.field)?void 0:h.value[c],fields:[...l],treeData:u})}a.success(p("Sync successfully"))}}},iu=(0,ec.connect)(rS.A,(0,ec.mapProps)({value:"checkedKeys",dataSource:"treeData"}));iu.displayName="Tree";let ip=(e,t)=>null==e?void 0:e.map(e=>{let{dataId:n,...o}=e,l={...o};if(n){var r;l.dataScope={$and:[{id:{$eq:n}}]},l.titleField=(null==l?void 0:l.titleField)||(null==t||null==(r=t[e.collection])?void 0:r.titleField)||"id"}return l}),im=Tr((0,ec.observer)(e=>{let{formSchema:t,designerCtx:n,defaultValues:o,collectionName:l}=iq(e),{collectionList:r,getEnableFieldTree:i,getOnLoadData:a,getOnCheck:s,getScopeDataSource:c,useTitleFieldDataSource:d}=vj(l),{getCollection:u,getCollectionField:p}=sO(),{t:m}=(0,eT.useTranslation)(),h=(0,es.useMemo)(()=>(0,ec.observable)({...o,items:ip((null==o?void 0:o.items)||[],null==o?void 0:o.config)}),[]),x=e=>{var t;let n=u(e);return p("".concat(e,".").concat((null==h||null==(t=h.config[e])?void 0:t.titleField)||(null==n?void 0:n.titleField)||"id"))},f=e=>{var t,n;let o=u(e);return{label:ih((null==(n=h.config)||null==(t=n[e])?void 0:t.titleField)||(null==o?void 0:o.titleField)||"id"),value:"id"}},v=(e,t)=>{var n,o;let l=null==(o=h.config)||null==(n=o[e])?void 0:n.filter;return eu().isEmpty(l)?{}:d5(pA([l,ii(t)],"$or"))},g=(0,es.useMemo)(()=>({ArrayCollapse:it}),[]),y=(0,es.useMemo)(()=>({getEnableFieldTree:i,getTargetField:x,getFieldNames:f,getFilter:v,getResource:ix,getOnLoadData:a,getOnCheck:s,collectionName:l,getScopeDataSource:c,useTitleFieldDataSource:d}),[]),b=(0,es.useMemo)(()=>({type:"object",properties:{items:{type:"array",default:null==h?void 0:h.items,"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{extra:[(0,A.jsx)(rJ,{},"0")]},properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{layout:"vertical"},properties:{collection:{type:"string",title:'{{ t("Collection") }}',required:!0,description:m("If collection inherits, choose inherited collections as templates"),default:"{{ collectionName }}","x-display":r.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:r}},dataScope:{type:"object",title:'{{ t("Assign data scope for the template") }}',"x-decorator":"FormItem","x-component":"Filter","x-component-props":{dynamicComponent:rW},"x-decorator-props":{style:{marginBottom:"0px"}},required:!0,"x-reactions":[{dependencies:[".collection"],fulfill:{state:{disabled:"{{ !$deps[0] }}"},schema:{enum:"{{ getScopeDataSource($deps[0]) }}"}}}]},titleField:{type:"string","x-decorator":"FormItem",title:'{{ t("Title field") }}',"x-component":"Select",required:!0,"x-reactions":"{{useTitleFieldDataSource}}"},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":"Action.Link","x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:()=>id(t)}},fields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:m("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":iu,"x-component-props":{treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:"{{ getOnLoadData($self) }}",onCheck:"{{ getOnCheck($self) }}",rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection"],fulfill:{state:{disabled:"{{ !$deps[0] }}",componentProps:{treeData:"{{ getEnableFieldTree($deps[0], $self) }}"}}}}]}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"}}},properties:{add:{type:"void",title:'{{ t("Add template") }}',"x-component":"ArrayCollapse.Addition"}}},display:{type:"boolean","x-content":'{{ t("Display data template selector") }}',default:(null==h?void 0:h.display)!==!1,"x-decorator":"FormItem","x-component":"Checkbox"}}}),[]);return(0,A.jsx)(eV.Provider,{value:{...n,designable:!0},children:(0,A.jsx)(al,{components:g,scope:y,schema:b})})},{displayName:"FormDataTemplates"}),{displayName:"FormDataTemplates"});function ih(e){return e||"label"}function ix(e,t){return e!==t.componentProps.service.resource&&(t.value=void 0),e}let iv=Tr((0,ec.observer)(e=>{let{defaultValues:t,collectionName:n}=iq(e),o=(0,ec.useForm)(),l=eB(),{getChildrenCollections:r}=sO(),i=r(n),a=async e=>{var t,n;let{childrenCollections:r}=(null==(t=o.values)?void 0:t.enableChildren)||{};return null==(n=i.filter(t=>!r.find(e=>e.collection===t.name)||e.initialValue||t.name===e.value))?void 0:n.map(e=>({label:l(e.title),value:e.name}))};return(0,A.jsx)(al,{schema:{type:"object",properties:{childrenCollections:{type:"array",default:null==t?void 0:t.filter(e=>i.find(t=>t.name===e.collection)),"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},collection:{type:"string","x-decorator":"FormItem",required:!0,"x-component":"Select","x-component-props":{style:{width:260}},"x-reactions":["{{useAsyncDataSource(loadData)}}"]},title:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{style:{width:235}}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add collection") }}',"x-component":"ArrayItems.Addition"}}}}},scope:{useAsyncDataSource:e=>(t,n)=>{t.loading=!0,e(t,n).then(ec.action.bound(e=>{t.dataSource=e,t.loading=!1,t.initialValue&&(t.disabled=!0)}))},loadData:a}})}),{displayName:"EnableChildCollections"});function ig(){let e=(0,ns._)(["\n min-width: 400px;\n margin-right: 15;\n .ant-input {\n width: 100% !important;\n }\n "]);return ig=function(){return e},e}let iy=(0,nu.rU)(e=>{let{css:t}=e;return{variableInput:t(ig())}}),ib=(0,ec.observer)(e=>{let{styles:t}=iy(),{rootCollection:n,onChange:o,value:l,collectionField:r}=e,i=(0,ec.useFieldSchema)(),{currentFormSettings:a}=ls({collectionName:n,collectionField:r}),{currentObjectSettings:s}=lw({schema:null==r?void 0:r.uiSchema,collectionField:r}),c=eB()((0,es.useMemo)(()=>[a,s].filter(Boolean),[a,s]));return(0,es.useEffect)(()=>{o(i.default)},[]),(0,A.jsx)(P7.Input,{value:l,onChange:o,scope:c,className:t.variableInput})},{displayName:"ChildDynamicComponent"}),iC=es.forwardRef((e,t)=>{var n;let o=eh.ArrayBase.useArray(),l=eh.ArrayBase.useIndex(e.index),{t:r}=(0,eT.useTranslation)();return(0,A.jsx)(oh.A,{...e,checkedChildren:r("On"),unCheckedChildren:r("Off"),checked:!(null==o||null==(n=o.field)?void 0:n.value[l].disabled),size:"small",style:{transition:"all 0.25s ease-in-out",color:"rgba(0, 0, 0, 0.8)",fontSize:16,marginLeft:6,marginBottom:3},onChange:(e,t)=>{var n;t.stopPropagation(),o.field.value.splice(l,1,{...null==o||null==(n=o.field)?void 0:n.value[l],disabled:!e})},onClick:(e,t)=>{t.stopPropagation()}})});iC.displayName="EnableLinkage";var iS=n(91410),iw=n(98273);let iF=()=>iw.A.useToken(),ij=(0,nu.rU)(()=>({arrayCollapseItem:{marginBottom:"10px"}})),iA=e=>{var t;let n=eh.ArrayBase.useArray(),o=eh.ArrayBase.useIndex(e.index),{t:l}=(0,eT.useTranslation)(),r=null==n||null==(t=n.field)?void 0:t.value[o];return(0,A.jsx)(nJ.A.TextArea,{value:r.title,defaultValue:l("Linkage rule"),onChange:e=>{e.stopPropagation(),n.field.value.splice(o,1,{...r,title:e.target.value})},onBlur:e=>{e.stopPropagation(),n.field.value.splice(o,1,{...r,title:e.target.value})},autoSize:!0,style:{width:"70%",border:"none"},onClick:e=>{e.stopPropagation()}})},ik=e=>{var t,n;return(null==(n=e["x-component"])||null==(t=n.indexOf)?void 0:t.call(n,"Addition"))>-1},iI=e=>{var t,n;return(null==(n=e["x-component"])||null==(t=n.indexOf)?void 0:t.call(n,"Index"))>-1},iP=e=>{var t,n,o,l,r,i,a,s;return ik(e)||(null==(n=e["x-component"])||null==(t=n.indexOf)?void 0:t.call(n,"Remove"))>-1||(null==(l=e["x-component"])||null==(o=l.indexOf)?void 0:o.call(l,"MoveDown"))>-1||(null==(i=e["x-component"])||null==(r=i.indexOf)?void 0:r.call(i,"MoveUp"))>-1||(null==(s=e["x-component"])||null==(a=s.indexOf)?void 0:a.call(s,"Copy"))>-1},iT=e=>Array.from({length:e}).map((e,t)=>t),iN=(e,t)=>e<t?iT(e):iT(t),iM=(0,ec.observer)(e=>{let{styles:t}=ij(),n=(0,ec.useField)(),o=Array.isArray(n.value)?n.value:[],[l,r]=(0,es.useState)(iN(o.length,e.defaultOpenPanelCount)),i=(0,ec.useFieldSchema)();if((0,es.useEffect)(()=>{!n.modified&&o.length&&r(iN(o.length,e.defaultOpenPanelCount))},[o.length,n]),!i)throw Error("can not found schema object");return(0,A.jsxs)(eh.ArrayBase,{onAdd:e=>{r(l.length<=e?l.concat(e):l.reduce((t,n)=>n<e?t.concat(n):n===e?t.concat([n,n+1]):t.concat(n+1),[]))},children:[(()=>{if(!o.length)return(0,A.jsx)(rZ.A,{className:r6()("".concat(t.arrayCollapseItem),e.className),children:(0,A.jsx)(op.A,{})})})(),(0,A.jsx)(r0.A,{...e,activeKey:l,onChange:e=>r((0,ec.toArr)(e).map(Number)),className:r6()("".concat(t.arrayCollapseItem),e.className),children:o.map((e,t)=>{let o,l,r,a=Array.isArray(i.items)?i.items[t]||i.items[0]:i.items,s=n.query("".concat(n.address,".").concat(t)).get("componentProps"),c=a["x-component-props"],d=(0,A.jsxs)(eh.ArrayBase.Item,{index:t,record:e,children:[(0,A.jsx)(ec.RecursionField,{schema:a,name:t,filterProperties:e=>!!iP(e),onlyRenderProperties:!0}),null==s?void 0:s.extra]}),u=(0,A.jsx)(ec.RecursionField,{schema:a,name:t,filterProperties:e=>!(iI(e)||iP(e))});return(0,es.createElement)(r0.A.Panel,{...c,...s,forceRender:!0,key:t,header:(o="".concat((null==s?void 0:s.header)||c.header||n.title),l=n.address.concat(t),r=n.form.queryFeedbacks({type:"error",address:"".concat(l,".**")}),(0,A.jsxs)(eh.ArrayBase.Item,{index:t,record:()=>{var e;return null==(e=n.value)?void 0:e[t]},children:[(0,A.jsx)(ec.RecursionField,{schema:a,name:t,filterProperties:e=>!!iI(e),onlyRenderProperties:!0}),r.length?(0,A.jsx)(r1.A,{size:"small",className:"errors-badge",count:r.length,children:o}):(0,A.jsx)(iA,{item:e.initialValue||e,index:t})]})),extra:d},(0,A.jsx)(eh.ArrayBase.Item,{index:t,record:e,children:u},t))})}),i.reduceProperties((e,t,n)=>ik(t)?(0,A.jsx)(ec.RecursionField,{schema:t,name:n}):e,null)]})},{displayName:"ArrayCollapse"}),iD=e=>{let{children:t}=e;return(0,A.jsx)(es.Fragment,{children:t})};iD.displayName="CollapsePanel",iM.defaultProps={defaultOpenPanelCount:5},iM.displayName="ArrayCollapse",iM.CollapsePanel=iD,eh.ArrayBase.mixin(iM),iM.Copy=es.forwardRef((e,t)=>{var n;let{token:o}=iF(),l=(0,ec.useField)(),r=eh.ArrayBase.useArray(),i=eh.ArrayBase.useIndex(e.index);return r&&(null==(n=r.field)?void 0:n.pattern)==="editable"?(0,A.jsx)(rQ.A,{...e,style:{transition:"all 0.25s ease-in-out",color:o.colorText,fontSize:o.fontSizeLG,marginLeft:6},ref:t,onClick:t=>{var n,o;if((null==l?void 0:l.disabled)||(t.stopPropagation(),null==(n=r.props)?void 0:n.disabled))return;let a=(0,ed.cloneDeep)(null==r||null==(o=r.field)?void 0:o.value[i]);r.field.push(a),e.onClick&&e.onClick(t)}}):null}),iM.Copy.displayName="ArrayCollapse.Copy";let iR=()=>({}),iq=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{useProps:t=iR,...n}=e,o=t;"function"!=typeof t&&(o=iR);let l=o();return{...n,...l}},i_=(0,es.createContext)(null);i_.displayName="RemoveActionContext";let iO=(0,es.createContext)(null);iO.displayName="FilterContext";let iB=(0,es.createContext)(null);iB.displayName="LinkageLogicContext";var iE=n(1906),iV=n(31724),iz=n(51039),iL=n(12498),iG=n(11136),iK=n(62682);let i$=()=>(0,A.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:(0,A.jsx)("path",{d:"M0 0h3v3H0V0zm4.5 0h3v3h-3V0zM9 0h3v3H9V0zM0 4.5h3v3H0v-3zm4.503 0h3v3h-3v-3zM9 4.5h3v3H9v-3zM0 9h3v3H0V9zm4.503 0h3v3h-3V9zM9 9h3v3H9V9z"})}),iU=()=>(0,A.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:(0,A.jsx)("path",{d:"M730.6 64.7H295.4c-19.9 0-36 16.1-36 36v160.1c0 19.9 16.1 36 36 36h435.2c19.9 0 36-16.1 36-36V100.7c0-19.9-16.1-36-36-36z m-36 160.1H331.4v-88.1h363.2v88.1zM650.6 395.8H375.4c-64 0-116 52.1-116 116 0 64 52.1 116 116 116h275.2c64 0 116-52.1 116-116 0-64-52-116-116-116z m0 160H375.4c-24.3 0-44-19.8-44-44 0-24.3 19.8-44 44-44h275.2c24.3 0 44 19.8 44 44 0 24.3-19.7 44-44 44zM729 727.7H293.7c-19.9 0-36 16.1-36 36v160.1c0 19.9 16.1 36 36 36H729c19.9 0 36-16.1 36-36V763.7c0-19.9-16.2-36-36-36z m-36 160.1H329.7v-88.1H693v88.1zM183.4 167.5c-34.4 17.4-63.5 44-84 76.7C78.2 277.9 67 316.9 67 356.8c0 47.6 15.4 92.5 44.5 130 0.1 0.1 0.2 0.3 0.3 0.4L70 513.9c-4.5 2.9-3.3 9.8 1.9 10.9l115.9 25.5c3.2 0.7 6.4-1.3 7.1-4.5l26-115.6c1.2-5.2-4.6-9.2-9.1-6.4l-39.6 25.1c-1.1-2.2-2.4-4.3-3.9-6.2-19.2-24.7-29.4-54.4-29.4-85.9 0-53.1 29.5-101 76.9-125.1 17.7-9 24.8-30.6 15.8-48.4s-30.5-24.8-48.2-15.8zM948.5 837.5l-36.3-29.9c1-1 2.1-2.1 3-3.3 28.9-35.8 44.8-80.8 44.8-126.9 0-36.1-9.7-71.6-27.9-102.6-17.7-30-43-55.1-73.2-72.6-5.1-2.9-10.3-5.7-15.6-8.2-18-8.4-39.4-0.6-47.9 17.4-8.4 18-0.6 39.4 17.4 47.9 3.4 1.6 6.8 3.4 10.1 5.2C863 588 888 631.2 888 677.5c0 30.1-10 58.3-28.8 81.7-0.8 1-1.5 2-2.2 3l-38.3-31.5c-4.1-3.4-10.3-0.1-9.8 5.2L820.7 854c0.3 3.3 3.3 5.7 6.5 5.4l117.9-11.3c5.5-0.5 7.5-7.2 3.4-10.6z"})}),iW=()=>(0,A.jsxs)("svg",{viewBox:"0 0 1024 1024",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:[(0,A.jsx)("path",{d:"M928 128H832V32c0-19.2-12.8-32-32-32s-32 12.8-32 32V128H256V32c0-19.2-12.8-32-32-32S192 12.8 192 32V128H96C44.8 128 0 172.8 0 224v640c0 51.2 44.8 96 96 96h384c19.2 0 32-12.8 32-32s-12.8-32-32-32h-384c-19.2 0-32-12.8-32-32v-640c0-19.2 12.8-32 32-32h832c19.2 0 32 12.8 32 32v256c0 19.2 12.8 32 32 32s32-12.8 32-32v-256c0-51.2-44.8-96-96-96z"}),(0,A.jsx)("path",{d:"M902.4 729.6c32-32 57.6-70.4 57.6-121.6C960 518.4 889.6 448 800 448S640 518.4 640 608c0 51.2 25.6 89.6 57.6 121.6C627.2 768 576 838.4 576 928v64c0 19.2 12.8 32 32 32h384c19.2 0 32-12.8 32-32v-64c0-89.6-51.2-160-121.6-198.4zM704 608c0-51.2 44.8-96 96-96s96 44.8 96 96-44.8 96-96 96-96-44.8-96-96z m179.2 185.6l-83.2 64-83.2-64c25.6-12.8 51.2-25.6 83.2-25.6s57.6 6.4 83.2 25.6zM960 960h-320v-32c0-32 12.8-64 25.6-89.6l115.2 83.2c6.4 6.4 12.8 6.4 19.2 6.4s12.8 0 19.2-6.4l115.2-83.2c19.2 25.6 25.6 57.6 25.6 89.6v32zM761.6 364.8c-12.8-12.8-32-12.8-44.8 0L416 627.2 281.6 486.4c-12.8-12.8-32-12.8-44.8 0s-12.8 32 0 44.8l160 160c0 12.8 12.8 12.8 19.2 12.8 6.4 0 12.8 0 19.2-6.4l320-288c12.8-12.8 19.2-32 6.4-44.8z"})]}),iH=()=>(0,A.jsx)("svg",{fillRule:"evenodd",viewBox:"0 0 34 34",focusable:"false",fill:"currentColor","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:(0,A.jsx)("g",{id:"Component 11",children:(0,A.jsxs)("g",{id:"Group 31",children:[(0,A.jsx)("path",{id:"Ellipse 42",d:"M16.8963 7C14.6872 7 12.8963 8.79086 12.8963 11C12.8963 12.2907 13.5076 13.4385 14.4564 14.1699C14.7966 14.4322 15.018 14.8415 14.9526 15.266L14.6723 17.0856C14.5972 17.5734 14.1774 17.9334 13.6839 17.9334H10.999C10.4467 17.9334 9.99902 18.3811 9.99902 18.9334V22.012",stroke:"white",strokeWidth:"1.5"}),(0,A.jsx)("path",{id:"Ellipse 43",d:"M19.3365 14.1699L18.8786 13.5759L18.8786 13.5759L19.3365 14.1699ZM18.8404 15.266L19.5816 15.1518L19.5816 15.1518L18.8404 15.266ZM19.1207 17.0856L19.8619 16.9714L19.8619 16.9714L19.1207 17.0856ZM10.0008 22.762C9.58658 22.762 9.2508 22.4262 9.2508 22.012C9.2508 21.5978 9.58658 21.262 10.0008 21.262V22.762ZM20.1466 11C20.1466 9.20507 18.6916 7.75 16.8966 7.75V6.25C19.52 6.25 21.6466 8.37665 21.6466 11H20.1466ZM18.8786 13.5759C19.6512 12.9804 20.1466 12.0482 20.1466 11H21.6466C21.6466 12.5331 20.9195 13.8967 19.7944 14.764L18.8786 13.5759ZM19.5816 15.1518L19.8619 16.9714L18.3794 17.1998L18.0991 15.3802L19.5816 15.1518ZM20.109 17.1834H22.7939V18.6834H20.109V17.1834ZM24.5439 18.9334V21.012H23.0439V18.9334H24.5439ZM22.7939 22.762H10.0008V21.262H22.7939V22.762ZM24.5439 21.012C24.5439 21.9785 23.7604 22.762 22.7939 22.762V21.262C22.932 21.262 23.0439 21.1501 23.0439 21.012H24.5439ZM22.7939 17.1834C23.7604 17.1834 24.5439 17.9669 24.5439 18.9334H23.0439C23.0439 18.7953 22.932 18.6834 22.7939 18.6834V17.1834ZM19.8619 16.9714C19.8807 17.0934 19.9856 17.1834 20.109 17.1834V18.6834C19.2454 18.6834 18.5109 18.0534 18.3794 17.1998L19.8619 16.9714ZM19.7944 14.764C19.6085 14.9072 19.5686 15.067 19.5816 15.1518L18.0991 15.3802C17.9814 14.6161 18.3842 13.9571 18.8786 13.5759L19.7944 14.764Z",fill:"white"}),(0,A.jsx)("path",{id:"Vector 5",d:"M10.0479 25.0195H23.7546",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),iY=()=>(0,A.jsx)("svg",{viewBox:"0 0 1024 1024",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,A.jsx)("path",{d:"M852.992 732.238769l-2.835692 2.914462a37.966769 37.966769 0 0 1-60.179693-8.979693 35.209846 35.209846 0 0 1 4.726154-38.912l8.979693-10.318769A365.252923 365.252923 0 1 0 219.766154 677.415385l6.301538 8.507077a37.179077 37.179077 0 0 1-5.671384 51.2l-0.315077 0.236307a34.737231 34.737231 0 0 1-49.388308-3.938461 438.272 438.272 0 1 1 682.141539-1.181539z m-153.6-386.126769a218.584615 218.584615 0 0 1 2.914462 217.088l-1.890462 3.623385a37.021538 37.021538 0 0 1-46.631385 17.959384 34.028308 34.028308 0 0 1-19.219692-44.110769l14.572308-37.257846a146.116923 146.116923 0 1 0-276.716308 1.339077l13.705846 34.894769a34.658462 34.658462 0 0 1-19.692307 44.898462l-0.551385 0.236307a36.312615 36.312615 0 0 1-46.473846-20.243692A218.978462 218.978462 0 0 1 619.126154 267.264c33.083077 18.904615 60.652308 46.08 80.108308 78.848h0.078769zM487.108923 607.704615a32.846769 32.846769 0 0 1 49.939692 0l291.446154 310.35077a28.199385 28.199385 0 0 1 2.520616 30.404923 31.507692 31.507692 0 0 1-27.096616 16.147692H220.16a31.507692 31.507692 0 0 1-27.490462-16.384 28.750769 28.750769 0 0 1 0-30.168615l294.596924-310.35077z m255.369846 298.692923l-230.006154-235.756307-230.793846 235.756307h460.721231z"})}),iX=()=>(0,A.jsx)("svg",{viewBox:"0 0 1024 1024",width:"1em",height:"1em",fill:"currentColor",children:(0,A.jsx)("path",{d:"M979.689326 108.982857H356.219611A144.530286 144.530286 0 0 0 217.028754 0c-64.804571 0.731429-121.124571 45.348571-137.654857 108.982857H44.045897a36.571429 36.571429 0 0 0-37.814857 15.798857 37.741714 37.741714 0 0 0 0 41.545143 36.571429 36.571429 0 0 0 37.814857 15.798857h35.328c15.945143 64.219429 72.411429 109.494857 137.654857 110.445715a144.530286 144.530286 0 0 0 139.117715-108.982858h623.542857a37.156571 37.156571 0 0 0 29.549714-36.571428 37.156571 37.156571 0 0 0-29.549714-36.571429v-1.462857zM144.909897 146.285714c0-40.374857 32.329143-73.142857 72.118857-73.142857s72.118857 32.768 72.118857 73.142857c0 19.382857-7.606857 38.034286-21.211428 51.712A71.533714 71.533714 0 0 1 217.101897 219.428571a72.630857 72.630857 0 0 1-72.118857-73.142857z m834.779429 694.125715H356.219611A144.530286 144.530286 0 0 0 217.028754 731.428571c-64.804571 0.731429-121.124571 45.348571-137.654857 108.982858H44.045897a36.571429 36.571429 0 0 0-37.814857 15.798857 37.741714 37.741714 0 0 0 0 41.545143 36.571429 36.571429 0 0 0 37.814857 15.798857h35.328c15.945143 64.219429 72.411429 109.494857 137.654857 110.445714a144.530286 144.530286 0 0 0 139.117715-108.982857h623.542857a36.571429 36.571429 0 0 0 37.814857-15.798857 37.741714 37.741714 0 0 0 0-41.545143 36.571429 36.571429 0 0 0-37.814857-15.798857v-1.462857zM144.909897 877.714286c0-40.374857 32.329143-73.142857 72.118857-73.142857s72.118857 32.768 72.118857 73.142857c0 19.382857-7.606857 38.034286-21.211428 51.712a71.533714 71.533714 0 0 1-50.907429 21.430857 72.630857 72.630857 0 0 1-72.118857-73.142857zM43.972754 474.697143h623.616A144.530286 144.530286 0 0 1 806.706469 365.714286c64.804571 0.731429 121.124571 45.348571 137.654857 108.982857h34.596571a36.571429 36.571429 0 0 1 37.814857 15.798857 37.741714 37.741714 0 0 1 0 41.545143 36.571429 36.571429 0 0 1-37.814857 15.798857h-34.596571A144.603429 144.603429 0 0 1 806.779611 658.285714a144.530286 144.530286 0 0 1-139.117714-108.982857H44.045897a36.571429 36.571429 0 0 1-37.814857-15.798857 37.741714 37.741714 0 0 1 0-41.545143 36.571429 36.571429 0 0 1 37.814857-15.798857v-1.462857zM807.803611 585.142857a73.142857 73.142857 0 1 0 0-146.285714 73.142857 73.142857 0 0 0 0 146.285714z"})}),iJ=()=>(0,A.jsx)("svg",{viewBox:"0 0 1024 1024",width:"1em",height:"1em",fill:"currentColor",children:(0,A.jsx)("path",{d:"M832.256 133.162667l60.330667 60.373333a128 128 0 0 1 0 180.992l-108.16 108.202667 119.765333 119.765333a128 128 0 0 1 0 181.034667l-120.661333 120.661333a128 128 0 0 1-181.034667 0l-119.765333-119.765333-93.866667 93.866666a42.666667 42.666667 0 0 1-21.802667 11.648L140.757333 935.253333a42.666667 42.666667 0 0 1-50.176-50.218666l45.226667-226.261334a42.666667 42.666667 0 0 1 11.690667-21.76L651.221333 133.12a128 128 0 0 1 181.034667 0z m-93.098667 394.794666l-211.2 211.2 36.821334 36.821334 45.269333-45.226667a32 32 0 0 1 48.341333 41.642667l-3.072 3.584-45.226666 45.226666 37.674666 37.76a64 64 0 0 0 85.632 4.394667l4.864-4.394667 120.704-120.704a64 64 0 0 0 4.394667-85.632l-4.394667-4.864-119.808-119.808z m-155.818666-236.373333l-386.048 386.048-37.674667 188.586667 188.544-37.76 386.048-386.048-150.869333-150.826667zM415.36 114.048l6.144 5.76 121.557333 121.557333-45.226666 45.226667-121.6-121.557333a64 64 0 0 0-85.632-4.394667l-4.864 4.394667-120.704 120.704a64 64 0 0 0-4.394667 85.632l4.394667 4.864 37.717333 37.717333L278.186667 338.517333a32 32 0 0 1 48.341333 41.685334l-3.072 3.584-75.434667 75.434666 38.613334 38.570667-45.269334 45.226667-121.6-121.514667a128 128 0 0 1-5.717333-174.890667l5.76-6.144 120.661333-120.661333a128 128 0 0 1 174.890667-5.76z m281.173333 64.384l-67.925333 67.882667 150.869333 150.869333 67.84-67.882667a64 64 0 0 0 0-90.538666l-60.330666-60.330667a64 64 0 0 0-90.453334 0z"})}),iQ=()=>(0,A.jsx)("svg",{viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,A.jsxs)("g",{id:"Component 10",children:[(0,A.jsx)("circle",{id:"Ellipse 52",cx:"16.9991",cy:"8.50005",r:"1.51323",fill:"white"}),(0,A.jsx)("path",{id:"Vector",d:"M24.4041 18.5198C23.276 17.6737 22.4299 15.488 22.4299 13.0203C22.4299 11.1166 20.9493 9.35392 18.7635 8.71935C17.0009 8.22581 15.2382 8.71935 15.1677 8.71935C12.982 9.42442 11.5013 11.1166 11.5013 13.0203C11.5013 15.488 10.7258 17.6737 9.52714 18.5198C8.96308 19.0134 8.54004 19.7889 8.54004 20.494C8.54004 21.2696 9.24511 22.3859 10.0207 22.3859H23.9811C24.7566 22.3859 25.4617 21.2696 25.4617 20.494C25.4617 19.7889 25.0387 19.0134 24.4041 18.5198ZM23.5382 20.4235H10.4132C10.4132 20.212 10.5542 20.0005 10.7657 19.8594C12.3874 18.8018 13.6348 15.9816 13.6348 12.8793C13.6348 11.3986 14.8857 10.5068 17.0009 10.5068C19.1161 10.5068 20.4156 11.3281 20.4156 12.8793C20.4156 15.9111 21.564 18.8018 23.2562 19.93C23.3267 20.0005 23.4677 20.1415 23.5382 20.4235ZM18.0441 23.2438C17.903 23.6668 17.5649 23.9489 17.0009 23.9489C16.4368 23.9489 16.1287 23.6668 15.9877 23.2438H14.1101V23.3143C14.3921 24.7244 15.8023 25.5 17.0009 25.5C18.1995 25.5 19.5391 24.7244 19.8917 23.3143V23.2438H18.0441Z",fill:"white"})]})}),iZ=new Map;function i0(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;iZ.set(e.toLowerCase(),t)}function i1(e){return!!e&&iZ.has(e.toLowerCase())}function i2(e){Object.keys(e).forEach(t=>{i0(t,e[t])})}Object.keys(iL).forEach(e=>{e.endsWith("Outlined")&&i0(e,iL[e])});let i6=e=>{let{type:t="",component:n,...l}=e;if(n)return(0,A.jsx)(iG.A,{component:n,...l});if(t&&iZ.has(t.toLowerCase())){let e=iZ.get(t.toLowerCase());return(0,A.jsx)(e,{...l})}return t&&o?(0,A.jsx)(o,{type:t,...l}):null};for(let e in i6.createFromIconfontCN=e=>{o=(0,iK.A)(e)},i6.register=e=>{i2(e)},h){let t=t=>(0,A.jsx)(i6,{component:h[e],...t});i6.register({[e]:t})}let i3=()=>{let{designable:e,setDesignable:t}=eY(),{t:n}=(0,eT.useTranslation)(),{token:o}=iF(),l={};return e&&(l.backgroundColor="var(--colorSettings)"),(0,iz.vC)("Ctrl+Shift+U",()=>t(!e),[e]),(0,A.jsx)(iV.A,{title:n("UI Editor"),children:(0,A.jsx)(e3.Ay,{"data-testid":"ui-editor-button",icon:(0,A.jsx)(i6,{type:"Design",style:{color:o.colorTextHeaderMenu,fill:o.colorTextHeaderMenu}}),title:n("UI Editor"),style:l,onClick:()=>{t(!e)}})})};class i5 extends eR{async load(){this.addComponents()}addComponents(){this.app.addComponents({DesignableSwitch:i3})}}let i4=()=>(0,es.useContext)(ec.SchemaOptionsContext)||{},i8=(0,es.memo)(e=>{let{children:t}=e,n=i4(),o=(0,es.useMemo)(()=>({...n.components,...e.components}),[n.components,e.components]),l=(0,es.useMemo)(()=>({...n.scope,...e.scope}),[n.scope,e.scope]),r=(0,es.useMemo)(()=>({scope:l,components:o}),[l,o]);return(0,A.jsx)(ec.SchemaOptionsContext.Provider,{value:r,children:(0,A.jsx)(ec.SchemaComponentsContext.Provider,{value:o,children:(0,A.jsx)(ec.ExpressionScope,{value:l,children:t})})})});i8.displayName="SchemaComponentOptions";let i7=e=>{let{children:t,form:n,...o}=e,l=(0,es.useContext)(ec.SchemaOptionsContext),r=(0,es.useContext)(ec.SchemaExpressionScopeContext),i={...null==l?void 0:l.scope,...r},a={...null==l?void 0:l.components};return(0,A.jsx)(ec.FormProvider,{...o,form:n,children:(0,A.jsx)(i8,{components:a,scope:i,children:t})})},i9=e=>{let{children:t,...n}=e,o=(0,es.useContext)(ec.SchemaOptionsContext),l=(0,es.useContext)(ec.SchemaExpressionScopeContext),r={...null==o?void 0:o.scope,...l},i={...null==o?void 0:o.components},a=(0,es.useMemo)(()=>(0,ec.createForm)(),[]);return(0,A.jsx)(ec.FormProvider,{...n,form:a,children:(0,A.jsx)(i8,{components:i,scope:r,children:t})})},ae=e=>e.form?(0,A.jsx)(i7,{...e}):(0,A.jsx)(i9,{...e});function at(e){return ec.Schema.isSchemaInstance(e)?e:new ec.Schema((null==e?void 0:e.name)?{type:"object",properties:{[e.name]:e}}:e)}let an=e=>{let{components:t,scope:n,schema:o,...l}=e,r=(0,es.useContext)(eV),i=(0,es.useMemo)(()=>at(o),[o]);return(0,A.jsx)(eV.Provider,{value:{...r,refresh:()=>{var t,n;null==(t=r.refresh)||t.call(r),null==(n=e.onChange)||n.call(e,i)}},children:(0,A.jsx)(i8,{inherit:!0,components:t,scope:n,children:(0,A.jsx)(ec.RecursionField,{...l,schema:i})})})},ao=e=>{let{schema:t,...n}=e,o=(0,es.useMemo)(()=>at(t),[]);return(0,A.jsx)(an,{...n,schema:o})},al=e=>{let{memoized:t,...n}=e;return t?(0,A.jsx)(ao,{...n}):(0,A.jsx)(an,{...n})},ar=e=>e,ai=e=>{let{noForm:t,onlyRenderProperties:n,hidden:o,scope:l,uid:r,components:i,onSuccess:a,schemaTransform:s=ar}=e,{reset:c}=SA(),d={url:"/uiSchemas:".concat(n?"getProperties":"getJsonSchema","/").concat(r)},u=(0,es.useMemo)(()=>(0,ec.createForm)(),[r]),{data:p,loading:m}=ek(d,{refreshDeps:[r],onSuccess(e){a&&a(e),c&&c()}});if(!m&&!o&&p)return t?(0,A.jsx)(al,{components:i,scope:l,schema:s((null==p?void 0:p.data)||{})}):(0,A.jsx)(ae,{form:u,children:(0,A.jsx)(al,{components:i,scope:l,schema:s((null==p?void 0:p.data)||{})})})},aa=e=>e.uid?(0,A.jsx)(ai,{...e}):null,as=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(e).concat((0,ec.uid)())};ec.Schema.silent(!0);let ac={},ad={silent:!0,compile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=()=>{if(!ad.silent)return Function("$root","with($root) { return (".concat(e,"); }"))(t);try{return Function("$root","with($root) { return (".concat(e,"); }"))(t)}catch{return"{{".concat(e,"}}")}};return ac[e]?ac[e]:e.trim().startsWith("t(")?(ac[e]=n(),ac[e]):n()}};ec.Schema.registerCompiler(ad.compile);let au=e=>{let{designable:t,onDesignableChange:n,components:o,children:l}=e,[r,i]=(0,es.useState)((0,ec.uid)()),[a,s]=(0,es.useState)((0,ec.uid)()),c=(0,es.useMemo)(()=>e.form||(0,ec.createForm)(),[a]),{t:d}=(0,eT.useTranslation)(),u=(0,es.useMemo)(()=>({...e.scope,t:d,randomString:as}),[e.scope,d]),[p,m]=(0,es.useState)(t),h=(0,es.useMemo)(()=>({scope:u,components:o,reset:()=>s((0,ec.uid)()),refresh:()=>{i((0,ec.uid)())},designable:"boolean"==typeof t?t:p,setDesignable:e=>{"boolean"!=typeof t&&m(e),null==n||n(e)}}),[r,u,o,t,p]);return(0,A.jsx)(eV.Provider,{value:h,children:(0,A.jsx)(ec.FormProvider,{form:c,children:(0,A.jsx)(i8,{inherit:!0,scope:u,components:o,children:l})})})};au.displayName="SchemaComponentProvider";let ap=e=>{let{dynamicComponent:t,disabled:n}=(0,es.useContext)(iO)||{},o=eE(t),l=(0,es.useMemo)(()=>(0,ec.createForm)({values:{value:e.value},disabled:n,effects(){(0,ec.onFieldValueChange)("value",t=>{var n;null==e||null==(n=e.onChange)||n.call(e,t.value)})}}),[JSON.stringify(e.schema),JSON.stringify(e.value)]),r=()=>{var t;return(0,A.jsx)(ec.FieldContext.Provider,{value:null,children:(0,A.jsx)(al,{schema:{"x-component":"Input",...e.schema,"x-component-props":(0,ec.merge)((null==e||null==(t=e.schema)?void 0:t["x-component-props"])||{},{style:{minWidth:150,width:"100%"}}),name:"value","x-read-pretty":!1,"x-validator":void 0,"x-decorator":void 0}})})};return(0,A.jsx)(ec.FormContext.Provider,{value:l,children:o?es.createElement(o,{value:e.value,onChange:null==e?void 0:e.onChange,renderSchemaComponent:r}):r()})};var am=((a={}).Visible="visible",a.Editable="editable",a.ReadOnly="disabled",a.ReadPretty="readPretty",a.None="none",a.Hidden="hidden",a.Required="required",a.InRequired="notRequired",a.Disabled="disabled",a.Value="value",a.Active="enabled",a);let ah=function(){var e;let t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1?arguments[1]:void 0,l=o;return null==n||null==(e=n.forEach)||e.call(n,(e,n)=>{let o=l.find(t=>t.name===e);o&&(t=o),l=(null==o?void 0:o.children)||[]}),t},ax=e=>{let t=(0,ec.useField)(),n=(0,es.useContext)(iB);return(0,es.useEffect)(()=>{var n;t.data={...t.initialValue||t.value};let o=null==(n=t.data)?void 0:n.targetFields,l=o&&ah(o,e)||{},r=(null==l?void 0:l.operators)||[];t.data.operators=r,t.data.schema=null==l?void 0:l.schema},[n]),{fields:e,...t.data,setDataIndex(n){let o=ah(n,e);t.data=t.data||{};let l=null==o?void 0:o.operators;t.data.operators=null==l?void 0:l.filter(e=>!0),t.data.schema=null==o?void 0:o.schema,t.value=t.value||[],t.data.operator=void 0,t.data.value=void 0,t.value={...t.value,targetFields:n,operator:void 0,value:void 0}},setOperator(e){t.data.operator=e,t.value={...t.value,operator:e}},setValue(e){t.data.value=e,t.value={...t.value,value:e}}}},{Option:af}=oo.A,av=e=>{let{fieldValue:t,schema:n,setValue:o,collectionName:l}=e,[r,i]=(0,es.useState)((null==t?void 0:t.mode)||"constant"),{t:a}=(0,eT.useTranslation)(),{form:s}=Tp(),c=rU({collectionField:{uiSchema:n},form:s,record:m3(),uiSchema:n,noDisabled:!0}),{compatOldVariables:d}=rY({collectionField:{uiSchema:n,collectionName:l},uiSchema:n,blockCollectionName:l}),u=(0,es.useMemo)(()=>({minWidth:150,maxWidth:430,marginLeft:5}),[]),p=(0,es.useCallback)(e=>{o({mode:r,value:e})},[r,o]),m=(0,es.useMemo)(()=>({minWidth:150,maxWidth:430,fontSize:13}),[]),h=(0,es.useCallback)(e=>{let t=e.replaceAll("".concat(l,"."),"").replaceAll("$system.","").trim();o({mode:r,value:e,result:t})},[l,r,o]),x=(0,es.useMemo)(()=>({minWidth:460,marginRight:15}),[]),f=(0,es.useMemo)(()=>d(c,{value:null==t?void 0:t.value}),[d,null==t?void 0:t.value,c]),v={constant:(0,A.jsx)("div",{role:"button","aria-label":"dynamic-component-linkage-rules",style:u,children:es.createElement(ap,{value:(null==t?void 0:t.value)||t,schema:n,onChange:p})}),express:(0,A.jsxs)("div",{role:"button","aria-label":"dynamic-component-linkage-rules",style:m,children:[(0,A.jsx)(P7.TextArea,{value:null==t?void 0:t.value,onChange:h,scope:f,style:x}),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra",children:[a("Syntax references"),":"]}),(0,A.jsx)("a",{href:"https://formulajs.info/functions/",target:"_blank",rel:"noreferrer",children:"Formula.js"})]})]})};return(0,A.jsxs)(of.A.Compact,{children:[(0,A.jsxs)(oo.A,{role:"button","data-testid":"select-linkage-value-type",value:r,style:{width:150},onChange:e=>{i(e),o({mode:e})},children:[(0,A.jsx)(af,{value:"constant",children:a("Constant value")}),(0,A.jsx)(af,{value:"express",children:a("Expression")}),(0,A.jsx)(af,{value:"empty",children:a("Empty")})]}),v[r]]})};function ag(){let e=(0,ns._)(["\n .ant-space {\n display: inline-block;\n }\n "]);return ag=function(){return e},e}function ay(){let e=(0,ns._)(["\n .ant-space {\n display: inline-block;\n }\n .ant-space-item {\n max-width: 95%;\n display: inline-block;\n margin: 2px;\n vertical-align: top;\n }\n "]);return ay=function(){return e},e}function ab(){let e=(0,ns._)(["\n min-width: 120px;\n "]);return ab=function(){return e},e}function aC(){let e=(0,ns._)(["\n min-width: 160px;\n "]);return aC=function(){return e},e}let aS=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(ag()),item:t(ay()),select:t(ab()),tree:t(aC())}}),aw=(0,ec.observer)(e=>{let{value:t,options:n,collectionName:o}=e,{styles:l}=aS(),{t:r}=(0,eT.useTranslation)(),i=eB(),a=(0,es.useContext)(i_),{schema:s,fields:c,operator:d,setDataIndex:u,setOperator:p,setValue:m,value:h,operators:x}=ax(n);return(0,A.jsx)(iB.Provider,{value:(0,ec.uid)(),children:(0,A.jsx)("div",{style:{marginBottom:8},className:l.container,children:(0,A.jsxs)(of.A,{className:l.item,children:[(0,A.jsx)(eh.TreeSelect,{role:"button","data-testid":"select-linkage-property-field",className:l.tree,fieldNames:{label:"title",value:"name",children:"children"},treeCheckable:!0,value:null==t?void 0:t.targetFields,multiple:!0,allowClear:!0,treeData:i(c),onChange:e=>{u(e)},placeholder:r("Select field")}),(0,A.jsx)(oo.A,{role:"button","data-testid":"select-linkage-action-field",popupMatchSelectWidth:!1,value:d,className:l.select,options:i(x),onChange:e=>{p(e)},placeholder:r("action")}),[am.Value].includes(d)&&(0,A.jsx)(av,{fieldValue:h,schema:s,setValue:m,collectionName:o}),!e.disabled&&(0,A.jsx)("a",{role:"button","aria-label":"icon-close",children:(0,A.jsx)(iE.A,{onClick:()=>a(),style:{color:"#bfbfbf"}})})]})})})},{displayName:"FormFieldLinkageRuleAction"}),aF=(0,ec.observer)(e=>{let{value:t,options:n}=e,{t:o}=(0,eT.useTranslation)(),l=eB(),[r,i]=(0,es.useState)(!1),a=(0,es.useContext)(i_),{schema:s,operator:c,setOperator:d,setValue:u}=ax(n),p=(0,es.useMemo)(()=>l([{label:o("Visible"),value:am.Visible,schema:{}},{label:o("Hidden"),value:am.Hidden,schema:{}},{label:o("Disabled"),value:am.Disabled,schema:{}},{label:o("Enabled"),value:am.Active,schema:{}}]),[l,o]),m=(0,es.useCallback)(e=>{i([am.Value].includes(e)),d(e)},[d]),h=(0,es.useCallback)(e=>{u(e)},[u]),x=(0,es.useMemo)(()=>({color:"#bfbfbf"}),[]);return(0,A.jsx)("div",{style:{marginBottom:8},children:(0,A.jsxs)(of.A,{children:[(0,A.jsx)(oo.A,{"data-testid":"select-linkage-properties",popupMatchSelectWidth:!1,value:c,options:p,onChange:m,placeholder:o("action")}),r&&es.createElement(ap,{value:t,schema:s,onChange:h}),!e.disabled&&(0,A.jsx)("a",{role:"button","aria-label":"icon-close",children:(0,A.jsx)(iE.A,{onClick:a,style:x})})]})})},{displayName:"FormButtonLinkageRuleAction"}),aj=(0,ec.observer)(e=>{var t;let{type:n,linkageOptions:o}=e,l=(0,ec.useField)();return null==l||null==(t=l.value)?void 0:t.map((t,r)=>(0,A.jsx)(i_.Provider,{value:()=>l.remove(r),children:(0,A.jsx)(ec.ObjectFieldComponent,{name:r,component:["button"===n?aF:aw,{...e,options:o}]})},r))},{displayName:"LinkageRuleActions"}),aA=Tr(e=>{let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),{type:o,linkageOptions:l,collectionName:r}=iq(e),i=(0,es.useMemo)(()=>({marginLeft:10}),[]),a=(0,es.useMemo)(()=>[aj,{type:o,linkageOptions:l,collectionName:r}],[r,l,o]),s=(0,es.useMemo)(()=>({marginTop:8,marginBottom:8}),[]),c=(0,es.useCallback)(()=>{let e=n.query(".actions").take(),t=e.value||[];t.push({}),e.value=t},[n]);return(0,A.jsxs)("div",{style:i,children:[(0,A.jsx)(ec.ArrayFieldComponent,{name:"actions",component:a,disabled:!1}),(0,A.jsx)(of.A,{size:16,style:s,children:(0,A.jsx)("a",{onClick:c,children:t("Add property")})})]})},{displayName:"LinkageRuleActionGroup"}),ak=e=>{let t,{getCollectionFields:n,getInterface:o}=sO(),l=n(e).filter(e=>!["id","createdAt","createdBy","updatedAt","updatedBy"].includes(e.name)),{t:r}=(0,eT.useTranslation)(),i=[{label:r("Visible"),value:am.Visible,selected:!0,schema:{}},{label:r("Editable"),value:am.Editable,selected:!1,schema:{}},{label:r("Disabled"),value:am.ReadOnly,selected:!1,schema:{}},{label:r("Easy reading"),value:am.ReadPretty,selected:!1,schema:{}},{label:r("Hidden"),value:am.None,selected:!1,schema:{}},{label:r("Hidden(reserved value)"),value:am.Hidden,selected:!1,schema:{}},{label:r("Required"),value:am.Required,selected:!1,schema:{}},{label:r("Not required"),value:am.InRequired,selected:!1,schema:{}},{label:r("Value"),value:am.Value,selected:!1,schema:{}}];return t=[],l.forEach(e=>{let n=((e,t)=>{var n,l;let r=o(e.interface);if(!r)return;let{nested:a,children:s}=(null==r?void 0:r.filterable)||{},c={name:e.name,title:(null==e||null==(n=e.uiSchema)?void 0:n.title)||e.name,schema:null==e?void 0:e.uiSchema,interface:e.interface,target:e.target,operators:(null==i||null==(l=i.filter)?void 0:l.call(i,e=>!(a||s||["formula","richText","sequence"].includes(r.name))||(null==e?void 0:e.value)!==am.Value))||[]};if(!e.target||!(t>2))return c})(e,1);n&&t.push(n)}),t};function aI(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n margin-left: 10px;\n "]);return aI=function(){return e},e}let aP=(0,nu.rU)(e=>{let{css:t}=e;return{filter:t(aI())}}),aT=Tr((0,ec.observer)(e=>{let{styles:t}=aP(),n=(0,ec.useFieldSchema)(),{options:o,defaultValues:l,collectionName:r,form:i,formBlockType:a,variables:s,localVariables:c,record:d,dynamicComponent:u}=iq(e),{getAllCollectionsInheritChain:p}=sO(),m=tG(),h=(0,es.useMemo)(()=>({ArrayCollapse:iM}),[]),x=(0,es.useMemo)(()=>({type:"object",properties:{rules:{type:"array",default:l,"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{extra:(0,A.jsx)(iC,{})},properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{labelStyle:{marginTop:"6px"},labelCol:8,wrapperCol:16},properties:{conditions:{"x-component":"h4","x-content":'{{ t("Condition") }}'},condition:{"x-component":"Filter","x-use-component-props":()=>({options:o,className:t.filter}),"x-component-props":{collectionName:r,dynamicComponent:e=>{let{collectionField:t}=e;return(0,A.jsx)(rW,{...e,form:i,record:d,shouldChange:rH({collectionField:t,variables:s,localVariables:c,getAllCollectionsInheritChain:p})})}}},actions:{"x-component":"h4","x-content":'{{ t("Properties") }}'},action:{type:"void","x-component":aA,"x-component-props":{...e}}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"},copy:{type:"void","x-component":"ArrayCollapse.Copy"}}},properties:{add:{type:"void",title:'{{ t("Add linkage rule") }}',"x-component":"ArrayCollapse.Addition","x-reactions":{dependencies:["rules"],fulfill:{state:{}}}}}}}}),[r,l,i,c,o,e,d,s]),f=(0,es.useMemo)(()=>({field:o,fieldSchema:n,dynamicComponent:u,options:o||[]}),[u,n,o]);return(0,A.jsx)(Ta.Provider,{value:{form:i,type:a,collectionName:r},children:(0,A.jsx)(m1,{record:d,parent:m,children:(0,A.jsx)(rV.Provider,{value:f,children:(0,A.jsx)(al,{components:h,schema:x})})})})}),{displayName:"FormLinkageRules"});function aN(){let e=(0,ns._)(["\n .ant-dropdown-menu-item-group-list {\n max-height: 400px;\n overflow-y: auto;\n }\n "]);return aN=function(){return e},e}function aM(){let e=(0,ns._)(["\n // screen > 576px\n @media (min-width: 576px) {\n min-width: 520px;\n }\n\n // screen <= 576px\n @media (max-width: 576px) {\n min-width: 320px;\n }\n "]);return aM=function(){return e},e}let aD=(0,es.createContext)(null);function aR(){return(0,es.useContext)(aD)}aD.displayName="SchemaSettingsContext";let aq=(0,nu.rU)(e=>{let{css:t}=e;return{menu:t(aN()),modal:t(aM())}}),a_=e=>{let{children:t,fieldSchema:n,...o}=e,{getTemplateBySchema:l}=rg(),{name:r}=tJ(),i=l(n);return(0,A.jsx)(aD.Provider,{value:{collectionName:r,template:i,fieldSchema:n,...o},children:t})},aO=e=>{let{title:t,dn:n,...o}=e,{styles:l}=aq(),[r,i]=(0,es.useState)(!1),{Component:a,getMenuItems:s}=ro(),[,c]=(0,es.useTransition)(),d=l9([r]),u=(0,es.useCallback)((e,t)=>{("trigger"===t.source||e)&&c(()=>{i(e)})},[]),p=s(()=>e.children);return(0,A.jsxs)(a_,{visible:r,setVisible:i,dn:n,...o,children:[(0,A.jsx)(a,{}),(0,A.jsx)(nX.A,{open:r,onOpenChange:u,overlayClassName:l.menu,menu:{items:p,style:{maxHeight:d,overflowY:"auto"}},children:(0,A.jsx)("div",{"data-testid":e["data-testid"],children:"string"==typeof t?(0,A.jsx)("span",{children:t}):t})})]})},aB=function(e){let{componentName:t,collectionName:n,resourceName:o,needRender:l}=e,{t:r}=(0,eT.useTranslation)(),{getCollection:i}=sO(),{dn:a,setVisible:s,template:c,fieldSchema:d}=aR(),u=eB(),p=eC(),{dn:m}=rc(),{saveAsTemplate:h,copyTemplateSchema:x}=rg(),{theme:f}=yS();return n||l?c?(0,A.jsx)(az,{title:"Convert reference to duplicate",onClick:async()=>{let e=await x(c),t=m.removeWithoutEmit();m.insertAfterEnd(e,{async onSuccess(){await p.request({url:"/uiSchemas:remove/".concat(t["x-uid"])})}})},children:r("Convert reference to duplicate")}):(0,A.jsx)(az,{title:"Save as template",onClick:async()=>{s(!1);let e=n&&i(n),l=await AE(r("Save as template"),()=>(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(al,{components:{Input:eh.Input,FormItem:eh.FormItem},schema:{type:"object",properties:{name:{title:r("Template name"),required:!0,default:e?"".concat(u((null==e?void 0:e.title)||(null==e?void 0:e.name)),"_").concat(r(t)):r(t),"x-decorator":"FormItem","x-component":"Input"}}}})}),f).open({}),c=ez({t:r,api:p,refresh:a.refresh.bind(a),current:d.parent});c.loadAPIClientEvents();let{key:m}=await h({collectionName:n,resourceName:o,componentName:t,dataSourceKey:e.dataSource,name:l.name,uid:d["x-uid"]});c.removeWithoutEmit(d),c.insertBeforeEnd({type:"void","x-component":"BlockTemplate","x-component-props":{templateId:m}})},children:r("Save as template")}):null},aE=e=>e.reduceProperties((e,t)=>{if("FormV2"===t["x-component"]||"Details"===t["x-component"]){let e=t.reduceProperties((e,t)=>"Grid"===t["x-component"]||"BlockTemplate"===t["x-component"]?t:e,null);if(e)return e}return e},null),aV=function(e){let{insertAdjacentPosition:t="beforeEnd",componentName:n,collectionName:o,resourceName:l}=e,{t:r}=(0,eT.useTranslation)(),i=eB(),{getCollection:a}=sO(),{dn:s,setVisible:c,template:d,fieldSchema:u}=aR(),p=eC(),{saveAsTemplate:m,copyTemplateSchema:h}=rg(),{theme:x}=yS();return o?d?(0,A.jsx)(az,{title:"Convert reference to duplicate",onClick:async()=>{let e=await h(d),n=u.reduceProperties((e,t)=>{if("FormV2"===t["x-component"]||"Details"===t["x-component"]){let e=t.reduceProperties((e,t)=>"BlockTemplate"===t["x-component"]?t:e,null);if(e)return e}return e},null),o=ez({t:r,api:p,refresh:s.refresh.bind(s),current:n.parent});o.loadAPIClientEvents(),o.removeWithoutEmit(n),o.insertAdjacent(t,e,{async onSuccess(){await p.request({url:"/uiSchemas:remove/".concat(n["x-uid"])})}}),u["x-template-key"]=null,await p.request({url:"uiSchemas:patch",method:"post",data:{"x-uid":u["x-uid"],"x-template-key":null}}),s.refresh()},children:r("Convert reference to duplicate")}):(0,A.jsx)(az,{title:"Save as block template",onClick:async()=>{c(!1);let e=o&&a(o),d=aE(u),h=await AE(r("Save as template"),()=>{let t={FormItem:r("Form"),ReadPrettyFormItem:r("Details")};return(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(al,{components:{Input:eh.Input,FormItem:eh.FormItem},schema:{type:"object",properties:{name:{title:r("Template name"),required:!0,default:e?"".concat(i((null==e?void 0:e.title)||(null==e?void 0:e.name)),"_").concat(r(t[n]||n)):r(t[n]||n),"x-decorator":"FormItem","x-component":"Input"}}}})})},x).open({}),f=ez({t:r,api:p,refresh:s.refresh.bind(s),current:d.parent});f.loadAPIClientEvents();let{key:v}=await m({collectionName:o,resourceName:l,componentName:n,dataSourceKey:e.dataSource,name:h.name,uid:d["x-uid"]});f.removeWithoutEmit(d),f.insertAdjacent(t,{type:"void","x-component":"BlockTemplate","x-component-props":{templateId:v}}),u["x-template-key"]=v,await p.request({url:"uiSchemas:patch",method:"post",data:{"x-uid":u["x-uid"],"x-template-key":v}})},children:r("Save as block template")}):null},az=e=>{let{eventKey:t,title:n}=e,{pushMenuItem:o}=rn(),{collectMenuItem:l}=(0,es.useContext)(re)||{},{name:r}=se(),i={key:n,...eu().omit(e,["children","name"]),eventKey:t,onClick:t=>{var n;t.domEvent.preventDefault(),t.domEvent.stopPropagation(),null==e||null==(n=e.onClick)||n.call(e,t)},style:{minWidth:120},label:e.children||e.title,title:e.title};return null==o||o(i),null==l||l(i),null},aL=e=>{let{Component:t,getMenuItems:n}=ro(),{pushMenuItem:o}=rn();return o({key:(0,es.useMemo)(()=>(0,ec.uid)(),[]),type:"group",title:e.title,label:e.title,children:n(()=>e.children)}),(0,A.jsx)(t,{})},aG=function(e){let{Component:t,getMenuItems:n}=ro(),{pushMenuItem:o}=rn();return o({key:(0,es.useMemo)(()=>(0,ec.uid)(),[]),label:e.title,title:e.title,children:n(()=>e.children)}),(0,A.jsx)(t,{})},aK=function(){let{pushMenuItem:e}=rn();return e({key:(0,es.useMemo)(()=>(0,ec.uid)(),[]),type:"divider"}),null},a$=e=>{let{icon:t,confirm:n,removeParentsIfNoChildren:o,breakRemoveOn:l}=e,{dn:r,template:i}=aR(),{t:a}=(0,eT.useTranslation)(),s=(0,ec.useField)(),c=(0,ec.useFieldSchema)(),d=rc(),u=(0,ec.useForm)(),{modal:p}=eX.A.useApp(),{removeActiveFieldName:m}=uM()||{};return(0,A.jsx)(az,{title:"Delete",eventKey:"remove",icon:t?(0,A.jsx)(i6,{style:{color:"#eb5050"},type:t}):null,onClick:()=>{p.confirm({title:a("Delete block"),content:a("Are you sure you want to delete it?"),...n,async onOk(){var e;let t={removeParentsIfNoChildren:o,breakRemoveOn:l};(null==s?void 0:s.required)&&(s.required=!1,c.required=!1),i&&i.uid===c["x-uid"]&&(null==d?void 0:d.dn)?await (null==d?void 0:d.dn.remove(null,t)):await r.remove(null,t),await (null==n||null==(e=n.onOk)?void 0:e.call(n)),delete u.values[c.name],null==m||m(c.name),(null==s?void 0:s.setInitialValue)&&(null==s?void 0:s.reset)&&(s.setInitialValue(null),s.reset())}})},children:(0,A.jsx)("span",{style:{color:"#eb5050"},children:a("Delete")})})},aU=e=>{let{type:t,emptyDescription:n}=e,o=(0,ec.useFieldSchema)(),{dn:l}=eY(),{t:r}=(0,eT.useTranslation)(),i=tJ(),{inProvider:a}=nV(),s=pP(t),{targets:c=[],uid:d}=u$(o),u=eB(),{getAllCollectionsInheritChain:p}=sO();if(!a)return null;let m=s.map(e=>{let t="".concat(u(e.collection.title)," #").concat(e.uid.slice(0,4)),n=()=>{let t=window.scrollY||window.pageYOffset||document.documentElement.scrollTop,n=e.dom,o=n.querySelector(".general-schema-designer");o&&(o.style.display="block"),n.style.boxShadow="0 0 10px rgba(0, 0, 0, 0.2)",setTimeout(()=>{n.scrollIntoView({behavior:"smooth",block:"center"})},1e3),setTimeout(()=>{window.scrollTo({top:t,behavior:"smooth"})},2e3)},a=()=>{let t=e.dom,n=t.querySelector(".general-schema-designer");n&&(n.style.display=null),t.style.boxShadow="none"};if(pD(e.collection,i))return(0,A.jsx)(aY,{title:t,checked:c.some(t=>t.uid===e.uid),onChange:t=>{t?c.push({uid:e.uid}):(c=c.filter(t=>t.uid!==e.uid),e.clearFilter(d)),uU(o,c),l.emit("patch",{schema:{"x-uid":d,"x-filter-targets":c}}).catch(eh.error),l.refresh()},onMouseLeave:a,onMouseUp:n},e.uid);let s=c.find(t=>t.uid===e.uid);return(0,A.jsx)(aW,{title:t,value:(null==s?void 0:s.field)||"",options:[...pk(p(i.name),e).map(e=>({label:u(e.uiSchema.title)||e.name,value:"".concat(e.name,".").concat((null==e?void 0:e.targetKey)||"id")})),...pI(i,e).map(e=>({label:"".concat(u(e.uiSchema.title)||e.name," [").concat(r("Foreign key"),"]"),value:e.name})),{label:r("Unconnected"),value:""}],onChange:t=>{""===t?(c=c.filter(t=>t.uid!==e.uid),e.clearFilter(d)):(c=c.filter(t=>t.uid!==e.uid)).push({uid:e.uid,field:t}),uU(o,c),l.emit("patch",{schema:{"x-uid":d,"x-filter-targets":c}}),l.refresh()},onMouseEnter:n,onMouseLeave:a},e.uid)});return(0,A.jsx)(aG,{title:r("Connect data blocks"),children:m.length?m:(0,A.jsx)(az,{title:"empty",children:(0,A.jsx)(op.A,{style:{width:160,padding:"0 1em"},description:n,image:op.A.PRESENTED_IMAGE_SIMPLE})})})},aW=e=>{let{title:t,options:n,value:o,onChange:l,fieldNames:r,...i}=e;return(0,A.jsx)(az,{title:t,...i,children:(0,A.jsx)(ol,{title:t,defaultValue:o,onChange:l,options:n,fieldNames:r})})},aH=e=>{let{title:t,options:n,value:o,onChange:l,...r}=e;return(0,A.jsx)(az,{title:t,...r,children:(0,A.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},children:[t,(0,A.jsx)(om.A,{variant:"borderless",defaultValue:o,onChange:l,options:n,style:{textAlign:"right",minWidth:100},multiple:!!e.multiple,...e})]})})},aY=e=>{let{title:t,onChange:n,...o}=e,[l,r]=(0,es.useState)(!!e.checked);return(0,A.jsx)(az,{title:t,...o,onClick:()=>{null==n||n(!l),r(!l)},children:(0,A.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},children:[t,(0,A.jsx)(oh.A,{size:"small",checked:l,style:{marginLeft:32}})]})})},aX=e=>{let{schema:t,...n}=e,[o,l]=(0,es.useState)(!1),r=(0,es.useContext)(aD);return(0,A.jsxs)(ct,{value:{visible:o,setVisible:l},children:[(0,A.jsx)(az,{title:e.title,...n,onClick:()=>{r.setVisible(!1),l(!0)},children:e.children||e.title}),(0,A.jsx)(al,{schema:{name:(0,ec.uid)(),...t}})]})},aJ=es.memo(e=>{let{title:t,onSubmit:n,initialValues:o,beforeOpen:l,initialSchema:r,schema:i,modalTip:a,components:s,scope:c,...d}=e,[u,p]=(0,es.useState)(!1),[m,h]=(0,es.useState)(e.uid),{t:x}=(0,eT.useTranslation)(),f=(0,ec.useFieldSchema)(),v=(0,es.useContext)(aD),{dn:g}=aR(),y=eB(),b=eC(),C=uM(),S=(0,es.useMemo)(()=>(0,ec.createForm)({initialValues:(0,ed.cloneDeep)(o),values:(0,ed.cloneDeep)(o)}),[o]);(0,es.useEffect)(()=>{S.setInitialValues((0,ed.cloneDeep)(o))},[JSON.stringify(o||{})]);let w=(0,es.useCallback)(()=>{p(!1),S.reset()},[S]),F=(0,es.useCallback)(async()=>{await S.submit(),null==n||n((0,ed.cloneDeep)(S.values)),p(!1)},[S,n]),j=(0,es.useCallback)(async()=>{!m&&(null==r?void 0:r["x-uid"])&&(f["x-action-settings"].schemaUid=r["x-uid"],g.emit("patch",{schema:f}),await b.resource("uiSchemas").insert({values:r}),h(r["x-uid"])),"function"==typeof l&&(null==l||l()),v.setVisible(!1),p(!0)},[b,v,g,f,r,m]),k=(0,es.useCallback)(e=>e.stopPropagation(),[]);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(az,{title:y(t),...d,onClick:j,onKeyDown:k,children:e.children||e.title}),(0,oy.createPortal)((0,A.jsx)(ox.A,{width:"50%",title:y(t),...d,destroyOnClose:!0,open:u,onCancel:w,footer:(0,A.jsxs)(of.A,{children:[(0,A.jsx)(e3.Ay,{onClick:w,children:x("Cancel")}),(0,A.jsx)(e3.Ay,{type:"primary",onClick:F,children:x("Submit")})]}),children:(0,A.jsx)(uN,{name:"form",getActiveFieldsName:null==C?void 0:C.getActiveFieldsName,children:(0,A.jsx)(ae,{form:S,children:(0,A.jsxs)(eh.FormLayout,{layout:"vertical",children:[a&&(0,A.jsx)(ov.A,{message:a}),a&&(0,A.jsx)("br",{}),u&&m&&(0,A.jsx)(aa,{noForm:!0,components:s,scope:c,uid:m}),u&&i&&(0,A.jsx)(al,{components:s,scope:c,schema:i})]})})})}),document.body)]})});aJ.displayName="SchemaSettingsActionModalItem";let aQ=e=>{let{hidden:t,title:n,components:o,scope:l,effects:r,onSubmit:i,asyncGetInitialValues:a,initialValues:s,width:c="fit-content",...d}=e,u=(0,es.useContext)(ec.SchemaOptionsContext);u.components={...u.components,Input:gd,"Input.TextArea":gd.TextArea,"Radio.Group":IN.Group,"Checkbox.Group":j4.Group,DatePicker:AD,Select:wt,AlternativeAssociationSelect:void 0,Cascader:jZ};let{styles:p}=aq(),m=tJ(),h=eC(),{theme:x}=yS(),f=nj(),v=uM(),{locale:g}=(0,es.useContext)(og.Ay.ConfigContext),y=tr(),b=tc(),C=tV(),{association:S}=t7()||{},w=Tp(),F=os(),{formValue:j,collection:k}=lb(),I=lk("$nPopupRecord");return t?null:(0,A.jsx)(az,{title:n,...d,onClick:async()=>{let t=a?await a():s,d=eu().isFunction(e.schema)?e.schema():e.schema;AE({title:d.title||n,width:c},()=>(0,A.jsx)(lA,{name:"$nPopupRecord",title:I.title,value:I.value,collection:I.collection,children:(0,A.jsx)(oa.Provider,{value:F,children:(0,A.jsx)(tE,{record:C,children:(0,A.jsx)(Ta.Provider,{value:w,children:(0,A.jsx)(ly,{value:{value:j,collection:k},children:(0,A.jsx)(uN,{name:"form",getActiveFieldsName:null==v?void 0:v.getActiveFieldsName,children:(0,A.jsx)(ep.Router,{location:location,navigator:null,children:(0,A.jsx)(nC.Provider,{value:f,children:(0,A.jsx)(t_,{dataSourceManager:y,dataSource:b,children:(0,A.jsx)(t5,{allowNull:!0,collection:m.name,association:S,children:(0,A.jsx)(i8,{scope:u.scope,components:u.components,children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",className:p.modal,children:(0,A.jsx)(eP,{apiClient:h,children:(0,A.jsx)(og.Ay,{locale:g,children:(0,A.jsx)(al,{components:o,scope:l,schema:d})})})})})})})})})})})})})})}),x).open({initialValues:t,effects:r}).then(e=>(i(e),e)).catch(e=>{console.error(e)})},children:e.children||e.title})},aZ=function(){var e;let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o}=eY(),{t:l}=(0,eT.useTranslation)();return(0,A.jsx)(aQ,{title:l("Edit block title"),schema:{type:"object",title:l("Edit block title"),properties:{title:{title:l("Block title"),type:"string",default:null==n||null==(e=n["x-component-props"])?void 0:e.title,"x-decorator":"FormItem","x-component":"Input"}}},onSubmit:e=>{let{title:l}=e,r=n["x-component-props"]||{};r.title=l,n["x-component-props"]=r,t.componentProps.title=l,o.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":n["x-component-props"]}}),o.refresh()}})},a0=function(e){let{path:t="x-component-props.params.sort"}=e,{t:n}=(0,eT.useTranslation)(),{dn:o}=eY(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),i=e.title||n("Set default sorting rules"),{name:a}=tJ(),s=(0,ed.get)(l,t)||[],c=null==s?void 0:s.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"}),d=hd(e.name||a),u=async n=>{var i;let{sort:a}=n;if(null==e?void 0:e.onSubmit)return e.onSubmit({sort:a});let s=a.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);return(0,ed.set)(r,t.replace("x-component-props","componentProps").replace("x-decorator-props","decoratorProps"),s),(0,ed.set)(l,t,s),await o.emit("patch",{schema:l}),null==(i=e.onSubmitAfter)?void 0:i.call(e)};return(0,A.jsx)(aQ,{title:i,components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:i,properties:{sort:{type:"array",default:c,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:d,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:n("ASC"),value:"asc"},{label:n("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:n("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:u})},a1=function(e){let{collectionName:t}=e,n=(0,ec.useFieldSchema)(),{form:o}=Tp(),{dn:l}=eY(),{t:r}=(0,eT.useTranslation)(),{getTemplateById:i}=rg(),a=lN(),s=lT(),c=m3(),{type:d}=Tc(),u=(null==e?void 0:e.type)||["Action","Action.Link"].includes(n["x-component"])?"button":"field",p=aE(n)||n,m=(0,es.useMemo)(()=>({type:"object",title:r("Linkage rules"),properties:{fieldReaction:{"x-component":aT,"x-use-component-props":()=>({options:hx(t),defaultValues:(null==p?void 0:p["x-linkage-rules"])||(null==n?void 0:n["x-linkage-rules"]),type:u,linkageOptions:ak(t),collectionName:t,form:o,variables:a,localVariables:s,record:c,formBlockType:d})}}}),[t,n,o,p,s,c,r,u,a]),h=(0,es.useMemo)(()=>({ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout}),[]),x=(0,es.useCallback)(e=>{var t;let n=[];for(let t of e.fieldReaction.rules)n.push(eu().pickBy(t,eu().identity));let o="BlockTemplate"===p["x-component"]&&(null==(t=p["x-component-props"])?void 0:t.templateId),r={"x-uid":o&&i(o).uid||p["x-uid"]};p["x-linkage-rules"]=n,r["x-linkage-rules"]=n,l.emit("patch",{schema:r}),l.refresh()},[l,i,p]);return(0,A.jsx)(aQ,{title:r("Linkage rules"),components:h,width:770,schema:m,onSubmit:x})},a2=e=>{let t=(0,ec.useFieldSchema)();if(e)return{templateData:eu().cloneDeep(e["x-data-templates"])};let n=Tx(t)||t;return{templateData:eu().cloneDeep(null==n?void 0:n["x-data-templates"])}},a6=function(e){let t=(0,es.useContext)(eV),{collectionName:n}=e,o=(0,ec.useFieldSchema)(),{dn:l}=eY(),{t:r}=(0,eT.useTranslation)(),i=Tx(o)||o,{templateData:a}=a2(),s=(0,es.useMemo)(()=>({type:"object",title:r("Form data templates"),properties:{fieldReaction:{"x-decorator":e=>(0,A.jsx)(ld,{...e,isInFormDataTemplate:!0}),"x-component":im,"x-use-component-props":()=>({defaultValues:a,collectionName:n}),"x-component-props":{designerCtx:t,formSchema:i}}}}),[a]),c=(0,es.useCallback)(e=>{let t={...i["x-data-templates"],...e.fieldReaction};t.items.forEach(e=>{e.fields=Array.isArray(e.fields)?e.fields:e.fields.checked});let n={"x-uid":i["x-uid"],"x-data-templates":t};i["x-data-templates"]=t,l.emit("patch",{schema:n}),l.refresh()},[]),d=(0,es.useMemo)(()=>r("Form data templates"),[]),u=(0,es.useMemo)(()=>({ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout}),[]);return(0,A.jsx)(aQ,{title:d,components:u,width:770,schema:s,onSubmit:c})};function a3(e){var t,n,o;let{collectionName:l}=e,r=(0,ec.useFieldSchema)(),i=(0,ec.useField)(),{dn:a}=eY(),{t:s}=(0,eT.useTranslation)(),c=null==r?void 0:r["x-allow-add-to-current"],{getCollectionJoinField:d}=sO(),u=nj(),p=d(null==r||null==(t=r.parent)?void 0:t["x-collection-field"])||{},m=(null==r||null==(n=r.parent)?void 0:n["x-component"])==="CollectionField";return(0,A.jsx)(aQ,{title:s("Enable child collections"),components:{ArrayItems:eh.ArrayItems,FormLayout:eh.FormLayout},scope:{isAssocationAdd:m},schema:{type:"object",title:s("Enable child collections"),properties:{enableChildren:{"x-component":iv,"x-use-component-props":()=>({defaultValues:null==r?void 0:r["x-enable-children"],collectionName:l})},allowAddToCurrent:{type:"boolean","x-content":"{{t('Allow adding records to the current collection')}}","x-decorator":"FormItem","x-component":"Checkbox",default:void 0===c||c},linkageFromForm:{type:"string",title:"{{t('Linkage with form fields')}}","x-visible":"{{isAssocationAdd}}","x-decorator":"FormItem","x-component":ib,"x-component-props":{rootCollection:u.props.collection||u.props.resource,collectionField:p},default:null==r||null==(o=r["x-component-props"])?void 0:o.linkageFromForm}}},onSubmit:e=>{let t=[];for(let n of e.enableChildren.childrenCollections)t.push(eu().pickBy(n,eu().identity));let n={"x-uid":r["x-uid"]};r["x-enable-children"]=t,r["x-allow-add-to-current"]=e.allowAddToCurrent,r["x-component-props"]={...r["x-component-props"],component:"CreateRecordAction",linkageFromForm:null==e?void 0:e.linkageFromForm},n["x-enable-children"]=t,n["x-allow-add-to-current"]=e.allowAddToCurrent,n["x-component-props"]={...r["x-component-props"],component:"CreateRecordAction",linkageFromForm:null==e?void 0:e.linkageFromForm},i.componentProps.linkageFromForm=e.linkageFromForm,a.emit("patch",{schema:n}),a.refresh()}})}let a5=e=>{let t=e.parent;for(;t;){if("CollectionField"===t["x-component"])return t;t=t.parent}},a4=()=>{let{fields:e}=tJ(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{t:o}=(0,eT.useTranslation)(),{dn:l}=eY(),r=eB(),{service:i}=lz(),a=e.filter(e=>!(null==e?void 0:e.target)&&"sort"===e.interface).map(e=>{var t;return{value:null==e?void 0:e.name,label:r(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return(0,A.jsx)(aW,{title:o("Drag and drop sorting field"),options:a,value:t.decoratorProps.dragSortBy,onChange:e=>{var o;n["x-decorator-props"].dragSortBy=e,i.run({...null==(o=i.params)?void 0:o[0],sort:e}),t.decoratorProps.dragSortBy=e,l.emit("patch",{schema:{"x-uid":n["x-uid"],"x-decorator-props":n["x-decorator-props"]}}),l.refresh()}},"sort-field")},a8=(e,t)=>{let n=null==t?void 0:t(null==e?void 0:e.interface);return(null==n?void 0:n.group)==="systemInfo"};function a7(e,t){var n;return null!=(n=null==e?void 0:e.default)?n:null==t?void 0:t.defaultValue}let a9=(0,es.createContext)({});function se(){return(0,es.useContext)(a9)}a9.displayName="SchemaSettingItemContext";let st={item:az,itemGroup:aL,subMenu:aG,divider:aK,remove:a$,select:aW,cascader:aH,switch:aY,popup:aX,actionModal:aJ,modal:aQ},sn=e=>{let{children:t}=e,{visible:n}=aR(),o=(0,es.useRef)(!1),l=ux();return((0,es.useEffect)(()=>{n&&(o.current=!0)},[n]),(n||o.current)&&t&&0!==t.length)?(0,A.jsx)(A.Fragment,{children:t.sort((e,t)=>(e.sort||0)-(t.sort||0)).map(e=>{let t="".concat(l?l+"-":"").concat(e.name);return(0,A.jsx)(sa,{...e},t)})}):null},so=()=>void 0,sl=()=>void 0,sr=()=>!0,si=e=>{let{Component:t,componentProps:n,useComponentProps:o,children:l}=e,r=o();return(0,A.jsx)(t,{...n,...r,children:l})},sa=(0,es.memo)(e=>{let{useVisible:t=sr,useChildren:n=so,useComponentProps:o=sl,type:l,Component:r,children:i,hideIfNoChildren:a=!0,componentProps:s}=e,c=n(),d=eH(),u=(0,es.useMemo)(()=>{let e=[...c||[],...i||[]];return 0===e.length?void 0:e},[c,i]),p=t(),m=(0,es.useMemo)(()=>!r&&l&&st[l]?st[l]:r,[l,r]);if(!p||!l&&!r)return null;let h=d(m);return!h||a&&Array.isArray(u)&&0===u.length?null:(0,A.jsx)(a9.Provider,{value:e,children:(0,A.jsx)(si,{Component:h,useComponentProps:o,componentProps:s,children:Array.isArray(u)&&u.length>0&&(0,A.jsx)(sn,{children:u})})})});sa.displayName="SchemaSettingsChild";var ss=n(53869);let sc=()=>{let e=(0,ec.useFieldSchema)(),{name:t}=tJ();return{getAriaLabel:(0,es.useCallback)((n,o)=>{if(!e)return"";let l=e["x-component"],r=e["x-designer"]?"-".concat(e["x-designer"]):"",i=e["x-settings"]?"-".concat(e["x-settings"]):"",a=e["x-collection-field"]?"-".concat(e["x-collection-field"]):"",s=t?"-".concat(t):"";return o=o?"-".concat(o):"","designer-".concat(n,"-").concat(l).concat(r).concat(i).concat(s).concat(a).concat(o)},[e,t])}},sd=es.memo(e=>{let{name:t}=e,{getAriaLabel:n}=sc(),o=(0,es.useMemo)(()=>({cursor:"pointer",fontSize:12}),[]);return(0,A.jsx)(ss.A,{role:"button",style:o,"aria-label":n("schema-settings",t)})});sd.displayName="SchemaSettingsIcon";let su=e=>{let{items:t,Component:n=sd,name:o,componentProps:l,style:r,...i}=e,{dn:a}=eY(),s=(0,ec.useField)(),c=(0,ec.useFieldSchema)(),d=(0,es.useMemo)(()=>({options:e,style:r,...l}),[l,e,r]);return(0,A.jsx)(aO,{title:es.createElement(n,d),dn:a,field:s,fieldSchema:c,...i,children:(0,A.jsx)(sn,{children:t})})};var sp=n(46913),sm=n.n(sp);let sh=[{name:"designer",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Debug tools")}},children:[{name:"dump",type:"item",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=eC(),n=(0,ec.useFieldSchema)();return{onClick:async()=>{let e=["name","x-uid","_isJSONSchemaObject","version","x-index","x-async"],o=t=>{e.forEach(e=>delete t[e]),Object.keys(t.properties||{}).forEach(e=>{o(t.properties[e])})},{data:l}=await t.request({url:"/uiSchemas:getJsonSchema/".concat(n["x-uid"],"?includeAsyncNode=true")}),r=(null==l?void 0:l.data)||{};o(r);let i=new Blob([JSON.stringify(r,null,2)],{type:"application/json"});(0,sp.saveAs)(i,n["x-uid"]+".schema.json")},title:e("Dump")}}},{name:"load",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{refresh:t}=eY(),n=eC(),o=(0,ec.useFieldSchema)(),l=(0,es.useMemo)(()=>{let l=ez({t:e,api:n,refresh:t,current:o.parent});return l.loadAPIClientEvents(),l},[e,n,t,o]);return{schema:{type:"object",title:e("Load"),properties:{file:{type:"object",title:'{{ t("File") }}',required:!0,"x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{action:"attachments:create",multiple:!1}}}},title:e("Load"),onSubmit:async e=>{let{file:t}=e,{data:o}=await n.request({url:t.url,baseURL:"/"});l.insertBeforeEnd(null!=o?o:{})}}}},{name:"edit",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{refresh:t}=eY(),n=eC(),o=(0,ec.useFieldSchema)(),l=(0,es.useMemo)(()=>{let l=ez({t:e,api:n,refresh:t,current:o.parent});return l.loadAPIClientEvents(),l},[e,n,t,o]);return{width:"800px",asyncGetInitialValues:async()=>{let{data:e}=await n.request({url:"/uiSchemas:getJsonSchema/".concat(o["x-uid"],"?includeAsyncNode=true")});return{schema:JSON.stringify((null==e?void 0:e.data)||{},null,2)}},schema:()=>({type:"object",title:e("Edit"),properties:{schema:{type:"string",title:'{{ t("Schema") }}',required:!0,"x-decorator":"FormItem","x-component":"CodeMirror","x-component-props":{defaultLanguage:"json",height:"500px"}}}}),title:e("Edit"),onSubmit:async e=>{let{schema:t}=e;l.emit("patch",{schema:JSON.parse(t)}),l.refresh()}}}},{name:"values",type:"modal",useComponentProps(){let e=(0,ec.useForm)(),{t}=(0,eT.useTranslation)();return{width:"800px",schema:()=>({type:"object",title:t("Values"),properties:{values:{type:"string",title:'{{ t("Schema") }}',default:JSON.stringify(e.values,null,2),"x-decorator":"FormItem","x-component":"CodeMirror","x-component-props":{defaultLanguage:"json",height:"500px"}}}}),title:t("Values"),onSubmit:()=>{}}}},{name:"divider",type:"divider"}]}];function sx(e,t){let n=os(),o=(0,es.useMemo)(()=>n.schemaSettingsManager.get(e),[n.schemaSettingsManager,e]);return e?o?{exists:!0,render:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=[...sh,...o.options.items],l={...o.options,items:n};return es.createElement(su,{...l,...t,...e})}}:(console.error('[tachybase]: SchemaSettings "'.concat(e,'" not found')),{exists:!1,render:()=>null}):{exists:!1,render:()=>null}}function sf(){let e=(0,ns._)(["\n position: relative;\n margin: ",";\n padding: ",";\n\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover) !important;\n border: 0 !important;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return sf=function(){return e},e}let sv=(0,nu.rU)((e,t)=>{let{css:n}=e,{margin:o="-18px -16px",padding:l="18px 16px"}=t;return{designer:n(sf(),o,l)}}),sg=(0,ec.observer)(e=>{let t=SF(),{isInSubTable:n}=lu()||{},{styles:o}=sv({margin:n?"-12px -8px":"-18px -16px",padding:n?"12px 8px":"18px 16px"});return(0,A.jsxs)(SE,{className:o.designer,children:[(0,A.jsx)(t,{}),e.children]})},{displayName:"TableColumnActionBar"}),sy=e=>"CollectionField"===e["x-component"],sb=()=>{let{getField:e}=tJ(),t=eB(),n=(0,ec.useFieldSchema)(),{getCollectionJoinField:o}=sO(),l=n.reduceProperties((e,t)=>sy(t)?t:e,null);if(!l)return{};let r=e(l.name)||o(null==l?void 0:l["x-collection-field"]);return{columnSchema:n,fieldSchema:l,collectionField:r,uiSchema:t(null==r?void 0:r.uiSchema)}},sC=(0,es.createContext)({});sC.displayName="SchemaToolbarContext";let sS=e=>{let{children:t,...n}=e;return(0,A.jsx)(sC.Provider,{value:n,children:t})};function sw(){return(0,es.useContext)(sC)}var sF=n(8574),sj=n(93704);function sA(){let e=(0,ns._)(["\n pointer-events: none;\n position: absolute;\n font-size: 12px;\n padding: 0;\n line-height: 16px;\n height: 16px;\n border-bottom-right-radius: 2px;\n border-radius: 2px;\n top: 2px;\n left: 2px;\n .title-tag {\n padding: 0 3px;\n border-radius: 2px;\n background: var(--colorSettings);\n color: #fff;\n display: block;\n }\n "]);return sA=function(){return e},e}function sk(){let e=(0,ns._)(["\n & .ant-space-item .anticon {\n margin: 0;\n }\n\n &:hover {\n display: flex !important;\n }\n "]);return sk=function(){return e},e}let sI=(0,nu.rU)(e=>{let{css:t}=e;return{toolbar:{position:"absolute",zIndex:999,display:"none",top:0,left:0,right:0,bottom:0,border:"2px solid var(--colorBorderSettingsHover)",background:"var(--colorBgSettingsHover)",pointerEvents:"none",".ant-space-item .anticon":{margin:0}},toolbarTitle:{pointerEvents:"none",position:"absolute",fontSize:12,padding:0,lineHeight:"16px",height:"16px",borderBottomRightRadius:2,borderRadius:2,top:2,left:2},toolbarTitleTag:{padding:"0 3px",borderRadius:2,background:"var(--colorSettings)",color:"#fff",display:"block"},toolbarIcons:{position:"absolute",right:"2px",top:"2px",lineHeight:"16px",pointerEvents:"all",".ant-space-item":{backgroundColor:"var(--colorSettings)",color:"#fff",lineHeight:"16px",width:"16px",paddingLeft:"1px",alignSelf:"stretch"}},titleCss:t(sA()),overrideAntdCSS:t(sk())}}),sP=e=>{var t,n;let{disableInitializer:o,title:l,template:r,schemaSettings:i,contextValue:a,draggable:s=!0,showDataSource:c=!0,AddMenuModalComponent:d}=e,{dn:u,designable:p}=eY(),m=(0,ec.useField)(),{t:h}=(0,eT.useTranslation)(),x=(0,ec.useFieldSchema)(),f=eB(),{getAriaLabel:v}=sc(),g={dn:u,field:m,fieldSchema:x},{render:y,exists:b}=sx(x["x-settings"]||i,x["x-settings-props"]),C=A6(),S=A2(),{styles:w}=sI(),F=tr(),j=null==F?void 0:F.getDataSources(),k=ts(),I=(null==j?void 0:j.length)>1&&k,P=["FormItem","ReadPrettyFormItem"].includes(null==r?void 0:r.componentName)?"".concat(null==r?void 0:r.name," ").concat(h("(Fields only)")):null==r?void 0:r.name,T=(0,es.useMemo)(()=>{var e;return{insertPosition:"afterEnd",wrap:(null==C||null==(e=C.cols)?void 0:e.length)>1?void 0:pO,Component:e=>(0,A.jsx)(sF.A,{...e,role:"button","aria-label":v("schema-initializer"),style:{cursor:"pointer",fontSize:14}})}},[v,null==C||null==(t=C.cols)?void 0:t.length]);return p?(0,A.jsx)(sS,{...a,children:(0,A.jsxs)("div",{className:r6()("general-schema-designer",w.overrideAntdCSS),children:[l&&(0,A.jsx)("div",{className:r6()("general-schema-designer-title",w.titleCss),children:(0,A.jsxs)(of.A,{size:2,children:[(0,A.jsx)("span",{className:"title-tag",children:c&&I?"".concat(f(null==I?void 0:I.displayName)," > ").concat(f(l)):f(l)}),r&&(0,A.jsxs)("span",{className:"title-tag",children:[h("Reference template"),": ",P||h("Untitled")]})]})}),(0,A.jsx)("div",{className:"general-schema-designer-icons",children:(0,A.jsxs)(of.A,{size:3,align:"center",children:[!!d&&(0,A.jsx)(aO,{title:(0,A.jsx)(sF.A,{role:"button","aria-label":v("add-menu")}),...g,children:d}),s&&(0,A.jsx)(SV,{children:(0,A.jsx)(sj.A,{role:"button","aria-label":v("drag-handler")})}),!o&&((null==S?void 0:S.InitializerComponent)?(0,A.jsx)(S.InitializerComponent,{...T}):null==S||null==(n=S.renderSchemaInitializer)?void 0:n.call(S,T)),b?y(a):(0,A.jsx)(aO,{title:(0,A.jsx)(ss.A,{role:"button","aria-label":v("schema-settings"),style:{cursor:"pointer",fontSize:12}}),...g,children:e.children})]})})]})}):null},sT=e=>{var t;let{title:n,initializer:o,settings:l,showBackground:r,showBorder:i=!0,draggable:a=!0}=e,{designable:s}=eY(),c=(0,ec.useFieldSchema)(),d=eB(),{styles:u}=sI(),{getAriaLabel:p}=sc(),m=tr(),h=null==m?void 0:m.getDataSources(),x=ts(),f=(null==h?void 0:h.length)>1&&x,v=(0,es.useMemo)(()=>{if(n){if("string"==typeof n)return[d(n)];if(Array.isArray(n))return n.map(e=>d(e))}},[d,n]),{render:g,exists:y}=sx(c["x-settings"]||l,c["x-settings-props"]),{render:b,exists:C}=mz(c["x-initializer"]||o,c["x-initializer-props"]),S=A6(),w=A2(),F=(0,es.useMemo)(()=>{var e;return{insertPosition:"afterEnd",wrap:(null==S||null==(e=S.cols)?void 0:e.length)>1?void 0:pO,Component:e=>(0,A.jsx)(sF.A,{...e,role:"button","aria-label":p("schema-initializer"),style:{cursor:"pointer",fontSize:14}})}},[p,null==S||null==(t=S.cols)?void 0:t.length]),j=(0,es.useMemo)(()=>!1===a?null:(0,A.jsx)(SV,{children:(0,A.jsx)(sj.A,{role:"button","aria-label":p("drag-handler")})}),[a,p]),k=(0,es.useMemo)(()=>{if(!1===o)return null;if((null==w?void 0:w.InitializerComponent)||(null==w?void 0:w.renderSchemaInitializer)){var e;return(null==w?void 0:w.InitializerComponent)?(0,A.jsx)(w.InitializerComponent,{...F}):null==(e=w.renderSchemaInitializer)?void 0:e.call(w,F)}return C?b(F):null},[w,o,F,C,b]),I=(0,es.useMemo)(()=>!1!==l&&y?g():null,[y,g,l]),P=(0,es.useRef)(null);return((0,es.useEffect)(()=>{let e=P.current,t=null==e?void 0:e.parentElement;function n(){e&&(e.style.display="block")}function o(){e&&(e.style.display="none")}return t&&("static"===window.getComputedStyle(t).position&&(t.style.position="relative"),t.addEventListener("mouseenter",n),t.addEventListener("mouseleave",o)),()=>{t&&(t.removeEventListener("mouseenter",n),t.removeEventListener("mouseleave",o))}},[]),s)?(0,A.jsxs)("div",{ref:P,className:u.toolbar,style:{border:i?"auto":0,background:r?"auto":0},children:[v&&(0,A.jsx)("div",{className:u.toolbarTitle,children:(0,A.jsx)(of.A,{size:2,children:v.map(e=>(0,A.jsx)("span",{className:u.toolbarTitleTag,children:f?"".concat(d(null==f?void 0:f.displayName)," > ").concat(e):e},e))})}),(0,A.jsx)("div",{className:u.toolbarIcons,children:(0,A.jsxs)(of.A,{size:3,align:"center",children:[j,k,I]})})]}):null},sN=e=>{let{designable:t}=eY();return t?(0,A.jsx)(sT,{...e}):null},sM=e=>{let{designable:t}=eY(),n=eE((0,es.useMemo)(()=>e["x-toolbar"]||e["x-designer"]?e["x-toolbar"]||e["x-designer"]:e["x-settings"]?sN:void 0,[e]));return{render:o=>t&&n?(0,A.jsx)(n,{...e["x-toolbar-props"],...o}):null,exists:!!n}};function sD(){let e=(0,ns._)(["\n & > .tb-form-item {\n flex: 1;\n }\n "]);return sD=function(){return e},e}let sR=(0,nu.rU)(e=>{let{css:t}=e;return{defaultInput:t(sD())}}),sq=function(e){var t,n,o,l;let r,{styles:i}=sR(),a=(0,ec.useFieldSchema)(),s=null!=(n=null==e?void 0:e.fieldSchema)?n:a,c=(0,ec.useField)(),{dn:d}=eY(),{t:u}=(0,eT.useTranslation)(),p=co(),{getField:m}=tJ(),{getCollectionJoinField:h,getCollectionFields:x,getAllCollectionsInheritChain:f}=sO(),v=lN(),g=lT(),y=tJ(),b=m3(),{form:C}=Tp(),{getFields:S}=hh(y),{isInSubForm:w,isInSubTable:F}=lu()||{},{name:j}=y,k=(0,es.useMemo)(()=>m(s.name)||h(s["x-collection-field"]),[s,h,m]),I=eu().omit(s,"required");(null==k?void 0:k.target)&&(r=h("".concat(k.target,".").concat((null==(l=s["x-component-props"])||null==(o=l.fieldNames)?void 0:o.label)||"id")));let P=(null==k?void 0:k.interface)==="m2o"&&a5(s),T=P&&h(null==P?void 0:P["x-collection-field"]),N=lz(),M=(null==p||null==(t=p.fieldSchema)?void 0:t["x-action"])==="customize:create"&&((null==k?void 0:k.interface)==="m2m"||(null==T?void 0:T.type)==="hasMany"&&(null==k?void 0:k.interface)==="m2o"),D=(0,es.useCallback)(e=>{let t=e.find(e=>"$nForm"===e.value),n=x(j);return(null==n?void 0:n.length)||!t||(t.children=rX(S())),e},[S,j]),R=(0,es.useMemo)(()=>({ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout,VariableInput:e=>(0,A.jsx)(ld,{isInSubForm:w,isInSubTable:F,isInSetDefaultValueDialog:!0,collectionField:k,children:(0,A.jsx)(rW,{...e})})}),[w,F]),q=(0,es.useMemo)(()=>({type:"object",title:u("Set default value"),properties:{default:{"x-decorator":"FormItem","x-component":"VariableInput","x-component-props":{...null==s?void 0:s["x-component-props"],collectionField:k,contextCollectionName:M&&N.collection,schema:null==k?void 0:k.uiSchema,targetFieldSchema:s,className:i.defaultInput,form:C,record:b,returnScope:D,shouldChange:rH({collectionField:k,variables:v,localVariables:g,getAllCollectionsInheritChain:f}),renderSchemaComponent:function(e){let t=eu().cloneDeep(I)||{};t.title="",t.name="default",t["x-read-pretty"]=!1,t["x-disabled"]=!1;let n=a7(t,k);k.target&&t["x-component-props"]&&(t["x-component-props"].mode="Select"),(null==k?void 0:k.uiSchema.type)&&(t.type=k.uiSchema.type),(null==k?void 0:k.uiSchema["x-component"])==="Checkbox"&&(eu().set(t,"x-component-props.defaultChecked",n),t.type="void");let o={...t,"x-decorator":"FormItem","x-component-props":{...t["x-component-props"],collectionName:null==k?void 0:k.collectionName,targetField:r,onChange:e.onChange,defaultValue:oY(n)?"":n,style:{width:"100%",verticalAlign:"top",minWidth:"200px"}},default:oY(n)?"":n};return(0,A.jsx)(ae,{children:(0,A.jsx)(al,{schema:o})})}},title:u("Default value"),default:a7(s,k)}}}),[k,s,I,C,f,M,g,b,D,u,N.collection,r,v,i]),_=(0,es.useCallback)(e=>{let t={"x-uid":s["x-uid"]};e.default=e.default||null,c.value=e.default,s.default=e.default,e.default||0===e.default||(c.value=null),t.default=e.default,d.emit("patch",{schema:t,currentSchema:a})},[a,d,c,s]);return(0,A.jsx)(aQ,{title:u("Set default value"),components:R,width:800,schema:q,onSubmit:_})},s_=[{name:"editFieldTitle",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{getCollectionJoinField:r}=sO(),{getField:i}=tJ(),a=i(l.name)||r(l["x-collection-field"]);return{title:t("Edit field title"),schema:{type:"object",title:t("Edit field title"),properties:{title:{title:t("Field title"),default:null==o?void 0:o.title,description:"".concat(t("Original field title: ")).concat(null==a||null==(e=a.uiSchema)?void 0:e.title),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit(e){let{title:t}=e;t&&(o.title=t,l.title=t,n.emit("patch",{schema:{"x-uid":l["x-uid"],title:l.title}})),n.refresh()}}},useVisible(){let e=(0,ec.useFieldSchema)(),{getCollectionJoinField:t}=sO(),{getField:n}=tJ();return!!(n(e.name)||t(e["x-collection-field"]))}},{name:"displayTitle",type:"switch",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),{dn:o}=eY(),l=(0,ec.useField)(),r=(0,ec.useFieldSchema)();return{title:n("Display title"),checked:null==(t=null==(e=r["x-decorator-props"])?void 0:e.showTitle)||t,onChange(e){r["x-decorator-props"]=r["x-decorator-props"]||{},r["x-decorator-props"].showTitle=e,l.decoratorProps.showTitle=e,o.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":{...r["x-decorator-props"],showTitle:e}}}),o.refresh()}}}},{name:"editDescription",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{dn:t}=eY(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)();return{title:e("Edit description"),schema:{type:"object",title:e("Edit description"),properties:{description:{default:null==n?void 0:n.description,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit(e){let{description:l}=e;n.description=l,o.description=l,t.emit("patch",{schema:{"x-uid":o["x-uid"],description:o.description}}),t.refresh()}}},useVisible:()=>!(0,ec.useField)().readPretty},{name:"editTooltip",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)();return{title:t("Edit tooltip"),schema:{type:"object",title:t("Edit tooltip"),properties:{tooltip:{default:null==l||null==(e=l["x-decorator-props"])?void 0:e.tooltip,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit(e){let{tooltip:t}=e;o.decoratorProps.tooltip=t,l["x-decorator-props"]=l["x-decorator-props"]||{},l["x-decorator-props"].tooltip=t,n.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}}),n.refresh()}}},useVisible:()=>(0,ec.useField)().readPretty},{name:"required",type:"switch",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o,refresh:l}=eY();return{title:e("Required"),checked:n.required,onChange(e){let r={"x-uid":n["x-uid"]};t.required=e,n.required=e,r.required=e,o.emit("patch",{schema:r}),l()}}},useVisible(){let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{required:n=!0}=sw();return!e.readPretty&&"FormField"!==t["x-component"]&&n}},{name:"editDefaultValue",Component:sq}],sO=e=>{let t=tr(),n=ts(),o=tg(),l=e||(null==n?void 0:n.key)||void 0,[r,i]=(0,es.useState)((0,ec.uid)()),{refresh:a}=SA(),s=(0,es.useMemo)(()=>{var e;return null==t||null==(e=t.collectionFieldInterfaceManager)?void 0:e.getFieldInterfaces().reduce((e,t)=>(e[t.name]=t,e),{})},[t,r]),c=(0,es.useMemo)(()=>null==t?void 0:t.collectionTemplateManager.getCollectionTemplates(),[t,r]),d=(0,es.useCallback)(()=>{var e,n;return null==t||null==(n=t.getDataSource(l))||null==(e=n.collectionManager)?void 0:e.getCollections().map(e=>e.getOptions())},[t,n]),u=(0,es.useCallback)(e=>{var n;return o&&!e?o:null==t||null==(n=t.getDataSource(e||l))?void 0:n.collectionManager},[o,t,l]),p=(0,es.useMemo)(()=>{var e,n;return null==t||null==(n=t.getDataSource(e9))||null==(e=n.collectionManager)?void 0:e.getCollections()},[t,r]),m=(0,es.useCallback)(()=>null==t?void 0:t.getDataSource(e9).reload().then(()=>{a(),i((0,ec.uid)())}),[t]),h=(0,es.useCallback)(()=>null==t?void 0:t.getDataSource(e9).reload().then(()=>{a(),i((0,ec.uid)())}),[t]),x=eB(),f=(0,es.useCallback)((e,t)=>{var n,o;return(null==(o=u(t))||null==(n=o.getCollection(e))?void 0:n.getInheritedFields())||[]},[t,u]),v=(0,es.useCallback)((e,t)=>{var n,o;if(!e)return[];let l=null==(n=u(t))?void 0:n.getCollection(e);return(null==l||null==(o=l.getAllFields)?void 0:o.call(l))||(null==l?void 0:l.getFields())||[]},[t,u]),g=(0,es.useCallback)((e,t)=>{var n;if(e&&!(e.split(".").length<2))return null==(n=u(t))?void 0:n.getCollectionField(e)},[t,u]),y=(0,es.useCallback)((e,t)=>{var n,o;return e&&(null==(o=u(t))||null==(n=o.getCollection(e))?void 0:n.getParentCollectionsName())||[]},[t,u]),b=(0,es.useCallback)(function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2?arguments[2]:void 0;if(!e)return[];let l=null==(t=u(o))?void 0:t.getCollection(e);return(null==l?void 0:l.getChildrenCollections(n))||[]},[t,u]),C=(0,es.useCallback)((e,t)=>{var n,o;return e&&(null==(o=u(t))||null==(n=o.getCollection(e))?void 0:n.getCurrentFields())||[]},[t,u]),S=(0,es.useCallback)(function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"string",o=arguments.length>2?arguments[2]:void 0,{association:l=!1,cached:r={},collectionNames:i=[e],maxDepth:a=1,allowAllTypes:s=!1,exceptInterfaces:c=[],prefixFieldValue:d="",usePrefix:u=!1,dataSource:p}=o||{};if(i.length-1>a)return;if(r[e])return eu().cloneDeep(r[e]);"string"==typeof n&&(n=[n]);let m=v(e,p),h=null==m||null==(t=m.filter(t=>t.interface&&!c.includes(t.interface)&&(s||n.includes(t.type)||!!(l&&t.target&&t.target!==e&&Array.isArray(l))&&l.includes(t.interface))))?void 0:t.map(e=>{var t,a;let s={value:u&&d?"".concat(d,".").concat(e.name):e.name,label:x(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name,...e};return l&&e.target&&(s.children=i.includes(e.target)?[]:S(e.target,n,{...o,cached:r,dataSource:p,collectionNames:[...i,e.target],prefixFieldValue:u?d?"".concat(d,".").concat(e.name):e.name:"",usePrefix:u}),!(null==(a=s.children)?void 0:a.length))?null:s}).filter(Boolean);return r[e]=h,h},[v]),w=(0,es.useCallback)((e,t)=>{var n;return null==(n=u(t))?void 0:n.getCollection(e)},[t,u]),F=(0,es.useCallback)((e,t)=>{var n,o;return null==(o=u(t))||null==(n=o.getCollection(e))?void 0:n.getAllCollectionsInheritChain()},[t,u]),j=(0,es.useCallback)((e,t)=>()=>{var n,o;return null==(o=u(t))||null==(n=o.getCollection(e))?void 0:n.getInheritCollectionsChain()},[t,u]),A=(0,es.useCallback)(e=>null==t?void 0:t.collectionFieldInterfaceManager.getFieldInterface(e),[t]),k=(0,es.useCallback)((e,t,n)=>{var o,l;return null==(l=u(n))||null==(o=l.getCollection(t))?void 0:o.getParentCollectionFields(e)},[t,u]);return{service:m,interfaces:s,collections:p,templates:c,getTemplate:(0,es.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"general";return null==t?void 0:t.collectionTemplateManager.getCollectionTemplate(e)},[t]),getInterface:A,getCollections:d,getParentCollectionFields:k,getInheritCollections:y,getChildrenCollections:b,refreshCM:h,get:w,getInheritedFields:f,getCollectionField:g,getCollectionFields:v,getCollectionFieldsOptions:S,getCurrentCollectionFields:C,getCollection:w,getCollectionJoinField:g,getAllCollectionsInheritChain:F,getInheritCollectionsChain:j,isTitleField:e=>{var t;return!e.isForeignKey&&(null==(t=A(e.interface))?void 0:t.titleUsable)}}},sB=e=>{var t;return(null==e||null==(t=e["x-component-props"])?void 0:t["pattern-disable"])==!0},sE=es.createContext(null),sV=e=>{let t=(0,es.useMemo)(()=>({isAllowToSetDefaultValue:e.isAllowToSetDefaultValue}),[e.isAllowToSetDefaultValue]);return(0,A.jsx)(sE.Provider,{value:t,children:e.children})},sz=function(){let{form:e,fieldSchema:t,collectionField:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{getInterface:o,getCollectionJoinField:l}=sO(),{getField:r}=tJ(),{form:i}=Tp(),a=(0,ec.useFieldSchema)(),{type:s}=Tc(),{isAllowToSetDefaultValue:c=sG}=(0,es.useContext)(sE)||{},d=r(a.name)||l(a["x-collection-field"]);return{isAllowToSetDefaultValue:l=>c({collectionField:n||d,getInterface:o,form:e||i,formBlockType:s,fieldSchema:t||a,isSubTableColumn:l})}},sL=["o2o","oho","obo","o2m","attachment","expression","point","lineString","circle","polygon","sequence","formula"];function sG(e){var t;let{collectionField:n,getInterface:o,formBlockType:l,form:r,fieldSchema:i,isSubTableColumn:a}=e;return a?!sL.includes(null==n?void 0:n.interface)&&!a8(n,o):!!n&&(!n.target||null==(t=i["x-component-props"])||!t.mode||!!["Picker","Select"].includes(i["x-component-props"].mode))&&"create"===l&&!(null==r?void 0:r.readPretty)&&!sB(i)&&!sL.includes(null==n?void 0:n.interface)&&!a8(n,o)}function sK(){var e,t;let n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{getCollectionField:l}=sO(),r=o["x-collection-field"]?l(o["x-collection-field"]):null,i=(null==(e=((null==r?void 0:r.uiSchema)||o)["x-component-props"])?void 0:e.multiple)===!0,a=null==n||null==(t=n.componentProps)?void 0:t.mode;return function(){return!n.readPretty&&"TableField"!==o["x-component"]&&i&&"SubTable"!==a}}var s$=n(1248),sU=n(88365);function sW(){let e=(0,ns._)(["\n width: 100%;\n & > .ant-space-item {\n flex: 1;\n }\n "]);return sW=function(){return e},e}let sH=P()(),sY=(0,nu.rU)(e=>{let{css:t}=e;return{space:t(sW())}}),sX=e=>{let t=P()();return(0,A.jsxs)("div",{style:{display:"inline-flex"},children:[(0,A.jsx)("span",{children:e.format}),(0,A.jsx)(sJ,{content:t.format(e.format)})]})},sJ=e=>{let{content:t}=e,{token:n}=iF();return(0,A.jsx)("span",{style:{display:"inline-block",background:n.colorBgTextHover,marginLeft:n.marginMD,lineHeight:"1",padding:n.paddingXXS,borderRadius:n.borderRadiusOuter},children:t})},sQ=(0,ec.connect)(e=>{let{styles:t}=sY(),{onChange:n,defaultValue:o,formats:l,timeFormat:r}=e,[i,{setFalse:a,setTrue:s}]=(0,s$.A)(e.value&&!l.includes(e.value)),c=e.value&&!l.includes(e.value)?e.value:o,[d,u]=(0,es.useState)(c?sH.format(c):null);return(0,A.jsx)(of.A,{className:t.space,children:(0,A.jsx)(sU.Ay.Group,{value:i?"custom":e.value,onChange:e=>{"custom"===e.target.value?(s(),n(c)):(a(),n(e.target.value))},children:(0,A.jsx)(of.A,{direction:"vertical",children:e.options.map(e=>"custom"===e.value?(0,A.jsxs)(sU.Ay,{value:e.value,children:[(0,A.jsx)(nJ.A,{style:{width:"150px"},defaultValue:c,onChange:e=>{e.target.value?u(sH.format(e.target.value)):u(null),i&&n(e.target.value)}}),(0,A.jsx)(sJ,{content:d})]},e.value):(0,A.jsx)(sU.Ay,{value:e.value,"aria-label":e.value,children:(0,A.jsx)("span",{role:"button","aria-label":e.value,children:e.label})},e.value))})})})},(0,ec.mapProps)({dataSource:"options"}));function sZ(){let e=(0,ns._)(["\n .ant-radio-wrapper {\n display: flex;\n margin: 5px 0px;\n }\n "]);return sZ=function(){return e},e}function s0(){let e=(0,ns._)(["\n margin-bottom: 0px;\n "]);return s0=function(){return e},e}function s1(){let e=(0,ns._)(["\n color: red;\n .ant-radio-wrapper {\n display: flex;\n margin: 5px 0px;\n }\n "]);return s1=function(){return e},e}let s2=(0,nu.rU)(e=>{let{css:t}=e;return{radio:t(sZ()),margin:t(s0()),redRadio:t(s1())}}),s6=function(e){var t,n,o,l,r,i,a,s,c;let{styles:d}=s2(),{fieldSchema:u}=e,p=(0,ec.useField)(),{dn:m}=eY(),{t:h}=(0,eT.useTranslation)(),{getCollectionJoinField:x}=sO(),f=x(null==u?void 0:u["x-collection-field"])||{},v=null==u||null==(t=u["x-component-props"])?void 0:t.showTime,g=(null==u||null==(n=u["x-component-props"])?void 0:n.dateFormat)||(null==f||null==(l=f.uiSchema)||null==(o=l["x-component-props"])?void 0:o.dateFormat)||"YYYY-MM-DD",y=(null==u||null==(r=u["x-component-props"])?void 0:r.timeFormat)||(null==f||null==(a=f.uiSchema)||null==(i=a["x-component-props"])?void 0:i.timeFormat)||"HH:mm:ss";return(0,A.jsx)(aQ,{title:h("Date display format"),schema:{type:"object",properties:{dateFormat:{type:"string",title:'{{t("Date format")}}',"x-component":sQ,"x-decorator":"FormItem","x-decorator-props":{},"x-component-props":{className:d.radio,defaultValue:"dddd",formats:["MMMM Do YYYY","YYYY-MM-DD","MM/DD/YY","YYYY/MM/DD","DD/MM/YYYY"]},default:g,enum:[{label:sX({format:"MMMM Do YYYY"}),value:"MMMM Do YYYY"},{label:sX({format:"YYYY-MM-DD"}),value:"YYYY-MM-DD"},{label:sX({format:"MM/DD/YY"}),value:"MM/DD/YY"},{label:sX({format:"YYYY/MM/DD"}),value:"YYYY/MM/DD"},{label:sX({format:"DD/MM/YYYY"}),value:"DD/MM/YYYY"},{label:"custom",value:"custom"}]},showTime:{default:void 0===v?null==f||null==(c=f.uiSchema)||null==(s=c["x-component-props"])?void 0:s.showTime:v,type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Show time")}}',"x-reactions":["{{(field) => {\n field.query('.timeFormat').take(f => {\n f.display = field.value ? 'visible' : 'none';\n });\n }}}"]},timeFormat:{type:"string",title:'{{t("Time format")}}',"x-component":sQ,"x-decorator":"FormItem","x-decorator-props":{className:d.margin},"x-component-props":{className:d.redRadio,defaultValue:"h:mm a",formats:["hh:mm:ss a","HH:mm:ss"],timeFormat:!0},default:y,enum:[{label:sX({format:"hh:mm:ss a"}),value:"hh:mm:ss a"},{label:sX({format:"HH:mm:ss"}),value:"HH:mm:ss"},{label:"custom",value:"custom"}]}}},onSubmit:e=>{let t={"x-uid":u["x-uid"]};t["x-component-props"]=u["x-component-props"]||{},u["x-component-props"]={...u["x-component-props"]||{},...e},t["x-component-props"]=u["x-component-props"],p.componentProps=u["x-component-props"];let n=p.path.entire.split(".");n.pop();let o=n.join(".");p.query("".concat(o,".*[0:].").concat(u.name)).forEach(t=>{t.props.name===u.name&&t.setComponentProps({...e})}),m.emit("patch",{schema:t}),m.refresh()}})},s3=function(e){var t,n,o,l;let r=(0,ec.useField)(),{dn:i}=eY(),{t:a}=(0,eT.useTranslation)(),s=(0,ec.useFieldSchema)(),{getField:c}=tJ(),{getCollectionJoinField:d}=sO(),u=null!=(l=null==e?void 0:e.fieldSchema)?l:s,p=c(u.name)||d(u["x-collection-field"]),m=hd(null==p?void 0:p.target),h=(null==(o=u["x-component-props"])||null==(n=o.service)||null==(t=n.params)?void 0:t.sort)||[],x=null==h?void 0:h.map(e=>(null==e?void 0:e.startsWith("-"))?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return(0,A.jsx)(aQ,{title:a("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:a("Set default sorting rules"),properties:{sort:{type:"array",default:x,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:m,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:a("ASC"),value:"asc"},{label:a("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:a("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:t=>{var n;let{sort:o}=t,l=o.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);r.query(new RegExp("[0-9]+\\.".concat(u.name,"$"))).forEach(e=>{eu().set(e,"componentProps.service.params.sort",l)}),eu().set(u,"x-component-props.service.params.sort",l),null==e||null==(n=e.onSubmitCallBack)||n.call(e,l),r.componentProps=u["x-component-props"],i.emit("patch",{schema:{"x-uid":u["x-uid"],"x-component-props":u["x-component-props"]}})}})},s5=()=>{var e;let t=(0,ec.useFieldSchema)(),{dn:n}=eY(),{name:o}=tJ(),l=(e=>{var t;let{getCollectionFields:n,getInterface:o}=sO(),l=n(e);return null==l||null==(t=l.filter)?void 0:t.call(l,e=>{if(!e.interface)return!1;let t=o(e.interface);return!!(null==t?void 0:t.filterable)})})(o),r=eB(),{t:i}=(0,eT.useTranslation)(),a=(null==t||null==(e=t["x-component-props"])?void 0:e.nonfilterable)||[];return(0,A.jsx)(aL,{title:i("Filterable fields"),children:l.map(e=>{var o;let l=!a.includes(e.name);return(0,A.jsx)(aY,{checked:l,title:r(null==e||null==(o=e.uiSchema)?void 0:o.title),onChange:o=>{var l;t["x-component-props"]=(null==t?void 0:t["x-component-props"])||{};let r=(null==t||null==(l=t["x-component-props"])?void 0:l.nonfilterable)||[];if(o){let t=r.indexOf(e.name);r.splice(t,1)}else r.push(e.name);t["x-component-props"].nonfilterable=r,n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-component-props":{...t["x-component-props"]}}}),n.refresh()}},e.name)})})};function s4(){let e=(0,ns._)(["\n padding-top: ","px;\n "]);return s4=function(){return e},e}function s8(){let e=(0,ns._)(["\n display: flex;\n justify-content: flex-end;\n width: 100%;\n flex-shrink: 0;\n padding-bottom: ","px;\n border-bottom: 1px solid rgba(5, 5, 5, 0.06);\n .ant-btn {\n margin-right: ","px;\n }\n\n .title {\n flex: 1;\n margin: 0;\n color: rgba(0, 0, 0, 0.88);\n font-weight: 600;\n font-size: ","px;\n line-height: ",";\n padding-right: 24px;\n }\n "]);return s8=function(){return e},e}function s7(){let e=(0,ns._)(["\n position: sticky !important;\n top: 0 !important;\n z-index: 100 !important;\n background: #fff !important;\n background-color: #fff !important;\n padding: ","px 0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n border-bottom: 1px solid rgba(5, 5, 5, 0.06);\n margin: 0 -16px;\n padding-left: 16px;\n padding-right: 16px;\n\n /* 确保完全遮挡 */\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100vw;\n right: -100vw;\n bottom: 0;\n background: #fff;\n z-index: -1;\n }\n "]);return s7=function(){return e},e}let s9=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{container:t(s4(),n.padding),footer:t(s8(),n.padding,n.margin,n.fontSizeHeading3,n.lineHeightHeading3),stickyFooter:t(s7(),n.padding)}}),ce=(0,es.createContext)({});ce.displayName="ActionContext";let ct=e=>{let t=co();return(0,A.jsx)(ce.Provider,{value:{...t,...e,...null==e?void 0:e.value},children:e.children})},cn=()=>({async run(){}}),co=()=>{let e=(0,es.useContext)(ce),{t}=(0,eT.useTranslation)(),{modal:n}=eX.A.useApp();return{...e,setVisible(o){let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((null==e?void 0:e.openMode)!=="page"){var r,i;o?null==e||null==(i=e.setVisible)||i.call(e,o):l&&e.formValueChanged?n.confirm({title:t("Unsaved changes"),content:t("Are you sure you don't want to save?"),async onOk(){var t;e.setFormValueChanged(!1),null==(t=e.setVisible)||t.call(e,!1)}}):null==e||null==(r=e.setVisible)||r.call(e,!1)}}}},cl=()=>{let{setVisible:e}=(0,es.useContext)(ce),t=(0,ec.useForm)();return{async run(){e(!1),t.submit(e=>{console.warn(e)})}}},cr=()=>{let e=(0,ec.useFieldSchema)(),t=Td();return["Action.Link","Action"].includes(e["x-component"])&&t},ci=es.createContext({}),ca=e=>{let{children:t}=e,[n,o]=(0,es.useState)(()=>{}),[l,r]=(0,es.useState)(()=>{}),i=(0,es.useRef)();return(0,A.jsx)(ci.Provider,{value:{component:n,setComponent:o,prevSetVisible:l,setPrevSetVisible:r,ref:i},children:t})},cs=()=>{let{component:e}=(0,es.useContext)(ci);return e},cc=()=>{let{ref:e}=(0,es.useContext)(ci);return(0,A.jsx)("div",{ref:e})},cd=e=>{let{children:t}=e,{visible:n,setVisible:o}=co(),{prevSetVisible:l,setPrevSetVisible:r,ref:i}=(0,es.useContext)(ci);return(0,es.useEffect)(()=>{n&&(null==r||r(()=>(null==l||l(!1),o(!0),o)))},[n]),n&&i.current?(0,oy.createPortal)(t,i.current):null},cu=(0,ec.observer)(e=>{let{footerNodeName:t="ActionArea.Footer",stickyFooter:n=!1}=e,o=(0,ec.useFieldSchema)(),l=(0,ec.useField)(),{styles:r}=s9();return(0,A.jsx)(cd,{children:(0,A.jsx)(()=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"".concat(r.footer," ").concat(n?r.stickyFooter:""),children:[(0,A.jsx)("div",{className:"title",children:(0,A.jsx)("strong",{children:l.title})}),(0,A.jsx)(ec.RecursionField,{basePath:l.address,schema:o,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]===t})]}),(0,A.jsx)("div",{className:r.container,children:(0,A.jsx)(ec.RecursionField,{basePath:l.address,schema:o,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]!==t})})]}),{})})},{displayName:"ActionArea"});cu.Footer=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)();return(0,A.jsx)(ec.RecursionField,{basePath:e.address,schema:t,onlyRenderProperties:!0})},{displayName:"ActionArea.Footer"});var cp=n(64620),cm=n(52101),ch=n(62073),cx=n(19961);let{ConfigContext:cf}=og.Ay,cv=(e,t)=>{let{getPrefixCls:n}=(0,es.useContext)(og.Ay.ConfigContext)||{};if("ConfigContext"in og.Ay)return(null==n?void 0:n(e,null==t?void 0:t.prefixCls))||"";{var o;let n=null!=(o=null==t?void 0:t.prefixCls)?o:"ant-";return"".concat(n).concat(null!=e?e:"")}};var cg=n(33173);let cy=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Loading...",t=arguments.length>1?arguments[1]:void 0,n=null,o=setTimeout(()=>{n=cg.Ay.loading(e)},100);try{return await t()}finally{null==n||n(),clearTimeout(o)}},cb={...ob},{version:cC,render:cS,unmountComponentAtNode:cw}=cb;try{Number((cC||"").split(".")[0])>=18&&cb.createRoot&&(l=cb.createRoot)}catch(e){}function cF(e){let{__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:t}=cb;t&&"object"==typeof t&&(t.usingClientEntryPoint=e)}let cj="__antd_mobile_root__";async function cA(e){return Promise.resolve().then(()=>{var t;null==(t=e[cj])||t.unmount(),delete e[cj]})}let ck=(0,ec.observable)(new Map);var cI=n(22885);let cP=(e,t)=>n=>{let{theme:o,token:l,hashId:r}=iw.A.useToken(),{getPrefixCls:i,iconPrefixCls:a}=(0,es.useContext)(cf),s=cv(e),c=i();return{wrapSSR:(0,cI.useStyleRegister)({theme:o,token:l,hashId:r,path:["formily-antd",e,s,a]},()=>{let e=".".concat(s),o=t((0,ec.merge)(l,{componentCls:e,prefixCls:s,iconCls:".".concat(a),antCls:".".concat(c)}),n,{hashId:r,prefixCls:s,rootPrefixCls:c,iconPrefixCls:a});return[((e,t)=>{let{fontFamily:n,fontSize:o}=e,l='[class^="'.concat(t,'"], [class*=" ').concat(t,'"]');return{[l]:{fontFamily:n,fontSize:o,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[l]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}})(l,s),o]}),hashId:r,componentCls:s,rootPrefixCls:c}},cT=cP("tb-action-drawer",e=>{let{componentCls:t}=e;return{[t]:{overflow:"hidden","&.reset":{"&.tb-action-popup":{".ant-drawer-body":{paddingTop:e.paddingContentVerticalLG,backgroundColor:"var(--colorBgDrawer)"}},"&.tb-record-picker-selector":{".ant-drawer-wrapper-body":{backgroundColor:"var(--colorBgDrawer)"},".tb-block-item":{marginBottom:e.marginLG,".general-schema-designer":{top:-e.sizeXS,bottom:-e.sizeXS,left:-e.sizeXS,right:-e.sizeXS}}}},".ant-drawer-title":{textAlign:"center"},".footer":{display:"flex",justifyContent:"flex-end",width:"100%",".ant-btn":{marginRight:e.marginXS}},".ant-drawer-content-wrapper":{borderLeft:"1px solid ".concat(e.colorBorder)}}}}),cN=()=>{let e=(0,ec.useFieldSchema)(),t=e["x-component"],n=eB(),{name:o}=tJ(),l=n(e.title);return o=o?"-".concat(o):"",l=l?"-".concat(l):"",{getAriaLabel:(0,es.useCallback)(e=>(e=e?"-".concat(e):"","drawer-".concat(t).concat(o).concat(l).concat(e)),[o,t,l])}};function cM(){let e=(0,ns._)(["\n background: none;\n border: none;\n "]);return cM=function(){return e},e}function cD(){let e=(0,ns._)(["\n background: none;\n border: none;\n "]);return cD=function(){return e},e}let cR=new Map([["small","30%"],["middle","50%"],["large","70%"]]),cq=(0,ec.observer)(e=>{let{footerNodeName:t="Action.Drawer.Footer",...n}=e,{visible:o,setVisible:l,openSize:r="middle",drawerProps:i}=co(),a=(0,ec.useFieldSchema)(),s=(0,ec.useField)(),{componentCls:c,hashId:d}=cT(),u=a.reduceProperties((e,n)=>n["x-component"]===t?n:e);return(0,A.jsx)(cx.A,{width:cR.get(r),extra:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(c_,{}),(0,A.jsx)(e3.Ay,{type:"text",icon:(0,A.jsx)(cp.A,{}),className:(0,iS.css)(cM()),onClick:()=>l(!1,!0)})]}),title:s.title,...n,...i,rootStyle:{...null==i?void 0:i.style,...null==n?void 0:n.style},destroyOnClose:!0,closable:!1,open:o,onClose:()=>l(!1,!0),rootClassName:r6()(c,d,null==i?void 0:i.className,n.className,"reset"),footer:u&&(0,A.jsx)("div",{className:"footer",children:(0,A.jsx)(ec.RecursionField,{basePath:s.address,schema:a,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]===t})}),className:"".concat(e.className," amplifier-block"),children:(0,A.jsx)(ec.RecursionField,{basePath:s.address,schema:a,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]!==t})})},{displayName:"ActionDrawer"});cq.Footer=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)();return(0,A.jsx)(ec.RecursionField,{basePath:e.address,schema:t,onlyRenderProperties:!0})},{displayName:"ActionDrawer.Footer"});let c_=()=>{let[e,t]=(0,es.useState)(!1),[n,o]=(0,es.useState)("");return(0,A.jsx)(e3.Ay,{type:"text",icon:e?(0,A.jsx)(cm.A,{}):(0,A.jsx)(ch.A,{}),className:(0,iS.css)(cD()),onClick:l=>{let r=l.target.closest(".ant-drawer-content-wrapper");e?r.style.width=n:(o(r.getBoundingClientRect().width+"px"),r.style.width="100%"),t(!e)}})};function cO(){let e=(0,ns._)(["\n &.tb-action-popup {\n .ant-modal-header {\n // TODO: theme variables\n margin-top: -20px;\n margin-left: -24px;\n margin-right: -24px;\n padding-top: 20px;\n padding-left: 24px;\n padding-right: 24px;\n padding-bottom: 20px;\n }\n .ant-modal-content {\n background: var(--tb-box-bg);\n }\n }\n "]);return cO=function(){return e},e}function cB(){let e=(0,ns._)(["\n max-height: 80vh;\n overflow: hidden;\n .ant-tabs-content-holder {\n height: 70vh;\n overflow-y: scroll;\n overflow-x: hidden;\n }\n "]);return cB=function(){return e},e}let cE=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(cO()),modalClassName:t(cB())}}),cV=()=>{let e=(0,ec.useFieldSchema)(),t=e["x-component"],n=eB(),{name:o}=tJ(),l=n(e.title);return o=o?"-".concat(o):"",l=l?"-".concat(l):"",{getAriaLabel:(0,es.useCallback)(e=>(e=e?"-".concat(e):"","modal-".concat(t).concat(o).concat(l).concat(e)),[o,t,l])}};function cz(){let e=(0,ns._)(["\n background: none;\n border: none;\n "]);return cz=function(){return e},e}function cL(){let e=(0,ns._)(["\n background: none;\n border: none;\n "]);return cL=function(){return e},e}let cG=new Map([["small","40%"],["middle","60%"],["large","80%"]]),cK=(0,ec.observer)(e=>{let{footerNodeName:t="Action.Modal.Footer",width:n,...o}=e,{styles:l}=cE(),{visible:r,setVisible:i,openSize:a="middle",modalProps:s}=co(),c=null!=n?n:cG.get(a),d=(0,ec.useFieldSchema)(),u=(0,ec.useField)(),p=d.reduceProperties((e,n)=>n["x-component"]===t?n:e);return(0,A.jsx)(ox.A,{className:r6()(o.className,null==s?void 0:s.className,l.container,"amplifier-block"),style:{...null==s?void 0:s.style,...null==o?void 0:o.style},width:c,title:(0,A.jsxs)("div",{style:{display:"flex"},children:[(0,A.jsx)("span",{style:{flex:1},children:u.title}),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(c$,{}),(0,A.jsx)(e3.Ay,{type:"text",icon:(0,A.jsx)(cp.A,{}),className:(0,iS.css)(cz()),onClick:()=>i(!1,!0)})]})]}),...o,...s,destroyOnClose:!0,open:r,closable:!1,footer:!!p&&(0,A.jsx)(ec.RecursionField,{basePath:u.address,schema:d,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]===t}),children:(0,A.jsx)("div",{className:l.modalClassName,children:(0,A.jsx)(ec.RecursionField,{basePath:u.address,schema:d,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]!==t})})})},{displayName:"ActionModal"});cK.Footer=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)();return(0,A.jsx)(ec.RecursionField,{basePath:e.address,schema:t,onlyRenderProperties:!0})},{displayName:"ActionModal.Footer"});let c$=()=>{let[e,t]=(0,es.useState)(!1),[n,o]=(0,es.useState)("");return(0,A.jsx)(e3.Ay,{icon:e?(0,A.jsx)(cm.A,{}):(0,A.jsx)(ch.A,{}),type:"text",className:(0,iS.css)(cL()),onClick:l=>{let r=l.target.closest(".ant-modal-content"),i=document.querySelector(".ant-modal"),a=document.querySelector(".ant-modal-mask");e?(i.style.width=n,r.style.width="",i.style.top="",i.style.padding="",i.style.margin="",a.style.backgroundColor=""):(o(i.getBoundingClientRect().width+"px"),r.style.width="100vw",i.style.width="100%",i.style.top="0",i.style.padding="0",i.style.margin="0",a.style.backgroundColor="#f3f3f3"),t(!e)}})};function cU(){let e=(0,ns._)(["\n display: flex;\n width: 100%;\n .ant-btn {\n margin-right: 8px;\n }\n "]);return cU=function(){return e},e}let cW=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(cU())}}),cH=(0,ec.observer)(e=>{let{footerNodeName:t="Action.Page.Footer",...n}=e,{containerRefKey:o,visible:l,setVisible:r}=co(),i=(0,es.useContext)(ec.SchemaExpressionScopeContext)[o],{styles:a}=cW(),s=(0,ec.useFieldSchema)(),c=(0,ec.useField)(),d=s.reduceProperties((e,n)=>n["x-component"]===t?n:e);return(0,A.jsx)(A.Fragment,{children:(null==i?void 0:i.current)&&l&&(0,oy.createPortal)((0,A.jsxs)("div",{"data-testid":"action-page",className:"tb-action-page",children:[(0,A.jsx)(ec.RecursionField,{basePath:c.address,schema:s,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]!==t}),d&&(0,A.jsx)("div",{className:a.container,children:(0,A.jsx)(ec.RecursionField,{basePath:c.address,schema:s,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]===t})})]}),null==i?void 0:i.current)})},{displayName:"ActionPage"});function cY(){let e=(0,ns._)(["\n background: none;\n border: none;\n "]);return cY=function(){return e},e}cH.Footer=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)();return(0,A.jsx)(ec.RecursionField,{basePath:e.address,schema:t,onlyRenderProperties:!0})},{displayName:"ActionPage.Footer"});let cX=(0,ec.observer)(e=>{let{footerNodeName:t="Action.Drawer.Footer",...n}=e,{visible:o,setVisible:l,drawerProps:r}=co(),i=(0,ec.useFieldSchema)(),a=(0,ec.useField)(),{componentCls:s,hashId:c}=cT();return(0,A.jsx)(cx.A,{placement:"bottom",height:"90%",title:a.title,...n,...r,rootStyle:{...null==r?void 0:r.style,...null==n?void 0:n.style},extra:(0,A.jsx)(A.Fragment,{children:(0,A.jsx)(e3.Ay,{type:"text",icon:(0,A.jsx)(i6,{type:"CloseOutlined"}),className:(0,iS.css)(cY()),onClick:()=>l(!1,!0)})}),closable:!1,destroyOnClose:!0,open:o,onClose:()=>l(!1,!0),rootClassName:r6()(s,c,null==r?void 0:r.className,n.className,"reset"),className:"".concat(e.className," amplifier-block"),children:(0,A.jsx)(ec.RecursionField,{basePath:a.address,schema:i,onlyRenderProperties:!0,filterProperties:e=>e["x-component"]!==t})})},{displayName:"ActionSheet"});cX.Footer=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)();return(0,A.jsx)(ec.RecursionField,{basePath:e.address,schema:t,onlyRenderProperties:!0})},{displayName:"ActionSheet.Footer"});let cJ=(0,ec.observer)(e=>{let{openMode:t}=co();return"drawer"===t?(0,A.jsx)(cq,{footerNodeName:"Action.Container.Footer",...e}):"modal"===t?(0,A.jsx)(cK,{footerNodeName:"Action.Container.Footer",...e}):"sheet"===t?(0,A.jsx)(cX,{footerNodeName:"Action.Container.Footer",...e}):(0,A.jsx)(cH,{footerNodeName:"Action.Container.Footer",...e})},{displayName:"ActionContainer"});cJ.Footer=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)();return(0,A.jsx)(ec.RecursionField,{basePath:e.address,schema:t,onlyRenderProperties:!0})},{displayName:"ActionContainer.Footer"});var cQ=n(3411);let cZ=(0,ec.connect)(rS.A,(0,ec.mapProps)((e,t)=>{(0,es.useEffect)(()=>{t.value=e.defaultCheckedKeys||[]},[]);let[n,o]=(0,es.useState)(e.defaultCheckedKeys||[]),l=e=>{o(e),t.value=e};return t.onCheck=l,{...e,checkedKeys:n,onCheck:l}}));function c0(){let{dn:e}=eY(),{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{name:l}=tJ(),{getEnableFieldTree:r,getOnLoadData:i}=vj(l);return(0,A.jsx)(aQ,{title:t("Save mode"),components:{Tree:cZ},scope:{getEnableFieldTree:r,name:l,getOnLoadData:i},schema:{type:"object",title:t("Save mode"),properties:{saveMode:{"x-decorator":"FormItem","x-component":"Radio.Group",default:n.componentProps.saveMode||"create",enum:[{value:"create",label:'{{t("Insert")}}'},{value:"firstOrCreate",label:'{{t("Insert if not exists")}}'},{value:"updateOrCreate",label:'{{t("Insert if not exists, or update")}}'}]},filterKeys:{type:"array",title:'{{ t("Determine whether a record exists by the following fields") }}',required:!0,default:n.componentProps.filterKeys,"x-decorator":"FormItem","x-component":"Tree","x-component-props":{treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:"{{ getOnLoadData($self) }}",defaultCheckedKeys:n.componentProps.filterKeys,rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".saveMode"],fulfill:{state:{hidden:'{{ $deps[0]==="create"}}',componentProps:{treeData:"{{ getEnableFieldTree(name, $self) }}"}}}}]}}},onSubmit:t=>{let{saveMode:l,filterKeys:r}=t;n.componentProps.saveMode=l,n.componentProps.filterKeys=r,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].saveMode=l,o["x-component-props"].filterKeys=r,e.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":{...o["x-component-props"]}}}),e.refresh()}})}let c1=new or({name:"actionSettings:createSubmit",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"secondConfirmation",Component:dC},{name:"afterSuccessfulSubmission",Component:dh},{name:"jumpDetails",type:"switch",useVisible(){let{fieldSchema:e}=co(),t=dm(e);return!t||"page"===t},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useFieldSchema)(),o=(0,ec.useField)(),{dn:l,refresh:r}=eY();return{title:t("Jump details"),checked:null==n||null==(e=n["x-action-settings"])?void 0:e.pageMode,onChange(e){let t={"x-uid":n["x-uid"]};o.actionSetting={...null==o?void 0:o.ationSetting,pageMode:e},n["x-action-settings"]={...null==n?void 0:n["x-action-settings"],pageMode:e},t["x-action-settings"]=n["x-action-settings"],l.emit("patch",{schema:t}),r()}}}},{name:"workflowConfig",Component:dv,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.triggerWorkflows)}},{name:"saveMode",Component:c0},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),c2=e=>{var t,n,o,l;let{openMode:r=!0,openSize:i=!0}=e,a=(0,ec.useFieldSchema)(),s=(0,ec.useField)(),{t:c}=(0,eT.useTranslation)(),{dn:d}=eY(),u=(null==a||null==(t=a["x-component-props"])?void 0:t.openMode)||"drawer";return(0,A.jsxs)(A.Fragment,{children:[r?(0,A.jsx)(mD,{title:c("Open mode"),options:[{label:c("Drawer"),value:"drawer"},{label:c("Dialog"),value:"modal"}],value:u,onChange:e=>{s.componentProps.openMode=e;let t={"x-uid":a["x-uid"]};t["x-component-props"]=a["x-component-props"]||{},t["x-component-props"].openMode=e,a["x-component-props"].openMode=e,Reflect.deleteProperty(a["x-component-props"],"openSize"),d.emit("patch",{schema:t}),d.refresh()}}):null,i&&["modal","drawer"].includes(u)?(0,A.jsx)(mf,{children:(0,A.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},children:[c("Popup size"),(0,A.jsx)(oo.A,{"data-testid":"antd-select",bordered:!1,options:[{label:c("Small"),value:"small"},{label:c("Middle"),value:"middle"},{label:c("Large"),value:"large"}],value:null!=(l=null==a||null==(n=a["x-component-props"])?void 0:n.openSize)?l:(null==a||null==(o=a["x-component-props"])?void 0:o.openMode)=="modal"?"large":"middle",onChange:e=>{s.componentProps.openSize=e;let t={"x-uid":a["x-uid"]};t["x-component-props"]=a["x-component-props"]||{},t["x-component-props"].openSize=e,a["x-component-props"].openSize=e,d.emit("patch",{schema:t}),d.refresh()},style:{textAlign:"right",minWidth:100}})]})}):null]})},c6=e=>{var t,n,o,l;let{openMode:r=!0,openSize:i=!0}=e,a=(0,ec.useFieldSchema)(),s=(0,ec.useField)(),{t:c}=(0,eT.useTranslation)(),{dn:d}=eY(),u=(null==a||null==(t=a["x-component-props"])?void 0:t.openMode)||"drawer";return(0,A.jsxs)(A.Fragment,{children:[r?(0,A.jsx)(aW,{title:c("Open mode"),options:[{label:c("Drawer"),value:"drawer"},{label:c("Dialog"),value:"modal"},{label:c("Sheet"),value:"sheet"},{label:c("Page"),value:"page"}],value:u,onChange:e=>{s.componentProps.openMode=e;let t={"x-uid":a["x-uid"]};t["x-component-props"]=a["x-component-props"]||{},t["x-component-props"].openMode=e,a["x-component-props"].openMode=e,Reflect.deleteProperty(a["x-component-props"],"openSize"),d.emit("patch",{schema:t}),d.refresh()}}):null,i&&["modal","drawer"].includes(u)?(0,A.jsx)(aW,{title:c("Popup size"),options:[{label:c("Small"),value:"small"},{label:c("Middle"),value:"middle"},{label:c("Large"),value:"large"}],value:null!=(l=null==a||null==(n=a["x-component-props"])?void 0:n.openSize)?l:(null==a||null==(o=a["x-component-props"])?void 0:o.openMode)=="modal"?"large":"middle",onChange:e=>{s.componentProps.openSize=e;let t={"x-uid":a["x-uid"]};t["x-component-props"]=a["x-component-props"]||{},t["x-component-props"].openSize=e,a["x-component-props"].openSize=e,d.emit("patch",{schema:t}),d.refresh()}}):null]})};function c3(){Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var e={},t={$is:function(e,t){return e===t},$match:function(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.some(e=>Array.isArray(e))?e.some(e=>(null==e?void 0:e.length)===t.length&&(null==e?void 0:e.every((e,n)=>e===t[n]))):JSON.stringify(e)===JSON.stringify(t)},$eq:function(e,t){if(Array.isArray(e)&&Array.isArray(t))return JSON.stringify(e)===JSON.stringify(t);return Array.isArray(e)?e.includes(t):e===t},$ne:function(e,t){return e!=t},"!==":function(e,t){return e!==t},$gt:function(e,t){return Array.isArray(e)?e.some(e=>e>t):e>t},$gte:function(e,t){return e>=t},$lt:function(e,t,n){return Array.isArray(e)?e.some(e=>e<t):void 0===n?e<t:e<t&&t<n},$lte:function(e,t,n){return void 0===n?e<=t:e<=t&&t<=n},$exists:function(t){return e.truthy(t)},$notEmpty:function(t){return e.truthy(t)},$empty:function(t){return Array.isArray(t)?t.some(t=>!e.truthy(t)):!e.truthy(t)},$notExists:function(t){return!e.truthy(t)},"%":function(e,t){return e%t},log:function(e){return console.log(e),e},$in:function(e,t){return!!t&&void 0!==t.indexOf&&(Array.isArray(e)&&Array.isArray(t)?t.some(t=>e.includes(t)):-1!==t.indexOf(e))},$notIn:function(e,t){return!!t&&void 0!==t.indexOf&&-1===t.indexOf(e)},$includes:function(e,t){return!!e&&void 0!==e.indexOf&&(Array.isArray(e)?e.some(e=>null==e?void 0:e.includes(t)):-1!==e.indexOf(t))},$notIncludes:function(e,t){return!!e&&void 0!==e.indexOf&&(Array.isArray(e)?!e.some(e=>e.includes(t)):-1===e.indexOf(t))},$anyOf:function(e,t){return 0!==e.length&&(Array.isArray(e)&&Array.isArray(t)&&e.some(e=>Array.isArray(e))?e.some(e=>e.some(e=>t.includes(e))):e.some(e=>t.includes(e)))},$noneOf:function(e,t){return 0===e.length||(Array.isArray(e)&&Array.isArray(t)&&e.some(e=>Array.isArray(e))?e.some(e=>e.every(e=>!t.some(t=>e.includes(t)))):t.some(t=>!e.includes(t)))},$notMatch:function(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1},$dateOn:function(e,t){return!!e&&!!t&&(Array.isArray(e)||(e=[e,e]),Array.isArray(t)||(t=[t,t]),e=e.map(e=>P()(e)),t=t.map(e=>P()(e)),e[0].isBetween(t[0],t[1],null,"[]")&&e[1].isBetween(t[0],t[1],null,"[]"))},$dateBefore:function(e,t){return!!e&&!!t&&(Array.isArray(e)||(e=[e,e]),Array.isArray(t)||(t=[t,t]),e=e.map(e=>P()(e)),t=t.map(e=>P()(e)),e[0].isBefore(t[0])&&e[1].isBefore(t[0]))},$dateNotBefore:function(e,n){return!t.$dateBefore(e,n)},$dateAfter:function(e,t){return!!e&&!!t&&(Array.isArray(e)||(e=[e,e]),Array.isArray(t)||(t=[t,t]),e=e.map(e=>P()(e)),t=t.map(e=>P()(e)),e[0].isAfter(t[1])&&e[1].isAfter(t[1]))},$dateNotAfter:function(e,n){return!t.$dateAfter(e,n)},$dateBetween:function(e,n){return t.$dateOn(e,n)},$dateNotOn:function(e,n){return!t.$dateOn(e,n)},$isTruly:function(e){return Array.isArray(e)?e.some(e=>!0===e||1===e):!0===e||1===e},$isFalsy:function(t){return Array.isArray(t)?t.some(t=>!e.truthy(t)):!e.truthy(t)},cat:function(){return Array.prototype.join.call(arguments,"")},substr:function(e,t,n){if(n<0){var o=String(e).substr(t);return o.substr(0,o.length+n)}return String(e).substr(t,n)},"+":function(){return Array.prototype.reduce.call(arguments,function(e,t){return parseFloat(e,10)+parseFloat(t,10)},0)},"*":function(){return Array.prototype.reduce.call(arguments,function(e,t){return parseFloat(e,10)*parseFloat(t,10)})},"-":function(e,t){return void 0===t?-e:e-t},"/":function(e,t){return e/t},min:function(){return Math.min.apply(this,arguments)},max:function(){return Math.max.apply(this,arguments)},merge:function(){return Array.prototype.reduce.call(arguments,function(e,t){return e.concat(t)},[])},var:function(e,t){var n=void 0===t?null:t,o=this;if(void 0===e||""===e||null===e)return o;for(var l=String(e).split("."),r=0;r<l.length;r++)if(null==o||void 0===(o=o[l[r]]))return n;return o},missing:function(){for(var t=[],n=Array.isArray(arguments[0])?arguments[0]:arguments,o=0;o<n.length;o++){var l=n[o],r=e.apply({var:l},this);(null===r||""===r)&&t.push(l)}return t},missing_some:function(t,n){var o=e.apply({missing:n},this);return n.length-o.length>=t?[]:o}};return e.is_logic=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&1===Object.keys(e).length},e.truthy=function(e){return(!Array.isArray(e)||0!==e.length)&&!!e},e.get_operator=function(e){return Object.keys(e)[0]},e.get_values=function(t){return t[e.get_operator(t)]},e.apply=function(n,o){if(Array.isArray(n))return n.map(function(t){return e.apply(t,o)});if(!e.is_logic(n))return n;var l,r,i,a,s,c=e.get_operator(n),d=n[c];if(Array.isArray(d)||(d=[d]),"if"===c||"?:"==c){for(l=0;l<d.length-1;l+=2)if(e.truthy(e.apply(d[l],o)))return e.apply(d[l+1],o);return d.length===l+1?e.apply(d[l],o):null}if("$and"===c){for(l=0;l<d.length&&(r=e.apply(d[l],o),e.truthy(r));l+=1);return r}if("or"===c){for(l=0;l<d.length&&(r=e.apply(d[l],o),!e.truthy(r));l+=1);return r}if("filter"===c)return(a=e.apply(d[0],o),i=d[1],Array.isArray(a))?a.filter(function(t){return e.truthy(e.apply(i,t))}):[];if("map"===c)return(a=e.apply(d[0],o),i=d[1],Array.isArray(a))?a.map(function(t){return e.apply(i,t)}):[];else if("reduce"===c)return(a=e.apply(d[0],o),i=d[1],s=void 0!==d[2]?d[2]:null,Array.isArray(a))?a.reduce(function(t,n){return e.apply(i,{current:n,accumulator:t})},s):s;else if("all"===c){if(a=e.apply(d[0],o),i=d[1],!Array.isArray(a)||!a.length)return!1;for(l=0;l<a.length;l+=1)if(!e.truthy(e.apply(i,a[l])))return!1;return!0}else if("none"===c){if(a=e.apply(d[0],o),i=d[1],!Array.isArray(a)||!a.length)return!0;for(l=0;l<a.length;l+=1)if(e.truthy(e.apply(i,a[l])))return!1;return!0}else if("some"===c){if(a=e.apply(d[0],o),i=d[1],!Array.isArray(a)||!a.length)return!1;for(l=0;l<a.length;l+=1)if(e.truthy(e.apply(i,a[l])))return!0;return!1}if(d=d.map(function(t){return e.apply(t,o)}),t.hasOwnProperty(c)&&"function"==typeof t[c])return t[c].apply(o,d);if(c.indexOf(".")>0){var u=String(c).split("."),p=t;for(l=0;l<u.length;l++){if(!p.hasOwnProperty(u[l]))throw Error("Unrecognized operation "+c+" (failed at "+u.slice(0,l+1).join(".")+")");p=p[u[l]]}return p.apply(o,d)}throw Error("Unrecognized operation "+c)},e.uses_data=function(t){var n=[];if(e.is_logic(t)){var o=e.get_operator(t),l=t[o];Array.isArray(l)||(l=[l]),"var"===o?n.push(l[0]):l.forEach(function(t){n.push.apply(n,e.uses_data(t))})}for(var r=[],i=0,a=n.length;i<a;i++)-1===r.indexOf(n[i])&&r.push(n[i]);return r},e.add_operation=function(e,n){t[e]=n},e.rm_operation=function(e){delete t[e]},e.rule_like=function(t,n){if(n===t||"@"===n)return!0;if("number"===n)return"number"==typeof t;if("string"===n)return"string"==typeof t;if("array"===n)return Array.isArray(t)&&!e.is_logic(t);if(e.is_logic(n)){if(e.is_logic(t)){var o=e.get_operator(n),l=e.get_operator(t);if("@"===o||o===l)return e.rule_like(e.get_values(t,!1),e.get_values(n,!1))}return!1}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(var r=0;r<n.length;r+=1)if(!e.rule_like(t[r],n[r]))return!1;return!0}return!1},e}let c5=(e,t)=>{var n;let o=null==e||null==(n=e.match)?void 0:n.call(e,/{{(.*?)}}/);if(!o)return e;{let e=eu().get(t,o[1]);return eu().isFunction(e)?e():e}};function c4(e){if("object"!=typeof e||null===e)return null;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))if("[object Object]"===Object.prototype.toString.call(e[t])&&null!==e[t])return c4(e[t]);else return{key:t,value:e[t]};return null}let c8=e=>{let t,n=(t=[],!function e(n){Object.keys(n).sort().forEach(function(o){t.push(o),n[o]&&"object"==typeof n[o]&&e(n[o])})}(e),t),o=(0,ed.findIndex)(n,(e,t,n)=>{if(e.includes("$")&&t>0)return!0});return n.slice(0,o)},c7=async e=>{let{ruleGroup:t,variables:n,localVariables:o}=e,l=Object.keys(t)[0]||"$and",r=t[l],i=[];for(let e of r){var a;if("$and"in e||"$or"in e)return await c7({ruleGroup:e,variables:n,localVariables:o});let t=c4(e),l=null==t?void 0:t.key;if(!l)return!0;let r=c8(e),s=(a=r,"{{ $nForm.".concat(a.join(".")," }}")),c=o.find(e=>"$nForm"===e.name);if(null==c?void 0:c.ctx){let e=eu().get(c.ctx,r),a=await n.getCollectionField(s,o),d=c3().apply({[l]:[lM(e,{targetCollectionField:a}),lM(t.value,{targetCollectionField:a})]});i.push(d);continue}let d=n.parseVariable(s,o),u=oY(null==t?void 0:t.value)?[n.parseVariable(null==t?void 0:t.value,o),d]:[null==t?void 0:t.value,d];try{let e=c3(),[t,r]=await Promise.all(u),a=await n.getCollectionField(s,o),c=e.apply({[l]:[lM(r,{targetCollectionField:a}),lM(t,{targetCollectionField:a})]});i.push(c)}catch(e){throw e}}return"$and"===l?(0,ed.every)(i,e=>e):(0,ed.some)(i,e=>e)};async function c9(e,t){return[e,t]=await Promise.all([e,t]),{condition:e,value:t}}let de=e=>{var t,n,o,l,r,i,a,s,c;let{operator:d,value:u,field:p,condition:m,variables:h,localVariables:x}=e,f=(null==p||null==(t=p.stateOfLinkageRules)?void 0:t.required)||[null==p||null==(n=p.initStateOfLinkageRules)?void 0:n.required],v=(null==p||null==(o=p.stateOfLinkageRules)?void 0:o.display)||[null==p||null==(l=p.initStateOfLinkageRules)?void 0:l.display],g=(null==p||null==(r=p.stateOfLinkageRules)?void 0:r.pattern)||[null==p||null==(i=p.initStateOfLinkageRules)?void 0:i.pattern],y=(null==p||null==(a=p.stateOfLinkageRules)?void 0:a.value)||[null==p||null==(s=p.initStateOfLinkageRules)?void 0:s.value],{evaluate:b}=eh.evaluators.get("formula.js");switch(d){case am.Required:f.push(c9(c7({ruleGroup:m,variables:h,localVariables:x}),!0)),p.stateOfLinkageRules={...p.stateOfLinkageRules,required:f};break;case am.InRequired:f.push(c9(c7({ruleGroup:m,variables:h,localVariables:x}),!1)),p.stateOfLinkageRules={...p.stateOfLinkageRules,required:f};break;case am.Visible:case am.None:case am.Hidden:v.push(c9(c7({ruleGroup:m,variables:h,localVariables:x}),d)),p.stateOfLinkageRules={...p.stateOfLinkageRules,display:v};break;case am.Editable:case am.ReadOnly:case am.ReadPretty:g.push(c9(c7({ruleGroup:m,variables:h,localVariables:x}),d)),p.stateOfLinkageRules={...p.stateOfLinkageRules,pattern:g};break;case am.Value:{let e,t,n=async()=>{if((null==u?void 0:u.mode)==="express"){if(null==(u.value||u.result))return;let{exp:e,scope:t}=await dt(u.value||u.result,{variables:h,localVariables:x});try{return b(e,{now:()=>new Date().toString(),...t})}catch(e){console.error(e)}}else if((null==u?void 0:u.mode)==="constant")return(null==u?void 0:u.value)||u;else return null};(e=Object.keys(c=m)[0]||"$and",t=c[e],eu().isEmpty(t))?y.push(c9(!0,n())):y.push(c9(c7({ruleGroup:m,variables:h,localVariables:x}),n())),p.stateOfLinkageRules={...p.stateOfLinkageRules,value:y}}break;default:return null}};async function dt(e,t){var n;let{variables:o,localVariables:l}=t,r={},i={};if(null==e)return;let a=null==(n=e.match(oH))?void 0:n.map(async e=>{let t=await o.parseVariable(e,l),n="_".concat((0,eh.uid)());return i[n]=t,r[e]=n,t});return a&&await Promise.all(a),{exp:e.replace(oH,e=>"{{".concat(r[e]||e,"}}")),scope:i}}let dn=(0,ec.observer)(e=>{var t,n,o,l;let{required:r=!0}=e,{getCollectionJoinField:i}=sO(),{getField:a}=tJ(),s=(0,ec.useField)(),c=(0,ec.useFieldSchema)(),{t:d}=(0,eT.useTranslation)(),{dn:u,refresh:p}=eY(),m=a(c.name)||i(c["x-collection-field"]);return(0,A.jsxs)(A.Fragment,{children:[m&&(0,A.jsx)(aQ,{title:d("Edit field title"),schema:{type:"object",title:d("Edit field title"),properties:{title:{title:d("Field title"),default:null==s?void 0:s.title,description:"".concat(d("Original field title: ")).concat(null==m||null==(t=m.uiSchema)?void 0:t.title),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:e=>{let{title:t}=e;t&&(s.title=t,c.title=t,u.emit("patch",{schema:{"x-uid":c["x-uid"],title:c.title}})),u.refresh()}},"edit-field-title"),(0,A.jsx)(aY,{checked:null==(l=null==(n=c["x-decorator-props"])?void 0:n.showTitle)||l,title:d("Display title"),onChange:e=>{c["x-decorator-props"]=c["x-decorator-props"]||{},c["x-decorator-props"].showTitle=e,s.decoratorProps.showTitle=e,u.emit("patch",{schema:{"x-uid":c["x-uid"],"x-decorator-props":{...c["x-decorator-props"],showTitle:e}}}),u.refresh()}}),!s.readPretty&&(0,A.jsx)(aQ,{title:d("Edit description"),schema:{type:"object",title:d("Edit description"),properties:{description:{default:null==s?void 0:s.description,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit:e=>{let{description:t}=e;s.description=t,c.description=t,u.emit("patch",{schema:{"x-uid":c["x-uid"],description:c.description}}),u.refresh()}},"edit-description"),s.readPretty&&(0,A.jsx)(aQ,{title:d("Edit tooltip"),schema:{type:"object",title:d("Edit description"),properties:{tooltip:{default:null==c||null==(o=c["x-decorator-props"])?void 0:o.tooltip,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit:e=>{let{tooltip:t}=e;s.decoratorProps.tooltip=t,c["x-decorator-props"]=c["x-decorator-props"]||{},c["x-decorator-props"].tooltip=t,u.emit("patch",{schema:{"x-uid":c["x-uid"],"x-decorator-props":c["x-decorator-props"]}}),u.refresh()}},"edit-tooltip"),!s.readPretty&&"FormField"!==c["x-component"]&&r&&(0,A.jsx)(aY,{title:d("Required"),checked:c.required,onChange:e=>{let t={"x-uid":c["x-uid"]};s.required=e,eu().set(s,"initStateOfLinkageRules.required",c9(!0,e)),c.required=e,t.required=e,u.emit("patch",{schema:t}),p()}},"required")]})},{displayName:"GeneralSchemaItems"});function dl(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n margin-left: 10px;\n "]);return dl=function(){return e},e}let dr=(0,ec.observer)(e=>{let t=(0,ec.useFieldSchema)(),{useProps:n,dynamicComponent:o}=e,{options:l,defaultValues:r,collectionName:i,form:a,formBlockType:s,variables:c,localVariables:d,record:u}=n(),{getAllCollectionsInheritChain:p}=sO(),m=(0,es.useMemo)(()=>({ArrayCollapse:eh.ArrayCollapse}),[]),h=(0,es.useMemo)(()=>({type:"object",properties:{condition:{"x-component":"Filter",default:r,"x-component-props":{collectionName:i,useProps:()=>({options:l,className:(0,nu.AH)(dl())}),dynamicComponent:e=>{let{collectionField:t}=e;return(0,A.jsx)(rW,{...e,form:a,record:u,collectionField:e.collectionField,shouldChange:rH({collectionField:t,variables:c,localVariables:d,getAllCollectionsInheritChain:p})})}}}}}),[i,r,a,d,l,e,u,c]),x=(0,es.useMemo)(()=>({field:l,fieldSchema:t,dynamicComponent:o,options:l||[]}),[o,t,l]);return(0,A.jsx)(Ta.Provider,{value:{form:a,type:s,collectionName:i},children:(0,A.jsx)(m1,{record:u,children:(0,A.jsx)(rK.Provider,{value:x,children:(0,A.jsx)(al,{components:m,schema:h})})})})},{displayName:"FormFilterScope"}),di={validator:"{{(value, rule)=> {\n if (!value) {\n return '';\n }\n try {\n const val = JSON.parse(value);\n if(!isNaN(val)) {\n return false;\n }\n return true;\n } catch(error) {\n console.error(error);\n return false;\n }\n }}}",message:'{{t("Invalid JSON format")}}'},da={type:"object",properties:{url:{type:"string",title:'{{t("Request URL")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},method:{type:"string",title:'{{t("Request method")}}',"x-decorator":"FormItem","x-component":"Select",default:"POST",enum:[{label:"POST",value:"POST"},{label:"GET",value:"GET"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}]},headers:{type:"string",title:'{{t("Request headers")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-validator":di},params:{type:"string",title:'{{t("Request query parameters")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-validator":di},data:{type:"string",title:'{{t("Request body")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-validator":di}}},ds=async e=>{var t,n;let{operator:o,field:l,condition:r,variables:i,localVariables:a}=e,s=(null==l||null==(t=l.stateOfLinkageRules)?void 0:t.disabled)||[!1],c=(null==l||null==(n=l.stateOfLinkageRules)?void 0:n.display)||["visible"];switch(o){case am.Visible:await c7({ruleGroup:r,variables:i,localVariables:a})&&(c.push(o),l.data=l.data||{},l.data.hidden=!1),l.stateOfLinkageRules={...l.stateOfLinkageRules,display:c},l.display=(0,ed.last)(c);break;case am.Hidden:await c7({ruleGroup:r,variables:i,localVariables:a})?(l.data=l.data||{},l.data.hidden=!0):(l.data=l.data||{},l.data.hidden=!1);break;case am.Disabled:await c7({ruleGroup:r,variables:i,localVariables:a})&&s.push(!0),l.stateOfLinkageRules={...l.stateOfLinkageRules,disabled:s},l.disabled=(0,ed.last)(s),l.componentProps.disabled=(0,ed.last)(s);break;case am.Active:await c7({ruleGroup:r,variables:i,localVariables:a})&&s.push(!1),l.stateOfLinkageRules={...l.stateOfLinkageRules,disabled:s},l.disabled=(0,ed.last)(s),l.componentProps.disabled=(0,ed.last)(s);break;default:return null}};function dc(e){var t,n,o;let l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),{dn:i}=eY(),{t:a}=(0,eT.useTranslation)(),s=(null==e?void 0:e.isLink)||"Action.Link"===r["x-component"];return(0,A.jsx)(aQ,{title:a("Edit button"),schema:{type:"object",title:a("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:a("Button title"),default:r.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:a("Button icon"),default:null==r||null==(t=r["x-component-props"])?void 0:t.icon,"x-component-props":{},"x-visible":!s},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:a("Button background color"),default:(null==r||null==(n=r["x-component-props"])?void 0:n.danger)?"danger":(null==r||null==(o=r["x-component-props"])?void 0:o.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}],"x-visible":!s}}},onSubmit:e=>{let{title:t,icon:n,type:o}=e;r.title=t,l.title=t,l.componentProps.icon=n,l.componentProps.danger="danger"===o,l.componentProps.type=o||l.componentProps.type,r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].icon=n,r["x-component-props"].danger="danger"===o,r["x-component-props"].type=o||l.componentProps.type,i.emit("patch",{schema:{"x-uid":r["x-uid"],title:t,"x-component-props":{...r["x-component-props"]}}}),i.refresh()}})}function dd(){var e,t,n;let{dn:o}=eY(),{t:l}=(0,eT.useTranslation)(),r=(0,ec.useFieldSchema)(),i={type:"void","x-uid":(0,ec.uid)(),"x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"},a={"customize:update":l("After clicking the custom button, the following fields of the current record will be saved according to the following form."),"customize:save":l("After clicking the custom button, the following fields of the current record will be saved according to the following form.")},s=null!=(n=r["x-action"])?n:"",c=(0,es.useCallback)(e=>{r["x-action-settings"].assignedValues=e,o.emit("patch",{schema:{"x-uid":r["x-uid"],"x-action-settings":r["x-action-settings"]}})},[o,r]);return(0,A.jsx)(ld,{isInAssignFieldValues:!0,children:(0,A.jsx)(sV,{isAllowToSetDefaultValue:()=>!1,children:(0,A.jsx)(aJ,{title:l("Assign field values"),initialSchema:i,initialValues:null==r||null==(e=r["x-action-settings"])?void 0:e.assignedValues,modalTip:a[s],uid:null==r||null==(t=r["x-action-settings"])?void 0:t.schemaUid,onSubmit:c})})})}function du(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)();return(0,A.jsx)(aJ,{title:n("Request settings"),schema:da,initialValues:null==o||null==(e=o["x-action-settings"])?void 0:e.requestSettings,onSubmit:e=>{o["x-action-settings"].requestSettings=e,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}}),t.refresh()}})}function dp(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)();return(0,A.jsx)(aY,{title:n("Skip required validation"),checked:!!(null==o||null==(e=o["x-action-settings"])?void 0:e.skipValidator),onChange:e=>{o["x-action-settings"].skipValidator=e,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":{...o["x-action-settings"]}}})}})}let dm=e=>{if(e){if("ACLActionProvider"===e["x-decorator"]){var t;return null==(t=e["x-component-props"])?void 0:t.openMode}return dm(null==e?void 0:e.parent)}};function dh(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),l=dm(co().fieldSchema),r=o.parent.parent["x-component"],i={...{type:"object",title:n("After successful submission"),properties:{successMessage:{title:'{{t("Popup message")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}},popupClose:{title:'{{t("Popup close method")}}',enum:[{label:'{{t("Automatic close")}}',value:!1},{label:'{{t("Manually close")}}',value:!0}],"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{}},manualClose:{title:'{{t("Message clear metchod")}}',enum:[{label:'{{t("Automatic close")}}',value:!1},{label:'{{t("Manually close")}}',value:!0}],"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{}},redirecting:{title:'{{t("Then")}}',enum:[{label:'{{t("Stay on current page")}}',value:!1},{label:'{{t("Redirect to")}}',value:!0}],"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{},"x-reactions":{target:"redirectTo",fulfill:{state:{visible:"{{!!$self.value}}"}}}},redirectTo:{title:'{{t("Link")}}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}}};return((!l||"page"===l)&&r.includes("Form")||!r.includes("Form"))&&delete i.properties.popupClose,(0,A.jsx)(aQ,{title:n("After successful submission"),initialValues:null==o||null==(e=o["x-action-settings"])?void 0:e.onSuccess,schema:{...i},onSubmit:e=>{o["x-action-settings"].onSuccess=e,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}})}})}function dx(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{t}=(0,eT.useTranslation)(),n=(0,ec.useFieldSchema)();return(null==n?void 0:n.parent["x-component"])!=="CollectionField"&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:e=>"Space"===e["x-component"]||e["x-component"].endsWith("ActionBar"),confirm:{title:t("Delete action"),onOk:e.onConfirmOk}})]})}let df=Tr(function(e){let{formAction:t,buttonAction:n,actionType:o,direct:l=!1,noCollection:r=!1,...i}=e,{t:a}=(0,eT.useTranslation)(),s=eh.ArrayTable.useIndex(),{setValuesIn:c}=(0,ec.useForm)(),d=tJ(),{getCollection:u}=sO(),p=tc(),[m,h]=(0,es.useState)(vw(p,d.name)),x=eB(),f=oc("workflow");(0,es.useMemo)(()=>f.getTriggersOptions().filter(e=>"function"==typeof e.options.isActionTriggerable||!0===e.options.isActionTriggerable).map(e=>e.value),[f]),(0,ec.useFormEffects)(()=>{(0,ec.onFieldValueChange)("group[".concat(s,"].context"),e=>{let t=d;if(e.value){let n=e.value.split(".");for(let e=0;e<n.length&&t;e++){let o=n[e],l=t.fields.find(e=>e.name===o);l&&(t=u(l.target,p))}}h(vw(p,t.name)),c("group[".concat(s,"].workflowKey"),null)})});let v=(0,es.useCallback)(e=>{let{key:l,type:r,config:a}=e;if(l===i.value)return!0;let s=f.triggers.get(r);return!0===s.isActionTriggerable||"function"==typeof s.isActionTriggerable&&s.isActionTriggerable(a,{action:o,formAction:t,buttonAction:n,direct:"customize:triggerWorkflows"===n})},[i.value,f.triggers,o,t,n]);return(0,A.jsx)(ta,{dataSource:"main",children:(0,A.jsx)(wo,{manual:!1,placeholder:a("Select workflow",{ns:"workflow"}),fieldNames:{label:"title",value:"key"},service:{resource:"workflows",action:"list",params:{filter:{type:void 0===i.filterType?void 0:i.filterType,enabled:void 0===i.filterEnabled||i.filterEnabled,"config.collection":r?void 0:m,sync:void 0===i.filterSync?void 0:i.filterSync,key:void 0===i.filterKey?void 0:i.filterKey},sort:["-initAt"]}},optionFilter:v,optionRender:e=>{let{label:t,data:n}=e,o=f.getTriggersOptions().find(e=>e.value===n.type);return o?(0,A.jsxs)(cQ.A,{justify:"space-between",children:[(0,A.jsx)("span",{children:t}),(0,A.jsx)(nz.A,{color:o.color,children:x(o.label)})]}):t},...i})})});function dv(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),l=tJ(),r=Tp(),i=(null==r?void 0:r.type)||o["x-action"],a=null==r?void 0:r.type,s=o["x-action"],c={submit:n("Workflow will be triggered before or after submitting succeeded.",{ns:"workflow"}),"customize:save":n("Workflow will be triggered before or after submitting succeeded.",{ns:"workflow"}),"customize:triggerWorkflows":n("Workflow will be triggered directly once the button clicked, without data saving.",{ns:"workflow"}),destroy:n("Workflow will be triggered before or after submitting succeeded.",{ns:"workflow"})}[null==o?void 0:o["x-action"]],d={};return["submit","customize:save","destroy"].includes(null==o?void 0:o["x-action"])&&(d={order:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:n("Sequentially",{ns:"workflow"})},properties:{order:{type:"string","x-decorator":"FormItem","x-component":"Select",default:"after",enum:[{label:n("After"),value:"after"},{label:n("Before"),value:"before"}]}}}}),(0,A.jsx)(aJ,{title:n("Bind workflows",{ns:"workflow"}),scope:{fieldFilter:e=>["belongsTo","hasOne"].includes(e.type)},components:{Alert:ov.A,ArrayTable:eh.ArrayTable,WorkflowSelect:df},schema:{type:"void",title:n("Bind workflows",{ns:"workflow"}),properties:{description:c&&{type:"void","x-component":"Alert","x-component-props":{message:c,style:{marginBottom:"1em"}}},group:{type:"array","x-component":"ArrayTable","x-decorator":"FormItem",items:{type:"object",properties:{context:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:n("Trigger data context",{ns:"workflow"}),width:200},properties:{context:{type:"string","x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{placeholder:n("Select context",{ns:"workflow"}),popupMatchSelectWidth:!1,collection:"".concat(l.dataSource&&"main"!==l.dataSource?"".concat(l.dataSource,":"):"").concat(l.name),filter:"{{ fieldFilter }}",rootOption:{label:n("Full form data",{ns:"workflow"}),value:""},allowClear:!1,loadData:"destroy"===s?null:void 0},default:""}}},workflowKey:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:n("Workflow",{ns:"workflow"})},properties:{workflowKey:{type:"number","x-decorator":"FormItem","x-component":"WorkflowSelect","x-component-props":{placeholder:n("Select workflow",{ns:"workflow"}),actionType:i,formAction:a,buttonAction:s,direct:"customize:triggerWorkflows"===o["x-action"]},required:!0}}},...d,operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:32},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:n("Add workflow",{ns:"workflow"}),"x-component":"ArrayTable.Addition"}}}}},initialValues:{group:null==o||null==(e=o["x-action-settings"])?void 0:e.triggerWorkflows},onSubmit:e=>{let{group:n}=e;o["x-action-settings"].triggerWorkflows=n,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}})}})}let dg=()=>{var e;let t=(0,ec.useFieldSchema)();return(null==(e=t["x-component-props"])?void 0:e.useProps)==="{{ useFilterBlockActionProps }}"||"useFilterBlockActionProps"===t["x-use-component-props"]},dy=e=>{let{t}=(0,eT.useTranslation)(),n=(0,ec.useFieldSchema)(),{collectionName:o}=e,l=n.reduceProperties((e,t)=>{if("FormV2"===t["x-component"]){let e=t.reduceProperties((e,t)=>"Grid"===t["x-component"]||"BlockTemplate"===t["x-component"]?t:e,null);if(e)return e}return e},null)||n,{form:r}=Tp(),i=(null==e?void 0:e.type)||["Action","Action.Link"].includes(n["x-component"])?"button":"field",a=lN(),s=lT(),c=m3(),{type:d}=Tc(),u=(0,es.useMemo)(()=>({type:"object",title:t("Custom filter"),properties:{fieldReaction:{"x-component":dr,"x-component-props":{useProps:()=>({options:hm(o),defaultValues:(null==l?void 0:l["x-filter-rules"])||(null==n?void 0:n["x-filter-rules"]),type:i,collectionName:o,form:r,variables:a,localVariables:s,record:c,formBlockType:d})}}}}),[]),{getTemplateById:p}=rg(),{dn:m}=eY(),h=(0,es.useCallback)(e=>{let t=e.fieldReaction.condition,n="BlockTemplate"===l["x-component"]&&l["x-component-props"].templateId,o={"x-uid":n&&p(n).uid||l["x-uid"]};l["x-filter-rules"]=t,o["x-filter-rules"]=t,m.emit("patch",{schema:o}),m.refresh()},[m,p,l]);return(0,A.jsx)(aQ,{title:t("Custom filter"),width:770,schema:u,onSubmit:h})},db=[{name:"Customize",Component:e=>e.children,children:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:e=>(0,A.jsx)(a1,{...e}),useVisible(){let e=cr(),{linkageAction:t}=sw();return t||e},useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"openMode",Component:c6,useComponentProps(){let e=["create","update","view","customize:popup","duplicate","customize:create"].includes((0,ec.useFieldSchema)()["x-action"]||"");return{openMode:e,openSize:e}}},{name:"secondConFirm",Component:dC,useVisible:()=>!["create","update","view","customize:popup","duplicate","customize:create"].includes((0,ec.useFieldSchema)()["x-action"]||"")},{name:"assignFieldValues",Component:dd,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.assignedValues)}},{name:"requestSettings",Component:du,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.requestSettings)}},{name:"skipValidator",Component:dp,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.skipValidator)}},{name:"afterSuccess",Component:dh,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.onSuccess)}},{name:"workflowConfig",Component:dv,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.triggerWorkflows)}},{name:"saveMode",Component:c0,useVisible(){var e;let t=(0,ec.useFieldSchema)();return"submit"===t["x-action"]&&(null==(e=t.parent)?void 0:e["x-initializer"])==="createForm:configureActions"}},{name:"enableChildCollections",Component:a3,useVisible(){let e=(0,ec.useFieldSchema)(),{name:t}=tJ(),{getChildrenCollections:n}=sO();return n(t).length>0&&"create"===e["x-action"]},useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"Customize.setFilterScope",Component:dy,useVisible:dg,useComponentProps:()=>({collectionName:tS().name})},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e},useVisible(){var e;let t=(0,ec.useFieldSchema)();return(null==t||null==(e=t["x-action-settings"])?void 0:e.removable)!==!1}}]}];function dC(){var e,t;let{dn:n}=eY(),o=(0,ec.useFieldSchema)(),{t:l}=(0,eT.useTranslation)(),r=(0,ec.useField)();return(0,A.jsx)(aY,{title:l("Secondary confirmation"),checked:!!(null==o||null==(t=o["x-component-props"])||null==(e=t.confirm)?void 0:e.content),onChange:e=>{var t;o["x-component-props"]||(o["x-component-props"]={}),e?o["x-component-props"].confirm=e?{title:"Perform the {{title}}",content:"Are you sure you want to perform the {{title}} action?"}:{}:o["x-component-props"].confirm={},r.componentProps.confirm={...null==(t=o["x-component-props"])?void 0:t.confirm},n.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":{...o["x-component-props"]}}})}})}function dS(){var e,t;let{dn:n}=eY(),o=(0,ec.useFieldSchema)(),{t:l}=(0,eT.useTranslation)();return(0,A.jsx)(aY,{title:l("Is DownLoad"),checked:!!(null==o||null==(t=o["x-action-settings"])||null==(e=t.onSuccess)?void 0:e.down),onChange:e=>{var t;(null==o||null==(t=o["x-action-settings"])?void 0:t.onSuccess)||(o["x-action-settings"]={...null==o?void 0:o["x-action-settings"],onSuccess:{down:!1}}),o["x-action-settings"].onSuccess.down=e,n.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":{...o["x-action-settings"]}}})}})}function dw(){var e;let{dn:t}=eY(),n=(0,ec.useFieldSchema)(),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)();return(0,A.jsx)(aY,{title:o("Show Data"),checked:!!(null==n||null==(e=n["x-component-props"])?void 0:e.showData),onChange:e=>{(null==n?void 0:n["x-component-props"])||(n["x-component-props"]={showData:!1}),n["x-component-props"].showData=e,l.componentProps=n["x-component-props"],t.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":{...n["x-component-props"]}}})}})}function dF(){var e,t;let n=(0,ec.useFieldSchema)(),{dn:o}=eY(),{t:l}=(0,eT.useTranslation)();return(0,A.jsx)(aQ,{title:l("Setting Down Title"),onSubmit:e=>{let{title:t}=e;if(null==n?void 0:n["x-action-settings"]){var l;n["x-action-settings"].onSuccess={...null==(l=n["x-action-settings"])?void 0:l.onSuccess,downTitle:t}}else n["x-action-settings"]={onSussess:{downTitle:t}};o.emit("patch",{schema:{"x-uid":n["x-uid"],"x-action-settings":{...n["x-action-settings"]}}})},schema:{type:"item",title:l("Setting Down Title"),properties:{title:{"x-component":"Input",default:(null==(t=n["x-action-settings"])||null==(e=t.onSuccess)?void 0:e.downTitle)||"document.docx"}}}})}let dj=new or({name:"ActionSettings",items:db}),dA=e=>{let{modalTip:t,linkageAction:n,removeButtonProps:o,buttonEditorProps:l,linkageRulesProps:r,schemaSettings:i,...a}=e,s=os(),c=(0,ec.useFieldSchema)(),d=(null==c?void 0:c.parent["x-component"])!=="CollectionField",u="ActionSettings:".concat(c["x-action"]),p=s.schemaSettingsManager.has(u);return(0,A.jsx)(sP,{schemaSettings:p?u:i||"ActionSettings",contextValue:{modalTip:t,linkageAction:n,removeButtonProps:o,buttonEditorProps:l,linkageRulesProps:r},...a,disableInitializer:!0,draggable:d})};dA.ButtonEditor=dc,dA.RemoveButton=dx;let dk=Tr((0,ec.observer)(e=>(0,A.jsx)(dN,{...e,component:e.component||"a",className:r6()("tb-action-link",e.className)})),{displayName:"ActionLink"}),dI=cP("tb-action",e=>{let{componentCls:t}=e;return{[t]:{position:"relative","&:hover":{"> .general-schema-designer":{display:"block"}},"&.tb-action-link":{margin:"-12px",padding:"12px"},"> .general-schema-designer":{position:"absolute",zIndex:999,top:"0",bottom:"0",left:"0",right:"0",display:"none",background:"var(--colorBgSettingsHover)",border:"0",pointerEvents:"none","> .general-schema-designer-icons":{position:"absolute",right:"2px",top:"2px",lineHeight:"16px",pointerEvents:"all",".ant-space-item":{backgroundColor:e.colorSettings,color:"#fff",lineHeight:"16px",width:"16px",paddingLeft:"1px",alignSelf:"stretch"}}}}}}),dP=e=>{let t=m3(),n=m5(),o=(0,ec.useFieldSchema)(),l=eB(),r=o["x-component"],i=(null==t?void 0:t.name)||(null==t?void 0:t.title)||(null!=n?String(n):""),a=o["x-action"],{name:s}=tJ(),{name:c}=nP()||{},d=e||l(o.title);return s=s?"-".concat(s):"",c=c?"-".concat(c):"",a=a?"-".concat(a):"",i=i?"-".concat(i):"",{getAriaLabel:(0,es.useCallback)(e=>(e=e?"-".concat(e):"","action-".concat(r,"-").concat(d).concat(a).concat(s).concat(c).concat(i).concat(e)),[a,d,c,s,r,i])}},dT=Tr((0,ec.observer)(e=>{var t,n,o,l;let r,i,{isShow:a=!0,popover:s,confirm:c,openMode:d,containerRefKey:u,component:p,useAction:m=cn,className:h,icon:x,title:f,onClick:v,style:g,openSize:y,disabled:b,actionCallback:C,addChild:S,...w}=iq(e),F=NI(),j=(0,ep.useNavigate)(),{wrapSSR:k,componentCls:I,hashId:P}=dI(),{t:T}=(0,eT.useTranslation)(),[N,M]=(0,es.useState)(!1),[D,R]=(0,es.useState)(!1),q=SF(),_=(0,ec.useField)(),O=os().usePageMode(),B=(0,ec.useFieldSchema)(),{run:E,element:V}=(r=eB(),i=(0,ec.useExpressionScope)(),(0,es.useMemo)(()=>{if("function"==typeof m)return m;if("string"==typeof m&&m.startsWith("{{")){let e=m.match(/\{\{\s*([^}]+)\s*\}\}/);if(e&&e[1]){let t=e[1].trim(),n=i[t];if("function"==typeof n)return n;let o=r(m);return"function"==typeof o?o:(console.warn("useAction not found in scope or compilation failed: ".concat(t),i),cn)}let t=r(m);return"function"==typeof t?t:(console.warn("useAction compilation failed: ".concat(m),t),cn)}return console.warn("useAction is not a function or string reference:",m),cn},[m,r,i])(C)),z=(0,ec.useForm)(),L=tz(),G=tS(),K=B["x-designer-props"],$=null==B||null==(t=B["x-component-props"])?void 0:t.openMode,U=null==B||null==(n=B["x-component-props"])?void 0:n.openSize,W=z.disabled||_.disabled||(null==(o=_.data)?void 0:o.disabled)||b,H=(null==B?void 0:B["x-linkage-rules"])||[],{designable:Y}=eY(),X=eE(p)||p,{modal:J}=eX.A.useApp(),Q=lN(),Z=lT({currentForm:{values:L}}),{getAriaLabel:ee}=dP(f),et=eB(),en=f||et(B.title);en=eu().isString(en)?T(en):en,(0,es.useEffect)(()=>{_.stateOfLinkageRules={},H.filter(e=>!e.disabled).forEach(e=>{var t;null==(t=e.actions)||t.forEach(t=>{ds({operator:t.operator,field:_,condition:e.condition,variables:Q,localVariables:Z})})})},[_,H,Z,L,Q]);let eo=(0,es.useCallback)(e=>{if(!(0,eh.isPortalInBody)(e.target)&&(e.preventDefault(),e.stopPropagation(),!W&&F)){let t=()=>{null==v||v(e);let t=B.reduceProperties((e,t)=>"Action.Container"===t["x-component"]?t:e);if((null==O?void 0:O.enable)&&t){let e=na.getInstance().toWildcardPath({collection:G.name,filterByTk:L[G.getPrimaryKey()]});j("../"+t["x-uid"]+"/"+e)}else M(!0);E()};(null==c?void 0:c.content)?J.confirm({title:T(c.title,{title:en}),content:T(c.content,{title:en}),onOk:t}):t()}},[c,W,J,v,E]),el=(0,es.useMemo)(()=>{var e;return{...g,opacity:Y&&((null==_||null==(e=_.data)?void 0:e.hidden)||!F)&&.1}},[Y,null==_||null==(l=_.data)?void 0:l.hidden,g]),er=()=>{var t,n;return!Y&&((null==_||null==(t=_.data)?void 0:t.hidden)||!F)?null:(0,A.jsxs)(SE,{role:"button","aria-label":ee(),...w,loading:null==_||null==(n=_.data)?void 0:n.loading,icon:x?(0,A.jsx)(i6,{type:x}):null,disabled:W,style:el,onClick:eo,component:X||e3.Ay,className:r6()(I,P,h,"tb-action"),type:"danger"===e.type?void 0:e.type,children:[en,(0,A.jsx)(q,{...K})]})},ei=(0,A.jsxs)(ct,{button:er(),visible:N,setVisible:M,formValueChanged:D,setFormValueChanged:R,openMode:$,openSize:U,containerRefKey:u,fieldSchema:B,children:[s&&(0,A.jsx)(ec.RecursionField,{basePath:_.address,onlyRenderProperties:!0,schema:B}),!s&&er(),!s&&e.children,V]});return a?k(S?(0,A.jsx)(m1,{record:null,parent:L,children:ei}):ei):null}),{displayName:"Action"});dT.Popover=(0,ec.observer)(e=>{let{button:t,visible:n,setVisible:o}=co();return(0,A.jsx)(dE,{...e,destroyTooltipOnHide:!0,open:n,onOpenChange:e=>{o(e)},content:e.children,children:t})},{displayName:"Action.Popover"}),dT.Popover.Footer=(0,ec.observer)(e=>(0,A.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",width:"100%"},children:e.children}),{displayName:"Action.Popover.Footer"}),dT.Link=dk,dT.Designer=dA,dT.Drawer=cq,dT.Modal=cK,dT.Container=cJ,dT.Page=cH,dT.Area=cu;let dN=dT,dM=es.createContext({container:null}),dD=e=>{let{children:t,...n}=e;return(0,A.jsx)(dM.Provider,{value:n,children:t})},dR=()=>(0,es.useContext)(dM),dq=e=>{let t=(0,ec.useFieldSchema)(),{container:n,parentComponents:o=["BlockItem","CardItem"]}=dR();return(0,A.jsx)(A.Fragment,{children:n&&o.includes(t.parent["x-component"])?(0,oy.createPortal)(e.children,n):e.children})},d_=Tr((0,ec.observer)(e=>{var t;let{forceProps:n={}}=dR(),{layout:o="tow-columns",style:l,spaceProps:r,...i}={...iq(e),...n},a=(0,ec.useFieldSchema)(),{render:s}=mz(a["x-initializer"],a["x-initializer-props"]),{designable:c}=eY();if("one-column"===o)return(0,A.jsx)(dq,{children:(0,A.jsx)(SM,{children:(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,...l},...i,className:r6()(i.className,"tb-action-bar"),children:[e.children&&(0,A.jsx)("div",{children:(0,A.jsx)(of.A,{...r,style:{flexWrap:"wrap"},children:a.mapProperties((e,t)=>(0,A.jsx)(ec.RecursionField,{name:t,schema:e},t))})}),s({style:{margin:"0 !important"}})]})})});let d=Object.keys(null!=(t=a.properties)?t:{}).length>0;return(0,A.jsxs)("div",{style:c||d?{display:"flex",justifyContent:"space-between",alignItems:"center",overflowX:"auto",flexShrink:0,...l}:void 0,...i,className:r6()(i.className,"tb-action-bar"),children:[(0,A.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",overflow:"hidden",flexWrap:"wrap"},children:(0,A.jsxs)(SM,{children:[(0,A.jsx)(of.A,{...r,children:a.mapProperties((e,t)=>"left"!==e["x-align"]?null:(0,A.jsx)(ec.RecursionField,{name:t,schema:e},t))}),(0,A.jsx)(of.A,{...r,children:a.mapProperties((e,t)=>"left"===e["x-align"]?null:(0,A.jsx)(ec.RecursionField,{name:t,schema:e},t))})]})}),s()]})}),{displayName:"ActionBar"}),dO=()=>{let e=(0,ec.useFieldSchema)(),t=e["x-component"],n=eB(),{name:o}=tJ(),l=n(e.title);return o=o?"-".concat(o):"",l=l?"-".concat(l):"",{getAriaLabel:(0,es.useCallback)(e=>(e=e?"-".concat(e):"","popover-".concat(t).concat(o).concat(l).concat(e)),[o,t,l])}};var dB=n(30963);let dE=e=>{let t=(0,es.useRef)(null),n=(0,es.useCallback)(e=>{t.current=e.target},[]),o=(0,es.useCallback)(n=>{setTimeout(()=>{var o;if(!n&&null!==t.current&&!function(e){if(!e)return!1;for(;e;){var t;if(null==(t=e.classList)?void 0:t.contains("popover-with-stop-propagation"))return!0;e=e.parentNode}return!1}(t.current)){t.current=null;return}null==(o=e.onOpenChange)||o.call(e,n)})},[e]);return(0,A.jsx)("div",{className:"popover-with-stop-propagation",onClick:n,children:(0,A.jsx)(dB.A,{...e,onOpenChange:o})})};function dV(){let e=(0,ns._)(["\n display: flex;\n justify-content: flex-end;\n width: 100%;\n "]);return dV=function(){return e},e}function dz(){let e=(0,ns._)(["\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n "]);return dz=function(){return e},e}let dL=(0,es.createContext)(null);dL.displayName="FilterActionContext";let dG=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(dV()),button:t(dz())}}),dK=Tr((0,ec.observer)(e=>{let{styles:t}=dG(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),[l,r]=(0,es.useState)(!1),{designable:i,dn:a}=eY(),s=(0,ec.useFieldSchema)(),c=(0,es.useMemo)(()=>e.form||(0,ec.createForm)(),[]),{options:d,onSubmit:u,onReset:p,...m}=iq(e),h=(0,es.useCallback)(e=>{r(e)},[]);return(0,A.jsx)(dL.Provider,{value:{field:o,fieldSchema:s,designable:i,dn:a},children:(0,A.jsx)(dE,{destroyTooltipOnHide:!0,placement:"bottomLeft",open:l,onOpenChange:h,trigger:"click",content:(0,A.jsx)("form",{children:(0,A.jsxs)(ae,{form:c,children:[(0,A.jsx)(al,{schema:{type:"object",properties:{filter:{type:"string",enum:d||o.dataSource,default:s.default,"x-component":"Filter","x-component-props":{}}}}}),(0,A.jsx)("div",{className:t.container,children:(0,A.jsxs)(of.A,{children:[(0,A.jsx)(d$,{}),(0,A.jsx)(e3.Ay,{onClick:async()=>{await c.reset(),null==p||p(c.values),o.title=n("Filter"),r(!1)},children:n("Reset")}),(0,A.jsx)(e3.Ay,{type:"primary",htmlType:"submit",onClick:e=>{e.preventDefault(),e.stopPropagation(),null==u||u(c.values),r(!1)},children:n("Submit")})]})})]})}),children:(0,A.jsx)(dT,{...m,title:o.title})})})}),{displayName:"FilterAction"}),d$=()=>{let{fieldSchema:e,field:t,designable:n,dn:o}=(0,es.useContext)(dL),l=(0,ec.useForm)(),{t:r}=(0,eT.useTranslation)(),{styles:i}=dG();return n?(0,A.jsx)(e3.Ay,{type:"dashed",className:i.button,onClick:()=>{var t;let n,r={...l.values.filter};e.default=r,o.emit("patch",{schema:{"x-uid":e["x-uid"],default:(t=r,Object.keys(n=(0,eh.flatten)(t)).forEach(e=>{void 0===n[e]&&(n[e]=null)}),(0,eh.unflatten)(n))}}),o.refresh()},children:r("Save conditions")}):null},dU=e=>{let{dynamicComponent:t,disabled:n}=(0,es.useContext)(rV),o=eE(t),l=(0,es.useMemo)(()=>(0,ec.createForm)({values:{value:e.value},disabled:n,effects(){(0,ec.onFieldValueChange)("value",t=>{var n;null==e||null==(n=e.onChange)||n.call(e,t.value)})}}),[JSON.stringify(e.value),e.schema]),r=(0,es.useCallback)(()=>{var t;return(0,A.jsx)(ec.FieldContext.Provider,{value:null,children:(0,A.jsx)(al,{schema:{"x-component":"Input",...e.schema,"x-component-props":(0,ec.merge)((null==e||null==(t=e.schema)?void 0:t["x-component-props"])||{},{style:{minWidth:150}}),name:"value","x-read-pretty":!1,"x-validator":void 0,"x-decorator":void 0}})})},[e.schema]);return(0,A.jsx)(ec.FormContext.Provider,{value:l,children:o?es.createElement(o,{value:e.value,collectionField:e.collectionField,onChange:null==e?void 0:e.onChange,renderSchemaComponent:r}):r()})},dW=(0,ec.observer)(e=>{let{t}=(0,eT.useTranslation)(),n=eB(),o=(0,es.useContext)(rE),{schema:l,fields:r,operators:i,dataIndex:a,operator:s,setDataIndex:c,setOperator:d,value:u,setValue:p,collectionField:m}=rG(),h=(0,es.useMemo)(()=>({marginBottom:8}),[]),x=(0,es.useMemo)(()=>({label:"title",value:"name",children:"children"}),[]),f=(0,es.useCallback)(e=>{c(e)},[c]),v=(0,es.useCallback)(e=>{d(e)},[d]),g=(0,es.useMemo)(()=>({color:"#bfbfbf"}),[]);return(0,A.jsx)("div",{style:h,className:"nc-filter-item",children:(0,A.jsxs)(of.A,{children:[(0,A.jsx)(om.A,{"data-testid":"select-filter-field",style:{width:"160px"},fieldNames:x,changeOnSelect:!1,value:a,options:n(r),onChange:f,placeholder:t("Select field")}),(0,A.jsx)(oo.A,{"data-testid":"select-filter-operator",style:{minWidth:"110px"},popupMatchSelectWidth:!1,value:null==s?void 0:s.value,options:n(i),onChange:v,placeholder:t("Comparision")}),(null==s?void 0:s.noValue)?null:(0,A.jsx)(dU,{value:u,schema:l,collectionField:m,onChange:p}),!e.disabled&&(0,A.jsx)("a",{role:"button","aria-label":"icon-close",children:(0,A.jsx)(iE.A,{onClick:o,style:g})})]})})},{displayName:"FilterItem"}),dH=(0,ec.observer)(e=>{var t;let n=(0,ec.useField)();return(0,A.jsx)("div",{children:null==n||null==(t=n.value)?void 0:t.filter(Boolean).map((e,t)=>(0,A.jsx)(rE.Provider,{value:()=>n.remove(t),children:(0,A.jsx)(ec.ObjectFieldComponent,{name:t,component:[e.$and||e.$or?dY:dW]})},t))})},{displayName:"FilterItems"}),dY=(0,ec.connect)(e=>{let{bordered:t=!0,disabled:n}=e,o=(0,ec.useField)(),l=(0,es.useContext)(rE),{t:r}=(0,eT.useTranslation)(),{token:i}=iw.A.useToken(),a=Object.keys(o.value||{}).includes("$or")?"$or":"$and",s=n||o.disabled;return(0,A.jsx)(rz.Provider,{value:a,children:(0,A.jsxs)("div",{style:t?{position:"relative",border:"1px dashed ".concat(i.colorBorder),padding:i.paddingSM,marginBottom:i.marginXS}:{position:"relative",marginBottom:i.marginXS},children:[l&&!s&&(0,A.jsx)("a",{role:"button","aria-label":"icon-close",children:(0,A.jsx)(iE.A,{style:{position:"absolute",right:10,top:10,color:"#bfbfbf"},onClick:()=>l()})}),(0,A.jsx)("div",{style:{marginBottom:8,color:i.colorText},children:(0,A.jsxs)(eT.Trans,{children:["Meet ",(0,A.jsxs)(oo.A,{role:"button","data-testid":"filter-select-all-or-any",style:{width:"auto"},value:a,onChange:e=>{let t;t=o.value||{},o.value={[e]:[...t[a]||[]]}},children:[(0,A.jsx)(oo.A.Option,{value:"$and",children:"All"}),(0,A.jsx)(oo.A.Option,{value:"$or",children:"Any"})]})," conditions in the group"]})}),(0,A.jsx)("div",{children:(0,A.jsx)(ec.ArrayFieldComponent,{name:a,component:[dH],disabled:s})}),!s&&(0,A.jsxs)(of.A,{size:16,style:{marginTop:8,marginBottom:8},children:[(0,A.jsx)("a",{onClick:()=>{let e=(o.value||{})[a]||[];e.push({}),o.value={[a]:e}},children:r("Add condition")}),(0,A.jsx)("a",{onClick:()=>{let e=(o.value||{})[a]||[];e.push({$and:[{}]}),o.value={[a]:e}},children:r("Add condition group")})]})]})})}),dX=e=>{let t=(0,ec.useField)();return ek(()=>Promise.resolve({data:t.dataSource}),e)},dJ=Tr((0,ec.observer)(e=>{let{useDataSource:t=dX}=e,{options:n,dynamicComponent:o,className:l,collectionName:r}=iq(e),i=(0,ec.useField)(),a=(0,ec.useFieldSchema)();return t({onSuccess(e){i.dataSource=(null==e?void 0:e.data)||[]}}),(0,es.useEffect)(()=>{a.defaultValue&&(i.initialValue=a.defaultValue)},[a.defaultValue]),(0,A.jsx)("div",{className:l,children:(0,A.jsx)(rV.Provider,{value:{field:i,fieldSchema:a,dynamicComponent:o,options:n||i.dataSource||[],disabled:e.disabled,collectionName:r},children:(0,A.jsx)(dY,{...e,bordered:!1})})})}),{displayName:"Filter"});dJ.SaveDefaultValue=e=>{let{t}=(0,eT.useTranslation)(),{designable:n,dn:o,refresh:l}=eY(),r=(0,ec.useFieldSchema)(),i=(0,ec.useForm)();return n?(0,A.jsx)(e3.Ay,{style:{borderColor:"var(--colorSettings)",color:"var(--colorSettings)"},type:"dashed",onClick:()=>{var e,t,n,l;let a=null==r||null==(l=r.parent)||null==(n=l.parent)||null==(t=n.parent)||null==(e=t.properties)?void 0:e.filter;if(!a)return;let s=i.values.filter;o.emit("patch",{schema:{"x-uid":a["x-uid"],default:s}}),o.refresh(),a.default=s},children:t("Save conditions")}):null},dJ.Action=dK,dJ.Action.Designer=e=>{var t;let n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY(),{t:r}=(0,eT.useTranslation)();return(0,A.jsxs)(sP,{...e,disableInitializer:!0,children:[(0,A.jsx)(s5,{}),(0,A.jsx)(aK,{}),(0,A.jsx)(aQ,{title:r("Edit button"),schema:{type:"object",title:r("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:r("Button title"),default:o.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:r("Button icon"),default:null==o||null==(t=o["x-component-props"])?void 0:t.icon,"x-component-props":{}}}},onSubmit:e=>{let{title:t,icon:r}=e;o.title=t,n.title=t,n.componentProps.icon=r,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].icon=r,l.emit("patch",{schema:{"x-uid":o["x-uid"],title:t,"x-component-props":{...o["x-component-props"]}}}),l.refresh()}}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:e=>"Space"===e["x-component"]||"ActionBar"===e["x-component"]})]})};let dQ=e=>[...new Set(e)],dZ=()=>{let{getCollectionFields:e}=sO(),t=d1();return(n,o)=>t(e(n,o))},d0=e=>{let{getCollectionFields:t}=sO();return d2(t(e))},d1=()=>{var e;let t=(0,ec.useFieldSchema)(),n=(null==t||null==(e=t["x-component-props"])?void 0:e.nonfilterable)||[],{getCollectionFields:o,getInterface:l}=sO(),r=(e,t)=>{let i=[];return e.forEach(e=>{let a=((e,t)=>{var i,a;if(n.length&&1===t&&n.includes(e.name)||!e.interface)return;let s=l(e.interface);if(!(null==s?void 0:s.filterable))return;let{nested:c,children:d,operators:u}=s.filterable,p={name:e.name,type:e.type,target:e.target,title:(null==e||null==(i=e.uiSchema)?void 0:i.title)||e.name,schema:null==e?void 0:e.uiSchema,interface:e.interface,operators:(null==u||null==(a=u.filter)?void 0:a.call(u,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]};if(!e.target||!(t>2)){if(t>2)return p;if((null==d?void 0:d.length)&&(p.children=d),c){let n=r(o(e.target),t+1).filter(Boolean);p.children=p.children||[],p.children.push(...n)}return p}})(e,t);a&&i.push(a)}),i};return e=>r(e,1)},d2=e=>{var t;let n=(0,ec.useFieldSchema)(),o=(null==n||null==(t=n["x-component-props"])?void 0:t.nonfilterable)||[],{getCollectionFields:l,getInterface:r}=sO(),i=(e,t)=>{let n=[];return e.forEach(e=>{let a=((e,t)=>{var n,a;if(o.length&&1===t&&o.includes(e.name)||!e.interface)return;let s=r(e.interface);if(!(null==s?void 0:s.filterable))return;let{nested:c,children:d,operators:u}=s.filterable,p={name:e.name,type:e.type,target:e.target,title:(null==e||null==(n=e.uiSchema)?void 0:n.title)||e.name,schema:null==e?void 0:e.uiSchema,operators:(null==u||null==(a=u.filter)?void 0:a.call(u,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]};if(!e.target||!(t>2)){if(t>2)return p;if((null==d?void 0:d.length)&&(p.children=d),c){let n=i(l(e.target),t+1).filter(Boolean);p.children=p.children||[],p.children.push(...n)}return p}})(e,t);a&&n.push(a)}),n};return i(e,1)},d6=e=>Array.isArray(e)&&0===e.length||e&&0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype,d3=function(e,t){var n,o,l,r,i;let a,s,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:no(),d=t?t["x-filter-rules"]:"",u=c(d||""),p=c(e||{}),m=(null==d||null==(n=d.$and)?void 0:n.length)||(null==d||null==(o=d.$or)?void 0:o.length);if(m&&(a=dQ(Object.keys(p)),s=dQ(Object.keys(u)),dQ([...a,...s]).length<a.length+s.length))return c.unflatten(p);if(!m)return c.unflatten({});{for(let e in u){let t=null==(i=u[e])?void 0:i.slice(11,-2),n=null==t?void 0:t.split(".")[0],o=Object.keys(p).filter(e=>e.includes(n));o.length>1?u[e]=o.map(e=>p[e]):u[e]=p[o[0]]}for(let e in u)(!u[e]||u[e].includes("$nFilter"))&&delete u[e];let e=c.unflatten(u);return e.$and=null==e||null==(l=e.$and)?void 0:l.filter(Boolean),e.$or=null==e||null==(r=e.$or)?void 0:r.filter(Boolean),e}},d5=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:no(),n=t(e||{}),o={};for(let e in n){let t=n[e];null==t||d6(t)||(o[e]=t)}return t.unflatten(o)},d4=()=>{let{name:e}=tJ(),t=d0(e),{service:n,props:o}=nj();return d8({options:t,service:n,params:null==o?void 0:o.params})},d8=e=>{let{options:t,service:n,params:o}=e,{t:l}=(0,eT.useTranslation)(),r=(0,ec.useField)(),i=tZ();return{options:t,onSubmit(e){var t,a,s;let c=o.filter,d=d5(null==e?void 0:e.filter);if("manual"===i&&eu().isEmpty(d))return n.mutate(void 0);let u=(null==(a=n.params)||null==(t=a[1])?void 0:t.filters)||{};u.filterAction=d,n.run({...null==(s=n.params)?void 0:s[0],page:1,filter:pA([...Object.values(u),c])},{filters:u});let p=(null==d?void 0:d.$and)||(null==d?void 0:d.$or);(null==p?void 0:p.length)?r.title=l("{{count}} filter items",{count:(null==p?void 0:p.length)||0}):r.title=l("Filter")},onReset(){var e,t,a;let s=o.filter,c=(null==(t=n.params)||null==(e=t[1])?void 0:e.filters)||{};delete c.filterAction;let d=[{...null==(a=n.params)?void 0:a[0],filter:pA([...Object.values(c),s]),page:1},{filters:c}];if(r.title=l("Filter"),"manual"===i)return n.params=d,n.mutate(void 0);n.run(...d)}}},d7=e=>{var t;let n=eB(),{getCollectionFields:o}=sO();if(!e)return[];let l=o(e);return null==l||null==(t=l.map)?void 0:t.call(l,e=>{var t;return{value:e.name,label:n((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name)}})},d9=e=>{var t,n,o;let l=eB(),{getCollectionFields:r}=sO();if(!e)return[];let i=r(e);return null==i||null==(o=i.filter)||null==(n=o.call(i,e=>(null==e?void 0:e.interface)==="color"))||null==(t=n.map)?void 0:t.call(n,e=>{var t;return{value:e.name,label:l((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name)}})},ue=e=>{var t,n,o,l,r,i,a,s,c,d,u,p,m;let{uiSchema:h,fieldSchema:x,collectionField:f}=e,{form:v}=Tp(),{getInterface:g,getCollection:y}=sO(),b=(0,ec.useField)(),{t:C}=(0,eT.useTranslation)(),S=(0,ec.useFieldSchema)(),{dn:w}=eY(),F=(null==x||null==(t=x["x-component-props"])?void 0:t.fieldNames)||(null==h||null==(n=h["x-component-props"])?void 0:n.fieldNames),j=d7(null!=(u=null==f?void 0:f.target)?u:null==f?void 0:f.targetCollection),k=d9(null!=(p=null==f?void 0:f.target)?p:null==f?void 0:f.targetCollection),I=g(null==f?void 0:f.interface),P=(null==(m=y(null==f?void 0:f.target))?void 0:m.template)==="file",T=["QuickEdit","FormItem"].includes(x["x-decorator"]),{currentMode:N}=lx(),{isAllowToSetDefaultValue:M}=sz({collectionField:f,fieldSchema:x}),D=["datetime","createdAt","updatedAt"].includes(null==f?void 0:f.interface),R=["obo","oho","o2o","o2m","m2m","m2o","snapshot"].includes(null==f?void 0:f.interface),q=SN({fieldSchema:x}),_=(null==x||null==(o=x["x-component-props"])?void 0:o.mode)||"Select",O="editable";!0===x["x-disabled"]&&(O="readonly"),!0===x["x-read-pretty"]&&(O="read-pretty");let B=R&&"Select"===_;return(0,A.jsxs)(sP,{disableInitializer:!0,children:[(0,A.jsx)(aQ,{title:C("Custom column title"),schema:{type:"object",title:C("Custom column title"),properties:{title:{title:C("Column title"),default:null==S?void 0:S.title,description:"".concat(C("Original field title: ")).concat((null==f||null==(l=f.uiSchema)?void 0:l.title)||(null==x?void 0:x.title)),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:e=>{let{title:t}=e;t&&(b.title=t,S.title=t,w.emit("patch",{schema:{"x-uid":S["x-uid"],title:S.title}})),w.refresh()}}),B&&!b.readPretty&&!(null==h?void 0:h["x-read-pretty"])&&T&&(0,A.jsx)(il,{collectionName:null==f?void 0:f.target,defaultFilter:(null==x||null==(a=x["x-component-props"])||null==(i=a.service)||null==(r=i.params)?void 0:r.filter)||{},form:v,onSubmit:e=>{var t,n;let{filter:o}=e;o=d5(o),(0,ed.set)(b.componentProps,"service.params.filter",o),x["x-component-props"]=b.componentProps;let l=null==(n=b.path)?void 0:n.splice((null==(t=b.path)?void 0:t.length)-1,1);b.form.query("".concat(l.concat("*."+x.name))).forEach(e=>{e.componentProps.service=e.componentProps.service||{params:{}},e.componentProps.service.params.filter=o}),w.emit("patch",{schema:{"x-uid":x["x-uid"],"x-component-props":b.componentProps}})}}),(0,A.jsx)(aQ,{title:C("Column width"),schema:{type:"object",title:C("Column width"),properties:{width:{default:(null==S||null==(s=S["x-component-props"])?void 0:s.width)||200,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{}}}},onSubmit:e=>{let{width:t}=e,n=S["x-component-props"]||{};n.width=t;let o={"x-uid":S["x-uid"]};o["x-component-props"]=n,S["x-component-props"]=n,b.componentProps.width=t,w.emit("patch",{schema:o}),w.refresh()}}),I&&!0===I.sortable&&!N&&(0,A.jsx)(aY,{title:C("Sortable"),checked:b.componentProps.sorter,onChange:e=>{let t={"x-uid":S["x-uid"]};S["x-component-props"]={...S["x-component-props"],sorter:e},t["x-component-props"]=S["x-component-props"],b.componentProps.sorter=e,w.emit("patch",{schema:t}),w.refresh()}}),["linkTo","m2m","m2o","o2m","obo","oho","snapshot","createdBy","updatedBy"].includes(null==f?void 0:f.interface)&&!P&&("read-pretty"===O||b.readPretty||b.readOnly)&&(0,A.jsx)(aY,{title:C("Enable link"),checked:(null==(c=x["x-component-props"])?void 0:c.enableLink)!==!1,onChange:e=>{x["x-component-props"]={...null==x?void 0:x["x-component-props"],enableLink:e},b.componentProps={...null==x?void 0:x["x-component-props"],enableLink:e},w.emit("patch",{schema:{"x-uid":x["x-uid"],"x-component-props":{...null==x?void 0:x["x-component-props"]}}}),w.refresh()}}),["linkTo","m2m","m2o","o2m","obo","oho","snapshot"].includes(null==f?void 0:f.interface)&&(0,A.jsx)(aW,{title:C("Title field"),options:j,value:null==F?void 0:F.label,onChange:e=>{var t,n,o,l,r;let i={...null==f||null==(n=f.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...null==x||null==(o=x["x-component-props"])?void 0:o.fieldNames,label:e};eu().set(x,"x-component-props.fieldNames",i);let a=null==(r=b.path)?void 0:r.splice((null==(l=b.path)?void 0:l.length)-1,1);b.form.query("".concat(a.concat("*."+x.name))).forEach(e=>{e.componentProps.fieldNames=i}),w.emit("patch",{schema:{"x-uid":x["x-uid"],"x-component-props":{...x["x-component-props"]}}}),w.refresh()}}),R&&(0,A.jsx)(aW,{title:C("Field component"),options:"read-pretty"===O?[{label:C("Title"),value:"Select"},P&&{label:C("File manager"),value:"FileManager"},{label:C("Tag"),value:"Tag"}].filter(Boolean):q,value:_,onChange:e=>{let t={"x-uid":x["x-uid"]};x["x-component-props"]=x["x-component-props"]||{},x["x-component-props"].mode=e,t["x-component-props"]=x["x-component-props"],b.componentProps=b.componentProps||{},b.componentProps.mode=e,w.emit("patch",{schema:t}),w.refresh()}},"field-mode"),["Tag"].includes(_)&&(0,A.jsx)(aW,{title:C("Tag color field"),options:k,value:null==x||null==(d=x["x-component-props"])?void 0:d.tagColorField,onChange:e=>{let t={"x-uid":x["x-uid"]};x["x-component-props"]=x["x-component-props"]||{},x["x-component-props"].tagColorField=e,t["x-component-props"]=x["x-component-props"],b.componentProps.tagColorField=e,w.emit("patch",{schema:t}),w.refresh()}},"title-field"),T&&!b.readPretty&&!(null==h?void 0:h["x-read-pretty"])&&(0,A.jsx)(aY,{title:C("Required"),checked:x.required,onChange:e=>{var t,n;let o={"x-uid":x["x-uid"]};x.required=e,o.required=e;let l=null==(n=b.path)?void 0:n.splice((null==(t=b.path)?void 0:t.length)-1,1);b.form.query("".concat(l.concat("*."+x.name))).forEach(t=>{t.required=e}),w.emit("patch",{schema:o}),w.refresh()}},"required"),T&&!(null==b?void 0:b.readPretty)&&(null==f?void 0:f.interface)!=="o2m"&&!sB(x)&&(0,A.jsx)(aW,{title:C("Pattern"),options:[{label:C("Editable"),value:"editable"},{label:C("Readonly"),value:"readonly"},{label:C("Easy-reading"),value:"read-pretty"}],value:O,onChange:e=>{var t,n;let o={"x-uid":x["x-uid"]},l=null==(n=b.path)?void 0:n.splice((null==(t=b.path)?void 0:t.length)-1,1);switch(e){case"readonly":x["x-read-pretty"]=!1,x["x-disabled"]=!0,o["x-read-pretty"]=!1,o["x-disabled"]=!0,b.form.query("".concat(l.concat("*."+x.name))).forEach(e=>{e.readonly=!0,e.disabled=!0});break;case"read-pretty":x["x-read-pretty"]=!0,x["x-disabled"]=!1,o["x-read-pretty"]=!0,o["x-disabled"]=!1,b.form.query("".concat(l.concat("*."+x.name))).forEach(e=>{e.readPretty=!0});break;default:x["x-read-pretty"]=!1,x["x-disabled"]=!1,o["x-read-pretty"]=!1,o["x-disabled"]=!1,b.form.query("".concat(l.concat("*."+x.name))).forEach(e=>{e.readPretty=!1,e.disabled})}w.emit("patch",{schema:o}),w.refresh()}},"pattern"),D&&(0,A.jsx)(s6,{fieldSchema:x}),T&&!(null==b?void 0:b.readPretty)&&["obo","oho","o2o","o2m","m2m","m2o"].includes(null==f?void 0:f.interface)&&(0,A.jsx)(s3,{fieldSchema:x,onSubmitCallBack:e=>{var t,n;let o=null==(n=b.path)?void 0:n.splice((null==(t=b.path)?void 0:t.length)-1,1);b.form.query("".concat(o.concat("*."+x.name))).forEach(t=>{t.componentProps.service=t.componentProps.service||{params:{}},t.componentProps.service.params.sort=e})}}),M(T)&&(0,A.jsx)(sq,{fieldSchema:x}),e.children,(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!T,breakRemoveOn:{"x-component":"Grid"},confirm:{title:C("Delete table column")}})]})},ut=new or({name:"FormItemSettings",items:[...s_,{name:"allowAddNewData",type:"switch",useVisible(){let e=ul(),t=ui(),n=ud();return!e&&t&&["SubTable"].includes(n)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow add new"),checked:(null==(e=o["x-component-props"])?void 0:e.allowAddnew)!==!1,onChange(e){let t={"x-uid":o["x-uid"]};n.componentProps.allowAddnew=e,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].allowAddnew=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"allowSelectExistingRecord",type:"switch",useVisible(){let e=ul(),t=ui(),n=ud();return!e&&t&&["SubTable"].includes(n)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow selection of existing records"),checked:null==(e=o["x-component-props"])?void 0:e.allowSelectExistingRecord,onChange(e){let t={"x-uid":o["x-uid"]};n.componentProps.allowSelectExistingRecord=e,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].allowSelectExistingRecord=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"quickUpload",type:"switch",useVisible(){let e=uc();return!uo()&&e},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Quick upload"),checked:(null==(e=o["x-component-props"])?void 0:e.quickUpload)!==!1,onChange(e){let t={"x-uid":o["x-uid"]};n.componentProps.quickUpload=e,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].quickUpload=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"selectFile",type:"switch",useVisible(){let e=uc();return!uo()&&e},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Select file"),checked:(null==(e=o["x-component-props"])?void 0:e.selectFile)!==!1,onChange(e){let t={"x-uid":o["x-uid"]};n.componentProps.selectFile=e,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].selectFile=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"validationRules",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o,refresh:l}=eY(),r=up(),{getCollectionJoinField:i}=sO(),{getField:a}=tJ(),s=a(n.name)||i(n["x-collection-field"]);return{title:e("Set validation rules"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:e("Set validation rules"),properties:{rules:{type:"array",default:null==n?void 0:n["x-validator"],"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},maxItems:3,items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{header:'{{ t("Validation rule") }}'},properties:{index:{type:"void","x-component":"ArrayCollapse.Index"},layout:{type:"void","x-component":"FormLayout","x-component-props":{labelStyle:{marginTop:"6px"},labelCol:8,wrapperCol:16},properties:{...r,message:{type:"string",title:'{{ t("Error message") }}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:2,maxRows:2}}}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"}}},properties:{add:{type:"void",title:'{{ t("Add validation rule") }}',"x-component":"ArrayCollapse.Addition","x-reactions":{dependencies:["rules"],fulfill:{state:{disabled:"{{$deps[0].length >= 3}}"}}}}}}}},onSubmit(e){var r;let i=[];for(let t of e.rules)i.push(eu().pickBy(t,eu().identity));let a={"x-uid":n["x-uid"]};if(["percent"].includes(null==s?void 0:s.interface))for(let e of i)(e.maxValue||e.minValue)&&(e.percentMode=!0),e.percentFormat&&(e.percentFormats=!0);t.validator=eu().concat([],(null==s||null==(r=s.uiSchema)?void 0:r["x-validator"])||[],i),n["x-validator"]=i,a["x-validator"]=i,o.emit("patch",{schema:a}),l()}}},useVisible(){let{form:e}=Tp(),t=uo(),n=up();return e&&!t&&n}},{name:"isquickaddtabs",type:"switch",useVisible(){let e=ul(),t=ui(),n=ud();return!e&&t&&["SubTable"].includes(n)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Is Quick Add Tabs"),checked:(null==(e=o["x-component-props"])?void 0:e.isQuickAdd)||!1,onChange(e){let t={"x-uid":o["x-uid"]};n.componentProps.isQuickAdd=e,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].isQuickAdd=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"setquickaddtabs",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=eB(),o=(0,ec.useFieldSchema)(),l=tg().getCollection(o["x-collection-field"]),r=o["x-component-props"].quickAddField||"none",{dn:i}=eY(),a=un(),s=l.fields.map(e=>{if("m2o"===e.interface||"select"===e.interface){var t;return{...e,label:n(null==(t=e.uiSchema)?void 0:t.title),value:e.name}}}).filter(Boolean);return s.unshift({label:"none",value:"none"}),{title:e("Set Quick Add Tabs"),options:s,value:r,onChange(e){let n={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].quickAddField={fieldInterface:s.find(t=>t.value===e).interface||"none",value:e},n["x-component-props"]=o["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.quickAddField=o["x-component-props"].quickAddField,nW(o)&&a&&(n.default=null,o.default=null,t.setInitialValue(null),t.setValue(null)),i.emit("patch",{schema:n}),i.refresh()}}},useVisible:()=>(0,ec.useFieldSchema)()["x-component-props"].isQuickAdd},{name:"setquickaddparenttabs",type:"select",useComponentProps(){var e,t,n;let{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),r=eB(),i=(0,ec.useFieldSchema)(),a=tg(),{value:s}=(null==(e=i["x-component-props"])?void 0:e.quickAddField)||{},c=a.getCollectionFields("".concat(i["x-collection-field"],".").concat(s)),{dn:d}=eY(),u=un(),p=c.map(e=>{if("m2o"===e.interface)return{...e,label:r(e.uiSchema.title),value:e.name}}).filter(Boolean);p.unshift({label:o("none"),value:"none"});let m=(null==(n=i["x-component-props"])||null==(t=n.quickAddParentCollection)?void 0:t.value)||"none";return{title:o("Set Quick Add Parent Tabs"),options:p,value:m,onChange(e){let t={"x-uid":i["x-uid"]};i["x-component-props"]=i["x-component-props"]||{},i["x-component-props"].quickAddParentCollection={collectionField:"".concat(i["x-collection-field"],".").concat(s,".").concat(e),value:e},t["x-component-props"]=i["x-component-props"],l.componentProps=l.componentProps||{},l.componentProps.quickAddParentCollection={collectionField:"".concat(i["x-collection-field"],".").concat(s,".").concat(e),value:e},nW(i)&&u&&(t.default=null,i.default=null,l.setInitialValue(null),l.setValue(null)),d.emit("patch",{schema:t}),d.refresh()}}},useVisible(){let e=(0,ec.useFieldSchema)();return e["x-component-props"].isQuickAdd&&e["x-component-props"].quickAddField&&"none"!==e["x-component-props"].quickAddField}},{name:"defaultValue",Component:sq,useVisible(){let{isAllowToSetDefaultValue:e}=sz();return e()}},{name:"dataScope",Component:il,useVisible(){let e=uu(),t=uo();return e&&!t},useComponentProps(){var e,t,n;let{getCollectionJoinField:o,getAllCollectionsInheritChain:l}=sO(),{getField:r}=tJ(),{form:i}=Tp(),a=m3(),s=(0,ec.useField)(),c=(0,ec.useFieldSchema)(),d=r(c.name)||o(c["x-collection-field"]),u=lN(),p=lT(),{dn:m}=eY();return{collectionName:null==d?void 0:d.target,defaultFilter:(null==c||null==(n=c["x-component-props"])||null==(t=n.service)||null==(e=t.params)?void 0:e.filter)||{},form:i,dynamicComponent:e=>(0,A.jsx)(rW,{...e,form:i,collectionField:e.collectionField,record:a,shouldChange:rH({collectionField:e.collectionField,variables:u,localVariables:p,getAllCollectionsInheritChain:l})}),onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(s.componentProps,"service.params.filter",t),c["x-component-props"]=s.componentProps,m.emit("patch",{schema:{"x-uid":c["x-uid"],"x-component-props":s.componentProps}})}}}},{name:"sortingRule",Component:s3,useVisible(){let e=uu(),t=uo();return e&&!t}},{name:"fieldMode",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o}=eY(),l=SN(),r=un(),i=ud();return{title:e("Field component"),options:l,value:i,onChange(e){let l={"x-uid":n["x-uid"]};n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].mode=e,l["x-component-props"]=n["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(n)&&r&&(l.default=null,n.default=null,t.setInitialValue(null),t.setValue(null)),o.emit("patch",{schema:l}),o.refresh()}}},useVisible:um},{name:"customTitle",type:"modal",useComponentProps(){var e,t;let n=(0,ec.useFieldSchema)(),{fieldSchema:o}=sb(),l=o||n,{t:r}=(0,eT.useTranslation)(),{dn:i}=eY(),a=y4(),s=null==(t=l["x-component-props"])||null==(e=t.fieldNames)?void 0:e.formula,c=(0,ec.useField)();return{title:r("Custom option label"),schema:{type:"object",title:r("Custom option label"),properties:{formula:{required:!0,"x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:a},default:s||""}}},onSubmit:e=>{let{formula:t}=e;if(t){var n,o;let e,r={...l["x-component-props"],fieldNames:{...null==(n=l["x-component-props"])?void 0:n.fieldNames,formula:t},appends:[l.name]},a=/{{(.*?)}}/g;for(;e=a.exec(t);)if(e[1].includes(".")){let t=e[1].split("."),n=l.name;t.forEach((e,o)=>{o!==t.length-1&&(n+="."+e,r.appends.push(n))})}c.componentProps={...c.componentProps,fieldNames:{...null==(o=c.componentProps)?void 0:o.fieldNames,formula:t}},l["x-component-props"]=r,i.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":r}})}i.refresh()}}},useVisible:()=>{let e="CustomTitle"===(0,ec.useFieldSchema)()["x-component-props"].mode;return um()&&e}},{name:"popupSize",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{dn:r}=eY();return{title:n("Popup size"),options:[{label:n("Small"),value:"small"},{label:n("Middle"),value:"middle"},{label:n("Large"),value:"large"}],value:null!=(t=null==l||null==(e=l["x-component-props"])?void 0:e.openSize)?t:"middle",onChange:e=>{o.componentProps.openSize=e,l["x-component-props"]=o.componentProps,r.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":l["x-component-props"]}}),r.refresh()}}},useVisible(){var e;let t=um(),n=(null==(e=(0,ec.useFieldSchema)()["x-component-props"])?void 0:e.mode)==="Picker";return t&&n}},{name:"allowAddNew",type:"switch",useVisible(){let e=ul(),t=ui(),n=ud();return!e&&t&&["Picker"].includes(n)},useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o,refresh:l,insertAdjacent:r}=eY();return{title:e("Allow add new data"),checked:n["x-add-new"],onChange(e){n.reduceProperties((e,t)=>"Action"===t["x-component"]?t:e,null)||r("afterBegin",{"x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-toolbar":"ActionSchemaToolbar","x-settings":"actonSettings:addNew","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"default",component:"CreateRecordAction"}});let i={"x-uid":n["x-uid"]};t["x-add-new"]=e,n["x-add-new"]=e,i["x-add-new"]=e,o.emit("patch",{schema:i}),l()}}}},{name:"addMode",type:"select",useVisible(){let e=ul(),t=ui(),n=ud();return!e&&t&&["Select"].includes(n)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,insertAdjacent:r}=eY();return{title:t("Quick create"),options:[{label:t("None"),value:"none"},{label:t("Dropdown"),value:"quickAdd"},{label:t("Pop-up"),value:"modalAdd"}],value:(null==(e=n.componentProps)?void 0:e.addMode)||"none",onChange(e){"modalAdd"===e&&(o.reduceProperties((e,t)=>"Action"===t["x-component"]?t:e,null)||r("afterBegin",{"x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-toolbar":"ActionSchemaToolbar","x-settings":"actonSettings:addNew","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"default",component:"CreateRecordAction"}}));let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].addMode=e,t["x-component-props"]=o["x-component-props"],n.componentProps=n.componentProps||{},n.componentProps.addMode=e,l.emit("patch",{schema:t}),l.refresh()}}}},{name:"multiple",type:"switch",useVisible(){let e=ui(),t=sK();return e&&t()},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow multiple"),checked:(null==(e=o["x-component-props"])?void 0:e.multiple)===void 0||o["x-component-props"].multiple,onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},n.componentProps=n.componentProps||{},o["x-component-props"].multiple=e,n.componentProps.multiple=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"allowDissociate",type:"switch",useVisible(){var e;let t=sK();return(null==(e=(0,ec.useFieldSchema)()["x-component-props"])?void 0:e.mode)==="Nester"&&t()},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow dissociate"),checked:(null==(e=o["x-component-props"])?void 0:e.allowDissociate)!==!1,onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},n.componentProps=n.componentProps||{},o["x-component-props"].allowDissociate=e,n.componentProps.allowDissociate=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"enableLink",type:"switch",useVisible(){let e=uh(),t=ul(),n=uc(),o=(0,ec.useFieldSchema)();return t&&e.length>0&&!n&&"CollectionField"===o["x-component"]},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY();return{title:t("Enable link"),checked:(null==(e=o["x-component-props"])?void 0:e.enableLink)!==!1,onChange(e){o["x-component-props"]={...null==o?void 0:o["x-component-props"],enableLink:e},n.componentProps.enableLink=e,l.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":{...null==o?void 0:o["x-component-props"]}}}),l.refresh()}}}},{name:"pattern",type:"select",useVisible(){let{form:e}=Tp(),t=(0,ec.useFieldSchema)();return e&&!(null==e?void 0:e.readPretty)&&!sB(t)},useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o}=eY(),l="editable";return!0===n["x-disabled"]&&(l="readonly"),!0===n["x-read-pretty"]&&(l="read-pretty"),{title:e("Pattern"),options:[{label:e("Editable"),value:"editable"},{label:e("Readonly"),value:"readonly"},{label:e("Easy-reading"),value:"read-pretty"}],value:l,onChange(e){let l={"x-uid":n["x-uid"]};switch(e){case"readonly":n["x-read-pretty"]=!1,n["x-disabled"]=!0,l["x-read-pretty"]=!1,l["x-disabled"]=!0,t.readPretty=!1,t.disabled=!0,eu().set(t,"initStateOfLinkageRules.pattern",c9(!0,am.ReadOnly));break;case"read-pretty":n["x-read-pretty"]=!0,n["x-disabled"]=!1,l["x-read-pretty"]=!0,l["x-disabled"]=!1,t.readPretty=!0,eu().set(t,"initStateOfLinkageRules.pattern",c9(!0,am.ReadPretty));break;default:n["x-read-pretty"]=!1,n["x-disabled"]=!1,l["x-read-pretty"]=!1,l["x-disabled"]=!1,t.readPretty=!1,t.disabled=!1,eu().set(t,"initStateOfLinkageRules.pattern",c9(!0,am.Editable))}o.emit("patch",{schema:l}),o.refresh()}}}},{name:"titleField",type:"select",useVisible(){let e=uh(),t=ui(),n=ud();return e.length>0&&t&&"SubTable"!==n&&"CustomTitle"!==n},useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{dn:r}=eY(),i=uh(),a=hY();return{title:n("Title field"),options:i,value:null==o||null==(t=o.componentProps)||null==(e=t.fieldNames)?void 0:e.label,onChange(e){var t,n;let i={"x-uid":l["x-uid"]},s={...null==a||null==(n=a.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...o.componentProps.fieldNames,label:e};l["x-component-props"]=l["x-component-props"]||{},l["x-component-props"].fieldNames=s,i["x-component-props"]=l["x-component-props"],o.componentProps.fieldNames=l["x-component-props"].fieldNames,r.emit("patch",{schema:i}),r.refresh()}}}},{name:"dateFormat",Component:s6,useVisible(){let e=ur();return["datetime","createdAt","updatedAt"].includes(null==e?void 0:e.interface)},useComponentProps:()=>({fieldSchema:(0,ec.useFieldSchema)()})},{name:"size",type:"select",useVisible(){let e=ul(),t=ur(),{getCollection:n}=sO(),o=n(null==t?void 0:t.target),l=["attachment"].includes(null==t?void 0:t.interface)||(null==o?void 0:o.template)==="file";return e&&l},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY();return{title:t("Size"),options:[{label:t("Large"),value:"large"},{label:t("Default"),value:"default"},{label:t("Small"),value:"small"}],value:(null==n||null==(e=n.componentProps)?void 0:e.size)||"default",onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].size=e,t["x-component-props"]=o["x-component-props"],n.componentProps=n.componentProps||{},n.componentProps.size=e,l.emit("patch",{schema:t}),l.refresh()}}}},{name:"tagColor",type:"select",useVisible(){let e=ui(),t=ud();return e&&["Tag"].includes(t)},useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{dn:r}=eY(),i=ur(),a=d9(null!=(t=null==i?void 0:i.target)?t:null==i?void 0:i.targetCollection);return{title:n("Tag color field"),options:a,value:null==o||null==(e=o.componentProps)?void 0:e.tagColorField,onChange(e){let t={"x-uid":l["x-uid"]};l["x-component-props"]=l["x-component-props"]||{},l["x-component-props"].tagColorField=e,t["x-component-props"]=l["x-component-props"],o.componentProps.tagColorField=e,r.emit("patch",{schema:t}),r.refresh()}}}},{name:"divider",type:"divider",useVisible:()=>!!ur()},{name:"remove",type:"remove",useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{removeParentsIfNoChildren:!0,confirm:{title:e("Delete field")},breakRemoveOn:{"x-component":"Grid"}}}}]});function un(){let e=m3();return eu().isEmpty(eu().omit(e,["__parent","__collectionName"]))}function uo(){let{form:e}=Tp();return!!(null==e?void 0:e.readPretty)}function ul(){let{fieldSchema:e}=sb();return(0,ec.useField)().readPretty||(null==e?void 0:e["x-read-pretty"])}function ur(){let{getCollectionJoinField:e}=sO(),{getField:t}=tJ(),n=(0,ec.useFieldSchema)(),o=t(n.name)||e(n["x-collection-field"]),{collectionField:l}=sb();return o||l}function ui(){let e=ur();return["obo","oho","o2o","o2m","m2m","m2o","updatedBy","createdBy"].includes(null==e?void 0:e.interface)}function ua(){let e=ur();return["select","radioGroup"].includes(null==e?void 0:e.interface)}function us(){let e=ui(),t=ua();return e||t}function uc(){var e;let{getCollection:t}=sO(),n=ur();return(null==(e=t(null==n?void 0:n.target))?void 0:e.template)==="file"}function ud(){var e;let t=(0,ec.useField)(),n=uc();return(null==t||null==(e=t.componentProps)?void 0:e.mode)||(n?"FileManager":"Select")}function uu(){let e=ud();return ui()&&("Select"===e||"CustomTitle"===e)}function up(){var e;let{getInterface:t}=sO(),n=(0,ec.useFieldSchema)(),o=ur(),l=t(null==o?void 0:o.interface);return null==l||null==(e=l.validateSchema)?void 0:e.call(l,n)}function um(){let e=(0,ec.useFieldSchema)(),t=SN(),n="TableField"===e["x-component"];return ui()&&t&&!n}function uh(){var e;let{getCollectionFields:t,isTitleField:n}=sO(),o=eB(),l=ur();return((null==l?void 0:l.target)?t(null==l?void 0:l.target):null!=(e=t(null==l?void 0:l.targetCollection))?e:[]).map(e=>{var t;return{value:null==e?void 0:e.name,label:o(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}})}function ux(){var e,t,n,o;let{fieldSchema:l,collectionField:r}=sb(),i=(0,ec.useField)(),a=tg(),s=uc(),c=(0,ec.useFieldSchema)(),d=tA(),u=a.getCollection(null==d?void 0:d.target),p=(null==u?void 0:u.template)==="tree",m=l||c,h=r||d,x=(null==m||null==(e=m["x-component-props"])?void 0:e.mode)||(null==i||null==(t=i.componentProps)?void 0:t.mode)||(s?"FileManager":"")||(null==h||null==(n=h.uiSchema)?void 0:n["x-component"]);return({AssociationField:p?"Cascader":"Select"})[x]||x||(null==(o=m["x-component-props"])?void 0:o.component)}let uf=(0,es.createContext)(null);uf.displayName="CurrentAppInfoContext";let uv=()=>(0,es.useContext)(uf),ug=e=>{let t=ek({url:"app:getInfo"});if(!t.loading)return(0,A.jsx)(uf.Provider,{value:t.data,children:e.children})},uy=(0,es.createContext)(null);uy.displayName="CurrentUserContext";let ub=()=>(0,es.useContext)(uy),uC=()=>{var e;let{allowAnonymous:t}=NA(),{data:n}=ub(),o=eB();return(0,es.useMemo)(()=>{var e;let l=((null==n||null==(e=n.data)?void 0:e.roles)||[]).map(e=>{let{name:t,title:n}=e;return{name:t,title:o(n)}});return t&&l.push({title:"Anonymous",name:"anonymous"}),l},[t,null==n||null==(e=n.data)?void 0:e.roles])},uS=e=>{let t=eC(),n=ek(()=>t.request({url:"/auth:check",skipNotify:!0,skipAuth:!0}).then(e=>null==e?void 0:e.data));if(!n.loading)return(0,A.jsx)(uy.Provider,{value:n,children:e.children})},uw=e=>{var t,n;let{children:o}=e,l=ub(),{pathname:r,search:i}=(0,ep.useLocation)(),a="?redirect=".concat(r).concat(i);return(null==l||null==(n=l.data)||null==(t=n.data)?void 0:t.id)?(0,A.jsx)(A.Fragment,{children:o}):(0,A.jsx)(ep.Navigate,{replace:!0,to:"/signin".concat(a)})};function uF(){let e=(0,ns._)(["\n display: inline-block;\n vertical-align: top;\n width: 46px;\n height: var(--tb-header-height);\n &:hover {\n background: rgba(255, 255, 255, 0.1) !important;\n }\n "]);return uF=function(){return e},e}function uj(){let e=(0,ns._)(["\n overflow: hidden;\n display: inline-block;\n line-height: var(--tb-header-height);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: pointer;\n padding: 0 16px 0 16px;\n color: ",";\n "]);return uj=function(){return e},e}let uA=e=>{let{addMenuItem:t,getMenuItems:n}=n5(),{redirectUrl:o=""}=e,{allowAll:l,snippets:r}=NA(),i=l||(null==r?void 0:r.includes("app")),a=(0,ep.useNavigate)(),s=eC(),{t:c}=(0,eT.useTranslation)(),d=eC(),u=(0,es.useCallback)(async()=>await new Promise(e=>{let t=setInterval(()=>{d.silent().resource("app").getInfo().then(n=>((null==n?void 0:n.status)===200&&(e("ok"),clearInterval(t)),n)).catch(e=>{(0,eh.error)(e)})},3e3)}),[d]),p=(()=>{var e,t,n;let{data:o}=ub(),{token:l}=iF();return(0,es.useMemo)(()=>{var e,t,n;return{key:"nickname",disabled:!0,label:(0,A.jsx)("span",{"aria-disabled":"false",style:{cursor:"text",color:l.colorTextDescription},children:(null==o||null==(e=o.data)?void 0:e.nickname)||(null==o||null==(t=o.data)?void 0:t.username)||(null==o||null==(n=o.data)?void 0:n.email)})}},[null==o||null==(e=o.data)?void 0:e.email,null==o||null==(t=o.data)?void 0:t.nickname,null==o||null==(n=o.data)?void 0:n.username,null==o?void 0:o.data.version,l.colorTextDescription])})(),m=(()=>{let e=(0,es.useContext)(uk),[t,n]=(0,es.useState)(!1),{t:o}=(0,eT.useTranslation)();return(0,es.useMemo)(()=>({key:"profile",eventKey:"EditProfile",onClick:()=>{n(!0),null==e||e.setVisible(!1)},label:(0,A.jsxs)("div",{children:[o("Edit profile"),(0,A.jsx)(ct,{value:{visible:t,setVisible:n},children:(0,A.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,A.jsx)(al,{scope:{useCurrentUserValues:n7,useCloseAction:n8,useSaveCurrentUserValues:n9},schema:oe})})})]})}),[t])})(),h=(()=>{var e,t,n,o;let l=(0,es.useContext)(uk),[r,i]=(0,es.useState)(!1),{t:a}=(0,eT.useTranslation)(),s=os().pluginManager,c=s.get("@tachybase/plugin-otp"),d=s.get("@tachybase/plugin-auth-sms"),u=!!c&&!!d,p=ub(),m=(null==p||null==(t=p.data)||null==(e=t.data)?void 0:e.password)!==null,h=null==p||null==(o=p.data)||null==(n=o.data)?void 0:n.phone,x=h?a("Send verification code to phone: {{phoneNumber}}",{phoneNumber:h}):a("Please fill in your mobile phone number in your personal information first");return(0,es.useMemo)(()=>({key:"password",eventKey:"ChangePassword",onClick:()=>{i(!0),null==l||l.setVisible(!1)},label:(0,A.jsxs)(A.Fragment,{children:[a("Change password"),(0,A.jsx)(ct,{value:{visible:r,setVisible:i},children:(0,A.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,A.jsx)(al,{scope:{useCloseAction:n1,useSaveCurrentUserValues:n2,oldPassword:m,codeDescription:x,phoneNumber:h,smsVerifyEnabled:u},components:{VerificationCode:n0},schema:n6})})})]})}),[r,m])})(),x=(()=>{let e=eC(),t=uC(),{t:n}=(0,eT.useTranslation)(),o=(0,es.useMemo)(()=>({key:"role",eventKey:"SwitchRole",label:(0,A.jsx)(ol,{title:n("Switch role"),fieldNames:{label:"title",value:"name"},options:t,defaultValue:e.auth.role,onChange:async t=>{e.auth.setRole(t),await e.resource("users").setDefaultRole({values:{roleName:t}}),location.reload(),window.location.reload()}})}),[e,t,n]);return t.length<=1?null:o})(),f=(()=>{var e;let{t,i18n:n}=(0,eT.useTranslation)(),o=eC(),{data:l}=wg(),r=(0,es.useMemo)(()=>{var e;return(null==l||null==(e=l.data)?void 0:e.enabledLanguages)||[]},[null==l||null==(e=l.data)?void 0:e.enabledLanguages]),i=(0,es.useMemo)(()=>({key:"language",eventKey:"LanguageSettings",label:(0,A.jsx)(ol,{title:t("Language"),options:Object.keys(on).filter(e=>r.includes(e)).map(e=>({label:on[e].label,value:e})),defaultValue:n.language,onChange:async e=>{await o.resource("users").updateProfile({values:{appLang:e}}),o.auth.setLocale(e),window.location.reload()}})}),[o,r,n,t]);return r.length<2?null:i})(),{modal:v}=eX.A.useApp(),g=(0,es.useMemo)(()=>i?[{key:"cache",label:c("Clear cache"),onClick:async()=>{await s.resource("app").clearCache(),window.location.reload()}},{key:"reboot",label:c("Restart application"),onClick:async()=>{v.confirm({title:c("Restart application"),okText:c("Restart"),okButtonProps:{danger:!0},onOk:async()=>{await s.resource("app").restart()}})}},{key:"divider_4",type:"divider"}]:[],[s,i,u,v,c]);return(0,es.useMemo)(()=>{[p,{key:"divider_1",type:"divider"},m,h,{key:"divider_2",type:"divider"},x,{key:"divider_3",type:"divider"},...g,{key:"signout",label:c("Sign out"),onClick:async()=>{try{var e;let t=await s.resource("authenticators").publicList(),n=(null==t||null==(e=t.data)?void 0:e.data)||[];await s.auth.signOut(),1===n.length&&"mainApp"===n[0].authType?window.location.href="/":a("/signin?redirect=".concat(encodeURIComponent(o)))}catch(e){console.error("Sign out error:",e)}}}].forEach(e=>{e&&t(e)}),f&&t(f,{before:"divider_3"})},[t,s.auth,g,m,h,f,a,o,x,c,p]),(0,A.jsx)(nY.A,{items:n()})},uk=(0,es.createContext)(null);uk.displayName="DropdownVisibleContext";let uI=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{dropdown:t(uF()),button:t(uj(),n.colorTextHeaderMenu)}}),uP=()=>{let[e,t]=(0,es.useState)(!1),{styles:n}=uI();return(0,A.jsx)("div",{className:n.dropdown,children:(0,A.jsx)(uk.Provider,{value:{visible:e,setVisible:t},children:(0,A.jsx)(nX.A,{open:e,onOpenChange:e=>{t(e)},dropdownRender:()=>(0,A.jsx)(uA,{}),children:(0,A.jsx)("span",{"data-testid":"user-center-button",className:n.button,children:(0,A.jsx)(nH.A,{})})})})})},uT=(0,es.createContext)(null),uN=e=>{let{children:t,name:n,getActiveFieldsName:o,addActiveFieldName:l,removeActiveFieldName:r}=e,i=(0,es.useRef)(new Set),a=(0,es.useContext)(uT),s=(0,es.useMemo)(()=>({getActiveFieldsName:o||(e=>e&&e!==n?null==a?void 0:a.getActiveFieldsName(e):Array.from(i.current)),addActiveFieldName:l||(e=>{i.current.add(e)}),removeActiveFieldName:r||(e=>{i.current.delete(e)}),name:n,parent:a}),[l,o,n,r,a]);return(0,A.jsx)(uT.Provider,{value:s,children:t})},uM=()=>(0,es.useContext)(uT),uD=()=>{let e=(0,es.useContext)(oD);return null==e?void 0:e.isMobile};function uR(e){let t=no()(e),n={},o=new Set;for(let e in t){let l=t[e];if(void 0===l)continue;let r=e.split(".").filter(e=>!/^\d+$/.test(e)&&!["$and","$or"].includes(e)).join("."),i="".concat(r,"|").concat(JSON.stringify(l));o.has(i)||(o.add(i),n[e]=l)}return no().unflatten(n)}function uq(e){let{filterByTk:t,field:n,form:o,fieldNames:l,getField:r,resource:i,actionFields:a}=e;if(t&&a){let e=Object.keys(o.values).filter(e=>{let t=r(e);return!a.includes(e)&&["hasOne","hasMany","belongsTo","belongsToMany"].includes(null==t?void 0:t.type)});return e0()({...o.values},e)}return o.values}function u_(){let e=(0,ec.useForm)(),t=nM(),{field:n,resource:o}=nj(),{fields:l,getField:r,getTreeParentField:i,name:a}=tJ(),s=l.map(e=>e.name),{fieldSchema:c}=co(),{getActiveFieldsName:d}=uM()||{},u=lN(),p=lT({currentForm:e}),m=(0,ec.useFieldSchema)(),h=m3();return(0,es.useCallback)(async()=>{var l,a,x,f,v,g;let{assignedValues:y={},overwriteValues:b}=null!=(a=null==m?void 0:m["x-action-settings"])?a:{},C=uq({filterByTk:t,field:n,form:e,fieldNames:s,getField:r,resource:o,actionFields:(null==d?void 0:d("form"))||[]}),S={},w=Object.keys(y).map(async e=>{let t=y[e],n=r(e);if(oY(t)){let o=await (null==u?void 0:u.parseVariable(t,p));o&&(S[e]=lM(o,{targetCollectionField:n}))}else null!=t&&""!==t&&(S[e]=t)});if(await Promise.all(w),null==c||null==(l=c["x-component-props"])?void 0:l.addChild){let e=i();C[null!=(v=null==e?void 0:e.name)?v:"parent"]=e0()(null==h?void 0:h.__parent,["children"]),C[null!=(g=null==e||null==(x=e.collection.model.rawAttributes[null==e?void 0:e.foreignKey])?void 0:x.field)?g:"parentId"]=null==h||null==(f=h.__parent)?void 0:f.id}return{...C,...b,...S}},[m,null==h?void 0:h.__parent,n,s,c,t,e,d,r,i,p,a,o,u])}let uO="Action.Container",uB={type:"void",title:'{{t("View record")}}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{page:{type:"void",title:'{{t("Detail page")}}',"x-designer":"Page.Designer","x-component":"Page","x-component-props":{disablePageHeader:!0},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}},uE=()=>{let e=(0,ec.useFieldSchema)(),{insertAfterBegin:t}=eY();return(0,es.useCallback)(n=>{e.reduceProperties((e,t)=>t["x-component"]===uO?t:e,null)||t(eu().cloneDeep(n))},[uO])},uV=()=>{let e=(0,ec.useForm)(),t=co();return{async onClick(){t.setVisible(!1),e.reset()}}};function uz(e){if(null==e?void 0:e.length)return e.filter(e=>e&&"before"!==e.order).map(e=>[e.workflowKey,e.context].join("!")).join(",")}function uL(e){if(null==e?void 0:e.length)return e.filter(e=>e&&"before"===e.order).map(e=>[e.workflowKey,e.context].join("!")).join(",")}let uG=()=>{var e;let t,n,o,l,r,i=tV(),a=(0,ec.useForm)(),{field:s,resource:c,__parent:d}=nj(),u=(t=tS(),n=(0,ec.useFieldSchema)(),o=eY(),l=uE(),r=(0,ep.useNavigate)(),e=>{o.designable&&l(uB);let i=n.reduceProperties((e,t)=>t["x-component"]===uO?t:e);i&&r("../".concat(i["x-uid"],"/").concat(na.getInstance().toWildcardPath({collection:t.name,filterByTk:e})))}),{setVisible:p}=co(),m=(0,ep.useNavigate)(),h=(0,ec.useFieldSchema)(),x=(0,ec.useField)(),f=eB(),{modal:v,message:g}=eX.A.useApp(),{t:y}=(0,eT.useTranslation)(),{updateAssociationValues:b}=Tp(),C=u_(),S=i.isNew?x.componentProps.saveMode||"create":"update",w=(null==(e=x.componentProps.filterKeys)?void 0:e.checked)||[];return{async onClick(){var e,t,n,o,l;let{onSuccess:r,skipValidator:i,triggerWorkflows:F,pageMode:j}=null!=(e=null==h?void 0:h["x-action-settings"])?e:{};i||await a.submit(),x.data=s.data||{},x.data.loading=!0;try{let e=await c[S]({values:await C(),filterKeys:w,triggerWorkflows:uz(F),beforeWorkflows:uL(F),updateAssociationValues:b});if(x.data.loading=!1,x.data.data=e,null==d||null==(n=d.service)||null==(t=n.refresh)||t.call(n),j){await pt(a),u(null==e||null==(l=e.data)||null==(o=l.data)?void 0:o.id);return}let i=(null==r?void 0:r.successMessage)?f(null==r?void 0:r.successMessage):y("Saved successfully");(null==r?void 0:r.manualClose)?v.success({title:i,onOk:async()=>{await pt(a),(null==r?void 0:r.redirecting)&&(null==r?void 0:r.redirectTo)&&((0,eh.isURL)(r.redirectTo)?window.location.href=r.redirectTo:m(r.redirectTo))}}):(g.success(i),await pt(a),(null==r?void 0:r.redirecting)&&(null==r?void 0:r.redirectTo)&&((0,eh.isURL)(r.redirectTo)?window.location.href=r.redirectTo:m(r.redirectTo))),(null==r?void 0:r.popupClose)||(await pt(a),null==p||p(!1)),r||null==p||p(!1)}catch(e){x.data.loading=!1}}}},uK=()=>{var e;let t=(0,ec.useForm)(),{field:n,resource:o,__parent:l}=nj(),{setVisible:r,fieldSchema:i}=co(),a=(0,ec.useFieldSchema)(),s=(0,ec.useField)(),{message:c}=eX.A.useApp(),{fields:d,getField:u,getTreeParentField:p,name:m}=tJ(),h=eB(),x=nM(),f=m3(),v=lN(),g=lT({currentForm:t}),{getActiveFieldsName:y}=uM()||{},b=s.componentProps.saveMode||"create",C=(null==(e=s.componentProps.filterKeys)?void 0:e.checked)||[];return{async onClick(){var e,m,S,w,F,j,A;let k=d.map(e=>e.name),{assignedValues:I={},onSuccess:P,overwriteValues:T,skipValidator:N,triggerWorkflows:M}=null!=(m=null==a?void 0:a["x-action-settings"])?m:{},D=null==i||null==(e=i["x-component-props"])?void 0:e.addChild,R={},q=Object.keys(I).map(async e=>{let t=I[e],n=u(e);if(oY(t)){let o=await (null==v?void 0:v.parseVariable(t,g));o&&(R[e]=lM(o,{targetCollectionField:n}))}else null!=t&&""!==t&&(R[e]=t)});await Promise.all(q),N||await t.submit();let _=uq({filterByTk:x,field:n,form:t,fieldNames:k,getField:u,resource:o,actionFields:(null==y?void 0:y("form"))||[]});if(D){let e=p();_[null!=(w=null==e?void 0:e.name)?w:"parent"]=f,_[null!=(F=null==e||null==(S=e.collection.model.rawAttributes[null==e?void 0:e.foreignKey])?void 0:S.field)?F:"parentId"]=f.id}s.data=n.data||{},s.data.loading=!0;try{let e=await o[b]({values:{..._,...T,...R},filterKeys:C,triggerWorkflows:uz(M),beforeWorkflows:uL(M)});if(s.data.loading=!1,s.data.data=e,null==l||null==(A=l.service)||null==(j=A.refresh)||j.call(A),null==r||r(!1),!(null==P?void 0:P.successMessage))return;c.success(h(null==P?void 0:P.successMessage))}catch(e){s.data.data=null,s.data.loading=!1}}}},u$=e=>{for(;e;){if(e["x-filter-targets"])return{targets:e["x-filter-targets"],uid:e["x-uid"]};e=e.parent}return{}},uU=(e,t)=>{for(;e;){if(e["x-filter-targets"]){e["x-filter-targets"]=t;return}e=e.parent}},uW=()=>{let e=(0,ec.useForm)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{getDataBlocks:o}=nV(),{name:l}=tJ(),{getCollectionJoinField:r}=sO();return t.data=t.data||{},{async onClick(){let{targets:i=[],uid:a}=u$(n);t.data.loading=!0;let s={};try{await Promise.all(o().map(async t=>{var o,c,d,u;if(!i.find(e=>e.uid===t.uid))return;let p=(null==(o=t.service.params)?void 0:o[0])||{};for(let t in e.values)("object"!=typeof e.values[t]||"{}"!==JSON.stringify(e.values[t])&&"[]"!==JSON.stringify(e.values[t]))&&e.values[t]||delete e.values[t];let m=(null==(d=t.service.params)||null==(c=d[1])?void 0:c.filters)||{},h={formValues:{...e.values},customValues:{},customFilter:{}};if(null==(u=Object.keys(h.formValues))?void 0:u.includes("__custom")){let t={...e.values};for(let n in delete t.__custom,h.formValues={...t},e.values.__custom)e.values.__custom[n]&&(h.customValues[n]=e.values.__custom[n]);h.customFilter=d3(h.customValues,n)}m[a]=d5(pT(h.formValues,n,r,l));let x=pA([...Object.values(m).map(e=>d5(e)),t.defaultFilter,h.customFilter,s]),f=uR(x);return(s=f,"manual"===t.dataLoadingMode&&eu().isEmpty(f))?t.clearData():t.doFilter({...p,page:1,filter:f},{filters:m})}))}catch(e){console.error(e)}t.data.loading=!1}}},uH=()=>{let e=(0,ec.useForm)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{getDataBlocks:o}=nV();return t.data=t.data||{},{async onClick(){let{targets:l,uid:r}=u$(n);e.reset(),t.data.loading=!0;let i={};try{await Promise.all(o().map(async e=>{var t,n,o;if(!l.find(t=>t.uid===e.uid))return;if("manual"===e.dataLoadingMode)return e.clearData();let a=(null==(t=e.service.params)?void 0:t[0])||{},s=(null==(o=e.service.params)||null==(n=o[1])?void 0:n.filters)||{};delete s[r];let c=pA([...Object.values(s),e.defaultFilter,i]),d=uR(c);return i=d,e.doFilter({...a,page:1,filter:d},{filters:s})})),t.data.loading=!1}catch(e){t.data.loading=!1}}}},uY=()=>{let{resource:e,__parent:t,service:n}=nj(),o=nM(),l=(0,ec.useFieldSchema)(),r=(0,ep.useNavigate)(),i=eB(),a=(0,ec.useForm)(),{modal:s,message:c}=eX.A.useApp(),d=lN(),u=lT({currentForm:a}),{name:p,getField:m}=tJ();return{async onClick(){var p,h,x,f;let{assignedValues:v={},onSuccess:g,skipValidator:y,triggerWorkflows:b}=null!=(h=null==l?void 0:l["x-action-settings"])?h:{},C={},S=Object.keys(v).map(async e=>{let t=v[e],n=m(e);if(oY(t)){let o=await (null==d?void 0:d.parseVariable(t,u));o&&(C[e]=lM(o,{targetCollectionField:n}))}else null!=t&&""!==t&&(C[e]=t)});await Promise.all(S),!1===y&&await a.submit(),await e.update({filterByTk:o,values:{...C},triggerWorkflows:uz(b),beforeWorkflows:uL(b)}),null==n||null==(p=n.refresh)||p.call(n),e instanceof lK||null==t||null==(f=t.service)||null==(x=f.refresh)||x.call(f),(null==g?void 0:g.successMessage)&&((null==g?void 0:g.manualClose)?s.success({title:i(null==g?void 0:g.successMessage),onOk:async()=>{(null==g?void 0:g.redirecting)&&(null==g?void 0:g.redirectTo)&&((0,eh.isURL)(g.redirectTo)?window.location.href=g.redirectTo:r(g.redirectTo))}}):(c.success(i(null==g?void 0:g.successMessage)),(null==g?void 0:g.redirecting)&&(null==g?void 0:g.redirectTo)&&((0,eh.isURL)(g.redirectTo)?window.location.href=g.redirectTo:r(g.redirectTo))))}}},uX=()=>{var e;let t=eC(),n=(0,ep.useNavigate)(),o=nM(),l=(0,ec.useFieldSchema)(),r=eB(),i=(0,ec.useForm)(),{fields:a,getField:s}=tJ(),{field:c,resource:d,__parent:u,service:p}=nj(),m=m3(),h=ub(),x=null==h||null==(e=h.data)?void 0:e.data,f=(0,ec.useField)(),{setVisible:v}=co(),{modal:g,message:y}=eX.A.useApp(),{getActiveFieldsName:b}=uM()||{};return{async onClick(){var e,h,C,S,w,F;let{skipValidator:j,onSuccess:A,requestSettings:k}=null!=(e=null==l?void 0:l["x-action-settings"])?e:{},I=null==l?void 0:l["x-action"];if(!k.url)return;!0!==j&&"customize:form:request"===I&&await i.submit();let P=k.headers?JSON.parse(k.headers):{},T=k.params?JSON.parse(k.params):{},N=k.data?JSON.parse(k.data):{};"customize:form:request"===I&&["POST","PUT","PATCH"].includes(k.method)&&Object.assign(N,uq({filterByTk:o,field:c,form:i,fieldNames:a.map(e=>e.name),getField:s,resource:d,actionFields:(null==b?void 0:b("form"))||[]}));let M={url:(w=k.url,F={currentRecord:m,currentUser:x},w.replace(/\{\{\s*((\w+\.?)+)\s*\}\}/g,function(e,t){return nr()(F,t)||""})),method:k.method,headers:(0,eh.parse)(P)({currentRecord:m,currentUser:x}),params:(0,eh.parse)(T)({currentRecord:m,currentUser:x}),data:(0,eh.parse)(N)({currentRecord:m,currentUser:x})};f.data=c.data||{},f.data.loading=!0;try{if(await t.request({...M}),f.data.loading=!1,d instanceof lK||null==u||null==(S=u.service)||null==(C=S.refresh)||C.call(S),null==p||null==(h=p.refresh)||h.call(p),"customize:form:request"===I&&(null==v||v(!1)),!(null==A?void 0:A.successMessage))return;(null==A?void 0:A.manualClose)?g.success({title:r(null==A?void 0:A.successMessage),onOk:async()=>{(null==A?void 0:A.redirecting)&&(null==A?void 0:A.redirectTo)&&((0,eh.isURL)(A.redirectTo)?window.location.href=A.redirectTo:n(A.redirectTo))}}):y.success(r(null==A?void 0:A.successMessage))}finally{f.data.loading=!1}}}},uJ=()=>{let e=(0,ec.useForm)(),t=nM(),{field:n,resource:o,__parent:l}=nj(),{setVisible:r}=co(),i=(0,ec.useFieldSchema)(),a=(0,ep.useNavigate)(),{fields:s,getField:c,name:d}=tJ(),u=eB(),p=(0,ec.useField)(),{updateAssociationValues:m}=Tp(),{modal:h,message:x}=eX.A.useApp(),f=nq(),v=lN(),g=lT({currentForm:e}),{getActiveFieldsName:y}=uM()||{};return{async onClick(){var d,b,C;let{assignedValues:S={},onSuccess:w,overwriteValues:F,skipValidator:j,triggerWorkflows:A,isDeltaChanged:k}=null!=(d=null==i?void 0:i["x-action-settings"])?d:{},I={},P=Object.keys(S).map(async e=>{let t=S[e],n=c(e);if(oY(t)){let o=await (null==v?void 0:v.parseVariable(t,g));o&&(I[e]=lM(o,{targetCollectionField:n}))}else null!=t&&""!==t&&(I[e]=t)});await Promise.all(P),j||await e.submit();let T=s.map(e=>e.name),N=(null==y?void 0:y("form"))||[],M=uq({filterByTk:t,field:n,form:e,fieldNames:T,getField:c,resource:o,actionFields:N});p.data=n.data||{},p.data.loading=!0;let D={...M,...F,...I};try{if(await o.update({filterByTk:t,values:k?Object.entries(D).reduce((e,t)=>{let[n,o]=t;return N.includes(n)&&(e={...e,[n]:o}),e},{}):D,...f,updateAssociationValues:m,triggerWorkflows:uz(A),beforeWorkflows:uL(A)}),p.data.loading=!1,null==l||null==(C=l.service)||null==(b=C.refresh)||b.call(C),null==r||r(!1),!(null==w?void 0:w.successMessage))return;(null==w?void 0:w.manualClose)?h.success({title:u(null==w?void 0:w.successMessage),onOk:async()=>{await e.reset(),(null==w?void 0:w.redirecting)&&(null==w?void 0:w.redirectTo)&&((0,eh.isURL)(w.redirectTo)?window.location.href=w.redirectTo:a(w.redirectTo))}}):(x.success(u(null==w?void 0:w.successMessage)),(null==w?void 0:w.redirecting)&&(null==w?void 0:w.redirectTo)&&((0,eh.isURL)(w.redirectTo)?window.location.href=w.redirectTo:a(w.redirectTo)))}catch(e){p.data.loading=!1}}}},uQ=()=>{let e=nM(),{resource:t,service:n,block:o,__parent:l}=nj(),{setVisible:r}=co(),i=nq(),a=(0,ec.useFieldSchema)();return{async onClick(){var s,c,d,u,p,m;let{triggerWorkflows:h}=null!=(c=null==a?void 0:a["x-action-settings"])?c:{};await t.destroy({filterByTk:e,triggerWorkflows:uz(h),beforeWorkflows:uL(h),...i});let{count:x=0,page:f=0,pageSize:v=0}=(null==n||null==(s=n.data)?void 0:s.meta)||{};x%v==1&&1!==f?n.run({...null==n||null==(d=n.params)?void 0:d[0],page:f-1}):null==n||null==(u=n.refresh)||u.call(n),o&&"TableField"!==o&&(null==l||null==(m=l.service)||null==(p=m.refresh)||p.call(m),null==r||r(!1))}}},uZ=e=>{let t=nM(),n=eC().resource(e,t);return{async onClick(e){await n.remove({values:[e.id]})}}},u0=()=>{let e=nM(),{resource:t,service:n,block:o,__parent:l}=nj(),{setVisible:r}=co();return{async onClick(){var i,a,s,c,d;await t.remove({values:[e]});let{count:u=0,page:p=0,pageSize:m=0}=(null==n||null==(i=n.data)?void 0:i.meta)||{};u%m==1&&1!==p?n.run({...null==n||null==(a=n.params)?void 0:a[0],page:p-1}):null==n||null==(s=n.refresh)||s.call(n),o&&"TableField"!==o&&(null==l||null==(d=l.service)||null==(c=d.refresh)||c.call(d),null==r||r(!1))}}},u1=()=>{let{formBlockRef:e}=Tp(),t=(0,ni.useReactToPrint)({content:()=>e.current,pageStyle:"@media print {\n * {\n margin: 0;\n }\n :not(.ant-formily-item-control-content-component) > div.ant-formily-layout>div:first-child {\n overflow: hidden; height: 0;\n }\n }"});return{async onClick(){t()}}},u2=()=>{let{field:e}=nj(),{resource:t,service:n}=nj();return{async onClick(){var o,l,r,i,a,s,c;if(!(null==e||null==(l=e.data)||null==(o=l.selectedRowKeys)?void 0:o.length))return;await t.destroy({filterByTk:null==(r=e.data)?void 0:r.selectedRowKeys}),e.data.selectedRowKeys=[];let d=null==(i=n.params[0])?void 0:i.page;d===(null==(s=n.data)||null==(a=s.meta)?void 0:a.totalPage)&&(n.params[0].page=d-1),null==n||null==(c=n.refresh)||c.call(n)}}},u6=()=>{let{service:e}=nj();return{async onClick(){var t;null==e||null==(t=e.refresh)||t.call(e)}}},u3=()=>{var e,t,n,o,l,r;let i=oF(),a=(null==(n=i.service)||null==(t=n.data)||null==(e=t.meta)?void 0:e.count)||0;return{simple:!0,hidden:a<=1,current:(null==(r=i.service)||null==(l=r.data)||null==(o=l.meta)?void 0:o.page)||1,total:a,pageSize:1,showSizeChanger:!1,async onChange(e){var t,n;let o=null==(n=i.service)||null==(t=n.params)?void 0:t[0];i.service.run({...o,page:e})},style:{marginTop:24,textAlign:"center"}}},u5=()=>{var e,t,n,o,l;let r=gX.useAssociationField(),{service:i,props:a}=nj(),s=(0,ec.useFieldSchema)(),c=sO(),d=(null==r?void 0:r.target)?null==(e=c.getCollection(r.target))?void 0:e.getPrimaryKey():"id",u=(null==(n=s["x-component-props"])||null==(t=n.fieldNames)?void 0:t.label)||d,p=(0,ec.useField)(),m=r.name,{data:h,params:x,run:f}=ek({headers:t$(null==a?void 0:a.dataSource),resource:r.target,action:"list",params:{fields:[u,d],pageSize:200,page:1,...null==(o=p.componentProps)?void 0:o.params}},{refreshDeps:[u,d,JSON.stringify((null==(l=p.componentProps)?void 0:l.params)||{})],debounceWait:300});return{list:(null==h?void 0:h.data)||[],onSelected:e=>{var t,n,o,l;let r=(null==(n=i.params)||null==(t=n[1])?void 0:t.filters)||{};e.length?r["af.".concat(m)]={["".concat(m,".").concat(d,".$in")]:e}:delete r["af.".concat(m)],i.run({...null==(o=i.params)?void 0:o[0],pageSize:200,page:1,filter:pA([...Object.values(r),null==a||null==(l=a.params)?void 0:l.filter])},{filters:r})},handleSearchInput:e=>{f({...null==x?void 0:x[0],filter:{["".concat(u,".$includes")]:e.target.value}})},params:x,run:f}},u4=()=>{let{currentFields:e=[]}=tJ();return e.filter(e=>u8(e)&&e.uiSchema.enum)},u8=e=>["select","multipleSelect","checkbox","checkboxGroup","chinaRegion"].includes(e.interface),u7=()=>{var e,t,n,o,l,r;let i,a,s,c,d,u,p,m,h=gX.useAssociationField(),x=(0,ec.useFieldSchema)(),f=u4(),{getDataBlocks:v}=nV(),g=null==h?void 0:h.name,y=(0,ec.useField)(),{props:b}=nj(),C=t$(null==b?void 0:b.dataSource),S=sO();if(u=(null==h?void 0:h.target)?null==(e=S.getCollection(h.target))?void 0:e.getPrimaryKey():"id",p=(null==(n=x["x-component-props"])||null==(t=n.fieldNames)?void 0:t.label)||u,{data:d,params:s,run:c}=ek({headers:C,resource:null==h?void 0:h.target,action:"list",params:{fields:[p,u],pageSize:200,page:1,...null==(o=y.componentProps)?void 0:o.params}},{manual:!0,debounceWait:300}),(0,es.useEffect)(()=>{u8(x)||c()},[p,u,JSON.stringify((null==(l=y.componentProps)?void 0:l.params)||{}),u8(x)]),!h)return{};if(u8(x)){let e=f.find(e=>e.name===x.name),t=(null==e||null==(r=e.uiSchema)?void 0:r.enum)||[];u="value",p="label",i=t,s={},c=()=>{},m="".concat(e.name,".").concat({select:"$in",multipleSelect:"$anyOf",checkbox:"$in",checkboxGroup:"$anyOf"}[e.interface]),a=e=>{let n=e.target.value;if(!n){i=t;return}i=t.filter(e=>e.label.includes(n))}}else m="".concat(g,".").concat(u,".$in"),i=(null==d?void 0:d.data)||[],a=e=>{c({...null==s?void 0:s[0],filter:{["".concat(p,".$includes")]:e.target.value}})};return{list:i,onSelected:e=>{let{targets:t,uid:n}=u$(x);v().forEach(o=>{var l,r,i;if(!t.find(e=>e.uid===o.uid))return;let a="".concat(n).concat(x.name),s=(null==(l=o.service.params)?void 0:l[0])||{},c=(null==(i=o.service.params)||null==(r=i[1])?void 0:r.filters)||{};if(e.length)c[a]={[m]:e};else{if("manual"===o.dataLoadingMode)return o.clearData();delete c[a]}let d=pA([...Object.values(c),o.defaultFilter]);return o.doFilter({...s,page:1,filter:d},{filters:c})})},handleSearchInput:a,params:s,run:c,valueKey:u,labelKey:p}};function u9(e){let t=e.lastIndexOf(".");return -1!==t?e.substring(0,t):e}let pe=e=>{let t=new Set([]),n=new Set([]),{getCollectionJoinField:o,getCollection:l}=sO(e),r=(0,ec.useFieldSchema)(),i=(r,a)=>{r.reduceProperties((r,s)=>{var c,d,u,p,m,h,x,f,v;let g=r||a,y=s["x-collection-field"]&&o(s["x-collection-field"],e),b=s.name.includes("."),C=y&&["hasOne","hasMany","belongsTo","belongsToMany"].includes(y.type);if((null==(c=s["x-component-props"])?void 0:c.appends)&&eu().forEach(null==(h=s["x-component-props"])?void 0:h.appends,e=>{n.add(e)}),(null==(u=s["x-component-props"])||null==(d=u.fieldNames)?void 0:d.formula)&&C){let e;n.add(s.name);let t=/{{(.*?)}}/g,o=null==(f=s["x-component-props"])||null==(x=f.fieldNames)?void 0:x.formula;for(;e=t.exec(o);)if(e[1].includes(".")){let t=e[1].split("."),o=s.name;t.forEach((e,l)=>{l!==t.length-1&&(o+="."+e,n.add(o))})}}if(s["x-linkage-rules"]){let e=t=>{let o=Object.keys(t)[0]||"$and";t[o].forEach(t=>{let o,l,r;if("$and"in t||"$or"in t)return e(t);let i=(l=(o=[],!function e(t){Object.keys(t).sort().forEach(function(n){o.push(n),t[n]&&"object"==typeof t[n]&&e(t[n])})}(t),o),r=eu().findIndex(l,(e,t)=>{if(e.includes("$")&&t>0)return!0}),l.slice(0,r));i.length>1&&n.add(i.join("."))})};s["x-linkage-rules"].forEach(t=>{let{condition:n}=t;e(n)})}if(null==(p=s["x-component-props"])?void 0:p["x-next-title"]){let e=(g&&""!==g?g+"."+s.name:s.name)+"."+s["x-component-props"]["x-next-title"].label;n.add(e)}let S=C&&(null==(m=l(y.target,e))?void 0:m.template)==="tree";if(y&&(C||b)&&"TableField"!==s["x-component"]){let e=!C&&b?u9(s.name):s.name,o=""!==g&&g?g+"."+e:e;if(S?(n.add(o),n.add("".concat(o,".parent")+"(recursively=true)")):n.add(o),["Nester","SubTable","PopoverNester"].includes(null==(v=s["x-component-props"])?void 0:v.mode)){t.add(o);let e=g&&""!==g?g+"."+s.name:s.name;i(s,e)}}else["ActionBar","Action","Action.Link","Action.Modal","Selector","Viewer","AddNewer","AssociationField.Selector","AssociationField.AddNewer","TableField"].includes(s["x-component"])||i(s,a)},a)};return{getAssociationAppends:()=>(t=new Set([]),n=new Set([]),i(r,""),{appends:[...n],updateAssociationValues:[...t]})}};async function pt(e){(0,ec.untracked)(()=>{Object.keys(e.fields).forEach(t=>{nW(e.fields[t])&&(e.fields[t].initialValue=null)})}),await e.reset()}let pn=()=>{let e=(0,ec.useFieldSchema)(),{name:t}=tJ(),{getCollectionFields:n,getInterface:o}=sO();return(0,es.useMemo)(()=>{var l,r,i,a,s;let c=null==(l=e["x-designer-props"])?void 0:l.interface,d=n(t);if(c)return(null==(s=o(c))||null==(a=s.filterable)?void 0:a.operators)||[];let u=d.find(t=>t.name===e.name);return(null==(i=o(null==u?void 0:u.interface))||null==(r=i.filterable)?void 0:r.operators)||[]},[e.name])};function po(){let e=(0,ns._)(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.tb-form-item:hover {\n > .general-schema-designer {\n background: var(--colorBgSettingsHover) !important;\n border: 0 !important;\n top: -5px !important;\n bottom: -5px !important;\n left: -5px !important;\n right: -5px !important;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n border: 2px solid var(--colorBorderSettingsHover);\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return po=function(){return e},e}let pl=(0,nu.rU)(e=>{let{css:t}=e;return t(po())}),pr=Tr(e=>{let{className:t,children:n}=iq(e),{styles:o}=pl(),l=SF(),r=(0,ec.useFieldSchema)(),{getAriaLabel:i}=(e=>{var t,n,o;let l=(0,ec.useFieldSchema)(),r=eB(),i=eu().isString(l["x-component"])?l["x-component"]:null==(t=l["x-component"])?void 0:t.displayName,a=r(l["x-collection-field"]),{name:s}=nP()||{},c=tS(),d=e||s,u=r(l.title)||r(null==c||null==(o=c.getField(l.name))||null==(n=o.uiSchema)?void 0:n.title);return{getAriaLabel:(0,es.useCallback)(e=>(e=e?"-".concat(e):"",["block-item",i,null==c?void 0:c.name,d,a,u,e].filter(Boolean).join("-")),[i,null==c?void 0:c.name,d,a,u])}})(e.name);return(0,A.jsxs)(SE,{role:"button","aria-label":i(),className:r6()("tb-block-item",t,o),children:[(0,A.jsx)(l,{...r["x-toolbar-props"]}),n]})});function pi(e){let t=document.createElement("div");null!=t.textContent?t.textContent=e:t.innerText=e;let n=t.innerHTML;return t=null,n}function pa(){let e=(0,ns._)(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]);return pa=function(){return e},e}function ps(){let e=(0,ns._)(["\n > .ant-formily-item-label {\n display: none;\n }\n "]);return ps=function(){return e},e}function pc(){let e=(0,ns._)(["\n display: flex;\n flex-direction: row;\n align-items: baseline;\n "]);return pc=function(){return e},e}let pd=(0,nu.rU)(e=>{let{css:t}=e;return{space:t(pa()),hide:t(ps()),row:t(pc())}}),pu=e=>{var t,n;let{styles:o}=pd(),{layoutDirection:l}=e,r=(0,ec.useField)(),i=(0,ec.useFieldSchema)(),a=o9(),s=lN(),{addActiveFieldName:c}=uM()||{},{layoutDirection:d}=tY(),u=null!=l?l:d;pS(),(0,es.useEffect)(()=>{null==s||s.registerVariable(a)},[a]),(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),n=lN(),o=lT(),l=tV(),{isInAssignFieldValues:r,isInSetDefaultValueDialog:i,isInFormDataTemplate:a,isInSubTable:s,isInSubForm:c}=lu()||{},{getField:d}=tJ(),{isSpecialCase:u,setDefaultValue:p}=(()=>{let e=(0,ec.useForm)(),t=(0,ec.useFieldSchema)(),{getField:n}=tJ(),{getCollectionField:o}=sO(),l=(0,es.useMemo)(()=>n(t.name),[t.name,n]);return{isSpecialCase:(0,es.useCallback)(()=>oE({collectionField:l,fieldSchema:t,getCollectionField:o}),[l,t,o]),setDefaultValue:(0,es.useCallback)(n=>{let o=oB(t);if(o){let l=e.query(o.name).take();l&&l.setInitialValue(function(e,t){let{field:n,subFieldSchema:o}=t,l=n.value,r=null;return r=Array.isArray(e)?e.map(e=>({[o.name]:e})):[{[o.name]:e}],eu().assignWith([...l],r,(e,t)=>(!e&&t&&(t.__notFromDatabase=!0),eu().assign({...l[0]},t)))}(n,{field:l,subFieldSchema:t}))}},[t,e])}})(),m=m5(),h=(0,es.useCallback)(e=>{let t=null==n?void 0:n.getVariable(e);return t||(t=o.find(t=>t.name===e)),t},[o,n]);(0,es.useEffect)(()=>{if(null==t.default||i||a||nW(t)||!(null==l?void 0:l.isNew)&&!r)return;let x=async function(){let{forceUpdate:l=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n&&e&&(oY(t.default)&&null==e.value||e.value===t.default||l)){oY(e.value)&&await e.reset({forceClear:!0}),e.loading=!0;let l=!t.name.toString().includes(".")&&d(t.name),r=lM(await n.parseVariable(t.default,o),{targetCollectionField:l});null==r||""===r?(e.setInitialValue(null),await e.reset({forceClear:!0})):u()?0===m&&p(r):e.setInitialValue(r),e.loading=!1}else!/\{\{.+\}\}/g.test(t.default)&&e.setInitialValue&&e.setInitialValue(t.default)},f=eu().debounce(x,300);if(oY(t.default)){let e=lp(t.default),n=h(e);return n?(x(),(0,ec.reaction)(()=>{let o={[e]:(null==n?void 0:n.ctx)||{}},l=oX(t.default),r=(0,eh.getValuesByPath)(o,l);return void 0===r?Math.random():r},()=>f({forceUpdate:!0}))):console.error("useParseDefaultValue: can not find variable ".concat(e))}null==e.value&&(s||c)&&e.setValue(t.default)},[t.default,o])})(),(()=>{var e;let{name:t}=tJ(),{getCollectionJoinField:n}=sO(),o=(0,ec.useForm)(),l=tz(),r=(0,ec.useFieldSchema)(),i=lN(),a=(0,ec.useField)(),{formValue:s}=lb(),{isInSubForm:c,isInSubTable:d}=lu()||{},{getAssociationAppends:u}=pe(),p=r.name.toString(),m=eu().cloneDeep(c||d?s:o.values),h=(0,es.useRef)(null),x=(0,es.useRef)(null),f=(0,es.useMemo)(()=>{var e,t;let n;return e=l,t=p,null!=(n=eu().get(e,t))&&"[{}]"!==JSON.stringify(n)&&"{}"!==JSON.stringify(n)},[l,p]);null==h.current&&p.includes(".")&&(h.current=n("".concat(t,".").concat(p))),null==x.current&&p.includes(".")&&(x.current=n("".concat(t,".").concat(p.split(".")[0])));let v=p.includes(".")&&x.current?eu().get(m,"".concat(p.split(".")[0],".").concat((null==(e=x.current)?void 0:e.targetKey)||"id")):void 0;(0,es.useEffect)(()=>{if(!p.includes(".")||!i||"fields"===t||!h.current||f||eu().isEmpty(m))return;let e="{{ $nForm.".concat(p," }}");if(null==v)return;let{appends:n}=u();i.parseVariable(e,{name:"$nForm",ctx:m,collectionName:t},{appends:n}).then(e=>{(0,eh.nextTick)(()=>{let t=lM(e,{targetCollectionField:h.current});eu().isEmpty(t)&&!eu().isNumber(t)?a.value=null:a.value=t})}).catch(e=>{console.error(e)})},[v])})(),(0,es.useEffect)(()=>{null==c||c(i.name)},[c,i.name]);let p=null==(n=null==(t=i["x-decorator-props"])?void 0:t.showTitle)||n,m=(0,es.useMemo)(()=>{var e;if("string"==typeof r.description){let e=r.description.trim();if(!e)return;return(0,A.jsx)("div",{dangerouslySetInnerHTML:{__html:pi(e).split("\n").join("<br/>")}})}return null!=(e=r.description)?e:void 0},[r.description]),h=(0,es.useMemo)(()=>r6()(o.space,{[o.hide]:!1===p},{[o.row]:"row"===u}),[p]);return(0,A.jsx)(tj,{allowNull:!0,children:(0,A.jsx)(pr,{className:"tb-form-item",children:(0,A.jsx)(NM,{children:(0,A.jsx)(eh.FormItem,{className:h,...e,extra:m})})})})};function pp(e){return(null==e?void 0:e.template)==="file"}pu.displayName="FormItem",pu.Designer=function(){let e=os(),t=(0,ec.useFieldSchema)(),n="FormItemSettings:".concat(t["x-interface"]),o=e.schemaSettingsManager.has(n);return(0,A.jsx)(sP,{schemaSettings:o?n:"FormItemSettings"})},pu.FilterFormDesigner=()=>(0,A.jsx)(sP,{schemaSettings:"FilterFormItemSettings"});let pm=e=>{for(;e;){if(e["x-filter-operators"])return{operators:e["x-filter-operators"],uid:e["x-uid"]};e=e.parent}return{}},ph=()=>{var e;let{getCollectionJoinField:t}=sO(),{getField:n}=tJ(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{t:r}=(0,eT.useTranslation)(),{dn:i}=eY(),a=n(l.name)||t(l["x-collection-field"]);return a?(0,A.jsx)(aQ,{title:r("Edit field title"),schema:{type:"object",title:r("Edit field title"),properties:{title:{title:r("Field title"),default:null==o?void 0:o.title,description:"".concat(r("Original field title: ")).concat(null==a||null==(e=a.uiSchema)?void 0:e.title),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:e=>{let{title:t}=e;t&&(o.title=t,l.title=t,i.emit("patch",{schema:{"x-uid":l["x-uid"],title:l.title}})),i.refresh()}},"edit-field-title"):null},px=()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{t:n}=(0,eT.useTranslation)(),{dn:o}=eY();return e.readPretty?null:(0,A.jsx)(aQ,{title:n("Edit description"),schema:{type:"object",title:n("Edit description"),properties:{description:{default:null==e?void 0:e.description,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit:n=>{let{description:l}=n;e.description=l,t.description=l,o.emit("patch",{schema:{"x-uid":t["x-uid"],description:t.description}}),o.refresh()}},"edit-description")},pf=()=>{var e;let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{t:o}=(0,eT.useTranslation)(),{dn:l}=eY();return t.readPretty?(0,A.jsx)(aQ,{title:o("Edit tooltip"),schema:{type:"object",title:o("Edit description"),properties:{tooltip:{default:null==n||null==(e=n["x-decorator-props"])?void 0:e.tooltip,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit:e=>{let{tooltip:o}=e;t.decoratorProps.tooltip=o,n["x-decorator-props"]=n["x-decorator-props"]||{},n["x-decorator-props"].tooltip=o,l.emit("patch",{schema:{"x-uid":n["x-uid"],"x-decorator-props":n["x-decorator-props"]}}),l.refresh()}},"edit-tooltip"):null},pv=()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{t:n}=(0,eT.useTranslation)(),{dn:o,refresh:l}=eY();return e.readPretty||"FormField"===t["x-component"]?null:(0,A.jsx)(aY,{title:n("Required"),checked:t.required,onChange:n=>{let r={"x-uid":t["x-uid"]};e.required=n,t.required=n,r.required=n,o.emit("patch",{schema:r}),l()}},"required")},pg=()=>{var e;let{getInterface:t,getCollectionJoinField:n}=sO(),{getField:o}=tJ(),{form:l}=Tp(),r=(0,ec.useField)(),i=(0,ec.useFieldSchema)(),{t:a}=(0,eT.useTranslation)(),{dn:s,refresh:c}=eY(),d=o(i.name)||n(i["x-collection-field"]),u=t(null==d?void 0:d.interface),p=null==u||null==(e=u.validateSchema)?void 0:e.call(u,i);return l&&!(null==l?void 0:l.readPretty)&&p?(0,A.jsx)(aQ,{title:a("Set validation rules"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:a("Set validation rules"),properties:{rules:{type:"array",default:null==i?void 0:i["x-validator"],"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},maxItems:3,items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{header:'{{ t("Validation rule") }}'},properties:{index:{type:"void","x-component":"ArrayCollapse.Index"},layout:{type:"void","x-component":"FormLayout","x-component-props":{labelStyle:{marginTop:"6px"},labelCol:8,wrapperCol:16},properties:{...p,message:{type:"string",title:'{{ t("Error message") }}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:2,maxRows:2}}}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"}}},properties:{add:{type:"void",title:'{{ t("Add validation rule") }}',"x-component":"ArrayCollapse.Addition","x-reactions":{dependencies:["rules"],fulfill:{state:{disabled:"{{$deps[0].length >= 3}}"}}}}}}}},onSubmit:e=>{var t;let n=[];for(let t of e.rules)n.push(eu().pickBy(t,eu().identity));let o={"x-uid":i["x-uid"]};if(["percent"].includes(null==d?void 0:d.interface))for(let e of n)(e.maxValue||e.minValue)&&(e.percentMode=!0),e.percentFormat&&(e.percentFormats=!0);r.validator=eu().concat([],(null==d||null==(t=d.uiSchema)?void 0:t["x-validator"])||[],n),i["x-validator"]=n,o["x-validator"]=n,s.emit("patch",{schema:o}),c()}}):null},py=()=>{var e;let{getCollectionJoinField:t}=sO(),{getField:n}=tJ(),{form:o}=Tp(),l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),{t:i}=(0,eT.useTranslation)(),{dn:a,refresh:s}=eY(),c=n(r.name)||t(r["x-collection-field"]);return o&&!(null==o?void 0:o.readPretty)&&(null==c||null==(e=c.uiSchema)?void 0:e.type)?(0,A.jsx)(aQ,{title:i("Set default value"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:i("Set default value"),properties:{default:{...null==c?void 0:c.uiSchema,name:"default",title:i("Default value"),"x-decorator":"FormItem",default:r.default||(null==c?void 0:c.defaultValue)}}},onSubmit:e=>{let t={"x-uid":r["x-uid"]};l.value!==e.default&&(l.value=e.default),r.default=e.default,t.default=e.default,a.emit("patch",{schema:t}),s()}}):null},pb=()=>{var e;let{getCollectionJoinField:t,getCollection:n}=sO(),{getField:o}=tJ(),l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),{t:i}=(0,eT.useTranslation)(),{dn:a}=eY(),s=o(r.name)||t(r["x-collection-field"]),c=SN(),d=["belongsTo","hasOne","hasMany","belongsToMany"].includes(null==s?void 0:s.type),u=pp(n(null==s?void 0:s.target));return d&&c?(0,A.jsx)(aW,{title:i("Field component"),options:c,value:(null==l||null==(e=l.componentProps)?void 0:e.mode)||(u?"FileManager":"Select"),onChange:e=>{let t={"x-uid":r["x-uid"]};r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].mode=e,t["x-component-props"]=r["x-component-props"],l.componentProps=l.componentProps||{},l.componentProps.mode=e,a.emit("patch",{schema:t}),a.refresh()}},"field-mode"):null},pC=()=>{let{getCollectionJoinField:e}=sO(),{getField:t}=tJ(),{form:n}=Tp(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{t:r}=(0,eT.useTranslation)(),{dn:i}=eY(),a=t(l.name)||e(l["x-collection-field"]),s="editable";return!0===l["x-disabled"]&&(s="readonly"),!0===l["x-read-pretty"]&&(s="read-pretty"),!n||(null==n?void 0:n.readPretty)||(null==a?void 0:a.interface)==="o2m"||sB(l)?null:(0,A.jsx)(aW,{title:r("Pattern"),options:[{label:r("Editable"),value:"editable"},{label:r("Readonly"),value:"readonly"},{label:r("Easy-reading"),value:"read-pretty"}],value:s,onChange:e=>{let t={"x-uid":l["x-uid"]};switch(e){case"readonly":l["x-read-pretty"]=!1,l["x-disabled"]=!0,t["x-read-pretty"]=!1,t["x-disabled"]=!0,o.readPretty=!1,o.disabled=!0;break;case"read-pretty":l["x-read-pretty"]=!0,l["x-disabled"]=!1,t["x-read-pretty"]=!0,t["x-disabled"]=!1,o.readPretty=!0;break;default:l["x-read-pretty"]=!1,l["x-disabled"]=!1,t["x-read-pretty"]=!1,t["x-disabled"]=!1,o.readPretty=!1,o.disabled=!1}i.emit("patch",{schema:t}),i.refresh()}},"pattern")},pS=()=>{let e=(0,ec.useFieldSchema)(),t=pn(),{operators:n}=pm(e);n&&t.length&&!n[e.name]&&(n[e.name]=t[0].value)},pw=()=>{let e=eB(),t=(0,ec.useFieldSchema)(),n=(0,ec.useField)(),{t:o}=(0,eT.useTranslation)(),{dn:l}=eY(),r=pn(),{operators:i={},uid:a}=pm(t);return r.length&&!i[t.name]&&(i[t.name]=r[0].value),r.length?(0,A.jsx)(aW,{title:o("Operator"),value:i[t.name],options:e(r),onChange:e=>{var o,s,c,d,u,p,m,h,x;i[t.name]=e;let f=r.find(t=>t.value===e),v={...t["x-component-props"]},g=t.name.includes("__custom");if(null==f||null==(o=f.schema)?void 0:o["x-component"]){eu().set(t,g?"x-component":"x-component-props.component",f.schema["x-component"]),eu().set(n,g?"component":"componentProps.component",f.schema["x-component"]),n.reset(),v={component:f.schema["x-component"],...t["x-component-props"],...null==(c=f.schema)?void 0:c["x-component-props"]};let e={schema:{"x-uid":t["x-uid"],"x-component-props":v}};g&&(e.schema["x-component"]=null==(d=f.schema)?void 0:d["x-component"],e.schema["x-component-props"].component=t["x-component-props"].component),l.emit("patch",e)}else if(null==(s=t["x-component-props"])?void 0:s.component){eu().set(t,g?"x-component":"x-component-props.component",g?null==(u=t["x-component-props"])?void 0:u.component:null),eu().set(n,g?"component":"componentProps.component",g?null==(p=t["x-component-props"])?void 0:p.component:null),n.reset(),v={component:g?null==(m=t["x-component-props"])?void 0:m.component:null,...t["x-component-props"],...null==(h=f.schema)?void 0:h["x-component-props"]};let e={schema:{"x-uid":t["x-uid"],"x-component-props":v}};g&&(e.schema["x-component"]=null==(x=t["x-component-props"])?void 0:x.component),l.emit("patch",e)}n.componentProps=v,l.emit("patch",{schema:{"x-uid":a,"x-filter-operators":i}}),l.refresh()}},"operator"):null},pF=()=>{var e,t,n,o;let{getCollectionFields:l,getCollectionJoinField:r}=sO(),{getField:i}=tJ(),a=(0,ec.useField)(),s=(0,ec.useFieldSchema)(),{t:c}=(0,eT.useTranslation)(),{dn:d}=eY(),u=eB(),p=sO(),m=(null!=(n=null==s?void 0:s.name)?n:"").startsWith("__custom."),h=m?p.collections.filter(e=>e.name===s["x-decorator-props"])[0]:{},x=i(s.name)||r(s["x-collection-field"]),f=[];x?f=(null==x?void 0:x.target)?l(null==x?void 0:x.target):null!=(o=l(null==x?void 0:x.targetCollection))?o:[]:h&&(f=h.fields);let v=f.filter(e=>!(null==e?void 0:e.target)&&"boolean"!==e.type).map(e=>{var t;return{value:null==e?void 0:e.name,label:u(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return v.length>0&&("CollectionField"===s["x-component"]||m)?(0,A.jsx)(aW,{title:c("Title field"),options:v,value:(null==(t=s["x-component-props"])||null==(e=t.fieldNames)?void 0:e.label)||"id",onChange:e=>{var t,n;let o={"x-uid":s["x-uid"]},l={...null==x||null==(n=x.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...a.componentProps.fieldNames,label:e};m&&(l.value=e),s["x-component-props"]=s["x-component-props"]||{},s["x-component-props"].fieldNames=l,o["x-component-props"]=s["x-component-props"],a.componentProps=s["x-component-props"],d.emit("patch",{schema:o}),d.refresh()}},"title-field"):null};var pj=((s={})[s.FORM=0]="FORM",s[s.TABLE=1]="TABLE",s[s.TREE=2]="TREE",s[s.COLLAPSE=3]="COLLAPSE",s);let pA=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$and",n=e.filter(e=>{if(e&&"object"==typeof e&&!Array.isArray(e))return Object.values(e).filter(e=>void 0!==e).length});return 0===n.length?{}:1===n.length?n[0]:{[t]:n}},pk=(e,t)=>{var n;return null==(n=t.associatedFields)?void 0:n.filter(t=>null==e?void 0:e.some(e=>e===t.target))},pI=(e,t)=>{var n;return null==(n=t.foreignKeyFields)?void 0:n.filter(t=>e.fields.some(e=>"belongsTo"!==e.type&&e.foreignKey===t.name))},pP=e=>{let{getDataBlocks:t}=nV(),n=(0,ec.useFieldSchema)(),o=tJ(),{getAllCollectionsInheritChain:l}=sO();return 0===e||3===e?t().filter(e=>pD(e.collection,o)):1===e||2===e?t().filter(e=>{var t,r;return n["x-uid"]!==e.uid&&(pD(e.collection,o)||(null==(t=pk(l(o.name,o.dataSource),e))?void 0:t.length)||(null==(r=pI(o,e))?void 0:r.length))}):void 0},pT=(e,t,n,o)=>{let{operators:l}=pm(t);return{$and:Object.keys(e=(0,eh.flatten)(e,{breakOn(e){let{value:t,path:r}=e;if(["$match","$notMatch","$anyOf","$noneOf","$childIn","$childNotIn","$dateBetween","$in","$notIn"].includes(l[r]))return!0;let i=n("".concat(o,".").concat(r));if(null==i?void 0:i.target){if(Array.isArray(t))return!0;let e=i.targetKey||"id";if(t&&null!=t[e])return!0}return!1}})).map(t=>{let r=t,i=eu().get(e,t),a=n("".concat(o,".").concat(t));if((null==a?void 0:a.target)&&(i=(0,eh.getValuesByPath)(i,a.targetKey||"id"),t="".concat(t,".").concat(a.targetKey||"id")),!i)return null;if("$isTruly"===l[t]||"$isFalsy"===l[t]){if("true"===i)return{[t]:{$isTruly:!0}};else if("false"===i)return{[t]:{$isFalsy:!0}}}else if("$dateBetween"===l[t]&&Array.isArray(i))for(let e in i)i[e]&&("string"==typeof i[e]||i[e]instanceof Date||(i[e]=P()(i[e]).toISOString()));return{[t]:{[l[t]||l[r]||"$eq"]:i}}}).filter(Boolean)}},pN=()=>{let{fields:e}=tJ();return e.filter(e=>pM(e))||[]},pM=e=>["o2o","oho","obo","m2o","createdBy","updatedBy","o2m","m2m","linkTo","chinaRegion"].includes(null==e?void 0:e.interface),pD=(e,t)=>e.name===t.name&&e.dataSource===t.dataSource,pR=()=>{let e=(0,ec.useFieldSchema)(),{getDataBlocks:t}=nV(),{targets:n,uid:o}=u$(e),l=t(),[r,i]=(0,es.useState)(()=>n&&n.some(e=>l.some(t=>t.uid===e.uid))),a=Object.keys(n||{});return(0,es.useEffect)(()=>{i(n&&n.some(e=>l.some(t=>t.uid===e.uid)))},[a.length,l]),{isConnected:r,doFilter:(0,es.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"$eq";l.forEach(l=>{var i,a,s;let c=n.find(e=>e.uid===l.uid);if(!c)return;eu().isFunction(t)&&(t=t(c)),eu().isFunction(r)&&(r=r(c));let d=(null==(i=l.service.params)?void 0:i[0])||{},u=(null==(s=l.service.params)||null==(a=s[1])?void 0:a.filters)||{};void 0!==e?u[o]={$and:[{[t]:{[r]:e}}]}:delete u[o];let p=pA([...Object.values(u).map(e=>d5(e)),l.defaultFilter]);l.doFilter({...d,page:1,filter:p},{filters:u})})},[l])}},pq=e=>{for(;e;){if(e["x-filter-targets"])return"FilterFormBlockProvider"===e["x-decorator"];e=e.parent}return!1},p_=e=>e,pO=e=>({type:"void","x-component":"Grid.Row",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Grid.Col",properties:{[e.name||(0,ec.uid)()]:e}}}}),pB=(e,t)=>{t(e.parent)},pE=(e,t)=>{t(e,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})},pV=()=>{let e=(0,ec.useForm)();return(t,n)=>{var o;n(t,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}),null==(o=e.values)||delete o[t.name]}},pz=function(e,t,n){return arguments.length>3&&void 0!==arguments[3]&&arguments[3],e.reduceProperties((e,o)=>{if(o[t]===n)return o;let l=o.reduceProperties((e,o)=>o[t]===n?o:e);return l||e})},pL=["attachment","textarea","markdown","json","richText","polygon","circle","point","lineString"],pG=()=>{let{name:e,currentFields:t=[]}=tJ(),{getInterface:n,getCollection:o}=sO(),l="AssociationField.SubTable"===(0,ec.useFieldSchema)()["x-component"],r=(0,ec.useForm)(),i=!l||r.readPretty;return t.filter(e=>(null==e?void 0:e.interface)&&(null==e?void 0:e.interface)!=="subTable"&&!(null==e?void 0:e.isForeignKey)&&!(null==e?void 0:e.treeChildren)).map(t=>{var r,a,s;let c=n(t.interface),d=(null==t?void 0:t.target)&&(null==(r=o(null==t?void 0:t.target))?void 0:r.template)==="file",u={name:t.name,"x-collection-field":"".concat(e,".").concat(t.name),"x-component":"CollectionField","x-component-props":d?{fieldNames:{label:"preview",value:"id"}}:{},"x-read-pretty":i||(null==(a=t.uiSchema)?void 0:a["x-read-pretty"]),"x-decorator":l?pL.includes(t.interface)||d?"QuickEdit":"FormItem":null,"x-decorator-props":{labelStyle:{display:"none"}}};return{type:"item",name:t.name,title:(null==t||null==(s=t.uiSchema)?void 0:s.title)||t.name,Component:"TableCollectionFieldInitializer",find:pz,remove:pB,schemaInitialize:e=>{var n;null==c||null==(n=c.schemaInitialize)||n.call(c,e,{field:t,readPretty:i,block:"Table",targetCollection:o(t.target)})},field:t,schema:u}})},pK=()=>{var e;let{name:t,fields:n}=tJ(),{getInterface:o,getCollectionFields:l,getCollection:r}=sO();return null==n||null==(e=n.filter(e=>["o2o","oho","obo","m2o"].includes(e.interface)))?void 0:e.map(e=>{var n,i,a;let s=l(e.target),c=null==s||null==(n=s.filter(e=>(null==e?void 0:e.interface)&&!["subTable"].includes(null==e?void 0:e.interface)&&!(null==e?void 0:e.treeChildren)))?void 0:n.map(n=>{var l;let i=o(n.interface),a={name:"".concat(e.name,".").concat(n.name),"x-component":"CollectionField","x-read-pretty":!0,"x-collection-field":"".concat(t,".").concat(e.name,".").concat(n.name),"x-component-props":{}};return{type:"item",name:n.name,title:(null==n||null==(l=n.uiSchema)?void 0:l.title)||n.name,Component:"TableCollectionFieldInitializer",find:pz,remove:pB,schemaInitialize:t=>{var o;null==i||null==(o=i.schemaInitialize)||o.call(i,t,{field:n,readPretty:!0,block:"Table",targetCollection:r(e.target)})},field:n,schema:a}});return{type:"subMenu",name:null==(i=e.uiSchema)?void 0:i.title,title:null==(a=e.uiSchema)?void 0:a.title,children:c}})},p$=()=>{let{name:e}=tJ(),{getInterface:t,getInheritCollections:n,getCollection:o,getParentCollectionFields:l}=sO(),r="AssociationField.SubTable"===(0,ec.useFieldSchema)()["x-component"],i=(0,ec.useForm)(),a=!r||i.readPretty,s=n(e);return null==s?void 0:s.map(n=>{let i=l(n,e),s=o(n);return{[null==s?void 0:s.title]:null==i?void 0:i.filter(e=>null==e?void 0:e.interface).map(n=>{var l,i,s,c;let d=t(n.interface),u=(null==n?void 0:n.target)&&(null==(l=o(null==n?void 0:n.target))?void 0:l.template)==="file",p={name:"".concat(n.name),"x-component":"CollectionField","x-read-pretty":a||(null==(i=n.uiSchema)?void 0:i["x-read-pretty"]),"x-collection-field":"".concat(e,".").concat(n.name),"x-component-props":u?{fieldNames:{label:"preview",value:"id"}}:{},"x-decorator":r?pL.includes(n.interface)||u?"QuickEdit":"FormItem":null,"x-decorator-props":{labelStyle:{display:"none"}}};return{name:(null==n||null==(s=n.uiSchema)?void 0:s.title)||n.name,type:"item",title:(null==n||null==(c=n.uiSchema)?void 0:c.title)||n.name,Component:"TableCollectionFieldInitializer",find:pz,remove:pB,schemaInitialize:e=>{var t;null==d||null==(t=d.schemaInitialize)||t.call(d,e,{field:n,readPretty:!0,block:"Table",targetCollection:o(null==n?void 0:n.target)})},field:n,schema:p}})}})},pU=e=>{var t;let{name:n,currentFields:o}=tJ(),{getInterface:l,getCollection:r}=sO(),i=(0,ec.useForm)(),{readPretty:a=i.readPretty,block:s="Form"}=e||{},{fieldSchema:c}=co(),d=null==c?void 0:c["x-action"];return null==o||null==(t=o.filter(e=>(null==e?void 0:e.interface)&&!(null==e?void 0:e.isForeignKey)&&!(null==e?void 0:e.treeChildren)))?void 0:t.map(e=>{var t,o,i,c;let u=l(e.interface),p=r(e.target),m=(null==e?void 0:e.target)&&(null==(t=r(null==e?void 0:e.target))?void 0:t.template)==="file",h=null==e||null==(o=e.uiSchema["x-component-props"])?void 0:o.fieldNames,x={type:"string",name:e.name,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"".concat(n,".").concat(e.name),"x-component-props":m?{fieldNames:{label:"preview",value:"id"}}:p&&h?{fieldNames:{...h,label:(null==p?void 0:p.titleField)||h.label}}:{},"x-read-pretty":null==e||null==(i=e.uiSchema)?void 0:i["x-read-pretty"]},f={type:"item",name:e.name,title:(null==e||null==(c=e.uiSchema)?void 0:c.title)||e.name,Component:"CollectionFieldInitializer",remove:pE,schemaInitialize:t=>{var n;null==u||null==(n=u.schemaInitialize)||n.call(u,t,{field:e,block:s,readPretty:a,action:d,targetCollection:p})},schema:x};return"Kanban"===s&&(f.find=(e,t,n)=>{let o=pJ(e,"x-component",s);return pJ(o,t,n)}),f})},pW=e=>{var t;let{name:n,fields:o}=tJ(),{getInterface:l,getCollectionFields:r,getCollection:i}=sO(),a=(0,ec.useForm)(),{readPretty:s=a.readPretty,block:c="Form"}=e||{},d="Form"===c?["m2o"]:["o2o","oho","obo","m2o"];return null==o||null==(t=o.filter(e=>d.includes(e.interface)))?void 0:t.map(e=>{var t,o,a;let d=r(e.target),u=null==d||null==(t=d.filter(e=>(null==e?void 0:e.interface)&&!["subTable"].includes(null==e?void 0:e.interface)&&!e.treeChildren))?void 0:t.map(t=>{var o,r,a;let d=l(t.interface),u=(null==e?void 0:e.target)&&(null==(o=i(null==e?void 0:e.target))?void 0:o.template)==="file",p={type:"string",name:"".concat(e.name,".").concat(t.name),"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem","x-component":"CollectionField","x-read-pretty":s,"x-component-props":{"pattern-disable":"Form"===c&&s,fieldNames:u?{label:"preview",value:"id"}:void 0},"x-decorator":"FormItem","x-collection-field":"".concat(n,".").concat(e.name,".").concat(t.name)};return{name:(null==t||null==(r=t.uiSchema)?void 0:r.title)||t.name,type:"item",title:(null==t||null==(a=t.uiSchema)?void 0:a.title)||t.name,Component:"CollectionFieldInitializer",remove:pE,schemaInitialize:n=>{var o;null==d||null==(o=d.schemaInitialize)||o.call(d,n,{field:t,block:c,readPretty:s,targetCollection:i(e.target)})},schema:p}});return{type:"subMenu",name:null==(o=e.uiSchema)?void 0:o.title,title:null==(a=e.uiSchema)?void 0:a.title,children:u}})},pH=(e,t,n,o,l,r,i)=>{if(r>=3)return null;if(["m2o","obo","oho","o2m","m2m"].includes(e.interface)){var a,s;if(l.includes(e.target))return null;let c=o(e.target),d=[];return c.forEach(a=>{["m2o","obo","oho","o2m","m2m"].includes(a.interface)&&d.push(pY("".concat(t,".").concat(a.name),a,n,(i||"")+e.key)),d.push(pH(a,"".concat(t,".").concat(a.name),n,o,[...l,e.target],r+1,(i||"")+e.key))}),{type:"subMenu",name:null==(a=e.uiSchema)?void 0:a.title,title:null==(s=e.uiSchema)?void 0:s.title,key:(i||"")+e.key+"menu",children:d.filter(Boolean)}}return pM(e)?null:pY(t,e,n,(i||"")+e.key)},pY=(e,t,n,o)=>{var l,r,i;let a={type:"string",name:e,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FilterFormItem","x-designer-props":{interface:t.interface},"x-component":"CollectionField","x-read-pretty":!1,"x-decorator":"FormItem","x-collection-field":"".concat(n,".").concat(e)};return{name:(null==(l=t.uiSchema)?void 0:l.title)||t.name,type:"item",key:((null==(r=t.uiSchema)?void 0:r.title)||t.name)+o,title:(null==(i=t.uiSchema)?void 0:i.title)||t.name,Component:"CollectionFieldInitializer",remove:pE,schema:a}},pX=e=>{let{name:t}=tJ(),{getInterface:n,getInheritCollections:o,getCollection:l,getParentCollectionFields:r}=sO(),i=o(t),{snapshot:a}=co(),s=(0,ec.useForm)();return null==i?void 0:i.map(o=>{var i;let a=r(o,t),{readPretty:c=s.readPretty,block:d="Form",component:u="CollectionField"}=e||{},p=l(o);return{[null==p?void 0:p.title]:null==a||null==(i=a.filter(e=>(null==e?void 0:e.interface)&&!(null==e?void 0:e.isForeignKey)))?void 0:i.map(e=>{var o,r,i,a;let s=n(e.interface),p=l(e.target),m={type:"string",name:e.name,title:(null==e||null==(o=e.uiSchema)?void 0:o.title)||e.name,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem","x-component":u,"x-decorator":"FormItem","x-collection-field":"".concat(t,".").concat(e.name),"x-component-props":{},"x-read-pretty":null==e||null==(r=e.uiSchema)?void 0:r["x-read-pretty"]};return{name:(null==e||null==(i=e.uiSchema)?void 0:i.title)||e.name,type:"item",title:(null==e||null==(a=e.uiSchema)?void 0:a.title)||e.name,Component:"CollectionFieldInitializer",remove:pE,schemaInitialize:t=>{var n;null==s||null==(n=s.schemaInitialize)||n.call(s,t,{field:e,block:d,readPretty:c,targetCollection:p})},schema:m}})}})},pJ=(e,t,n)=>ec.Schema.isSchemaInstance(e)?e.reduceProperties((e,o)=>{if(o[t]===n)return o;if("Action.Container"!==o["x-component"]&&"AssociationField.Viewer"!==o["x-component"]){let e=pJ(o,t,n);if(e)return e}return e}):null,pQ=(e,t)=>t(e),pZ=e=>e.parent?e.parent["x-initializer"]?e.parent:pZ(e.parent):null,p0=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pJ,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:pQ,{removeActiveFieldName:l}=uM()||{},{form:r}=Tp(),i=(0,ec.useFieldSchema)();if(!(null==i?void 0:i["x-initializer"])&&(null==i?void 0:i["x-decorator"])==="FormItem"){let e=pZ(i);e&&(i=e)}let{remove:a}=eY(),s=n(i,t,e);return{schema:s,exists:!!s,remove(){null==l||l(s.name),null==r||r.query(s.name).forEach(e=>{var t,n;null==(t=e.setInitialValue)||t.call(e,null),null==(n=e.reset)||n.call(e)}),s&&o(s,a)}}},p1=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,{t:l}=(0,eT.useTranslation)(),r=tJ(),{getTemplatesByCollection:i}=rg(),a=i(r.dataSource,n||r.name).filter(t=>e&&t.componentName===e).filter(t=>["FormItem","ReadPrettyFormItem"].includes(e)||t.resourceName===o);return a.length?[{key:"".concat(n||e,"_table_blank"),type:"item",name:r.name,title:l("Blank block"),item:t},{type:"divider"},{key:"".concat(n||e,"_table_subMenu_").concat(0,"_copy"),type:"subMenu",name:"copy",title:l("Duplicate template"),children:a.map(e=>{let n=["FormItem","ReadPrettyFormItem"].includes(null==e?void 0:e.componentName)?"".concat(null==e?void 0:e.name," ").concat(l("(Fields only)")):null==e?void 0:e.name;return{type:"item",mode:"copy",name:r.name,template:e,item:t,title:n||l("Untitled")}})},{key:"".concat(n||e,"_table_subMenu_").concat(0,"_ref"),type:"subMenu",name:"ref",title:l("Reference template"),children:a.map(e=>{let n=["FormItem","ReadPrettyFormItem"].includes(null==e?void 0:e.componentName)?"".concat(null==e?void 0:e.name," ").concat(l("(Fields only)")):null==e?void 0:e.name;return{type:"item",mode:"reference",name:r.name,template:e,item:t,title:n||l("Untitled")}})}]:[]},p2=e=>{let{componentName:t,filter:n=()=>!0,onlyCurrentDataSource:o=!1,showAssociationFields:l,filterDataSource:r,dataBlockInitializerProps:i,hideOtherRecordsInPopup:a}=e,{t:s}=(0,eT.useTranslation)(),c=tr(),d=tc(),u=tS(),p=function(e){let{componentName:t,filterCollections:n,showAssociationFields:o}=e,l=(0,ec.useFieldSchema)(),{getCollectionFields:r}=sO(),i=tJ(),a=tg(),s=tc(),{getTemplatesByCollection:c}=rg(),{t:d}=(0,eT.useTranslation)(),u=eB();return(0,es.useMemo)(()=>{if(!o)return[];let e=[];if(l["x-initializer"])e=i.fields;else{let t=pZ(l.parent);t&&(e=r(t))}return e.filter(e=>["linkTo","subTable","o2m","m2m","obo","oho","o2o","m2o"].includes(e.interface)).filter(e=>n({associationField:e})).map((e,n)=>{let o=u(e.uiSchema.title||e.name),l=c(s,e.target).filter(n=>{if("ReadPrettyFormItem"===t)if(["hasOne","belongsTo"].includes(e.type))return"ReadPrettyFormItem"===n.componentName;else return"Details"===n.componentName;return t&&n.componentName===t&&(["FormItem","ReadPrettyFormItem"].includes(t)||!n.resourceName||n.resourceName==="".concat(e.collectionName,".").concat(e.name))});return l.length?{key:"associationFiled_".concat(t,"_table_subMenu_").concat(n),type:"subMenu",name:"".concat(e.target,"_").concat(n),title:o,dataSource:s,children:[{type:"item",name:"".concat(e.collectionName,".").concat(e.name),collectionName:e.target,dataSource:s,title:d("Blank block"),associationField:e},{type:"divider"},{key:"associationFiled_".concat(t,"_table_subMenu_").concat(n,"_copy"),type:"subMenu",name:"copy",dataSource:s,title:d("Duplicate template"),children:l.map(t=>{let n=["FormItem","ReadPrettyFormItem"].includes(null==t?void 0:t.componentName)?"".concat(null==t?void 0:t.name," ").concat(d("(Fields only)")):null==t?void 0:t.name;return{type:"item",mode:"copy",name:"".concat(e.collectionName,".").concat(e.name),collectionName:e.target,template:t,dataSource:s,title:n||d("Untitled"),associationField:e}})},{key:"associationFiled_".concat(t,"_table_subMenu_").concat(n,"_ref"),type:"subMenu",name:"ref",dataSource:s,title:d("Reference template"),children:l.map(t=>{let n=["FormItem","ReadPrettyFormItem"].includes(null==t?void 0:t.componentName)?"".concat(null==t?void 0:t.name," ").concat(d("(Fields only)")):null==t?void 0:t.name;return{type:"item",mode:"reference",name:"".concat(e.collectionName,".").concat(e.name),collectionName:e.target,template:t,dataSource:s,title:n||d("Untitled"),associationField:e}})}]}:{type:"item",name:"".concat(e.collectionName,".").concat(e.name),collectionName:e.target,title:o,dataSource:s,associationField:e}})},[a,i.fields,u,t,s,l,n,r,c,o,d])}({componentName:t,filterCollections:n,showAssociationFields:l}),m=c.getAllCollections({filterCollection:e=>(!o||e.dataSource===d)&&n({collection:e}),filterDataSource:r});o&&(m=m.filter(e=>e.key===d));let{getTemplatesByCollection:h}=rg(),x=(0,es.useMemo)(()=>m.map(e=>{let{key:n,displayName:o,collections:l}=e;return{name:n,label:o,type:"subMenu",children:[...p8({collections:l,componentName:t,searchValue:"",dataSource:n,getTemplatesByCollection:h,t:s}).sort(e=>{let t=eu().toArray((null==u?void 0:u.inherits)||[]);if(e.name===(null==u?void 0:u.name)||t.some(t=>t===e.name))return -1})]}}),[m,null==u?void 0:u.inherits,null==u?void 0:u.name,t,h,s]);return l?(0,es.useMemo)(()=>{let e,n={name:"currentRecord",collectionName:u.name,dataSource:u.dataSource,Component:vB,onClick(){},componentProps:{...i,icon:null,title:s("Current record"),name:"currentRecord",hideSearch:!1,hideChildrenIfSingleCollection:!0,items:x}},o={name:"associationRecords",Component:vB,onClick(){},componentProps:{...i,icon:null,title:s("Associated records"),name:"associationRecords",hideSearch:!1,items:[{name:"associationFields",label:s("Association fields"),type:"subMenu",children:p}]}},l={name:"otherRecords",Component:vB,onClick(){},componentProps:{icon:null,title:s("Other records"),name:"otherRecords",showAssociationFields:!1,onlyCurrentDataSource:!1,hideChildrenIfSingleCollection:!1,onCreateBlockSchema:i.onCreateBlockSchema,fromOthersInPopup:!0,componentType:{ReadPrettyFormItem:"Details"}[t]||t,filter(e){let{collection:t,associationField:n}=e;return!0}}},r=p.length?o:null;if(x[0].children.length&&p.length)e=a?[n,r]:[n,r,l];else if(x[0].children.length)if(a){if(x[0].children.length<=1){var c;return x[0].children=(null==(c=x[0].children[0])?void 0:c.children)||[],x}e=[n]}else e=[n,l];else e=a?[r]:[r,l];return[{name:"records",label:s("Records"),type:"subMenu",children:e.filter(Boolean)}]},[p,u.dataSource,u.name,t,i,a,x,s]):x},p6=e=>{let{formItemInitializers:t="details:configureFields",actionInitializers:n="detailsWithPaging:configureActions",collection:o,dataSource:l,association:r,template:i,settings:a,action:s="list",...c}=e,d=r||o;return{type:"void","x-acl-action":"get"===s?"".concat(d,":get"):"".concat(d,":view"),"x-decorator":"DetailsBlockProvider","x-decorator-props":{dataSource:l,collection:o,association:r,readPretty:!0,action:s,..."list"===s?{params:{pageSize:1}}:{},...c},"x-toolbar":"BlockSchemaToolbar","x-settings":a,"x-component":"CardItem",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Details","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{[(0,ec.uid)()]:{type:"void","x-initializer":n,"x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{}},grid:i||{type:"void","x-component":"Grid","x-initializer":t,properties:{}},..."list"===s?{pagination:{type:"void","x-component":"Pagination","x-use-component-props":"useDetailsPaginationProps"}}:{}}}}}},p3=e=>{let{formItemInitializers:t="form:configureFields",actionInitializers:n="createForm:configureActions",collection:o,resource:l,dataSource:r,association:i,action:a,actions:s={},"x-designer":c="FormV2.Designer",template:d,title:u,settings:p,...m}=e,h=l||i||o;return{type:"void","x-acl-action-props":{skipScopeCheck:!a},"x-acl-action":a?"".concat(h,":update"):"".concat(h,":create"),"x-decorator":"FormBlockProvider","x-decorator-props":{...m,action:a,dataSource:r,resource:h,collection:o,association:i},"x-toolbar":"BlockSchemaToolbar",...p?{"x-settings":p}:{"x-designer":c},"x-component":"CardItem","x-component-props":{title:u},properties:{[(0,ec.uid)()]:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{[(0,ec.uid)()]:{type:"void","x-initializer":n,"x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:s},grid:d||{type:"void","x-component":"Grid","x-initializer":t,properties:{}}}}}}},p5=e=>{let{formItemInitializers:t="details:configureFields",actionInitializers:n="details:configureActions",collection:o,association:l,dataSource:r,resource:i,template:a,settings:s,...c}=e,d=i||l||o;return{type:"void","x-acl-action":"".concat(d,":get"),"x-decorator":"FormBlockProvider","x-decorator-props":{resource:d,collection:o,association:l,dataSource:r,readPretty:!0,action:"get",useParams:"{{ useParamsFromRecord }}",...c},"x-toolbar":"BlockSchemaToolbar","x-settings":s,"x-component":"CardItem",properties:{[(0,ec.uid)()]:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps","x-read-pretty":!0,properties:{[(0,ec.uid)()]:{type:"void","x-initializer":n,"x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{}},grid:a||{type:"void","x-component":"Grid","x-initializer":t,properties:{}}}}}}},p4=e=>{let{collection:t,rowKey:n,tableActionInitializers:o,tableColumnInitializers:l,tableActionColumnInitializers:r,tableBlockProvider:i,disableTemplate:a,dataSource:s,blockType:c,pageSize:d=20,...u}=e;return{type:"void","x-decorator":null!=i?i:"TableBlockProvider","x-acl-action":"".concat(t,":list"),"x-decorator-props":{collection:t,dataSource:s,action:"list",params:{pageSize:d},rowKey:n,showIndex:!0,dragSort:!1,disableTemplate:null!=a&&a,blockType:c,...u},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table","x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-initializer":null!=o?o:"table:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{}},[(0,ec.uid)()]:{type:"array","x-initializer":null!=l?l:"table:configureColumns","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:150,fixed:"right"},"x-designer":"TableV2.ActionColumnDesigner","x-initializer":null!=r?r:"table:configureItemActions",properties:{[(0,ec.uid)()]:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{}}}}}}}}},p8=e=>{var t;let{collections:n,dataSource:o,componentName:l,searchValue:r,getTemplatesByCollection:i,t:a}=e;return null==n||null==(t=n.filter(e=>{if(e.inherit||!e.filterTargetKey)return!1;{if(["Kanban","FormItem"].includes(l)&&("view"===e.template&&!e.writableView||"sql"===e.template)||"file"===e.template&&["Kanban","FormItem","Calendar"].includes(l))return!1;let t=e.title||e.tableName;return!!t&&t.toUpperCase().includes(r.toUpperCase())&&!((null==e?void 0:e.isThrough)&&(null==e?void 0:e.autoCreate))}}))?void 0:t.map((e,t)=>{let n=e.title||e.tableName||e.label,r=i(o,e.name).filter(t=>l&&t.componentName===l&&(["FormItem","ReadPrettyFormItem"].includes(l)||!t.resourceName||t.resourceName===e.name));return r.length?{key:"".concat(l,"_table_subMenu_").concat(t),type:"subMenu",name:"".concat(e.name,"_").concat(t),title:n,dataSource:o,children:[{type:"item",name:e.name,dataSource:o,title:a("Blank block")},{type:"divider"},{key:"".concat(l,"_table_subMenu_").concat(t,"_copy"),type:"subMenu",name:"copy",dataSource:o,title:a("Duplicate template"),children:r.map(t=>{let n=["FormItem","ReadPrettyFormItem"].includes(null==t?void 0:t.componentName)?"".concat(null==t?void 0:t.name," ").concat(a("(Fields only)")):null==t?void 0:t.name;return{type:"item",mode:"copy",name:e.name,template:t,dataSource:o,title:n||a("Untitled")}})},{key:"".concat(l,"_table_subMenu_").concat(t,"_ref"),type:"subMenu",name:"ref",dataSource:o,title:a("Reference template"),children:r.map(t=>{let n=["FormItem","ReadPrettyFormItem"].includes(null==t?void 0:t.componentName)?"".concat(null==t?void 0:t.name," ").concat(a("(Fields only)")):null==t?void 0:t.name;return{type:"item",mode:"reference",name:e.name,template:t,dataSource:o,title:n||a("Untitled")}})}]}:{type:"item",name:e.name,title:n,dataSource:o}})},p7=cP("tb-schema-initializer",e=>{let{componentCls:t}=e;return{[t]:{".ant-menu":{background:"transparent",borderInlineEnd:"none !important"},":not(.ant-menu)":{["".concat(t,"-group-title")]:{color:e.colorTextDescription,lineHeight:"".concat(e.controlHeight,"px"),paddingLeft:e.padding,paddingRight:e.paddingSM},["".concat(t,"-menu-item")]:{marginInline:e.marginXXS,paddingLeft:e.padding,paddingRight:e.paddingSM,lineHeight:"".concat(e.controlHeight,"px"),color:e.colorText,cursor:"pointer","&:hover":{borderRadius:e.borderRadiusSM,backgroundColor:e.colorBgTextHover}}}},["".concat(t,"-menu-sub")]:{ul:{maxHeight:"50vh !important"}},["".concat(t,"-item-content")]:{marginLeft:e.marginXS}}}),p9=(0,es.createContext)({});p9.displayName="SchemaInitializerContext";let me=()=>es.useContext(p9),mt=(0,es.createContext)({});mt.displayName="SchemaInitializerItemContext";let mn=()=>es.useContext(mt);function mo(){let e=(0,ns._)(["\n .ant-popover-inner {\n padding: ",";\n .ant-menu-submenu-title {\n margin-block: 0;\n }\n }\n "]);return mo=function(){return e},e}let ml=e=>e,mr=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{popover:t(mo(),"".concat(n.paddingXXS,"px 0"))}});function mi(e){return(0,ec.observer)(t=>{let{designable:n,insertAdjacent:o}=eY(),{isInSubTable:l}=lu()||{},{insert:r,useInsert:i,wrap:a=ml,insertPosition:s="beforeEnd",onSuccess:c,designable:d,popoverProps:u,children:p,popover:m=!0,style:h,componentProps:x}=t,f=i?i():r,v=(0,es.useCallback)(e=>{f?f(a(e,{isInSubTable:l})):o(s,a(e,{isInSubTable:l}),{onSuccess:c})},[f,a,o,s,c]),{wrapSSR:g,hashId:y,componentCls:b}=p7(),[C,S]=(0,es.useState)(!1),{token:w}=iw.A.useToken(),{styles:F}=mr(),j=l9([C]),k=(0,es.useMemo)(()=>({options:t,style:h,...x}),[x,t,h]);return n||!0===d?(0,A.jsx)(p9.Provider,{value:{visible:C,setVisible:S,insert:v,options:t},children:!1===m?es.createElement(e,k):(0,A.jsx)(dB.A,{placement:"bottomLeft",...u,arrow:!1,overlayClassName:F.popover,open:C,onOpenChange:S,content:g((0,A.jsx)("div",{className:"".concat(b," ").concat(y),style:{maxHeight:j,overflowY:"auto"},children:(0,A.jsx)(og.Ay,{theme:{components:{Menu:{itemHeight:w.marginXL,borderRadius:w.borderRadiusSM,itemBorderRadius:w.borderRadiusSM,subMenuItemBorderRadius:w.borderRadiusSM}}},children:p})})),children:es.createElement(e,k)})}):null},{displayName:"WithInitializer(".concat(e.displayName||e.name,")")})}var ma=n(58470);function ms(){let e=(0,ns._)(["\n box-shadow: none !important;\n border-inline-end: 0 !important;\n .ant-menu-sub {\n max-height: 50vh !important;\n }\n .ant-menu-item {\n margin-block: 0;\n }\n .ant-menu-root {\n margin: 0 -","px;\n .ant-menu-submenu-title,\n .ant-menu-item-only-child {\n margin-inline: 0;\n margin-block: 0;\n width: 100%;\n }\n }\n // associated issue https://github.com/ant-design/ant-design/issues/51361\n .ant-menu-title-content {\n display: inline;\n }\n "]);return ms=function(){return e},e}let mc=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{menu:t(ms(),n.margin)}}),md=es.createContext({}),mu=e=>(0,A.jsx)(md.Provider,{value:{isInMenu:!0},children:e.children}),mp=()=>es.useContext(md),mm=e=>{let{componentCls:t,hashId:n}=p7(),{items:o,...l}=e,{token:r}=iw.A.useToken(),{styles:i}=mc(),a=(0,es.useMemo)(()=>o.map(e=>({...e,popupClassName:"".concat(n," ").concat(t,"-menu-sub")})),[t,n,o]);return(0,A.jsx)(mu,{children:(0,A.jsx)(nY.A,{selectable:!1,expandIcon:(0,A.jsx)(ma.A,{style:{fontSize:r.fontSizeSM,color:r.colorTextDescription}}),rootClassName:i.menu,items:a,...l})})},mh=e=>{let{children:t,title:n,name:o=(0,ec.uid)(),onOpenChange:l,icon:r,...i}=e,a=eB(),s=mB(null==t?void 0:t.filter(e=>!e.useVisible||e.useVisible()),o),c=(0,es.useMemo)(()=>[{...i,key:o,label:a(n),icon:"string"==typeof r?(0,A.jsx)(iG.A,{type:r}):r,children:s}],[s,a,r,o,i,n]);return(0,A.jsx)(mm,{onOpenChange:l,items:c})},mx=()=>{let e=mn();return(0,A.jsx)(mh,{...e})},mf=(0,es.memo)(es.forwardRef((e,t)=>{let{style:n,name:o=(0,ec.uid)(),applyMenuStyle:l=!0,className:r,items:i,icon:a,title:s,onClick:c,children:d}=e,u=eB(),p=mB(i,o,c),{componentCls:m,hashId:h}=p7(),{attribute:x}=mO(),f=(0,es.useMemo)(()=>{if(i&&i.length>0)return[{key:o,style:n,className:r,label:d||u(s),onClick:t=>{t.key===o&&(null==c||c({...t,item:e}))},icon:"string"==typeof a?(0,A.jsx)(i6,{type:a}):a,children:p}]},[o,n,r,d,s,c,a,p]);return i&&i.length>0?(0,A.jsx)(mm,{items:f}):(0,A.jsx)("div",{ref:t,onClick:t=>{t.stopPropagation(),null==c||c({event:t,item:e})},children:(0,A.jsx)("div",{...x,className:r6()({["".concat(m,"-menu-item")]:l},r),style:n,children:d||(0,A.jsxs)(A.Fragment,{children:[a&&"string"==typeof a?(0,A.jsx)(i6,{type:a}):a,(0,A.jsx)("span",{className:r6()({["".concat(h," ").concat(m,"-item-content")]:a}),children:u(s)})]})})})}));mf.displayName="SchemaInitializerItem";let mv=()=>{let e=mn();return(0,A.jsx)(mf,{...e})},mg=e=>{let{title:t,checked:n,...o}=e,l=eB();return(0,A.jsx)(mf,{...o,children:(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l(t)," ",(0,A.jsx)(oh.A,{style:{marginLeft:20},size:"small",checked:n})]})})},my=()=>{let e=mn();return(0,A.jsx)(mg,{...e})},mb=e=>{let{children:t}=e;return t?(0,A.jsx)(A.Fragment,{children:t.sort((e,t)=>(e.sort||0)-(t.sort||0)).map((e,t)=>(0,A.jsx)(mj,{...e},e.key||(null==e?void 0:e.name)||t))}):null},mC={item:"SchemaInitializerItemInternal",itemGroup:"SchemaInitializerItemGroupInternal",divider:"SchemaInitializerDivider",subMenu:"SchemaInitializerSubMenuInternal",actionModal:"SchemaInitializerActionModalInternal"},mS=()=>void 0,mw=()=>!0,mF=()=>void 0,mj=(0,es.memo)(e=>{let{type:t,Component:n,component:o,children:l,useVisible:r=mw,useChildren:i=mS,useComponentProps:a=mF,hideIfNoChildren:s,componentProps:c,sort:d,...u}=e,p=i(),m=a(),h=eH(),x=n||o,f=!x&&t&&mC[t],v=(0,es.useMemo)(()=>{let e=[...p||[],...l||[]];return 0===e.length?void 0:e},[p,l]),g=(0,es.useMemo)(()=>({...u,...f?m:{},...f?c:{},children:v}),[u,f,m,c,v]);if(!r()||!t&&!x)return null;let y=h(f?mC[t]:x);return!y||s&&Array.isArray(v)&&0===v.length?null:(0,A.jsx)(mt.Provider,{value:g,children:(0,A.jsx)(y,{...c,...m,children:v})})});mj.displayName="SchemaInitializerChild";var mA=n(46990);let mk=()=>{let{token:e}=iw.A.useToken();return(0,A.jsx)(mA.A,{style:{marginTop:e.marginXXS,marginBottom:e.marginXXS}})},mI=e=>{let{children:t,title:n,divider:o}=e,l=eB(),{componentCls:r}=p7(),{token:i}=iw.A.useToken();return(0,A.jsxs)("div",{style:{marginInline:i.marginXXS},children:[o&&(0,A.jsx)(mk,{}),(0,A.jsx)("div",{className:"".concat(r,"-group-title"),children:l(n)}),(0,A.jsx)(mb,{children:t})]})},mP=()=>{let e=mn();return(0,A.jsx)(mI,{...e})},mT=e=>{let{items:t}=e;return 0===t.length?null:(0,A.jsx)(mb,{children:t})},mN=e=>{let{title:t,schema:n,buttonText:o,component:l,onCancel:r,onSubmit:i}=e,a=(0,es.useCallback)(()=>{let e=(0,ec.useForm)(),t=co();return{async run(){await (null==r?void 0:r()),t.setVisible(!1),e.reset()}}},[r]),s=(0,es.useCallback)(()=>{let e=(0,ec.useForm)(),t=co();return{async run(){await e.validate(),await (null==i?void 0:i(e.values)),t.setVisible(!1),e.reset()}}},[i]),c=(0,es.useMemo)(()=>({type:"void",properties:{action1:{type:"void","x-component":"Action","x-component-props":l?{component:l}:{icon:"PlusOutlined",style:{borderColor:"var(--colorSettings)",color:"var(--colorSettings)"},title:o,type:"dashed"},properties:{drawer1:{"x-decorator":"Form","x-component":"Action.Modal","x-component-props":{style:{maxWidth:"520px",width:"100%"}},type:"void",title:t,properties:{...(null==n?void 0:n.properties)||n,footer:{"x-component":"Action.Modal.Footer",type:"void",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:a}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:s}}}}}}}}}}),[o,l,n,t,a,s]);return(0,A.jsx)(al,{schema:c})},mM=()=>{let e=mn();return(0,A.jsx)(mN,{...e})},mD=e=>{let{title:t,options:n,value:o,onChange:l,openOnHover:r,onClick:i,...a}=e,[s,c]=(0,es.useState)(!1),d=(0,es.useCallback)(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];c(!1),null==i||i(...t)},[c,i]),u=(0,es.useCallback)(()=>c(!0),[]),p=(0,es.useMemo)(()=>r?{onMouseEnter:u,open:s}:{},[u,s,r]);return(0,A.jsx)(mf,{...a,children:(0,A.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},children:[t,(0,A.jsx)(oo.A,{"data-testid":"antd-select",popupMatchSelectWidth:!1,bordered:!1,defaultValue:o,onChange:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c(!1),l(...t)},options:n,style:{textAlign:"right",minWidth:100},onClick:d,...p})]})})},mR=()=>{let e=mn();return(0,A.jsx)(mD,{...e})},mq=()=>{let e=(0,ec.useFieldSchema)(),{name:t}=tJ();return{getAriaLabel:(0,es.useCallback)(n=>{if(!e)return"";let o=e["x-initializer"]?"-".concat(e["x-initializer"]):"",l=t?"-".concat(t):"";return n=n?"-".concat(n):"","schema-initializer-".concat(e["x-component"]).concat(o).concat(l).concat(n)},[e,t])}},m_=es.memo(e=>{let{style:t,options:n,...o}=e,l=eB(),{getAriaLabel:r}=mq();return(0,A.jsx)(e3.Ay,{"data-testid":n["data-testid"],"aria-label":r(),"aria-disabled":"false",type:"dashed",style:{borderColor:"var(--colorSettings)",color:"var(--colorSettings)",...t},icon:"string"==typeof n.icon?(0,A.jsx)(i6,{type:n.icon}):n.icon,...o,children:(0,A.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block",width:"100%",verticalAlign:"bottom"},children:l(n.title)})})});m_.displayName="SchemaInitializerButton(memo)";let mO=()=>{let{isInMenu:e}=mp();return{attribute:(0,es.useMemo)(()=>e?{}:{role:"menuitem"},[e])}};function mB(e,t,n){let o=mE(n);return(0,es.useMemo)(()=>o(e,t),[o,e,t])}function mE(e){let t=eB(),n=(0,es.useCallback)((o,l)=>(null==o?void 0:o.length)?o.map((o,r)=>{let i,a=o.component||o.Component,s=o.title||o.label?t(o.title||o.label):void 0;if(a&&!(i=es.createElement(mj,{...o,title:s})))return;if("divider"===o.type)return{type:"divider",key:o.key||"divider-".concat(r)};if("item"===o.type&&a)return o.key||(o.key="".concat(s,"-").concat(r)),o.associationField?{key:o.key,label:i,associationField:o.associationField}:{key:o.key,label:i};if("itemGroup"===o.type){let e="string"==typeof s?s:o.title,t=o.key||"".concat(l,"-item-group-").concat(r);return{type:"group",key:t,label:e,children:(null==o?void 0:o.children.length)?n(o.children,t):[]}}if("subMenu"===o.type){let e=o.key||o.name||"".concat(l,"-sub-menu-").concat(r);return{key:e,label:s,children:(null==o?void 0:o.children.length)?n(o.children,e):[]}}if(o.isMenuType){let{isMenuType:e,...t}=o;return t}let c=i||s||o.label,d=o.key||"".concat(l,"-").concat(s,"-").concat(r),u=t=>{t.domEvent.stopPropagation(),t.key===d&&(o.onClick?o.onClick({...t,item:o}):null==e||e({...t,item:o}))};return o.associationField?{key:d,label:c,associationField:o.associationField,onClick:u}:{key:d,label:c,onClick:u}}):[],[t,e]);return n}let mV=es.memo(e=>{let t=e.Component||m_,n=e.ItemsComponent||mT,o={...e.itemsComponentProps,options:e,items:e.items,style:e.itemsComponentStyle},l=(0,es.useMemo)(()=>mi(t),[t]);return es.createElement(l,e,es.createElement(n,o))});function mz(e,t){let n=os(),o=es.useRef({}),l=(0,es.useMemo)(()=>n.schemaInitializerManager.get(e),[n.schemaInitializerManager,e]);return(0,es.useMemo)(()=>e?l?{exists:!0,render:e=>{let n=JSON.stringify(e)||"{}";return o.current[n]?o.current[n]:o.current[n]=es.createElement(mV,{...l.options,...t,...e})}}:(console.error('[tachybase]: SchemaInitializer "'.concat(e,'" not found')),{exists:!1,render:()=>null}):{exists:!1,render:()=>null},[l,e,t])}mV.displayName="InitializerComponent";class mL{get items(){return this.options.items}add(e,t){let n=e.split("."),o={...t,name:n[n.length-1]};if(1===n.length){let t=this.items.findIndex(t=>t.name===e);-1===t?this.items.push(o):this.items[t]=o;return}let l=n.slice(0,-1).join("."),r=this.get(l);if(r){r.children||(r.children=[]);let t=r.children.findIndex(t=>t.name===e);-1===t?r.children.push(o):r.children[t]=o,this.waitlist.length>0&&this.add(...this.waitlist.shift())}else this.waitlist.push([e,t])}get(e){let t=e.split("."),n=this.items;for(let e=0;e<t.length;e++){let o=t[e];if(!(n=n.find(e=>e.name===o))||e===t.length-1)break;if(!n.children)return;n=n.children}return n}remove(e){let t=e.split(".");if(1===t.length){let e=this.items.findIndex(e=>e.name===t[0]);-1!==e&&this.items.splice(e,1);return}let n=this.get(t.slice(0,-1).join("."));if(n&&n.children){let e=t[t.length-1],o=n.children.findIndex(t=>t.name===e);-1!==o&&n.children.splice(o,1)}}constructor(e){(0,em._)(this,"options",void 0),(0,em._)(this,"name",void 0),(0,em._)(this,"waitlist",[]),this.options=Object.assign({items:[]},e),this.name=e.name}}class mG{add(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach(e=>{this.schemaInitializers[e.name]=e,Array.isArray(this.actionList[e.name])&&(this.actionList[e.name].forEach(t=>{e[t.type](t.itemName,t.data)}),this.actionList[e.name]=void 0)})}addItem(e,t,n){let o=this.get(e);o?o.add(t,n):(this.actionList[e]||(this.actionList[e]=[]),this.actionList[e].push({type:"add",itemName:t,data:n}))}get(e){return this.schemaInitializers[e]}getAll(){return this.schemaInitializers}has(e){return!!this.get(e)}remove(e){delete this.schemaInitializers[e]}removeItem(e,t){let n=this.get(e);n?n.remove(t):(this.actionList[e]||(this.actionList[e]=[]),this.actionList[e].push({type:"remove",itemName:t}))}constructor(e=[],t){(0,em._)(this,"_schemaInitializers",void 0),(0,em._)(this,"app",void 0),(0,em._)(this,"schemaInitializers",void 0),(0,em._)(this,"actionList",void 0),this._schemaInitializers=e,this.app=t,this.schemaInitializers={},this.actionList={},this.app=t,this.add(...e)}}function mK(e,t,n){var o;let{block:l,isReadPretty:r=e=>{let{form:t}=e;return t.readPretty},filter:i=()=>!0,getInitializerItem:a=()=>({}),getSchema:s=()=>({})}=e,{collectionManager:c,collection:d,dataSourceManager:u,actionContext:p}=n,m=null==(o=p.fieldSchema)?void 0:o["x-action"];return d?t.map(e=>{let t=c.getCollection(e.target),o=u.collectionFieldInterfaceManager.getFieldInterface(e.interface);return{collectionField:e,context:{...n,targetCollection:t,collectionFieldInterface:o}}}).filter(e=>{let{collectionField:t}=e;return t.interface}).filter(e=>{let{collectionField:t,context:n}=e;return i(t,n)}).map(e=>{var t,n;let{collectionField:o,context:l}=e,r={type:"string",title:(null==o||null==(t=o.uiSchema)?void 0:t.title)||o.name,name:o.name,"x-component":"CollectionField","x-collection-field":"".concat(d.name,".").concat(o.name),"x-read-pretty":null==o||null==(n=o.uiSchema)?void 0:n["x-read-pretty"]},i=s(o,{...l,defaultSchema:r}),a={...r,...i||{}};return{collectionField:o,schema:a,context:{...l,schema:a}}}).map(e=>{var t;let{collectionField:n,context:o}=e,i={type:"item",name:n.name,title:(null==n||null==(t=n.uiSchema)?void 0:t.title)||n.name,Component:"CollectionFieldInitializer",schemaInitialize:e=>{var t,i;null==(i=o.collectionFieldInterface)||null==(t=i.schemaInitialize)||t.call(i,e,{field:n,block:l,readPretty:null==r?void 0:r(o),action:m,targetCollection:o.targetCollection})},schema:o.schema};return{collectionField:n,context:o,defaultInitializerItem:i}}).map(e=>{let{collectionField:t,defaultInitializerItem:n,context:o}=e,l=a(t,{...o,defaultInitializerItem:n});return{...n,...l||{}}}):[]}function m$(){let{t:e}=(0,eT.useTranslation)(),t=tS(),n=tr(),o=co(),l=ts(),r=(0,ec.useForm)(),i=(0,ec.useFieldSchema)(),a=tg();return{t:e,compile:eB(),actionContext:o,fieldSchema:i,collection:t,dataSource:l,form:r,collectionManager:a,dataSourceManager:n}}let mU=e=>{let t=m$(),{t:n,collection:o}=t,l=mK(e,o.getFields(),t);return(0,A.jsx)(mI,{title:n("Display fields"),children:l})},mW=e=>{let t=m$(),{collection:n,t:o,collectionManager:l}=t,r=n.getParentCollectionsName();if(!r.length)return null;let i=r.map(e=>{let t=n.getParentCollectionFields(e);return 0===t.length?null:{parentCollection:l.getCollection(e),parentCollectionFields:t}}).filter(Boolean).map(n=>{let{parentCollection:l,parentCollectionFields:r}=n,i={...t,collection:l};return{type:"itemGroup",divider:!0,title:o("Parent collection fields")+"("+t.compile(l.title)+")",children:mK(e,r,i)}});return(0,A.jsx)(mb,{children:i})},mH=e=>{let{filterAssociationField:t,filterSelfField:n=()=>!0,getSchema:o,...l}=e,{collection:r,t:i,collectionManager:a}=e.context,s=r.getFields(),c=["o2o","oho","obo","m2o"],d=s.filter(e=>c.includes(e.interface)).filter(t=>n(t,e.context));if(!d.length)return null;let u=d.map(e=>{let t=a.getCollection(e.target);if(!t)return null;let n=null==t?void 0:t.getAllFields();return n.length?{associationField:e,associationCollection:t,associationCollectionFields:n}:null}).filter(Boolean).map(n=>{var i,a;let{associationField:s,associationCollection:c,associationCollectionFields:d}=n,u={...e.context,collection:c};return{type:"subMenu",name:null==(i=s.uiSchema)?void 0:i.title,title:null==(a=s.uiSchema)?void 0:a.title,children:mK({...l,filter:t,getSchema:(e,t)=>({...o(e,t)||{},"x-read-pretty":!0,name:"".concat(s.name,".").concat(e.name),"x-collection-field":"".concat(r.name,".").concat(s.name,".").concat(e.name)})},d,u)}});return u.length?(0,A.jsx)(mI,{title:i("Display association fields"),children:u}):null},mY=e=>{let{selfField:t,parentField:n,associationField:o,block:l}=e,r=m$();return r.collection?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(mU,{block:l,...t,context:{...r,collection:r.collection}}),n&&(0,A.jsx)(mW,{block:l,...n,context:{...r,collection:r.collection}}),o&&(0,A.jsx)(mH,{block:l,...o,context:{...r,collection:r.collection}})]}):null},mX=(e,t,n)=>{let o=pJ(e,"x-component","Kanban");return pJ(o,t,n)},mJ=e=>{let t=(null==e?void 0:e.block)||"Form",n={"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem","x-decorator":"FormItem"},o={remove:pE};return(0,A.jsx)(mY,{block:t,selfField:{filter:e=>!e.treeChildren,getSchema:(e,t)=>{var o,l;let{targetCollection:r}=t,i=(null==r?void 0:r.template)==="file",a=null==e||null==(l=e.uiSchema)||null==(o=l["x-component-props"])?void 0:o.fieldNames;return{...n,"x-component-props":i?{fieldNames:{label:"preview",value:"id"}}:r&&a?{fieldNames:{...a,label:(null==r?void 0:r.titleField)||a.label}}:{}}},getInitializerItem:()=>({...o,find:(null==e?void 0:e.block)==="Kanban"?mX:void 0})},parentField:{getSchema:()=>n,getInitializerItem:()=>o},associationField:{filterSelfField:e=>"Form"!==t||(null==e?void 0:e.interface)==="m2o",filterAssociationField:e=>(null==e?void 0:e.interface)&&!["subTable"].includes(null==e?void 0:e.interface)&&!e.treeChildren,getSchema:()=>n,getInitializerItem:()=>o}})},mQ={name:"fieldComponent",type:"select",useVisible(){let e=tA(),t=tr();if(!e)return!1;let n=t.collectionFieldInterfaceManager.getFieldInterface(null==e?void 0:e.interface);return Array.isArray(null==n?void 0:n.componentOptions)&&n.componentOptions.length>1&&n.componentOptions.filter(e=>!e.useVisible||e.useVisible()).length>1},useComponentProps(){var e,t,n,o;let{t:l}=(0,eT.useTranslation)(),r=(0,ec.useField)(),i=(0,ec.useFieldSchema)(),a=tA(),s=tr().collectionFieldInterfaceManager.getFieldInterface(null==a?void 0:a.interface),{fieldSchema:c}=sb(),d=c||i,{dn:u}=eY(),p=eB(),m=(null==s||null==(t=s.componentOptions)||null==(e=t.filter(e=>!e.useVisible||e.useVisible()))?void 0:e.map(e=>({label:p(e.label),value:e.value,useProps:e.useProps})))||[];return{title:l("Field component"),options:m,value:(null==(n=d["x-component-props"])?void 0:n.component)||(null==(o=m[0])?void 0:o.value),onChange(e){var t;let n=m.find(t=>t.value===e),o={component:e,...(null==n||null==(t=n.useProps)?void 0:t.call(n))||{}};r.componentProps=o,r.component=e,eu().set(d,"x-component-props",o),u.emit("patch",{schema:{"x-uid":d["x-uid"],"x-component-props":o}}),u.refresh()}}}},mZ=(0,es.createContext)({});mZ.displayName="RecordContext_deprecated";let m0=(0,es.createContext)(null);m0.displayName="RecordIndexContext";let m1=e=>{let{record:t,children:n,parent:o,isNew:l}=e,{name:r}=tJ(),i={...t};return i.__parent=o,i.__collectionName=r,(0,A.jsx)(mZ.Provider,{value:i,children:(0,A.jsx)(tE,{isNew:l,record:t,parentRecord:o,children:n})})},m2=e=>(0,A.jsx)(mZ.Provider,{...e}),m6=e=>{let{index:t,children:n}=e;return(0,A.jsx)(m0.Provider,{value:t,children:n})};function m3(){return(0,es.useContext)(mZ)}function m5(){return(0,es.useContext)(m0)}let m4=()=>{var e,t;let n=m3(),o=ub();return!!(null==n?void 0:n.createdById)&&(null==n?void 0:n.createdById)===(null==o||null==(t=o.data)||null==(e=t.data)?void 0:e.id)},m8=(0,es.createContext)(null);m8.displayName="ResourceActionContext";let m7=(0,es.createContext)(null);m7.displayName="ResourceContext";let m9=e=>{var t,n,o,l;let{collection:r,request:i,uid:a,dragSort:s}=e,c=eC(),d=m3(),u=null==i?void 0:i.action,p={};"get"===u&&(p.filterByTk=d[r.targetKey||r.filterTargetKey||"id"]);let m=(null==i||null==(t=i.params)?void 0:t.appends)||[],h=ek({...i,params:{...p,...null==i?void 0:i.params,appends:[...(null==r||null==(o=r.fields)||null==(n=o.filter)?void 0:n.call(o,e=>e.target).map(e=>e.name))||[],...m],sort:s?[!0===r.sortable?"sort":r.sortable]:null==i||null==(l=i.params)?void 0:l.sort}},{uid:a}),x=c.resource(i.resource);return(0,A.jsx)(m7.Provider,{value:{type:"collection",resource:x,collection:r},children:(0,A.jsx)(m8.Provider,{value:{...h,defaultRequest:i,dragSort:s},children:(0,A.jsx)(hH,{collection:r,children:e.children})})})},he=e=>{var t,n,o;let{collection:l,association:r,request:i,uid:a,dragSort:s}=e,c=eC(),d=m3()[r.sourceKey],u=(null==i||null==(t=i.params)?void 0:t.appends)||[],p=ek({resourceOf:d,...i,params:{...null==i?void 0:i.params,appends:[...(null==l||null==(o=l.fields)||null==(n=o.filter)?void 0:n.call(o,e=>e.target).map(e=>e.name))||[],...u]}},{uid:a}),m=c.resource(i.resource,d);return(0,A.jsx)(m7.Provider,{value:{type:"association",resource:m,association:r,collection:l},children:(0,A.jsx)(m8.Provider,{value:{...p,defaultRequest:i,dragSort:s},children:(0,A.jsx)(hH,{collection:l,children:e.children})})})},ht=e=>{var t;let{collection:n,request:o}=e,{getCollection:l}=sO();return("string"==typeof n&&(n=l(n)),n)?(null==o||null==(t=o.resource)?void 0:t.includes("."))?(0,A.jsx)(he,{...e,collection:n}):(0,A.jsx)(m9,{...e,collection:n}):null},hn=()=>(0,es.useContext)(m8),ho=e=>{let t=(0,es.useContext)(m8),n=(0,ec.useField)();return(0,es.useEffect)(()=>{t.loading||(null==e||e.onSuccess(t.data),n.componentProps.dragSort=!!t.dragSort)},[t.loading]),t},hl=()=>{let{type:e,resource:t,collection:n,association:o}=(0,es.useContext)(m7);return{type:e,resource:t,collection:n,association:o,targetKey:(null==o?void 0:o.targetKey)||(null==n?void 0:n.targetKey)||"id"}},hr=()=>{let e=(0,ec.useForm)(),t=co();return{async run(){t.setVisible(!1),e.reset()}}},hi=e=>{let t=m3(),n=ek(()=>Promise.resolve({data:e0()(eQ()(t),["__parent","__collectionName"])}),{...e,manual:!0}),o=co();return(0,es.useEffect)(()=>{o.visible&&n.run()},[o.visible]),n},ha=()=>{let{run:e}=hn(),t=(0,ec.useForm)(),n=co();return{async run(){t.reset(),e(),n.setVisible(!1)}}},hs=()=>{let{resource:e}=tJ();return{async onCardDragEnd(t,n,o){var l,r;let{columns:i,groupField:a}=t,{fromColumnId:s,fromPosition:c}=n,{toColumnId:d,toPosition:u}=o,p=i.find(e=>e.id===s),m=i.find(e=>e.id===d),h=null==p||null==(l=p.cards)?void 0:l[c],x=null==m||null==(r=m.cards)?void 0:r[u],f={sourceId:h.id,sortField:"".concat(a.name,"_sort")};x?f.targetId=x.id:f.targetScope={[a.name]:d},await e.move(f)}}},hc=e=>["belongsTo","hasOne"].includes(e.type),hd=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",{t:l}=(0,eT.useTranslation)(),{getCollectionFields:r,getInterface:i}=sO(),a=r(e);return Array.isArray(a)&&0!==a.length?(a.sort((e,t)=>{let n=hc(e),o=hc(t);return n&&!o?1:!n&&o?-1:e.sort-t.sort}),a.map(l=>{var r;if(!l.interface)return null;let a=i(l.interface);if(!(null==a?void 0:a.sortable)&&!hc(l)||!(null==a?void 0:a.sortable)&&t>=2||l.target===e)return null;let s=n?"".concat(n,".").concat(l.name):l.name,c=(null==l||null==(r=l.uiSchema)?void 0:r.title)||l.name,d="";if(o)if(o.includes("{{")||c.includes("{{")){let e=e=>e.includes("{{t(")?"t(".concat(e.slice(4,-3),")"):e.includes("{{")?"t(".concat(e.slice(2,-2),")"):'"'.concat(e,'"'),t=e(o),n=e(c);d="{{t(".concat(t,' + "/" + ').concat(n,")}}")}else d="".concat(o," / ").concat(c);else d=c;let u={label:c,fullLabel:d,value:s};return l.target&&(u.children=hd(l.target,t+1,s,d)),u}).filter(Boolean)):[]},hu=e=>{let{getChildrenCollections:t}=sO();return t(e).map(e=>({value:e.name,label:(null==e?void 0:e.title)||e.name}))},hp=e=>{let{getChildrenCollections:t,getCollection:n}=sO(),o=t(e),l=n(e);if(!e)return null;let r=o.map(e=>({value:e.name,label:(null==e?void 0:e.title)||e.name}));return r.unshift({value:l.name,label:(null==l?void 0:l.title)||l.name}),r},hm=(e,t)=>{let{getCollectionFields:n,getInterface:o}=sO();return(0,es.useMemo)(()=>{let l=n(e,t),r=(e,l)=>{let i=[];return e.forEach(e=>{let a=((e,l)=>{var i,a;if(!e.interface)return;let s=o(e.interface);if(!(null==s?void 0:s.filterable))return;let{nested:c,children:d,operators:u}=s.filterable,p={name:e.name,title:(null==e||null==(i=e.uiSchema)?void 0:i.title)||e.name,schema:null==e?void 0:e.uiSchema,operators:(null==u||null==(a=u.filter)?void 0:a.call(u,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[],interface:e.interface};if(!e.target||!(l>2)){if(l>2)return p;if((null==d?void 0:d.length)&&(p.children=d),c){let o=r(n(e.target,t),l+1).filter(Boolean);p.children=p.children||[],p.children.push(...o)}return p}})(e,l);a&&i.push(a)}),i};return r(l,1)},[eu().isString(e)?e:null==e?void 0:e.name,t])},hh=e=>{let{getCollectionFields:t,getInterface:n}=sO();return{getFields:(0,es.useCallback)(()=>{let o=t(e),l=(e,o)=>{let r=[];return e.forEach(e=>{let i=((e,o)=>{var r,i;if(!e.interface)return;let a=n(e.interface);if(!(null==a?void 0:a.filterable))return;let{nested:s,children:c,operators:d}=a.filterable,u={name:e.name,title:(null==e||null==(r=e.uiSchema)?void 0:r.title)||e.name,schema:null==e?void 0:e.uiSchema,operators:(null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[],interface:e.interface};if(!e.target||!(o>2)){if(o>2)return u;if((null==c?void 0:c.length)&&(u.children=c),s){let n=l(t(e.target),o+1).filter(Boolean);u.children=u.children||[],u.children.push(...n)}return u}})(e,o);i&&r.push(i)}),r};return l(o,1)},[eu().isString(e)?e:null==e?void 0:e.name])}},hx=e=>{let{getCollectionFields:t,getInterface:n}=sO(),o=t(e),l=(e,o)=>{let r=[];return e.forEach(e=>{let i=((e,o)=>{var r,i;if(!e.interface)return;let a=n(e.interface);if(!(null==a?void 0:a.filterable))return;let{nested:s,children:c,operators:d}=a.filterable,u={name:e.name,title:(null==e||null==(r=e.uiSchema)?void 0:r.title)||e.name,schema:null==e?void 0:e.uiSchema,operators:(null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[],interface:e.interface};if(!e.target||!(o>2)){if(o>2)return u;if((null==c?void 0:c.length)&&(u.children=c),s){let n=l(t(e.target).filter(t=>["hasMany","belongsToMany"].includes(e.type)?!["hasOne","hasMany","belongsTo","belongsToMany"].includes(t.type):!["hasMany","belongsToMany"].includes(t.type)),o+1).filter(Boolean);u.children=u.children||[],u.children.push(...n)}return u}})(e,o);i&&r.push(i)}),r};return l(o,1)},hf=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],{getCollectionFields:o,getInterface:l}=sO(),r=o(e).filter(e=>!n.includes(e.interface)),i=(e,r,a)=>{let s=[];return e.forEach(e=>{let c=((e,r,a)=>{var s;if(!e.interface)return;let c=l(e.interface);if(!(null==c?void 0:c.filterable))return;let{nested:d,children:u}=c.filterable,p=a?"".concat(a,".").concat(e.name):e.name,m={...e,name:e.name,title:(null==e||null==(s=e.uiSchema)?void 0:s.title)||e.name,schema:null==e?void 0:e.uiSchema,key:p};if(!e.target||!(r>t)){if(r>t)return m;if((null==u?void 0:u.length)&&(m.children=u.map(t=>({...t,key:"".concat(e.name,".").concat(t.name)}))),d){let t=i(o(e.target).filter(e=>!n.includes(e.interface)),r+1,e.name).filter(Boolean);m.children=m.children||[],m.children.push(...t)}return m}})(e,r,a);c&&s.push(c)}),s};return i(r,1)},hv=e=>{let{name:t}=tJ(),n=hm(t);return ek(()=>Promise.resolve({data:n}),e)},hg=()=>{let{run:e,params:t,defaultRequest:n}=hn(),o=(0,ec.useForm)(),l=co(),[r,...i]=t;return{async run(){var t;let a=null==n||null==(t=n.params)?void 0:t.filter,s=a?{$and:[a,o.values.filter]}:o.values.filter;e({...r,filter:s},...i),l.setVisible(!1)}}},hy=e=>{let t=(0,ec.useForm)(),n=(0,ec.useField)(),o=co(),{refresh:l}=hn(),{resource:r}=hl();return{async run(){try{var i;await t.submit(),n.data=n.data||{},n.data.loading=!0;let a=await r.create({values:t.values});o.setVisible(!1),null==e||e(null==a||null==(i=a.data)?void 0:i.data),await t.reset(),n.data.loading=!1,l()}catch(e){n.data&&(n.data.loading=!1)}}}},hb=e=>{let t=(0,ec.useForm)(),{resource:n}=hl();return{async run(){var o;await t.submit();let l=await n.create({values:t.values});null==e||e(null==l||null==(o=l.data)?void 0:o.data),await t.reset()}}},hC=e=>{let t=(0,ec.useForm)(),{message:n}=eX.A.useApp(),{t:o}=(0,eT.useTranslation)(),{resource:l,targetKey:r}=hl(),{[r]:i}=m3();return{async run(){var r;await t.submit();let a=await l.update({filterByTk:i,values:t.values});null==e||e(i,null==a||null==(r=a.data)?void 0:r.data),n.success(o("Save successfully."))}}},hS=()=>{let{resource:e}=hl(),{refresh:t}=hn();return{async move(n,o){await e.move({sourceId:n.id,targetId:o.id}),t()}}},hw=e=>{let t=(0,ec.useField)(),n=(0,ec.useForm)(),o=co(),{refresh:l}=hn(),{resource:r,targetKey:i}=hl(),{[i]:a}=m3();return{async run(){await n.submit(),t.data=t.data||{},t.data.loading=!0;try{var i;let t=await r.update({filterByTk:a,values:n.values});o.setVisible(!1),null==e||e(a,null==t||null==(i=t.data)?void 0:i.data),await n.reset(),l()}catch(e){console.error(e)}finally{t.data.loading=!1}}}},hF=e=>{let{refresh:t}=hn(),{resource:n,targetKey:o}=hl(),{[o]:l}=m3();return{async run(){await n.destroy({filterByTk:l}),null==e||e(l),t()}}},hj=e=>{let{state:t,setState:n,refresh:o}=hn(),{resource:l}=hl(),{message:r}=eX.A.useApp(),{t:i}=(0,eT.useTranslation)();return{async run(){var a;if(!(null==t||null==(a=t.selectedRowKeys)?void 0:a.length))return r.error(i("Please select the records you want to delete"));await l.destroy({filterByTk:(null==t?void 0:t.selectedRowKeys)||[]}),null==e||e(null==t?void 0:t.selectedRowKeys),null==n||n({selectedRowKeys:[]}),o()}}},hA=e=>{let t=hn();return ek(()=>Promise.resolve(t.data),{...e,refreshDeps:[t.data]})},hk=()=>{let{run:e}=hy(),{refreshCM:t}=sO();return{async run(){await e(),await t()}}},hI=()=>{let{run:e}=hw(),{refreshCM:t}=sO();return{async run(){await e(),await t()}}},hP=()=>{let{run:e}=hF(),{refreshCM:t}=sO();return{async run(){await e(),await t()}}},hT=e=>{let t=m3();return hN(e||t)},hN=e=>{let{interface:t,deletable:n=!0}=e||{};return!n||"id"===t},hM=()=>{let{run:e}=hj(),{refreshCM:t}=sO();return{async run(){await e(),await t()}}},hD=()=>{var e,t;let{collection:n}=hl(),o=d2(n.fields),l=hn();return d8({options:o.filter(e=>["title","name"].includes(e.name)),params:(null==(t=l.state)||null==(e=t.params)?void 0:e[0])||l.params,service:l})},hR=(0,es.createContext)({historyCollections:[],refreshCH:()=>void 0});hR.displayName="CollectionHistoryContext";let hq=e=>{var t;let n=eC(),o={resource:"collectionsHistory",action:"list",params:{paginate:!1,appends:["fields"],filter:{},sort:["sort"]}},l=(0,ep.useLocation)(),r=ek(o,{manual:!0}),i=l.pathname.startsWith("/admin"),a=n.auth.getToken()||"";(0,es.useEffect)(()=>{i&&a&&r.run()},[i,a]);let s=async()=>{let{data:e}=await n.request(o);return r.mutate(e),(null==e?void 0:e.data)||[]};if(!r.loading)return(0,A.jsx)(hR.Provider,{value:{historyCollections:null==(t=r.data)?void 0:t.data,refreshCH:s},children:e.children})},h_=e=>{let{historyCollections:t}=(0,es.useContext)(hR);return t.filter(t=>e.includes(t.name))},hO=()=>(0,es.useContext)(hR),hB={name:"fields",targetKey:"name",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:'{{ t("Field interface") }}',type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}}]},hE=(0,es.createContext)(null);hE.displayName="DataSourceContext_deprecated";let hV={useSelectedRowKeys:()=>{let e=(0,es.useContext)(hE);return[e.selectedRowKeys,e.setSelectedRowKeys]},useDataSource_deprecated:e=>{let t=(0,es.useContext)(hE);return ek(()=>Promise.resolve({data:t.dataSource}),{...e,refreshDeps:[JSON.stringify(t.dataSource)]})},useCreateAction:()=>{let e=(0,es.useContext)(hE),t=(0,ec.useForm)(),{setVisible:n}=co();return{async run(){let o=e.dataSource||[];o.push((0,ed.cloneDeep)(t.values)),e.setDataSource([...o]),n(!1),await t.reset()}}},useBulkDestroyAction:()=>{let e=(0,es.useContext)(hE),{selectedRowKeys:t,setSelectedRowKeys:n}=e;return{async run(){let o=e.dataSource||[];e.setDataSource(o.filter((e,n)=>!t.includes(n))),n([])}}},useUpdateAction:()=>{let e=m5(),t=(0,ec.useForm)(),{setVisible:n}=co(),o=(0,es.useContext)(hE);return{async run(){let l=((null==o?void 0:o.dataSource)||[]).map((n,o)=>o===e?{...t.values}:n);o.setDataSource([...l]),n(!1)}}},useDestroyAction:()=>{let e=m5(),t=(0,es.useContext)(hE);return{async run(){let n=t.dataSource||[];t.setDataSource(n.filter((t,n)=>e!==n))}}}},hz=(0,ec.observer)(e=>{let[t,n]=(0,es.useState)([]),[o,l]=(0,es.useState)([]),r=m3(),i=eC(),a=ek(()=>{if("subTable"===r.interface){var e;return(null==r||null==(e=r.children)?void 0:e.length)?Promise.resolve({data:(null==r?void 0:r.children)||[]}):i.resource("fields").list({paginate:!1,sort:"sort",filter:{parentKey:r.key}}).then(e=>null==e?void 0:e.data)}return Promise.resolve({data:[]})},{onSuccess(e){l(null==e?void 0:e.data)}});return(0,A.jsx)(hH,{collection:hB,children:(0,A.jsx)(hE.Provider,{value:{rowKey:"name",service:a,dataSource:o,setDataSource:l,selectedRowKeys:t,setSelectedRowKeys:n},children:e.children})})},{displayName:"SubFieldDataSourceProvider_deprecated"}),hL=(0,ec.observer)(e=>{let{rowKey:t,collection:n,association:o}=e,[l,r]=(0,es.useState)([]),[i,a]=(0,es.useState)([]),s=m3(),c=eC(),{getCollection:d}=sO(),u=d(n),p=null==s?void 0:s[o.targetKey||"id"],m=ek(()=>{if(p){var e,t;return c.request({resource:"".concat(o.collectionName,".").concat(o.name),resourceOf:p,action:"list",params:{appends:null==u||null==(t=u.fields)||null==(e=t.filter(e=>e.target))?void 0:e.map(e=>e.name)}}).then(e=>e.data)}return Promise.resolve({data:(null==s?void 0:s[o.name])||[]})},{onSuccess(e){a(null==e?void 0:e.data)}});return(0,A.jsx)(hH,{collection:u,children:(0,A.jsx)(hE.Provider,{value:{rowKey:t,service:m,dataSource:i,setDataSource:a,selectedRowKeys:l,setSelectedRowKeys:r},children:e.children})})},{displayName:"DataSourceProvider_deprecated"}),hG=e=>(0,A.jsx)(i8,{scope:{cm:{...v,useDataSourceFromRAC:ho},ds:hV},components:{SubFieldDataSourceProvider_deprecated:hz,DataSourceProvider_deprecated:hL,CollectionProvider_deprecated:hH,ResourceActionProvider:ht},children:e.children}),hK=(0,es.createContext)({data:[],refresh:()=>{}});hK.displayName="CollectionCategroriesContext";let h$=e=>(0,A.jsx)(tv,{children:(0,A.jsx)(hG,{children:e.children})}),hU=e=>{let t=eC(),n=tr(),{refreshCH:o}=hO(),l={url:"collectionCategories:list",params:{paginate:!1,sort:["sort"]}},r=ek(()=>n.reload().then(o)),i=ek(l);if(r.loading)return;let a=async()=>{let{data:e}=await t.request(l);return i.mutate(e),(null==e?void 0:e.data)||[]};return(0,A.jsx)(hW,{service:{...i},refreshCategory:a,children:(0,A.jsx)(h$,{...e})})},hW=e=>{var t;let{service:n,refreshCategory:o}=e;return(0,A.jsx)(hK.Provider,{value:{data:null==n||null==(t=n.data)?void 0:t.data,refresh:o,...e},children:e.children})},hH=e=>{let{children:t,allowNull:n,name:o,dataSource:l,collection:r}=e;return l?(0,A.jsx)(tv,{dataSource:l,children:(0,A.jsx)(tC,{allowNull:n,name:o||r,children:t})}):(0,A.jsx)(tC,{allowNull:n,name:o||r,children:t})},hY=()=>{let e=tJ(),t=m3(),n=eC(),o=eB(),l=tA();if(!l)return{};let r="".concat((null==l?void 0:l.collectionName)||(null==e?void 0:e.name),".").concat(l.name),i=null==n?void 0:n.resource(r,t[l.sourceKey]);return{...l,uiSchema:o(l.uiSchema),resource:i}};function hX(e){let t=eB(),{collections:n=[]}=sO();return o=>{ec.action.bound(n=>{o.dataSource=("function"==typeof e?n.filter(e):n).map(e=>({label:t(e.title),value:e.name}))})(n)}}let hJ=()=>{let{data:{database:e}}=uv();return{isDialect:t=>(null==e?void 0:e.dialect)===t,dialect:null==e?void 0:e.dialect}};var hQ=n(62991);let hZ=["string","bigInt","integer","uuid","uid"],h0=(0,ec.observer)(()=>{let e=m3(),{getCollection:t}=sO(),n=(null==e?void 0:e.collectionName)?t(e.collectionName):e,o=(0,ec.useField)();(0,ec.useForm)();let{getCollectionFields:l}=sO();return(0,A.jsx)("div",{children:(0,A.jsx)(oo.A,{allowClear:!0,placeholder:"留空时,自动生成 FK 字段",disabled:o.disabled,value:o.value,options:l(n.name).filter(e=>e.type).map(e=>{var t;return{label:(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})})})},{displayName:"SourceForeignKey"}),h1=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useForm)(),{getCollectionFields:n}=sO();return(0,A.jsx)("div",{children:(0,A.jsx)(oo.A,{allowClear:!0,popupMatchSelectWidth:!1,placeholder:"留空时,自动生成 FK 字段",disabled:e.disabled,value:e.value,options:n(t.values.through).filter(e=>e.type).map(e=>{var t;return{label:(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})})})},{displayName:"ThroughForeignKey"}),h2=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=(0,ec.useForm)(),{getCollectionFields:n}=sO();return(0,A.jsx)("div",{children:(0,A.jsx)(oo.A,{allowClear:!0,popupMatchSelectWidth:!1,placeholder:"留空时,自动生成 FK 字段",disabled:e.disabled,value:e.value,options:n(t.values.target).filter(e=>e.type).map(e=>{var t;return{label:(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})})})},{displayName:"TargetForeignKey"}),h6=(0,ec.observer)(()=>{let e=m3(),{getCollection:t}=sO(),n=(null==e?void 0:e.collectionName)?t(e.collectionName):e,o=eB();return(0,A.jsx)("div",{children:(0,A.jsx)(oo.A,{disabled:!0,popupMatchSelectWidth:!1,value:n.name,options:[{value:n.name,label:o(n.title)}]})})},{displayName:"SourceCollection"}),h3=(0,ec.observer)(e=>{var t,n,o;let{sourceKey:l,collectionName:r,name:i}=m3(),{getCollection:a}=sO(),s=(0,ec.useField)(),c=eB(),d=null==(n=a(r||i))||null==(t=n.fields)?void 0:t.filter(e=>e.primaryKey||e.unique).map(e=>{var t;return{value:e.name,label:c((null==(t=e.uiSchema)?void 0:t.title)||e.name)}});return(0,es.useEffect)(()=>{var e;s.initialValue=(null==d||null==(e=d[0])?void 0:e.value)||l},[]),(0,A.jsx)("div",{children:(0,A.jsx)(oo.A,{disabled:l,options:d,defaultValue:l||(null==d||null==(o=d[0])?void 0:o.value),onChange:null==e?void 0:e.onChange,showSearch:!0})})},{displayName:"SourceKey"}),h5=(0,ec.observer)(e=>{let{value:t,disabled:n}=e,{targetKey:o,target:l,type:r}=m3(),{getCollection:i}=sO(),[a,s]=(0,es.useState)([]),[c,d]=(0,es.useState)(t||o),u=(0,ec.useForm)(),p=eB();return(0,ec.useField)().required=!0,(0,es.useEffect)(()=>{if(l&&"__temp__"!==l){var e;s(null==(e=i(l).fields)?void 0:e.filter(e=>"hasMany"!==r?e.primaryKey||e.unique:hZ.includes(e.type)).map(e=>{var t;return{value:e.name,label:p((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.title||e.name)}}))}},[]),(0,A.jsx)("div",{children:(0,A.jsx)(oo.A,{showSearch:!0,options:a,onDropdownVisibleChange:async e=>{let{target:t,type:n}=u.values;if(t&&e){var o;s(null==(o=i(t).fields)?void 0:o.filter(e=>"hasMany"!==n?e.primaryKey||e.unique:hZ.includes(e.type)).map(e=>{var t;return{value:e.name,label:p((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.title||e.name)}}))}},onChange:t=>{var n;null==e||null==(n=e.onChange)||n.call(e,t),d(t)},value:c,disabled:n})})},{displayName:"TargetKey"}),h4=(0,ec.observer)(e=>{let{disabled:t}=e,[n,o]=(0,es.useState)([]),{getCollection:l}=sO(),r=m3(),i=(0,ec.useField)(),{collectionName:a,target:s,type:c,through:d,name:u,template:p}=r,m=r[i.props.name],h=eB(),x=(0,ec.useForm)(),[f,v]=(0,es.useState)(m||("view"===p?null:i.initialValue));(0,es.useEffect)(()=>{var e;let t=null==(e=l(["belongsTo"].includes(c)?a:["belongsToMany"].includes(c)?d:s))?void 0:e.fields;if(t){let e=null==t?void 0:t.filter(e=>hZ.includes(e.type)).map(e=>{var t;return{value:e.name,label:h((null==(t=e.uiSchema)?void 0:t.title)||e.name)}});if(o(e),m){let t=e.find(e=>e.value===m);v((null==t?void 0:t.label)||m)}}},[c]);let g="view"===p?oo.A:hQ.A;return(0,A.jsx)("div",{children:(0,A.jsx)(g,{disabled:t,value:f,options:n,showSearch:!0,onDropdownVisibleChange:async e=>{let{target:t,type:n,through:r}=x.values,i=["belongsTo"].includes(n)?a||u:["belongsToMany"].includes(n)?r:t;if(i&&e){var s;let e=(null==(s=l(i))?void 0:s.fields)||[];o(null==e?void 0:e.filter(e=>hZ.includes(e.type)).map(e=>{var t;return{value:e.name,label:h((null==(t=e.uiSchema)?void 0:t.title)||e.name)}}))}},onChange:(t,n)=>{var o;null==e||null==(o=e.onChange)||o.call(e,t),v(n.label||t)}})})},{displayName:"ForeignKey"}),h8=(0,ec.observer)(e=>{let{disabled:t}=e,n=eB(),{getCollections:o}=sO(),[l,r]=(0,es.useState)([]),i=(0,ec.useField)(),a=m3()[i.props.name],[s,c]=(0,es.useState)(a||i.initialValue),[d,u]=(0,es.useState)([]);return(0,es.useEffect)(()=>{let e=o().filter(e=>!e.autoCreate||!e.isThrough).map(e=>({label:n(e.title),value:e.name}));if(r(e),u(e),a){let t=e.find(e=>e.value===a);c((null==t?void 0:t.label)||a)}},[]),(0,A.jsx)("div",{children:(0,A.jsx)(hQ.A,{disabled:t,showSearch:!0,popupMatchSelectWidth:!1,value:s,options:l,onSearch:e=>{e?r(d.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()))):r(d)},onChange:(t,n)=>{var o;null==e||null==(o=e.onChange)||o.call(e,t),c(n.label||t)}})})},{displayName:"ThroughCollection"}),h7=()=>{let e=tr();return(0,es.useMemo)(()=>{let t,n=e.collectionFieldInterfaceManager.getFieldInterfaces(),o=e.collectionFieldInterfaceManager.getFieldInterfaceGroups();return t=n.reduce((e,t)=>{let n=t.group||"basic";return e[n]||(e[n]=[]),e[n].push(t),e},{}),Object.keys(o).map(e=>({...o[e],key:e,children:Object.keys(t[e]||{}).map(n=>{let o=t[e][n];return{value:n,label:o.title,name:n,...t[e][n]}}).sort((e,t)=>e.order-t.order)})).sort((e,t)=>e.order-t.order)},[e])},h9=()=>{let e=(0,ec.useForm)();return{getValues(){let t=(0,ed.cloneDeep)(e.values);return t.autoCreateReverseField||delete t.reverseField,delete t.autoCreateReverseField,t}}},xe=()=>{let e=(0,ec.useForm)(),{refreshCM:t}=sO(),n=co(),{refresh:o}=hn(),{resource:l}=hl(),r=(0,ec.useField)();return{async run(){await e.submit(),r.data=r.data||{},r.data.loading=!0;let i=(0,ed.cloneDeep)(e.values);i.autoCreateReverseField||delete i.reverseField,delete i.autoCreateReverseField;try{await l.create({values:i}),n.setVisible(!1),await e.reset(),r.data.loading=!1,o(),await t()}catch(e){r.data.loading=!1}}}},xt=e=>{let t=m3();return(0,A.jsx)(xn,{item:t,...e})},xn=e=>{var t,n;let{scope:o,getContainer:l,item:r,children:i,trigger:a,align:s,database:c}=e,{getInterface:d,getTemplate:u,collections:p,getCollection:m}=sO(),[h,x]=(0,es.useState)(!1),[f,v]=(0,es.useState)(),[y,b]=(0,es.useState)({}),C=eB(),{t:S}=(0,eT.useTranslation)(),{isDialect:w}=hJ(),F=h7(),j=(null==(n=m(r.name))||null==(t=n.options)?void 0:t.fields)||r.fields||[],k=(0,es.useMemo)(()=>p.map(e=>({label:C(e.title),value:e.name})),[]),I=(0,es.useCallback)(()=>{let{availableFieldInterfaces:e}=u(r.template)||{},{exclude:t,include:n}=e||{},o=[];return F.forEach(e=>{if("systemInfo"===e.key)o.push({...e,children:e.children.filter(e=>!e.hidden&&("tableoid"!==e.value?"boolean"!=typeof r[e.value]||r[e.value]:(null==n?void 0:n.length)?n.includes(e.value):(null==c?void 0:c.dialect)==="postgres"))});else{let r=[];if(null==n?void 0:n.length)n.forEach(t=>{var n;let o=null==e||null==(n=e.children)?void 0:n.find(e=>[t,t.interface].includes(e.name));o&&r.push({...o,targetScope:null==t?void 0:t.targetScope})});else if(null==t?void 0:t.length){var l;r=null==e||null==(l=e.children)?void 0:l.filter(e=>!t.includes(e.name))}else r=null==e?void 0:e.children;(null==r?void 0:r.length)&&o.push({...e,children:r})}}),o},[u,r]),P=(0,es.useMemo)(()=>I().map(e=>{var t;return(null==e||null==(t=e.children)?void 0:t.length)===0?null:"view"===r.template?{type:"group",label:C(e.label),title:C(e.label),key:e.label,children:e.children.filter(e=>["m2o","custom","m2m"].includes(e.name)).map(e=>({label:C(e.title),title:C(e.title),key:e.name,dataTargetScope:e.targetScope}))}:{type:"group",label:C(e.label),title:C(e.label),key:e.label,children:null==e?void 0:e.children.filter(e=>!["o2o","subTable","linkTo"].includes(e.name)).map(e=>({label:C(e.title),title:C(e.title),key:e.name,dataTargetScope:e.targetScope}))}}).filter(e=>{var t;return null==e||null==(t=e.children)?void 0:t.length}),[I]),T=(0,es.useMemo)(()=>({style:{maxHeight:"60vh",overflow:"auto"},onClick:e=>{let t=e.item.props["data-targetScope"];t&&v(t);let n=((e,t,n)=>{if(!e)return;let o=(0,ed.cloneDeep)(e.properties);if(!0===e.hasDefaultValue){var l;o.defaultValue=(0,ed.cloneDeep)(null==e||null==(l=e.default)?void 0:l.uiSchema),o.defaultValue.required=!1,o.defaultValue.title=n('{{ t("Default value") }}'),o.defaultValue["x-decorator"]="FormItem",o.defaultValue["x-reactions"]=[{dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}},{dependencies:["primaryKey","unique","autoIncrement"],when:"{{$deps[0]||$deps[1]||$deps[2]}}",fulfill:{state:{hidden:!0,value:null}},otherwise:{state:{hidden:!1}}}]}let r={name:"f_".concat((0,ec.uid)()),...(0,ed.cloneDeep)(e.default),interface:e.name};return r.reverseField&&(r.reverseField.name="f_".concat((0,ec.uid)())),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues:e=>ek(()=>Promise.resolve({data:r}),e)},title:"".concat(n(t.title)," - ").concat(n('{{ t("Add field") }}')),properties:{summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}},...o,description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCollectionField }}"}}}}}}}}})(d(e.key),r,C);n&&(b(n),x(!0))},items:P}),[d,P,r]),N=(0,es.useMemo)(()=>j.filter(e=>["string","bigInt","integer"].includes(e.type)).map(e=>{var t;return{value:e.name,label:C(null==(t=e.uiSchema)?void 0:t.title)}}),[null==j?void 0:j.length]);return"sql"!==r.template&&(0,A.jsx)(m1,{record:r,children:(0,A.jsxs)(ct,{value:{visible:h,setVisible:x},children:[(0,A.jsx)(nX.A,{getPopupContainer:l,trigger:a,align:s,menu:T,children:i||(0,A.jsx)(e3.Ay,{icon:(0,A.jsx)(sF.A,{}),type:"primary",children:S("Add field")})}),(0,A.jsx)(al,{schema:y,components:{...g,ArrayTable:eh.ArrayTable},scope:{getContainer:l,useCancelAction:hr,createOnly:!0,isOverride:!1,override:!1,useCreateCollectionField:xe,record:r,showReverseFieldConfig:!0,targetScope:f,collections:k,isDialect:w,disabledJSONB:!1,scopeKeyOptions:N,createMainOnly:!0,...o}})]})})};var xo=n(77579),xl=n.n(xo);let xr=()=>{let e=(0,ec.useForm)(),{refreshCM:t}=sO(),n=co(),{refresh:o}=hn(),{resource:l,targetKey:r}=hl(),{[r]:i}=m3();return{async run(){await e.submit();let r=eQ()(e.values);r.autoCreateReverseField||delete r.reverseField,delete r.autoCreateReverseField,await l.update({filterByTk:i,values:r}),n.setVisible(!1),await e.reset(),o(),await t()}}},xi=e=>{let t=m3(),n=tG();return(0,A.jsx)(xa,{item:t,parentItem:n,...e})},xa=e=>{let{scope:t,getContainer:n,item:o,parentItem:l,children:r,...i}=e,{getInterface:a,collections:s,getCollection:c}=sO(),[d,u]=(0,es.useState)(!1),[p,m]=(0,es.useState)({}),h=eC(),{t:x}=(0,eT.useTranslation)(),f=eB(),[v,y]=(0,es.useState)({}),{isDialect:b}=hJ(),C=(0,es.useMemo)(()=>(null==o?void 0:o.fields)||c(o.collectionName).options.fields.filter(e=>"select"===e.interface).map(e=>{var t;return{value:e.name,label:f(null==(t=e.uiSchema)?void 0:t.title)}}),[o.name]),S=(0,es.useMemo)(()=>s.map(e=>({label:f(e.title),value:e.name})),[]);return(0,A.jsx)(m1,{record:o,parent:l,children:(0,A.jsxs)(ct,{value:{visible:d,setVisible:u},children:[(0,A.jsx)("a",{...i,onClick:async()=>{let{data:e}=await h.resource("collections.fields",o.collectionName).get({filterByTk:o.name,appends:["reverseField"]});y(null==e?void 0:e.data);let t=a(o.interface),n=eQ()(null==e?void 0:e.data)||{};if(!(null==n?void 0:n.reverseField)){var l,r;n.autoCreateReverseField=!1,n.reverseField=null==t||null==(l=t.default)?void 0:l.reverseField,xl()(n.reverseField,"name","f_".concat((0,ec.uid)())),xl()(n.reverseField,"uiSchema.title",null==(r=o.__parent)?void 0:r.title)}m(((e,t,n,o)=>{var l;if(!e)return;let r=eQ()(e.properties);return(null==r?void 0:r.name)&&(r.name["x-disabled"]=!0),!0===e.hasDefaultValue&&(r.defaultValue=eQ()(e.default.uiSchema)||{},r.defaultValue.required=!1,r.defaultValue.title=n('{{ t("Default value") }}'),r.defaultValue["x-decorator"]="FormItem",r.defaultValue["x-reactions"]=[{dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}},{dependencies:["primaryKey","unique","autoIncrement"],when:"{{$deps[0]||$deps[1]||$deps[2]}}",fulfill:{state:{hidden:!0,value:void 0}},otherwise:{state:{hidden:!1}}}]),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues:t=>ek(()=>Promise.resolve({data:eQ()(e0()(e.default,["uiSchema.rawTitle"]))}),t)},title:"".concat(n(null==(l=t.__parent)?void 0:l.title)," - ").concat(n('{{ t("Edit field") }}')),properties:{summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}},...r,description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionField }}"}}}}}}}}})({...t,default:n},o,f,0)),u(!0)},children:r||x("Edit")}),(0,A.jsx)(al,{schema:p,components:{...g,ArrayTable:eh.ArrayTable},scope:{getContainer:n,useUpdateCollectionField:xr,useCancelAction:hr,showReverseFieldConfig:!(null==v?void 0:v.reverseField),collections:S,isDialect:b,disabledJSONB:!0,scopeKeyOptions:C,createMainOnly:!0,...t}})]})})},xs=()=>{let e=(0,ec.useForm)(),{refreshCM:t}=sO(),n=co(),{refresh:o}=hn(),{resource:l}=hl();return{async run(){await e.submit();let r=eQ()(e.values),i=(0,ed.omit)(r,["key","uiSchemaUid","collectionName","autoCreateReverseField","uiSchema.x-uid","reverseField","reverseKey","parentKey"]);await l.create({values:i}),n.setVisible(!1),await e.reset(),o(),await t()}}},xc=e=>{let t=m3(),n=tG();return(0,A.jsx)(xd,{item:t,parentItem:n,...e})},xd=e=>{var t;let{scope:n,getContainer:o,item:l,parentItem:r,children:i,currentCollection:a}=e,{target:s,through:c}=l,{getInterface:d,getCurrentCollectionFields:u,getChildrenCollections:p,collections:m}=sO(),[h,x]=(0,es.useState)(!1),[f,v]=(0,es.useState)({}),y=eC(),{t:b}=(0,eT.useTranslation)(),C=eB(),S=e=>{var t;return e&&(null==(t=p(e))?void 0:t.map(e=>e.name).concat([e]))},[w,F]=(0,es.useState)({}),j=(t=u(a),t.find(e=>e.name===l.name)),k=(0,es.useMemo)(()=>m.map(e=>({label:C(e.title),value:e.name})),[]);return(0,A.jsx)(m1,{record:{...l,collectionName:r.name},parent:r,children:(0,A.jsxs)(ct,{value:{visible:h,setVisible:x},children:[(0,A.jsx)("a",{disabled:j,onClick:async()=>{if(!j){let{data:t}=await y.resource("collections.fields",l.collectionName).get({filterByTk:l.name,appends:["reverseField"]});F(null==t?void 0:t.data);let n=d(l.interface),o=eQ()(null==t?void 0:t.data)||{};if(!(null==o?void 0:o.reverseField)){var e;o.autoCreateReverseField=!1,o.reverseField=null==(e=n.default)?void 0:e.reverseField,(0,ed.set)(o.reverseField,"name","f_".concat((0,ec.uid)())),(0,ed.set)(o.reverseField,"uiSchema.title",l.__parent.title)}v(((e,t,n,o)=>{var l;if(!e)return;let r=eQ()(e.properties);return r.name["x-disabled"]=!0,!0===e.hasDefaultValue&&(r.defaultValue=eQ()(e.default.uiSchema),r.defaultValue.title=n('{{ t("Default value") }}'),r.defaultValue["x-decorator"]="FormItem"),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:t=>ek(()=>Promise.resolve({data:eQ()(e.default)}),t)},title:"".concat(n(null==(l=t.__parent)?void 0:l.title)," - ").concat(n('{{ t("Override field") }}')),properties:{summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}},...r,description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useOverridingCollectionField }}"}}}}}}}}})({...n,default:o},l,C,0)),x(!0)}},children:i||b("Override")}),(0,A.jsx)(al,{schema:f,components:{...g,ArrayTable:eh.ArrayTable},scope:{getContainer:o,useOverridingCollectionField:xs,useCancelAction:hr,showReverseFieldConfig:!(null==w?void 0:w.reverseField),createOnly:!0,override:!0,isOverride:!0,targetScope:{target:S(s),through:S(c)},collections:k,...n}})]})})},xu=e=>{let t=m3(),n=tG();return(0,A.jsx)(xp,{item:t,parentItem:n,...e})},xp=e=>{let{scope:t,getContainer:n,item:o,parentItem:l,children:r}=e,{getInterface:i,collections:a}=sO(),[s,c]=(0,es.useState)(!1),[d,u]=(0,es.useState)({}),p=eC(),{t:m}=(0,eT.useTranslation)(),h=eB(),[x,f]=(0,es.useState)({}),v=(0,es.useMemo)(()=>a.map(e=>({label:h(e.title),value:e.name})),[]);return(0,A.jsx)(m1,{record:o,parent:l,children:(0,A.jsxs)(ct,{value:{visible:s,setVisible:c},children:[(0,A.jsx)("a",{onClick:async()=>{let{data:e}=await p.resource("collections.fields",o.collectionName).get({filterByTk:o.name,appends:["reverseField"]});f(null==e?void 0:e.data);let t=i(o.interface),n=eQ()(null==e?void 0:e.data)||{};if(!(null==n?void 0:n.reverseField)){var l;n.autoCreateReverseField=!1,n.reverseField=null==(l=t.default)?void 0:l.reverseField,xl()(n.reverseField,"name","f_".concat((0,ec.uid)())),xl()(n.reverseField,"uiSchema.title",o.__parent.title)}u(((e,t,n,o)=>{var l;if(!e)return;let r=eQ()(e.properties);return r.name["x-disabled"]=!0,!0===e.hasDefaultValue&&(r.defaultValue=eQ()(e.default.uiSchema),r.defaultValue.title=n('{{ t("Default value") }}'),r.defaultValue["x-decorator"]="FormItem"),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues:t=>ek(()=>Promise.resolve({data:eQ()(e.default)}),t)},title:"".concat(n(null==(l=t.__parent)?void 0:l.title)," - ").concat(n('{{ t("View") }}')),properties:{summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}},...r,description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"}}}}}})({...t,default:n},o,h,0)),c(!0)},children:r||m("View")}),(0,A.jsx)(al,{schema:d,components:{...g,ArrayTable:eh.ArrayTable},scope:{getContainer:n,showReverseFieldConfig:!(null==x?void 0:x.reverseField),createOnly:!1,collections:v,...t}})]})})};var xm=n(50982),xh=n(84598);let xx=(0,ec.observer)(e=>{let{schema:t,label:n}=e,o=eB(),l=(0,xh.G)(),r=(0,es.useMemo)(()=>({container:{backgroundColor:l.colorFillAlter,marginBottom:l.marginLG,padding:l.paddingSM+l.paddingXXS},title:{color:l.colorText},description:{marginTop:l.marginXS,color:l.colorTextDescription},tag:{background:"none"}}),[l.colorFillAlter,l.colorText,l.colorTextDescription,l.marginLG,l.marginXS,l.paddingSM,l.paddingXXS]);return t?(0,A.jsxs)("div",{style:r.container,children:[(0,A.jsxs)("div",{style:r.title,children:[n,": ",(0,A.jsx)(nz.A,{style:r.tag,children:o(t.title)})]}),t.description?(0,A.jsx)("div",{style:r.description,children:o(t.description)}):null]}):null},{displayName:"Summary"}),xf=e=>{let{t}=(0,eT.useTranslation)(),{getTemplate:n}=sO(),o=(0,es.useMemo)(()=>n(e.schemaKey),[n,e.schemaKey]);return(0,A.jsx)(xx,{label:t("Collection template"),schema:o})};xf.displayName="TemplateSummary";var xv=n(45573),xg=n(96258);let{Dragger:xy}=xg.A,xb=e=>{let t,{t:n}=(0,eT.useTranslation)(),{refreshCM:o}=sO(),{close:l}=e,{refresh:r,state:{category:i}}=hn(),a={multiple:!1,action:"/collections:importMeta",data:(null==i?void 0:i[0])&&{category:i[0]}||{},async onChange(e){e.fileList.length>1&&e.fileList.splice(0,e.fileList.length-1);let{status:t}=e.file;"done"===t?(l(),cg.Ay.success("".concat(e.file.name," ")+n("file uploaded successfully")),r(),await o()):"error"===t&&cg.Ay.error("".concat(e.file.name," ")+n("file upload failed"))},onDrop(e){console.log("Dropped files",e.dataTransfer.files)}};return(0,A.jsxs)(xy,{...(t=eC(),{...a,customRequest(e){let{action:n,data:o,file:l,filename:r,headers:i,onError:a,onProgress:s,onSuccess:c,withCredentials:d}=e,u=new FormData;return o&&Object.keys(o).forEach(e=>{u.append(e,o[e])}),u.append(r,l),t.axios.post(n,u,{withCredentials:d,headers:i,onUploadProgress:e=>{let{total:t,loaded:n}=e;s({percent:Math.round(n/t*100).toFixed(2)},l)}}).then(e=>{let{data:t}=e;c(t,l)}).catch(a).finally(()=>{}),{abort(){console.log("upload progress is aborted.")}}},onChange:e=>{var t;null==(t=a.onChange)||t.call(a,e)}}),children:[(0,A.jsx)("p",{className:"ant-upload-drag-icon",children:(0,A.jsx)(xv.A,{})}),(0,A.jsxs)("p",{className:"ant-upload-text",children:[" ",n("Click or drag file to this area to upload")]})]})},xC=es.forwardRef((e,t)=>{let{t:n}=(0,eT.useTranslation)(),[o,l]=(0,es.useState)(["required"]),[r,i]=(0,es.useState)(!1),[a,s]=(0,es.useState)(!1),c=()=>{i(!0)};(0,es.useImperativeHandle)(t,()=>({showModal:c}));let d=()=>{i(!1),l(["required"])};return(0,A.jsx)(A.Fragment,{children:(0,A.jsx)(ox.A,{title:n("Import"),width:800,footer:void 0,open:r,onOk:d,onCancel:d,children:(0,A.jsx)(eD.A,{spinning:a,children:(0,A.jsx)(xb,{close:d})})})})});var xS=n(42625);let xw=()=>{let e=(0,ec.useForm)(),t=co(),n=(0,ec.useField)(),o=eC(),{refresh:l}=hn(),{refreshCM:r}=sO(),{t:i}=(0,eT.useTranslation)();return{async onClick(){n.data=n.data||{},n.data.loading=!0;try{await e.submit();let{collectionData:i,...a}=(0,ed.cloneDeep)(e.values);a.autoCreateReverseField||delete a.reverseField,delete a.autoCreateReverseField,await o.resource("collections").create({values:{logging:!0,...a}}),o.resource("".concat(a.name)).create({values:i}),t.setVisible(!1),null==l||l(),await r(),n.data.loading=!1}catch(e){n.data.loading=!1,cg.Ay.error(i("Operation failed"))}}}};var xF=n(98019);let xj=es.createContext({}),xA=()=>{let e=(0,ec.useForm)(),{value:t,setFormValue:n}=es.useContext(xj),o=co(),{t:l}=(0,eT.useTranslation)();return{async onClick(){await e.submit();let r=(0,ed.cloneDeep)(e.values);r.autoCreateReverseField||delete r.reverseField,delete r.autoCreateReverseField;let{index:i,...a}=r;i<0||i>=t.length?cg.Ay.error("Invalid field index"):(((e,o)=>{let r=[...t];if(o.primaryKey){let t=r.find((t,n)=>!0===t.primaryKey&&n!==e);if(t)return cg.Ay.error(l("existingPrimaryKeyError",{name:t.name}))}r[e]=o,n(r)})(i,a),o.setVisible(!1))}}},xk=e=>{let{scope:t,getContainer:n,record:o,parentItem:l,children:r,handleUiSchemaChange:i,...a}=e,{getInterface:s,collections:c,getCollection:d}=sO(),[u,p]=(0,es.useState)(!1),[m,h]=(0,es.useState)({});eC();let{t:x}=(0,eT.useTranslation)(),f=eB(),[v,y]=(0,es.useState)({record:o}),{isDialect:b}=hJ();return(0,A.jsx)(m1,{record:o,parent:l,children:(0,A.jsxs)(ct,{value:{visible:u,setVisible:p},children:[(0,A.jsx)("a",{...a,onClick:async()=>{y(o);let e=s(o.interface),t=(0,ed.cloneDeep)(o)||{};if(!(null==t?void 0:t.reverseField)){var l;t.autoCreateReverseField=!1,t.reverseField=null==e||null==(l=e.default)?void 0:l.reverseField,(0,ed.set)(t.reverseField,"name",o.name),(0,ed.set)(t,"uiSchema.title",o.uiSchema.title)}h(xI({...e,default:t},o,f,n)),p(!0)},children:r||x("Edit")}),(0,A.jsx)(al,{schema:m,components:{...g,ArrayTable:eh.ArrayTable},scope:{getContainer:n,useCancelAction:hr,showReverseFieldConfig:!(null==v?void 0:v.reverseField),isDialect:b,setUpdateXlsxCollectionField:xA,disabledJSONB:!0,createMainOnly:!0,...t}})]})})},xI=(e,t,n,o)=>{if(!e)return;let l=(0,ed.cloneDeep)(e.properties);return(null==l?void 0:l.name)&&(l.name["x-disabled"]=!0),!0===e.hasDefaultValue&&(l.defaultValue=(0,ed.cloneDeep)(e.default)||{},l.defaultValue.required=!1,l.defaultValue.title=n('{{ t("Default value") }}'),l.defaultValue["x-decorator"]="FormItem",l.defaultValue["x-reactions"]=[{dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}},{dependencies:["primaryKey","unique","autoIncrement"],when:"{{$deps[0]||$deps[1]||$deps[2]}}",fulfill:{state:{hidden:!0,value:void 0}},otherwise:{state:{hidden:!1}}}]),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:o},"x-decorator":"Form","x-decorator-props":{useValues:t=>ek(()=>Promise.resolve({data:(0,ed.cloneDeep)((0,ed.omit)(e.default,["uiSchema.rawTitle"]))}),t)},title:"".concat(n(t.uiSchema.title)," - ").concat(n('{{ t("Edit field") }}')),properties:{summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}},...l,description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":"setUpdateXlsxCollectionField"}}}}}}}},xP=(0,ec.observer)(e=>{let{filedata:t}=e,{fields:n,data:o}=t;tr();let{t:l}=(0,eT.useTranslation)(),r=h7(),i=eB(),[a,s]=(0,es.useState)(),c=(0,ec.useForm)(),[d,u]=(0,es.useState)(n),{getInterface:p}=sO(),m=(e,t)=>{var n;let o=p(e)||{},l=(0,ed.cloneDeep)(o);return{...(null==l||null==(n=l.default)?void 0:n.uiSchema)||{},title:t}},h=async(e,t)=>{let{type:n,name:r,uiSchema:i}=e,a=[...o],s=!1;e.interface=await {json:"json",boolean:"checkbox",string:"input",integer:"integer",float:"number",date:"datetime"}[n]||null;let c=await m(e.interface,i.title);if(e.uiSchema=c,a.forEach((e,t)=>{try{void 0!==e[r]&&(e[r]=f(e[r],n))}catch(e){s=!0,cg.Ay.error("Row ".concat(t+1,", Column ").concat(i.title,": ").concat(e.message))}}),!s){cg.Ay.success("".concat(l("Fields"),' "').concat(i.title,'"').concat(l("Converted to")," ").concat(n));let o=[...d];o[t]=e,u(o)}},x=async(e,t)=>{let n=await m(e.interface,e.uiSchema.title);e.uiSchema=n;let o=[...d];o[t]=e,u(o)},f=(e,t)=>{try{switch(t){case"boolean":if("true"===e.toLowerCase())return!0;if("false"===e.toLowerCase())return!1;throw Error("Invalid boolean");case"integer":if(!/^-?\d+$/.test(e))throw Error("Invalid integer");return parseInt(e,10);case"float":if(!/^-?\d+(\.\d+)?$/.test(e))throw Error("Invalid number");return Number(e);case"json":return JSON.parse(e);case"date":if(isNaN(Date.parse(e)))throw Error("Invalid date");return new Date(e);default:if(null==e||""===e)return"";return e.toString()}}catch(e){throw Error("Type conversion error: ".concat(e.message))}},v=[{title:l("Field display name"),dataIndex:"title",key:"title",render:(e,t,n)=>{let o=d[n];return(0,A.jsx)(nJ.A,{value:o.uiSchema.title||e,onChange:e=>{var t;let l;return t={...o,uiSchema:{title:e.target.value}},void((l=[...d])[n]=t,u(l))}})}},{title:l("Field name"),dataIndex:"name",key:"name",render:(e,t,n)=>{let o=d[n];return(0,A.jsx)(nJ.A,{value:o.name||e,variant:"borderless",disabled:!0})}},{title:l("Field type"),dataIndex:"type",key:"type",render:(e,t,n)=>{let o=d[n];return(0,A.jsx)(oo.A,{value:o.type||e,onChange:e=>h({...o,type:e},n),options:[{value:"string",label:(0,A.jsx)("span",{children:"string"})},{value:"boolean",label:(0,A.jsx)("span",{children:"boolean"})},{value:"integer",label:(0,A.jsx)("span",{children:"integer"})},{value:"float",label:(0,A.jsx)("span",{children:"float"})},{value:"json",label:(0,A.jsx)("span",{children:"json"})},{value:"date",label:(0,A.jsx)("span",{children:"date"})}]})}},{title:l("Field interface"),dataIndex:"interface",key:"interface",render:(e,t,n)=>{var o,l;let a,s=d[n],c=(o=r,l=s.type,a=[],o.forEach(e=>{let t=e.children.filter(e=>{var t;return null==e||null==(t=e.availableTypes)?void 0:t.includes(l)});a.push({label:e.label,key:e.key,children:t})}),a.filter(e=>"sort"===l?"advanced"===e.key:e.children.length>0)).map(e=>({label:(0,A.jsx)("span",{children:i(e.label)}),title:e.key,options:e.children.map(e=>({label:(0,A.jsx)("span",{children:i(e.label)}),value:e.name}))}));return(0,A.jsx)(oo.A,{"aria-label":"field-interface-".concat(null==s?void 0:s.type),role:"button",value:s.interface,popupMatchSelectWidth:!1,onChange:e=>x({...s,interface:e},n),options:c})}},{dataIndex:"titleField",title:l("Title field"),render:function(e,t,n){var o;let r=d[n];return!r.isForeignKey&&(null==(o=p(r.interface))?void 0:o.titleUsable)?(0,A.jsx)(iV.A,{title:l("Default title for each record"),placement:"right",overlayInnerStyle:{textAlign:"center"},children:(0,A.jsx)(oh.A,{"aria-label":"switch-title-field-".concat(r.name),size:"small",checked:r.name===a,onChange:e=>{let t;s(t=e?r.name:null),c.setValuesIn("titleField",t)}})}):null}},{title:l("Description"),dataIndex:"description",key:"description",render:(e,t,n)=>{let o=d[n];return(0,A.jsx)(nJ.A.TextArea,{value:o.description,variant:"borderless",disabled:!0})}},{title:l("Actions"),dataIndex:"actions",key:"actions",render:(t,n,o)=>{let l=d[o];return(0,A.jsx)(of.A,{size:"middle",children:(0,A.jsx)(xk,{record:{index:o,...l},...e})})}}],g=d.map(e=>({title:e.uiSchema.title,dataIndex:e.name,key:e.name,render:t=>{if("boolean"==typeof t)return t?"True":"False";if("date"===e.type&&t)return new Date(t).toLocaleString();if("json"===e.type&&t)try{return"string"==typeof t?t:JSON.stringify(t,null,2)}catch(e){return"Invalid JSON"}return t},width:200}));return(0,es.useEffect)(()=>{c.setValuesIn("fields",d),c.setValuesIn("collectionData",t.data)},[d]),(0,A.jsxs)(xj.Provider,{value:{value:d,setFormValue:u},children:[(0,A.jsx)(xF.A,{bordered:!0,size:"small",columns:v,dataSource:d,scroll:{y:300},pagination:!1,rowClassName:"row",rowKey:"uid",style:{marginBottom:"16px"},...e}),(0,A.jsxs)("div",{style:{fontWeight:"bold",marginBottom:"10px"},children:[l("Preview"),":"]}),(0,A.jsx)(xF.A,{bordered:!0,size:"small",columns:g,dataSource:t.data,scroll:{y:300,x:"max-content"},rowKey:"name"})]})},{displayName:"FieldsConfigure"}),xT=(0,ec.observer)(e=>{let{filedata:t}=e,{t:n}=(0,eT.useTranslation)(),o=t.fields.map(e=>({title:e.uiSchema.title,dataIndex:e.name,key:e.name,render:e=>e,width:200}));return(0,A.jsx)(xF.A,{bordered:!0,size:"small",columns:o,dataSource:t.data,scroll:{y:300,x:"max-content"},pagination:!1,rowKey:"name"})},{displayName:"PreviewTable"}),{Dragger:xN}=xg.A,xM=e=>{let{t}=(0,eT.useTranslation)(),{close:n}=e,{getInterface:o}=sO(),[l,r]=(0,es.useState)([]),[i,a]=(0,es.useState)({}),[s,c]=(0,es.useState)(!1),[d,u]=(0,es.useState)({});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(xN,{maxCount:1,...{onRemove:e=>{let t=l.indexOf(e),n=l.slice();n.splice(t,1),r(n)},beforeUpload:e=>{let n;return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===e.type||e.name.endsWith(".xlsx")||e.name.endsWith(".xls")?((n=new FileReader).onload=async e=>{let t=e.target.result,n=xS.LF(t,{type:"binary"}),l=n.SheetNames[0],r=n.Sheets[l],i=xS.Wp.sheet_to_json(r,{header:1});if(0===i.length)return;let s=i[0],c=i.slice(1),d=await Promise.all(s.map(async(e,t)=>{let n=((e,t)=>{if(/date|time|日期/i.test(t)&&e.every(e=>P()(e).isValid()))return"date";let n=Object.keys(e.map(e=>{if(null!=e){let t=e.toString().toLowerCase();if("true"===t||"yes"===t||"false"===t||"no"===t)return"boolean"}let t=Number(e);if(!isNaN(t))return Number.isInteger(t)?"integer":"float";try{return JSON.parse(e),"json"}catch{}return"string"}).reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{}));return n.length>1?"string":n[0]})(c.map(e=>e[t]),e),l=n?((e,t)=>{switch(e){case"json":return"json";case"boolean":return"checkbox";case"string":return"input";case"integer":return"integer";case"float":return"number";case"date":return"datetime";default:return null}})(n,0):null,r=l?o(l):null,i=(0,ed.cloneDeep)(r),a=(null==i?void 0:i.default.uiSchema)||{};return{name:"f_".concat((0,ec.uid)()),type:n,interface:l,uiSchema:{title:e,...a}}})),u=c.map((e,t)=>s.reduce((n,o,l)=>{var r,i;let a=null==(r=d[l])?void 0:r.name,s=null==(i=d[l])?void 0:i.type;if(a&&s)try{let t=((e,t)=>{try{switch(t){case"boolean":{let t=e.toString().toLowerCase();if("true"===t||"yes"===t)return!0;if("false"===t||"no"===t)return!1;throw Error("Invalid boolean")}case"integer":if(!/^-?\d+$/.test(e))throw Error("Invalid integer");return parseInt(e,10);case"float":if(!/^-?\d+(\.\d+)?$/.test(e))throw Error("Invalid number");return Number(e);case"json":return JSON.parse(e);case"date":if(isNaN(Date.parse(e)))throw Error("Invalid date");return new Date(e);default:if(null==e||""===e)return"";return e.toString()}}catch(e){throw Error("Type conversion error: ".concat(e.message))}})(e[l],s);n[a]=t}catch(e){n[a]=null,cg.Ay.error('Error in column "'.concat(o,'" at row ').concat(t+1,": ").concat(e.message))}return n},{}));a({fields:d,data:u})},n.readAsBinaryString(e),r([e]),!1):(cg.Ay.error(t("You can only upload Excel files!")),xg.A.LIST_IGNORE)},fileList:l},children:[(0,A.jsx)("p",{className:"ant-upload-drag-icon",children:(0,A.jsx)(xv.A,{})}),(0,A.jsxs)("p",{className:"ant-upload-text",children:[" ",t("Click or drag file to this area to upload")]})]}),(0,A.jsxs)(ct,{value:{visible:s,setVisible:c},children:[(0,A.jsx)(e3.Ay,{type:"primary",onClick:async()=>{var e;u({type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-decorator":"FormV2","x-component":"Action.Drawer","x-component-props":{width:"70%"},"x-use-component-props":"useFormBlockProps",properties:{action:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{justifyContent:"right"}},properties:{cancel:{title:"Cancel","x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit"},"x-use-component-props":"xlsxImportAction"}}},title:{type:"string",default:null==(e=l[0])?void 0:e.name.replace(/\.[^/.]+$/,""),title:'{{ t("Collection display name") }}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Collection name")}}',default:'{{ useNewId("t_") }}',required:!0,"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 an letter.')}}"},category:{title:'{{t("Categories")}}',type:"hasMany",name:"category","x-decorator":"FormItem","x-component":"Select","x-component-props":{mode:"multiple"},"x-reactions":["{{useAsyncDataSource(loadCategories)}}"]},description:{title:'{{t("Description")}}',type:"string",name:"description","x-decorator":"FormItem","x-component":"Input.TextArea"},fields:{type:"array",title:'{{t("Fields")}}',default:i.fields,"x-decorator":"FormItem","x-component":"xlsxFieldsConfigure","x-component-props":{filedata:i},required:!0}}}}}),c(!0),n()},disabled:0===l.length,style:{marginTop:16},children:t("Upload")}),(0,A.jsx)(al,{schema:d,components:{xlsxFieldsConfigure:xP},scope:{xlsxPreviewTable:xT,xlsxImportAction:xw}})]})]})},xD=es.forwardRef((e,t)=>{let{t:n}=(0,eT.useTranslation)(),[o,l]=(0,es.useState)(!1),[r,i]=(0,es.useState)(!1),a=()=>{l(!0)};(0,es.useImperativeHandle)(t,()=>({showModal:a}));let s=()=>{l(!1)};return(0,A.jsx)(A.Fragment,{children:(0,A.jsx)(cx.A,{title:n("Import collection"),footer:void 0,open:o,onClose:s,children:(0,A.jsx)(eD.A,{spinning:r,children:(0,A.jsx)(xM,{close:s})})})})}),xR=e=>{let t=(0,ec.useForm)(),{refreshCM:n}=sO(),o=co(),{refresh:l}=hn(),{resource:r}=hl(),i=(0,ec.useField)();return{async run(){i.data=i.data||{},i.data.loading=!0;try{var a;await t.submit();let s=(0,ed.cloneDeep)(t.values);(null==e||null==(a=e.events)?void 0:a.beforeSubmit)&&e.events.beforeSubmit(s),s.autoCreateReverseField||delete s.reverseField,delete s.autoCreateReverseField,await r.create({values:{logging:!0,...s}}),o.setVisible(!1),await t.reset(),i.data.loading=!1,l(),await n()}catch(e){i.data.loading=!1}}}},xq=e=>{let t=m3();return(0,A.jsx)(x_,{item:t,...e})},x_=e=>{let{scope:t,getContainer:n,item:o,children:l,trigger:r,align:i}=e,{getTemplate:a,templates:s}=sO(),[c,d]=(0,es.useState)(!1),[u,p]=(0,es.useState)({}),m=eB(),{t:h}=(0,eT.useTranslation)(),x=(0,es.useRef)(null),f=(0,es.useRef)(null),v=(0,es.useMemo)(()=>{let e=[];return s.forEach(t=>{t.divider&&e.push({type:"divider"}),e.push({label:m(t.title),key:t.name})}),e},[s]),{state:{category:y}}=hn(),b=(0,es.useMemo)(()=>({style:{maxHeight:"60vh",overflow:"auto"},onClick:e=>{var t,n;if("import"===e.key){null==(t=x.current)||t.showModal();return}if("importXlsx"===e.key){null==(n=f.current)||n.showModal();return}p(((e,t,n)=>{if(!e)return;let o=(0,ed.cloneDeep)(e.configurableProperties);!0===e.hasDefaultValue&&(o.defaultValue=(0,ed.cloneDeep)(e.default.uiSchema),o.defaultValue.title=n('{{ t("Default value") }}'),o.defaultValue["x-decorator"]="FormItem");let l={name:"t_".concat((0,ec.uid)()),template:e.name,view:"view"===e.name,category:t,...(0,ed.cloneDeep)(e.default)};return l.reverseField&&(l.reverseField.name="f_".concat((0,ec.uid)())),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues:e=>ek(()=>Promise.resolve({data:l}),e)},title:'{{ t("Create collection") }}',properties:{summary:{type:"void","x-component":"TemplateSummay","x-component-props":{schemaKey:e.name}},...o,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:()=>xR(e)}}}}}}}}})(a(e.key),y,m)),d(!0)},items:v}),[y,v,x,f]);return(0,A.jsxs)(m1,{record:o,children:[(0,A.jsxs)(ct,{value:{visible:c,setVisible:d},children:[(0,A.jsx)(nX.A,{getPopupContainer:n,trigger:r,align:i,menu:b,children:l||(0,A.jsxs)(e3.Ay,{icon:(0,A.jsx)(sF.A,{}),type:"primary",children:[h("Create collection")," ",(0,A.jsx)(xm.A,{})]})}),(0,A.jsx)(al,{schema:u,components:{...g,ArrayTable:eh.ArrayTable,TemplateSummay:xf},scope:{getContainer:n,useCancelAction:hr,createOnly:!0,useCreateCollection:xR,record:o,showReverseFieldConfig:!0,...t}})]}),(0,A.jsx)(xC,{ref:x}),(0,A.jsx)(xD,{ref:f})]})},xO=e=>{let t=m3(),n=ek(()=>Promise.resolve({data:{...e0()(eQ()(t),["__parent","__collectionName"]),category:null==t?void 0:t.category.map(e=>e.id)}}),{...e,manual:!0}),o=co();return(0,es.useEffect)(()=>{o.visible&&n.run()},[o.visible]),n},xB=e=>{let{refreshCM:t}=sO(),n=(0,ec.useForm)(),o=co(),{refresh:l}=hn(),{resource:r,targetKey:i}=hl(),{[i]:a,template:s}=m3(),c=eC(),d="sql"===s?c.resource("sqlCollection"):r;return{async run(){await n.submit(),await d.update({filterByTk:a,values:"sql"===s?n.values:e0()(n.values,["fields"])}),o.setVisible(!1),await n.reset(),l(),await t()}}},xE=e=>{let t=m3();return(0,A.jsx)(xV,{item:t,...e})},xV=e=>{let{scope:t,getContainer:n,item:o,children:l,...r}=e,{getTemplate:i}=sO(),[a,s]=(0,es.useState)(!1),[c,d]=(0,es.useState)({}),{t:u}=(0,eT.useTranslation)(),p=eB();return(0,A.jsx)(m1,{record:o,children:(0,A.jsxs)(ct,{value:{visible:a,setVisible:s},children:[(0,A.jsx)("a",{...r,onClick:async()=>{d(((e,t,n,o)=>{if(!e)return;let l=eQ()(e.configurableProperties)||{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem"}};return!0===e.hasDefaultValue&&(l.defaultValue=eQ()(e.default.uiSchema),l.defaultValue.title=n('{{ t("Default value") }}'),l.defaultValue["x-decorator"]="FormItem"),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},title:'{{ t("Edit collection") }}',properties:{...l,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionActionAndRefreshCM }}"}}}}}}}}})({...i(o.template)},0,p,0)),s(!0)},children:l||u("Edit")}),(0,A.jsx)(al,{schema:c,components:{...g,ArrayTable:eh.ArrayTable},scope:{getContainer:n,useValuesFromRecord:xO,useUpdateCollectionActionAndRefreshCM:xB,useCancelAction:hr,createOnly:!1,...t}})]})})},xz=es.memo(e=>{let{databaseView:t,viewName:n,sources:o,schema:l}=e,{data:r}=(0,es.useContext)(m8),i=eC(),{t:a}=(0,eT.useTranslation)(),[s,c]=(0,es.useState)(!1),[d,u]=(0,es.useState)([]),[p,m]=(0,es.useState)([]),[h,x]=(0,es.useState)(o),f=(0,ec.useField)(),v=(0,ec.useForm)(),{getCollection:g,getInterface:y,getCollectionFields:b,getInheritCollections:C,getParentCollectionFields:S}=sO(),w=eB(),F=h7().filter(e=>!["relation","systemInfo"].includes(e.key));(0,es.useEffect)(()=>{let e=[];h.forEach(t=>{var n;let o=g(t),l=C(t).map(e=>{let n=S(e,t);return{type:"group",key:e,label:a("Parent collection fields")+a("(".concat(g(e).title,")")),children:n.filter(e=>!["hasOne","hasMany","belongsToMany"].includes(null==e?void 0:e.type)).map(e=>{var t;return{value:e.name,label:a(null==(t=e.uiSchema)?void 0:t.title)}})}}),r=null==(n=o.fields.filter(e=>!["hasOne","hasMany","belongsToMany"].includes(null==e?void 0:e.type)))?void 0:n.map(e=>{var t;return{value:e.name,key:e.name,label:a((null==(t=e.uiSchema)?void 0:t.title)||e.name)}}).concat(l);e.push({value:t,label:a(o.title||o.name),children:r})}),m(e)},[h,t]),(0,es.useEffect)(()=>{t&&(c(!0),i.resource("dbViews").get({filterByTk:n,schema:l}).then(e=>{let{data:t}=e;if(t){var n,o;c(!1),u([]);let e=null==(n=Object.values(null==t||null==(o=t.data)?void 0:o.fields))?void 0:n.map(e=>{var t,n;if(e.source){let n=(null==r?void 0:r.data.find(t=>t.name===e.name))||e;return{...e,uiSchema:{...(0,ed.omit)(n.uiSchema,"rawTitle"),title:(null==(t=n.uiSchema)?void 0:t.title)||n.name}}}{let t=(null==r?void 0:r.data.find(t=>t.name===e.name))||e;return{...t,uiSchema:{...(0,ed.omit)(t.uiSchema,"rawTitle"),title:(null==(n=t.uiSchema)?void 0:n.title)||t.name}}}});f.value=e,setTimeout(()=>{var n,o;u(e),v.setValuesIn("sources",null==(n=t.data)?void 0:n.sources),x(null==(o=t.data)?void 0:o.sources)})}}).catch)},[t]);let j=(e,t)=>{d.splice(t,1,e),u(d),f.value=d.map(e=>{var t,n,o;let l="string"==typeof e.source?e.source:null==(o=e.source)||null==(n=o.filter)||null==(t=n.call(o,Boolean))?void 0:t.join(".");return{...e,source:l}})},k=[{title:a("Field name"),dataIndex:"name",key:"name",width:130},{title:a("Field source"),dataIndex:"source",key:"source",width:200,render:(e,t,n)=>(0,A.jsx)(om.A,{defaultValue:"string"==typeof e?null==e?void 0:e.split("."):e,allowClear:!0,style:{width:"100%"},options:w(p),onChange:(e,o)=>{var l;let r=null==(l=b(null==e?void 0:e[0]))?void 0:l.find(t=>t.name===(0,ed.last)(e));j({...t,source:e,uiSchema:null==r?void 0:r.uiSchema},n)},placeholder:a("Select field source")})},{title:a("Field type"),dataIndex:"type",width:140,key:"type",render:(e,t,n)=>{let o=d[n];return(null==o?void 0:o.source)||!(null==o?void 0:o.possibleTypes)?(0,A.jsx)(nz.A,{children:e}):(0,A.jsx)(oo.A,{defaultValue:e,popupMatchSelectWidth:!1,style:{width:"100%"},options:(null==o?void 0:o.possibleTypes.map(e=>({label:e,value:e})))||[],onChange:e=>j({...o,type:e},n)})}},{title:a("Field interface"),dataIndex:"interface",key:"interface",width:150,render:(e,t,n)=>{var o;let l,r=d[n],i=(o=r.type,l=[],F.forEach(e=>{let t=e.children.filter(e=>{var t;return null==e||null==(t=e.availableTypes)?void 0:t.includes(o)});l.push({label:e.label,key:e.key,children:t})}),l.filter(e=>e.children.length>0));return r.source?e:(0,A.jsx)(oo.A,{defaultValue:e,style:{width:"100%"},popupMatchSelectWidth:!1,onChange:e=>{var t;let o=y(e);j({...r,interface:e,uiSchema:null==o||null==(t=o.default)?void 0:t.uiSchema},n)},children:i.map(e=>(0,A.jsx)(oo.A.OptGroup,{label:w(e.label),children:e.children.map(e=>(0,A.jsx)(oo.A.Option,{value:e.name,children:w(e.label)},e.value))},e.key))})}},{title:a("Field display name"),dataIndex:"title",key:"title",width:180,render:(e,t,n)=>{var o;let l=d[n];return(0,A.jsx)(nJ.A,{defaultValue:(null==l||null==(o=l.uiSchema)?void 0:o.title)||e,onChange:e=>j({...l,uiSchema:{...(0,ed.omit)(null==l?void 0:l.uiSchema,"rawTitle"),title:e.target.value}},n)})}}];return(0,A.jsx)(eD.A,{spinning:s,children:d.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"ant-formily-item-label",style:{display:"flex",padding:"0 0 8px"},children:[(0,A.jsx)("div",{className:"ant-formily-item-label-content",children:(0,A.jsx)("span",{children:(0,A.jsx)("label",{children:a("Fields")})})}),(0,A.jsx)("span",{className:"ant-formily-item-colon",children:":"})]}),(0,A.jsx)(xF.A,{bordered:!0,size:"middle",columns:k,dataSource:d,scroll:{y:300},pagination:!1,rowClassName:"editable-row"},n)]})})},function(e,t){return t.name===e.name&&t.sources===e.sources});xz.displayName="PreviewFields";let xL=["lineString","point","circle","polygon"],xG=e=>{let{databaseView:t,schema:n,viewName:o,fields:l}=e,[r,i]=(0,es.useState)([]),[a,s]=(0,es.useState)([]),c=eB(),[d,u]=(0,es.useState)(!1),{getInterface:p,getCollectionFields:m}=sO(),h=eC(),{t:x}=(0,eT.useTranslation)(),f=(0,ec.useForm)();(0,es.useEffect)(()=>{t&&v()},[o,n]),(0,es.useEffect)(()=>{i(g(l))},[f.values.fields]);let v=()=>{let e={};f.values.fields.map(t=>{xL.includes(t.type)&&(e[t.name]=t.type)}),u(!0),h.resource("dbViews").query({filterByTk:o,schema:n,fieldTypes:e}).then(e=>{let{data:t}=e;t&&(u(!1),s((null==t?void 0:t.data)||[]))}).catch},g=e=>{var t;return null==(t=e.filter(e=>e.source||e.interface))?void 0:t.map(e=>{var t,n,o,l,r,i;let a="string"==typeof(null==e?void 0:e.source)?null==e||null==(t=e.source)?void 0:t.split("."):null==e?void 0:e.source,s=null==(o=m(null==a?void 0:a[0]))||null==(n=o.find(e=>e.name===(null==a?void 0:a[1])))?void 0:n.uiSchema,d=(null==e||null==(l=e.uiSchema)?void 0:l.title)||(null==s?void 0:s.title)||e.name,u=e.source?s:null==(i=p(e.interface))||null==(r=i.default)?void 0:r.uiSchema;return{title:c(d),dataIndex:e.name,key:e.name,width:200,render:(t,n,o)=>{let l=n[e.name],r={type:"object",properties:{[e.name]:{name:"".concat(e.name),"x-component":u&&a?"CollectionField":"Input","x-read-pretty":!0,"x-collection-field":null==a?void 0:a.join("."),default:"json"===e.interface?JSON.stringify(l):l}}};return(0,A.jsx)(gi,{ellipsis:!0,children:(0,A.jsx)(ec.RecursionField,{schema:r,name:o,onlyRenderProperties:!0})})}}})};return(0,A.jsx)(eD.A,{spinning:d,children:(0,A.jsxs)("div",{style:{marginBottom:22},children:[(0,A.jsxs)("div",{className:"ant-formily-item-label",style:{marginTop:24,display:"flex",padding:"0 0 8px"},children:[(0,A.jsx)("div",{className:"ant-formily-item-label-content",children:(0,A.jsx)("span",{children:(0,A.jsx)("label",{children:x("Preview")})})}),(0,A.jsx)("span",{className:"ant-formily-item-colon",children:":"})]},o),(null==r?void 0:r.length)>0&&(0,A.jsx)(A.Fragment,{children:(0,A.jsx)(xF.A,{size:"middle",pagination:!1,bordered:!0,columns:r,dataSource:a,scroll:{x:1e3,y:300}},"".concat(o,"-preview"))})]})},"preview")},xK=()=>{let e=(0,ec.useForm)(),{refreshCM:t}=sO(),n=co(),{refresh:o}=hn(),{targetKey:l}=hl(),{[l]:r}=m3(),i=eC(),a=(0,ec.useField)();return{async run(){await e.submit(),a.data=a.data||{},a.data.loading=!0;try{await i.resource("collections").setFields({filterByTk:r,values:e.values}),n.setVisible(!1),await e.reset(),a.data.loading=!1,o(),await t()}catch(e){a.data.loading=!1}}}},x$=e=>{let t=m3();return(0,A.jsx)(xU,{item:t,...e})},xU=e=>{let{scope:t,getContainer:n,item:o,children:l}=e,[r,i]=(0,es.useState)(!1),[a,s]=(0,es.useState)({}),c=eB(),{t:d}=(0,eT.useTranslation)();return"view"===o.template&&(0,A.jsx)(m1,{record:o,children:(0,A.jsxs)(ct,{value:{visible:r,setVisible:i,drawerProps:{width:900}},children:[l||(0,A.jsx)(e3.Ay,{icon:(0,A.jsx)(sF.A,{}),onClick:e=>{let t=((e,t,n)=>{if(!e)return;let o=(0,ed.cloneDeep)(e.properties);if(!0===e.hasDefaultValue){var l;o.defaultValue=(0,ed.cloneDeep)(null==e||null==(l=e.default)?void 0:l.uiSchema),o.defaultValue.title=n('{{ t("Default value") }}'),o.defaultValue["x-decorator"]="FormItem"}let r={name:"f_".concat((0,ec.uid)()),...(0,ed.cloneDeep)(e.default),interface:e.name};return r.reverseField&&(r.reverseField.name="f_".concat((0,ec.uid)())),{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues:e=>ek(()=>Promise.resolve({data:r}),e)},title:"".concat(n('{{ t("Sync from database") }}')),properties:{schema:{type:"string","x-hidden":!0,default:null==t?void 0:t.schema},viewName:{type:"string","x-hidden":!0,default:null==t?void 0:t.viewName},fields:{type:"array","x-component":xz,"x-component-props":{...t},default:t.fields},preview:{type:"object","x-component":xG,"x-component-props":{...t},"x-reactions":{dependencies:["fields"],fulfill:{schema:{"x-component-props":"{{{...record,...$form.values}}}"}}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSyncFromDatabase }}"}}}}}}}}})({},o,c);t&&(s(t),i(!0))},children:d("Sync from database")}),(0,A.jsx)(al,{schema:a,components:{...g,ArrayTable:eh.ArrayTable},scope:{getContainer:n,useCancelAction:hr,createOnly:!0,isOverride:!1,useSyncFromDatabase:xK,record:o,...t}})]})})};var xW=n(77122);let xH=(0,es.createContext)(null);xH.displayName="AsyncDataContext";let xY=e=>{let{value:t,request:n,children:o,...l}=e,r=ek(n,{...l});return t?(0,A.jsx)(xH.Provider,{value:t,children:o}):(0,A.jsx)(xH.Provider,{value:r,children:o})},xX=()=>(0,es.useContext)(xH),xJ=(0,ec.observer)(()=>{let{t:e}=(0,eT.useTranslation)(),[t,n]=(0,es.useState)([]),{data:o,error:l,loading:r}=xX(),{data:i,fields:a}=o||{},s=(0,ec.useField)(),{data:c}=(0,es.useContext)(m8),d=eB(),{getInterface:u,getCollectionField:p}=sO(),m=h7(),h=(0,es.useMemo)(()=>m.filter(e=>!["relation"].includes(e.key)).map((e,t)=>({...e,key:t,label:d(e.label),options:e.children.map(e=>({...e,label:d(e.label)}))})),[d]),x=(()=>{let{sources:e=[]}=(0,ec.useForm)().values,{t}=(0,eT.useTranslation)(),{getCollection:n,getInheritCollections:o,getParentCollectionFields:l}=sO(),r=[];return e.forEach(e=>{var i;let a=n(e),s=o(e).map(o=>{let r=l(o,e);return{type:"group",key:o,label:t("Parent collection fields")+t("(".concat(n(o).title,")")),children:r.filter(e=>!["hasOne","hasMany","belongsToMany"].includes(null==e?void 0:e.type)).map(e=>{var n;return{value:e.name,label:t(null==(n=e.uiSchema)?void 0:n.title)}})}});if(!a)return;let c=null==(i=a.fields.filter(e=>!["hasOne","hasMany","belongsToMany"].includes(null==e?void 0:e.type)))?void 0:i.map(e=>{var n;return{value:e.name,label:t(null==(n=e.uiSchema)?void 0:n.title)}});r.push({value:e,label:t(a.title),children:[...c,...s]})}),r})(),f=(0,es.useRef)(u);if((0,es.useEffect)(()=>{var e;let t=new Map;r||(i&&i.length?Object.entries((null==i?void 0:i[0])||{}).forEach(e=>{var n,o,l;let[r,i]=e,s=a[r],c=(o=r,l=i,o.toLowerCase().includes("id")?"id":"number"==typeof l?Number.isInteger(l)?"integer":"number":"boolean"==typeof l?"checkbox":P()(l).isValid()?"datetime":"input"),d=null==(n=f.current(c))?void 0:n.default,u=(null==s?void 0:s.uiSchema)||(null==d?void 0:d.uiSchema)||{};t.set(r,{name:r,interface:(null==s?void 0:s.interface)||c,type:(null==s?void 0:s.type)||(null==d?void 0:d.type),source:null==s?void 0:s.source,uiSchema:{title:r,...u}})}):Object.entries(a||{}).forEach(e=>{let[n,o]=e;return t.set(n,{name:n,...o,uiSchema:{title:n,...(null==o?void 0:o.uiSchema)||{}}})})),(null==(e=s.value)?void 0:e.length)&&s.value.forEach(e=>{t.has(e.name)&&t.set(e.name,e)});let o=Array.from(t.values());o.length&&(n(o),s.setValue(o))},[r,i,s,a,c]),r)return(0,A.jsx)(eD.A,{});if(!i&&!l)return(0,A.jsx)(ov.A,{showIcon:!0,message:e("Please use a valid SELECT or WITH AS statement")});if(l){var v,g,y,b;let t=(null==l||null==(b=l.response)||null==(y=b.data)||null==(g=y.errors)||null==(v=g.map)?void 0:v.call(g,e=>e.message).join("\n"))||l.message;return(0,A.jsx)(ov.A,{showIcon:!0,message:"".concat(e("SQL error: ")).concat(t),type:"error"})}let C=(e,o)=>{let l=[...t];l.splice(o,1,e),n(l),s.setValue(l.map(e=>{var t,n,o;return{...e,source:"string"==typeof e.source?e.source:(null==(o=e.source)||null==(n=o.filter)||null==(t=n.call(o,Boolean))?void 0:t.join("."))||null}}))},S=[{title:e("Field name"),dataIndex:"name",key:"name",width:130},{title:e("Field source"),dataIndex:"source",key:"source",width:200,render:(n,o,l)=>{let r=t[l];return(0,A.jsx)(om.A,{defaultValue:"string"==typeof n?null==n?void 0:n.split("."):n,allowClear:!0,options:d(x),placeholder:e("Select field source"),onChange:e=>{let t=a[null==e?void 0:e[1]];t||(t=p((null==e?void 0:e.join("."))||"")),C({...r,source:e,interface:null==t?void 0:t.interface,type:null==t?void 0:t.type,uiSchema:null==t?void 0:t.uiSchema},l)}})}},{title:e("Field interface"),dataIndex:"interface",key:"interface",width:150,render:(e,n,o)=>{var l;let r=t[o];return r.source?(0,A.jsx)(nz.A,{children:d(null==(l=u(e))?void 0:l.title)||e}):(0,A.jsx)(oo.A,{defaultValue:r.interface||"input",style:{width:"100%"},popupMatchSelectWidth:!1,onChange:e=>{var t,n,l,i,a;let s=u(e);C({...r,interface:e||null,uiSchema:{...null==s||null==(t=s.default)?void 0:t.uiSchema,title:(null==s||null==(l=s.default)||null==(n=l.uiSchema)?void 0:n.title)||(null==(i=r.uiSchema)?void 0:i.title)},type:null==s||null==(a=s.default)?void 0:a.type},o)},allowClear:!0,options:h})}},{title:e("Field display name"),dataIndex:"title",key:"title",width:180,render:(e,n,o)=>{var l,r;let i=t[o];return(0,A.jsx)(nJ.A,{value:(null==(l=i.uiSchema)?void 0:l.title)||e,defaultValue:(null==(r=i.uiSchema)?void 0:r.title)!==void 0?i.uiSchema.title:null==i?void 0:i.name,onChange:e=>C({...i,uiSchema:{...null==i?void 0:i.uiSchema,title:e.target.value}},o)})}}];return(0,A.jsx)(xF.A,{bordered:!0,size:"small",columns:S,dataSource:t,scroll:{y:300},pagination:!1,rowClassName:"editable-row",rowKey:"name"})},{displayName:"FieldsConfigure"}),xQ=(0,ec.observer)(()=>{let{data:e,loading:t,error:n}=xX(),{data:o}=e||{},{t:l}=(0,eT.useTranslation)(),r=((0,ec.useForm)().values.fields||[]).reduce((e,t)=>{var n;return e[t.name]=null==t||null==(n=t.uiSchema)?void 0:n.title,e},{}),i=n?[]:Object.keys((null==o?void 0:o[0])||{}).map(e=>{let t=r[e];return{title:ec.Schema.compile(t||e,{t:l}),dataIndex:e,key:e}}),a=n?[]:null==o?void 0:o.map((e,t)=>({...Object.entries(e).reduce((e,t)=>{let[n,o]=t;if("string"!=typeof o)return e[n]=o,e;let r=ec.Schema.compile(o,{t:l});return e[n]=l(r),e},{}),key:t}));return(0,A.jsx)(xF.A,{bordered:!0,dataSource:a,columns:i,scroll:{x:150*i.length,y:300},loading:t,rowKey:"key"})},{displayName:"PreviewTable"}),xZ=e=>{let t=eC(),n=(0,ec.useForm)(),o=m3(),{manual:l}=e;l=void 0===l||l;let r=ek(e=>t.resource("sqlCollection").execute({values:{sql:e}}).then(e=>{var t;return(null==e||null==(t=e.data)?void 0:t.data)||{data:[],fields:[],sources:[]}}),{manual:!0,onSuccess:e=>{let{sources:t}=e,o=n.values.sources||[];n.setValuesIn("sources",Array.from(new Set([...o,...t])))}}),{run:i}=r,a=n.values.sql||o.sql,s=(0,es.useRef)(!0);return(0,es.useEffect)(()=>{a&&s.current&&i(a),s.current=!1},[l,i,a]),(0,A.jsx)(xY,{value:r,children:e.children})};var x0=n(56142),x1=n(73241);function x2(){let e=(0,ns._)(["\n position: relative;\n .ant-input {\n width: 100%;\n }\n "]);return x2=function(){return e},e}let x6=(0,nu.rU)(e=>{let{css:t}=e;return{input:t(x2())}}),x3=e=>{let{disabled:t}=e,{t:n}=(0,eT.useTranslation)(),{run:o,loading:l,error:r}=xX(),{styles:i}=x6(),a=(0,ec.useField)();return(0,es.useEffect)(()=>{r&&a.setComponentProps({disabled:!1})},[a,r]),(0,A.jsxs)("div",{className:i.input,children:[(0,A.jsx)(gd.TextArea,{value:a.value,disabled:t,onChange:e=>a.value=e.target.value}),(0,A.jsxs)(e3.Ay.Group,{children:[(0,A.jsx)(e3.Ay,{onClick:()=>{(t||a.value)&&(t||o(a.value),a.setComponentProps({disabled:!t}))},ghost:!0,size:"small",type:"primary",icon:(0,A.jsx)(x0.A,{}),children:n(t?"Edit":"Confirm")}),(0,A.jsx)(e3.Ay,{onClick:()=>void(a.value&&o(a.value)),loading:l,ghost:!0,size:"small",type:"primary",icon:(0,A.jsx)(x1.A,{}),children:n("Execute")})]})]})},x5={type:"object",properties:{[(0,ec.uid)()]:{type:"void",title:'{{ t("Sync from database") }}',"x-component":"Action.Drawer","x-decorator":"FormLayout","x-decorator-props":{layout:"vertical"},properties:{config:{type:"void","x-decorator":xZ,"x-decorator-props":{manual:!1},properties:{sql:{type:"string"},sources:{type:"array",title:'{{t("Source collections")}}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!0},"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]},fields:{type:"array",title:'{{t("Fields")}}',"x-decorator":"FormItem","x-component":xJ,required:!0},table:{type:"void",title:'{{t("Preview")}}',"x-decorator":"FormItem","x-component":xQ}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSyncFromDB }}"}}}}}}}},x4=e=>{let{refreshCMList:t}=e,n=m3(),o=tG(),{t:l}=(0,eT.useTranslation)(),[r,i]=(0,es.useState)(!1),a=(0,es.useMemo)(()=>(0,ec.createForm)({initialValues:n}),[n]);return"sql"===n.template&&(0,A.jsx)(m1,{record:n,parent:o,children:(0,A.jsx)(ae,{form:a,children:(0,A.jsxs)(ct,{value:{visible:r,setVisible:i},children:[(0,A.jsx)(e3.Ay,{icon:(0,A.jsx)(xW.A,{}),onClick:e=>i(!0),children:l("Sync from database")}),(0,A.jsx)(al,{schema:x5,components:{FormLayout:eh.FormLayout},scope:{useCancelAction:hr,useSyncFromDB:()=>(e=>{let t=(0,ec.useForm)(),n=co(),{refreshCM:o}=sO(),{refresh:l}=hn(),{targetKey:r}=hl(),{[r]:i}=m3(),a=eC(),s=(0,ec.useField)();return{async run(){await t.submit(),s.data=s.data||{},s.data.loading=!0;try{await a.resource("sqlCollection").setFields({filterByTk:i,values:{fields:t.values.fields,sources:t.values.sources}}),n.setVisible(!1),await t.reset(),s.data.loading=!1,l(),await o(),await (null==e?void 0:e())}catch(e){s.data.loading=!1}}}})(t)}})]})})})};var x8=n(27527),x7=n(67897);function x9(){let e=(0,ns._)(["\n .ant-modal-body {\n margin-left: 35px;\n margin-bottom: 35px;\n .ant-checkbox-wrapper {\n height: 25px;\n }\n }\n "]);return x9=function(){return e},e}let fe=e=>{let t=m3();return(0,A.jsx)(fi,{item:t,...e})},ft=()=>{let{run:e}=fo(),{refreshCM:t}=sO();return{async run(){await e(),await t()}}},fn=()=>{let{run:e}=fr(),{refreshCM:t}=sO();return{async run(){await e(),await t()}}},fo=()=>{let{refresh:e}=hn(),{resource:t,targetKey:n}=hl(),{[n]:o}=m3(),l=(0,ec.useForm)(),{cascade:r}=(null==l?void 0:l.values)||{};return{async run(){await t.destroy({filterByTk:o,cascade:r}),e()}}},fl=(0,nu.rU)(e=>{let{css:t}=e;return{modal:t(x9())}}),fr=()=>{let{state:e,setState:t,refresh:n}=hn(),{resource:o}=hl(),l=co(),{t:r}=(0,eT.useTranslation)(),{message:i}=eX.A.useApp(),a=(0,ec.useForm)(),{cascade:s}=(null==a?void 0:a.values)||{};return{async run(){var c,d;if(!(null==e||null==(c=e.selectedRowKeys)?void 0:c.length))return i.error(r("Please select the records you want to delete"));await o.destroy({filterByTk:(null==e?void 0:e.selectedRowKeys)||[],cascade:s}),a.reset(),null==l||null==(d=l.setVisible)||d.call(l,!1),null==t||t({selectedRowKeys:[]}),n()}}},fi=e=>{let{scope:t,getContainer:n,item:o,children:l,isBulk:r,useAction:i,...a}=e,{t:s}=(0,eT.useTranslation)(),{styles:c}=fl(),[d,u]=(0,es.useState)(!1);return(0,A.jsx)(m1,{record:o,children:(0,A.jsxs)(ct,{value:{visible:d,setVisible:u},children:[r?(0,A.jsx)(e3.Ay,{icon:(0,A.jsx)(x7.A,{}),onClick:()=>u(!0),children:l||s("Delete")}):(0,A.jsx)("a",{onClick:()=>u(!0),...a,children:l||s("Delete")}),(0,A.jsx)(al,{schema:{type:"object",properties:{deleteCollection:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:(0,A.jsx)(()=>(0,A.jsxs)("span",{children:[(0,A.jsx)(x8.A,{style:{color:"#faad14",marginRight:"12px",fontSize:"22px"}}),(0,A.jsx)("span",{style:{fontSize:"19px"},children:s("Delete collection")})]}),{}),"x-component-props":{width:520,getContainer:"{{ getContainer }}",className:c.modal},properties:{info:{type:"string","x-component":"div","x-content":"{{t('Are you sure you want to delete it?')}}"},cascade:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox",default:!1,"x-content":s("Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects")},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Ok") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDestroyCollectionAction }}",style:{marginLeft:"8px"}}}}}}}}},components:{...g},scope:{getContainer:n,useDestroyCollectionAction:r?fn:i||ft,useCancelAction:hr,...t}})]})})};fi.displayName="DeleteCollectionAction";let fa=()=>(co(),{async run(){}}),fs=()=>{let{getInterface:e}=sO(),[t,n]=(0,es.useState)(!1),[o,l]=(0,es.useState)({}),r=eB(),i=h7(),{t:a}=(0,eT.useTranslation)(),s=(0,es.useMemo)(()=>i.map(e=>{let t=e.children.map(e=>({label:r(e.title),key:e.name}));return{label:r(e.label),key:e.key,children:t}}),[i]),c=(0,es.useMemo)(()=>({style:{maxHeight:"60vh",overflow:"auto"},onClick:t=>{l((e=>{if(!e)return;let t=(0,ed.cloneDeep)(e.properties),n={name:"f_".concat((0,ec.uid)()),...(0,ed.cloneDeep)(e.default),interface:e.name};return{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:e=>ek(()=>Promise.resolve({data:n}),e)},title:'{{ t("Add field") }}',properties:{...t,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ ds.useCreateAction }}"}}}}}}}}})(e(t.key))),n(!0)},items:s}),[s]),d=tz();return(0,A.jsxs)(ct,{value:{visible:t,setVisible:n},children:[(0,A.jsx)(nX.A,{menu:c,children:(0,A.jsx)(e3.Ay,{icon:(0,A.jsx)(sF.A,{}),type:"primary",children:a("Add field")})}),(0,A.jsx)(m1,{record:{},parent:d,children:(0,A.jsx)(al,{schema:o,components:{...g,ArrayTable:eh.ArrayTable},scope:{createOnly:!0,useCreateSubField:fa}})})]})},fc=()=>{let e=(0,ec.useForm)(),{run:t}=hw(),{refreshCM:n}=sO();return{async run(){var o,l,r;await e.submit();let i=(null==e||null==(r=e.values)||null==(l=r.uiSchema)||null==(o=l.enum)?void 0:o.slice())||[];e.setValuesIn("uiSchema.enum",i.map(e=>({value:(0,ec.uid)(),...e}))),await t(),await n()}}},fd=e=>{let t=m3(),{getInterface:n}=sO(),[o,l]=(0,es.useState)(!1),[r,i]=(0,es.useState)({});eC();let{t:a}=(0,eT.useTranslation)();return(0,A.jsxs)(ct,{value:{visible:o,setVisible:l},children:[(0,A.jsx)("a",{onClick:async()=>{i((e=>{if(!e)return;let t=eQ()(e.properties);return t.name["x-disabled"]=!0,{type:"object",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:t=>ek(()=>Promise.resolve({data:eQ()(e.default)}),t)},title:'{{ t("Edit field") }}',properties:{...t,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ ds.useUpdateAction }}"}}}}}}}}})({...n(t.interface),default:t})),l(!0)},children:a("Edit")}),(0,A.jsx)(al,{schema:r,components:{...g,ArrayTable:eh.ArrayTable},scope:{useUpdateCollectionField:fc}})]})},fu=e=>{let{t}=(0,eT.useTranslation)(),{getInterface:n}=sO(),o=(0,es.useMemo)(()=>n(e.schemaKey),[n,e.schemaKey]);return(0,A.jsx)(xx,{label:t("Field interface"),schema:o})};fu.displayName="FieldSummary";let fp=(0,ec.observer)(e=>{let{value:t}=e,{getInterface:n}=sO(),o=eB(),l=n(t);return l?(0,A.jsx)(nz.A,{children:o(l.title)}):null},{displayName:"CollectionFieldInterfaceTag"}),fm=(0,ec.observer)(e=>{let{value:t}=e,n=eB();return(0,A.jsx)(A.Fragment,{children:null==t?void 0:t.map(e=>(0,A.jsx)(nz.A,{color:e.color,children:n(null==e?void 0:e.name)},e.name))})},{displayName:"CollectionCategory"}),fh=(0,ec.observer)(e=>{let{value:t}=e,{getTemplate:n}=sO(),o=eB(),l=n(t);return(0,A.jsx)(nz.A,{children:o((null==l?void 0:l.title)||'{{t("General collection")}}')})},{displayName:"CollectionTemplateTag"});(0,ec.registerValidateFormats)({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});let fx={type:"string",title:'{{t("Storage type")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[{label:"Boolean",value:"boolean"},{label:"String",value:"string"},{label:"Text",value:"text"},{label:"Integer",value:"integer"},{label:"BigInteger",value:"bigInt"},{label:"Float",value:"float"},{label:"Double",value:"double"},{label:"Decimal",value:"decimal"},{label:"Date",value:"date"},{label:"DateOnly",value:"dateonly"},{label:"Time",value:"time"},{label:"Virtual",value:"virtual"},{label:"JSON",value:"json"},{label:"Password",value:"password"},{label:"One to one",value:"hasOne"},{label:"One to many",value:"hasMany"},{label:"Many to one",value:"belongsTo"},{label:"Many to many",value:"belongsToMany"},{label:"Snapshot",value:"snapshot"}]},ff={type:"boolean","x-content":'{{t("Unique")}}',"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":[{dependencies:["primaryKey"],when:"{{$deps[0]}}",fulfill:{state:{value:!1}}}]},fv={type:"boolean","x-content":'{{t("Primary")}}',"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":[{dependencies:["unique"],when:"{{$deps[0]}}",fulfill:{state:{value:!1}}}]},fg={type:"boolean",title:'{{t("Auto increment")}}',"x-content":'{{t("Auto increment")}}',"x-decorator":"FormItem","x-component":"Checkbox","x-disabled":"{{ !createMainOnly }}"},fy={type:"string",title:'{{t("Relationship type")}}',required:!0,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[{label:"{{t('HasOne')}}",value:"hasOne"},{label:"{{t('HasMany')}}",value:"hasMany"},{label:"{{t('BelongsTo')}}",value:"belongsTo"},{label:"{{t('BelongsToMany')}}",value:"belongsToMany"}]},fb={onDelete:{type:"string",title:'{{t("ON DELETE")}}',required:!0,default:"SET NULL","x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Select",enum:[{label:"{{t('SET NULL')}}",value:"SET NULL"},{label:"{{t('RESTRICT')}}",value:"RESTRICT"},{label:"{{t('CASCADE')}}",value:"CASCADE"},{label:"{{t('NO ACTION')}}",value:"NO ACTION"}]}},fC={reverse:{type:"void","x-component":"div","x-hidden":"{{ !showReverseFieldConfig }}",properties:{autoCreateReverseField:{type:"boolean",default:!1,"x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Create inverse field in the target collection")}}',"x-reactions":[{target:"reverseField.type",when:"{{!!$self.value}}",fulfill:{state:{hidden:!1}},otherwise:{state:{hidden:!0}}},{target:"reverseField.uiSchema.title",when:"{{!!$self.value}}",fulfill:{state:{hidden:!1}},otherwise:{state:{hidden:!0}}},{target:"reverseField.name",when:"{{!!$self.value}}",fulfill:{state:{hidden:!1}},otherwise:{state:{hidden:!0}}}]},"reverseField.type":{...fy,title:'{{t("Inverse relationship type")}}'},"reverseField.uiSchema.title":{type:"string",title:'{{t("Inverse field display name")}}',default:"{{record.title}}",required:!0,"x-decorator":"FormItem","x-component":"Input"},"reverseField.name":{type:"string",title:'{{t("Inverse field name")}}',required:!0,"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 an letter.')}}"}}}},fS={"uiSchema.x-component-props.dateFormat":{type:"string",title:'{{t("Date format")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"YYYY-MM-DD",enum:[{label:'{{t("Year/Month/Day")}}',value:"YYYY/MM/DD"},{label:'{{t("Year-Month-Day")}}',value:"YYYY-MM-DD"},{label:'{{t("Day/Month/Year")}}',value:"DD/MM/YYYY"}]},"uiSchema.x-component-props.showTime":{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Show time")}}',"x-reactions":["{{(field) => {\n field.query('..[].timeFormat').take(f => {\n f.display = field.value ? 'visible' : 'none';\n });\n }}}"]},"uiSchema.x-component-props.timeFormat":{type:"string",title:'{{t("Time format")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"HH:mm:ss",enum:[{label:'{{t("12 hour")}}',value:"hh:mm:ss a"},{label:'{{t("24 hour")}}',value:"HH:mm:ss"}]}},fw={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","x-reactions":e=>{e.initialValue||(e.initialValue=(0,ec.uid)())}}}},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')}}"}}},fF={"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 an letter.')}}"}},fj={type:"void",title:'{{ t("View record") }}',"x-component":"RecordPicker.Viewer","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}},fA={type:"string",title:'{{t("Options")}}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!0},enum:"{{collections}}"},fk=(e,t)=>{if((null==t?void 0:t.template)==="view"||(null==t?void 0:t.template)==="sql")return t.fields;let n=t.fields?[...t.fields].filter(e=>!["id","createdBy","updatedAt","createdAt","updatedBy"].includes(e.name)):[];return e.find(e=>"id"===e.name)&&n.push({name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0},interface:"integer"}),e.find(e=>"createdAt"===e.name)&&n.push({name:"createdAt",interface:"createdAt",type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}}),e.find(e=>"createdBy"===e.name)&&n.push({name:"createdBy",interface:"createdBy",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}}),e.find(e=>"updatedAt"===e.name)&&n.push({type:"date",field:"updatedAt",name:"updatedAt",interface:"updatedAt",uiSchema:{type:"string",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}}),e.find(e=>"updatedBy"===e.name)&&n.push({type:"belongsTo",target:"users",foreignKey:"updatedById",name:"updatedBy",interface:"updatedBy",uiSchema:{type:"object",title:'{{t("Last updated by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}}),n},fI={title:{type:"string",title:'{{ t("Collection display name") }}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Collection 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 an letter.')}}"},inherits:{title:'{{t("Inherits")}}',type:"hasMany",name:"inherits","x-decorator":"FormItem","x-component":"Select","x-component-props":{mode:"multiple"},"x-disabled":"{{ !createOnly }}","x-visible":"{{ enableInherits}}","x-reactions":['{{useAsyncDataSource(loadCollections, ["file"])}}']},category:{title:'{{t("Categories")}}',type:"hasMany",name:"category","x-decorator":"FormItem","x-component":"Select","x-component-props":{mode:"multiple"},"x-reactions":["{{useAsyncDataSource(loadCategories)}}"]},description:{title:'{{t("Description")}}',type:"string",name:"description","x-decorator":"FormItem","x-component":"Input.TextArea"},presetFields:{title:'{{t("Preset fields")}}',type:"void","x-decorator":"FormItem","x-visible":"{{ createOnly }}","x-component":(0,ec.observer)(e=>{let{getInterface:t}=sO(),n=(0,ec.useForm)(),o=eB(),[l,r]=(0,es.useState)([]),{t:i}=(0,eT.useTranslation)(),a=[{title:i("Field"),dataIndex:"field",key:"field"},{title:i("Interface"),dataIndex:"interface",key:"interface",render:e=>{var n;return(0,A.jsx)(nz.A,{children:o(null==(n=t(e))?void 0:n.title)})}},{title:i("Description"),dataIndex:"description",key:"description"}],s=[{field:i("ID"),interface:"integer",description:i("Primary key, unique identifier, self growth"),name:"id"},{field:i("Created at"),interface:"createdAt",description:i("Store the creation time of each record"),name:"createdAt"},{field:i("Last updated at"),interface:"updatedAt",description:i("Store the last update time of each record"),name:"updatedAt"},{field:i("Created by"),interface:"createdBy",description:i("Store the creation user of each record"),name:"createdBy"},{field:i("Last updated by"),interface:"updatedBy",description:i("Store the last update user of each record"),name:"updatedBy"}];return(0,es.useEffect)(()=>{r(["id","createdAt","createdBy","updatedAt","updatedBy"]),n.setValues({...n.values,autoGenId:!0,createdAt:!0,createdBy:!0,updatedAt:!0,updatedBy:!0})},[]),(0,es.useEffect)(()=>{let e=fk(l.map(e=>({name:e})),n.values);n.setValuesIn("fields",e)},[l]),(0,A.jsx)(xF.A,{size:"small",pagination:!1,rowKey:"name",bordered:!0,scroll:{x:600},dataSource:s,columns:a,rowSelection:{type:"checkbox",selectedRowKeys:l,getCheckboxProps:e=>({disabled:"file"===n.values.template,name:e.name}),onChange:(e,t)=>{var o;let l=fk(t,n.values),i={autoGenId:!!l.find(e=>"id"===e.name),createdAt:!!l.find(e=>"createdAt"===e.name),createdBy:!!l.find(e=>"createdBy"===e.name),updatedAt:!!l.find(e=>"updatedAt"===e.name),updatedBy:!!l.find(e=>"updatedBy"===e.name)};r(null==l||null==(o=l.map)?void 0:o.call(l,e=>e.name)),n.setValues({...n.values,fields:l,...i})}}})},{displayName:"PresetFields"})}},fP=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let o={};for(let e of t)fI[e]&&(o[e]=fI[e]);return o};class fT extends tR{schemaInitialize(e,t){let{block:n}=t;["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","checkbox"),(0,em._)(this,"type","object"),(0,em._)(this,"group","choices"),(0,em._)(this,"icon","CheckSquareOutlined"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Checkbox")}}'),(0,em._)(this,"default",{type:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}),(0,em._)(this,"availableTypes",["boolean","integer","bigInt"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,"uiSchema.x-component-props.showUnchecked":{type:"boolean",title:'{{t("Display X when unchecked")}}',default:!1,"x-decorator":"FormItem","x-component":"Checkbox"}}),(0,em._)(this,"filterable",{operators:rD})}}class fN extends tR{schemaInitialize(e,t){let{block:n}=t;["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","checkboxGroup"),(0,em._)(this,"type","object"),(0,em._)(this,"group","choices"),(0,em._)(this,"icon","UnorderedListOutlined"),(0,em._)(this,"order",5),(0,em._)(this,"title",'{{t("Checkbox group")}}'),(0,em._)(this,"default",{interface:"checkboxGroup",type:"array",defaultValue:[],uiSchema:{type:"string","x-component":"Checkbox.Group"}}),(0,em._)(this,"availableTypes",["array"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,"uiSchema.enum":fw}),(0,em._)(this,"filterable",{operators:rA})}}class fM extends tR{initialize(e){e.through||(e.through="t_".concat((0,ec.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,ec.uid)())),e.otherKey||(e.otherKey="f_".concat((0,ec.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id")}constructor(...e){super(...e),(0,em._)(this,"name","chinaRegion"),(0,em._)(this,"type","object"),(0,em._)(this,"group","choices"),(0,em._)(this,"icon","CompassOutlined"),(0,em._)(this,"order",7),(0,em._)(this,"title",'{{t("China region")}}'),(0,em._)(this,"isAssociation",!0),(0,em._)(this,"default",{interface:"chinaRegion",type:"belongsToMany",target:"chinaRegions",targetKey:"code",sortBy:"level",uiSchema:{type:"array","x-component":"Cascader","x-component-props":{useDataSource:"{{ useChinaRegionDataSource }}",useLoadData:"{{ useChinaRegionLoadData }}",changeOnSelectLast:!1,labelInValue:!0,maxLevel:3,fieldNames:{label:"name",value:"code",children:"children"}}}}),(0,em._)(this,"availableTypes",["belongsToMany"]),(0,em._)(this,"properties",{...fF,"uiSchema.x-component-props.maxLevel":{type:"number","x-component":"Radio.Group","x-decorator":"FormItem",title:'{{t("Select level")}}',default:3,enum:[{value:1,label:'{{t("Province")}}'},{value:2,label:'{{t("City")}}'},{value:3,label:'{{t("Area")}}'},{value:4,label:'{{t("Street")}}',disabled:!0},{value:5,label:'{{t("Village")}}',disabled:!0}]},"uiSchema.x-component-props.changeOnSelectLast":{type:"boolean","x-component":"Checkbox","x-content":'{{t("Must select to the last level")}}',"x-decorator":"FormItem"}}),(0,em._)(this,"filterable",{children:[{name:"name",title:'{{t("Province/city/area name")}}',operators:rj,schema:{title:'{{t("Province/city/area name")}}',type:"string","x-component":"Input"}}]})}}class fD extends tR{schemaInitialize(e,t){let{block:n}=t,o=e["x-component-props"]=e["x-component-props"]||{};o.style={...o.style,width:"100%"},["Table","Kanban"].includes(n)&&(o.ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","collection"),(0,em._)(this,"type","string"),(0,em._)(this,"group","advanced"),(0,em._)(this,"icon","ClusterOutlined"),(0,em._)(this,"order",5),(0,em._)(this,"title",'{{t("Collection selector")}}'),(0,em._)(this,"description",'{{t("Providing certain collections as options for users, typically used in polymorphic or inheritance scenarios")}}'),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"string",uiSchema:{type:"string","x-component":"CollectionSelect"}}),(0,em._)(this,"availableTypes",["string"]),(0,em._)(this,"hasDefaultValue",!1),(0,em._)(this,"properties",{...fF,"uiSchema.enum":fA}),(0,em._)(this,"filterable",{operators:rq})}}class fR extends tR{constructor(...e){super(...e),(0,em._)(this,"name","color"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",10),(0,em._)(this,"icon","BgColorsOutlined"),(0,em._)(this,"title",'{{t("Color")}}'),(0,em._)(this,"default",{type:"string",uiSchema:{type:"string","x-component":"ColorPicker",default:"#1677FF"}}),(0,em._)(this,"availableTypes",["string"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF}),(0,em._)(this,"filterable",{operators:rj})}}class fq extends tR{constructor(...e){super(...e),(0,em._)(this,"name","createdAt"),(0,em._)(this,"type","object"),(0,em._)(this,"group","systemInfo"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Created at")}}'),(0,em._)(this,"sortable",!0),(0,em._)(this,"icon","FieldTimeOutlined"),(0,em._)(this,"default",{type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}}),(0,em._)(this,"availableTypes",["date"]),(0,em._)(this,"properties",{...fF,...fS}),(0,em._)(this,"filterable",{operators:rI}),(0,em._)(this,"titleUsable",!0)}}class f_ extends tR{schemaInitialize(e,t){let{block:n}=t;e.properties={viewer:(0,ed.cloneDeep)(fj)},["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","createdBy"),(0,em._)(this,"type","object"),(0,em._)(this,"group","systemInfo"),(0,em._)(this,"order",3),(0,em._)(this,"title",'{{t("Created by")}}'),(0,em._)(this,"icon","UserOutlined"),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}),(0,em._)(this,"availableTypes",["belongsTo"]),(0,em._)(this,"properties",{...fF}),(0,em._)(this,"filterable",{nested:!0,children:[]})}}class fO extends tR{constructor(...e){super(...e),(0,em._)(this,"name","datetime"),(0,em._)(this,"type","object"),(0,em._)(this,"group","datetime"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Datetime")}}'),(0,em._)(this,"icon","dateTimeField"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"date",uiSchema:{type:"string","x-component":"DatePicker","x-component-props":{showTime:!1}}}),(0,em._)(this,"availableTypes",["date","dateOnly"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,...fS,"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}}),(0,em._)(this,"filterable",{operators:rI}),(0,em._)(this,"titleUsable",!0)}}class fB extends tR{schemaInitialize(e,t){let{block:n}=t;["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","email"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",4),(0,em._)(this,"title",'{{t("Email")}}'),(0,em._)(this,"icon","CommentOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"string",uiSchema:{type:"string","x-component":"Input","x-validator":"email"}}),(0,em._)(this,"availableTypes",["string"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,unique:ff}),(0,em._)(this,"filterable",{operators:rj}),(0,em._)(this,"titleUsable",!0)}}class fE extends tR{constructor(...e){super(...e),(0,em._)(this,"name","icon"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",10),(0,em._)(this,"title",'{{t("Icon")}}'),(0,em._)(this,"icon","FieldNumberOutlined"),(0,em._)(this,"default",{type:"string",uiSchema:{type:"string","x-component":"IconPicker"}}),(0,em._)(this,"availableTypes",["string"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF})}}class fV extends tR{constructor(...e){super(...e),(0,em._)(this,"name","id"),(0,em._)(this,"type","object"),(0,em._)(this,"group","systemInfo"),(0,em._)(this,"order",0),(0,em._)(this,"title",'{{t("ID")}}'),(0,em._)(this,"hidden",!0),(0,em._)(this,"sortable",!0),(0,em._)(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}}),(0,em._)(this,"availableTypes",["bigInt","integer","string"]),(0,em._)(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 an letter.')}}"}}),(0,em._)(this,"filterable",{operators:rT}),(0,em._)(this,"titleUsable",!0)}}var fz=n(42545);function fL(e,t){return t?"{{t(".concat(JSON.stringify(e),", ").concat(JSON.stringify(t),")}}"):"{{t(".concat(JSON.stringify(e),")}}")}let fG=n.n(fz)().createInstance(),fK={};Object.keys(on).forEach(e=>{fK[e]=on[e].resources}),"undefined"!=typeof localStorage&&fG.use(eT.initReactI18next).init({lng:localStorage.getItem("TACHYBASE_LOCALE")||"en-US",defaultNS:"core",resources:{},keySeparator:!1,nsSeparator:!1}),(0,ec.registerValidateRules)({username:e=>/^[^@.<>"'/]{2,16}$/.test(e)||fG.t("Must be 2-16 characters in length (excluding @.<>\"'/)")});class f$ extends tR{schemaInitialize(e,t){let{block:n}=t;["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}validateSchema(e){return{max:{type:"number",title:'{{ t("Max length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Max length must greater than min length"),"' : ''\n }}}")},min:{type:"number",title:'{{ t("Min length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".max"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Min length must less than max length"),"' : ''}}")}}}},len:{type:"number",title:'{{ t("Length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0}},format:{type:"string",title:'{{ t("Format") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!0},enum:[{label:'{{ t("url") }}',value:"url"},{label:'{{ t("email") }}',value:"email"},{label:'{{ t("ipv6") }}',value:"ipv6"},{label:'{{ t("ipv4") }}',value:"ipv4"},{label:'{{ t("number") }}',value:"number"},{label:'{{ t("integer") }}',value:"integer"},{label:'{{ t("idcard") }}',value:"idcard"},{label:'{{ t("qq") }}',value:"qq"},{label:'{{ t("phone") }}',value:"phone"},{label:'{{ t("money") }}',value:"money"},{label:'{{ t("zh") }}',value:"zh"},{label:'{{ t("date") }}',value:"date"},{label:'{{ t("zip") }}',value:"zip"}]},pattern:{type:"string",title:'{{ t("Regular expression") }}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{prefix:"/",suffix:"/"}}}}constructor(...e){super(...e),(0,em._)(this,"name","input"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Single line text")}}'),(0,em._)(this,"icon","inputField"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{interface:"input",type:"string",uiSchema:{type:"string","x-component":"Input"}}),(0,em._)(this,"availableTypes",["string","uid"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:fv,unique:ff}}}),(0,em._)(this,"filterable",{operators:rj}),(0,em._)(this,"titleUsable",!0)}}(0,ec.registerValidateFormats)({odd:/^-?\d*[13579]$/,even:/^-?\d*[02468]$/});class fU extends tR{constructor(...e){super(...e),(0,em._)(this,"name","integer"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",6),(0,em._)(this,"title",'{{t("Integer")}}'),(0,em._)(this,"icon","FieldBinaryOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"bigInt",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"},"x-validator":"integer"}}),(0,em._)(this,"availableTypes",["bigInt","integer","sort"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,layout:{type:"void",title:'{{t("Index")}}',"x-component":"Space","x-decorator":"FormItem","x-decorator-props":{style:{marginBottom:"0px"}},properties:{primaryKey:fv,unique:ff}},autoIncrement:fg,"uiSchema.x-component-props.addonBefore":{type:"string",title:'{{t("Prefix")}}',"x-decorator":"FormItem","x-component":"Input"},"uiSchema.x-component-props.addonAfter":{type:"string",title:'{{t("Suffix")}}',"x-decorator":"FormItem","x-component":"Input"}}),(0,em._)(this,"filterable",{operators:rP}),(0,em._)(this,"titleUsable",!0),(0,em._)(this,"validateSchema",e=>({maximum:{type:"number",title:'{{ t("Maximum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Maximum must greater than minimum"),"' : ''\n }}}")},minimum:{type:"number",title:'{{ t("Minimum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".maximum"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Minimum must less than maximum"),"' : ''}}")}}}},format:{type:"string",title:'{{ t("Format") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!0},enum:[{label:'{{ t("Odd") }}',value:"odd"},{label:'{{ t("Even") }}',value:"even"}]},pattern:{type:"string",title:'{{ t("Regular expression") }}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{prefix:"/",suffix:"/"}}}))}}(0,ec.registerValidateRules)({json(e){try{return JSON.parse(e),!0}catch(e){return{type:"error",message:e.message}}}});class fW extends tR{constructor(...e){super(...e),(0,em._)(this,"name","json"),(0,em._)(this,"type","object"),(0,em._)(this,"group","advanced"),(0,em._)(this,"order",4),(0,em._)(this,"title",'{{t("JSON")}}'),(0,em._)(this,"icon","CodeOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"json",uiSchema:{type:"object","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5}},default:null}}),(0,em._)(this,"availableTypes",["json","array","jsonb","text","circle","lineString","point","polygon"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,jsonb:{type:"boolean",title:"JSONB","x-decorator":e=>{let{children:t}=e;return(0,A.jsx)(eh.FormLayout,{children:(0,A.jsx)(eh.FormItem,{children:t})})},"x-component":"Checkbox","x-hidden":"{{ !isDialect('postgres') }}","x-disabled":"{{ disabledJSONB }}"}}),(0,em._)(this,"filterable",{operators:rj})}}class fH extends tR{schemaInitialize(e,t){let{readPretty:n,block:o,targetCollection:l}=t;(null==l?void 0:l.titleField)&&e["x-component-props"]&&(e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:l.filterTargetKey||"id"},e["x-component-props"].fieldNames.label=l.titleField),["Table","Kanban"].includes(o)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}constructor(...e){super(...e),(0,em._)(this,"name","linkTo"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Link to")}}'),(0,em._)(this,"description",'{{t("Link to description")}}'),(0,em._)(this,"isAssociation",!0),(0,em._)(this,"default",{type:"belongsToMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"id",value:"id"}}},reverseField:{interface:"linkTo",type:"belongsToMany",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"id",value:"id"}}}}}),(0,em._)(this,"initialize",e=>{"belongsToMany"===e.type&&(e.through||(e.through="t_".concat((0,ec.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,ec.uid)())),e.otherKey||(e.otherKey="f_".concat((0,ec.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id"))}),(0,em._)(this,"properties",{...fF,target:{type:"string",title:'{{t("Related collection")}}',required:!0,"x-reactions":["{{useAsyncDataSource(loadCollections)}}"],"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":'{{t("Allow linking to multiple records")}}',"x-decorator":"FormItem","x-component":"Checkbox"}}),(0,em._)(this,"filterable",{nested:!0,children:[]})}}class fY extends tR{schemaInitialize(e,t){var n;let{field:o,block:l,readPretty:r,targetCollection:i}=t;e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:fX(i)},e["x-component-props"].fieldNames.label=(null==(n=e["x-component-props"].fieldNames)?void 0:n.label)||(null==i?void 0:i.titleField)||fX(i),["Table","Kanban"].includes(l)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}constructor(...e){super(...e),(0,em._)(this,"name","o2m"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",4),(0,em._)(this,"title",'{{t("One to many")}}'),(0,em._)(this,"icon","DeploymentUnitOutlined"),(0,em._)(this,"description",'{{t("One to many description")}}'),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}}}),(0,em._)(this,"availableTypes",["hasMany"]),(0,em._)(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 an letter.')}}"},type:fy,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-reactions":['{{useAsyncDataSource(loadCollections, ["file"])}}'],"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.')}}",default:"id",enum:[{label:"ID",value:"id"}],"x-decorator":"FormItem","x-component":"SourceKey"}}},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 an 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.')}}"}}}}}}},...fb,...fC}),(0,em._)(this,"filterable",{nested:!0,operators:r_,children:[]})}}function fX(e){return(null==e?void 0:e.filterTargetKey)||(null==e?void 0:e.getPrimaryKey())||"id"}class fJ extends tR{schemaInitialize(e,t){var n;let{field:o,readPretty:l,block:r,targetCollection:i}=t;e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:fX(i)},e["x-component-props"].fieldNames.label=(null==(n=e["x-component-props"].fieldNames)?void 0:n.label)||(null==i?void 0:i.titleField)||fX(i),["Table","Kanban"].includes(r)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}initialize(e){"belongsToMany"===e.type&&(e.through||(e.through="t_".concat((0,ec.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,ec.uid)())),e.otherKey||(e.otherKey="f_".concat((0,ec.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id"))}constructor(...e){super(...e),(0,em._)(this,"name","m2m"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",6),(0,em._)(this,"title",'{{t("Many to many")}}'),(0,em._)(this,"icon","DeploymentUnitOutlined"),(0,em._)(this,"description",'{{t("Many to many description")}}'),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}}}),(0,em._)(this,"availableTypes",["belongsToMany"]),(0,em._)(this,"properties",{...fF,type:fy,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-reactions":["{{useAsyncDataSource(loadCollections)}}"],"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 an 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 an 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.')}}"}}}}}}},...fC}),(0,em._)(this,"filterable",{nested:!0,operators:r_,children:[]})}}class fQ extends tR{schemaInitialize(e,t){var n;let{field:o,block:l,readPretty:r,targetCollection:i}=t;e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:fX(i)},e["x-component-props"].fieldNames.label=(null==(n=e["x-component-props"].fieldNames)?void 0:n.label)||(null==i?void 0:i.titleField)||fX(i),["Table","Kanban"].includes(l)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}constructor(...e){super(...e),(0,em._)(this,"name","m2o"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",5),(0,em._)(this,"title",'{{t("Many to one")}}'),(0,em._)(this,"description",'{{t("Many to one description")}}'),(0,em._)(this,"icon","DeploymentUnitOutlined"),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}}}),(0,em._)(this,"availableTypes",["belongsTo"]),(0,em._)(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 an letter.')}}"},type:fy,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-reactions":["{{useAsyncDataSource(loadCollections)}}"],"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 an 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 }}"}}}}}}},...fb,...fC}),(0,em._)(this,"filterable",{nested:!0,operators:r_,children:[]})}}class fZ extends tR{schemaInitialize(e,t){let{block:n}=t;["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}validateSchema(e){return{max:{type:"number",title:'{{ t("Max length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Max length must greater than min length"),"' : ''\n }}}")},min:{type:"number",title:'{{ t("Min length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".max"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Min length must less than max length"),"' : ''}}")}}}}}}constructor(...e){super(...e),(0,em._)(this,"name","markdown"),(0,em._)(this,"type","object"),(0,em._)(this,"title",'{{t("Markdown")}}'),(0,em._)(this,"group","media"),(0,em._)(this,"icon","CodeOutlined"),(0,em._)(this,"default",{type:"text",uiSchema:{type:"string","x-component":"Markdown"}}),(0,em._)(this,"availableTypes",["text","json"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF}),(0,em._)(this,"filterable",{operators:rj})}}class f0 extends tR{schemaInitialize(e,t){let{block:n}=t,o=e["x-component-props"]=e["x-component-props"]||{};o.style={...o.style,width:"100%"},["Table","Kanban"].includes(n)&&(o.ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","multipleSelect"),(0,em._)(this,"type","object"),(0,em._)(this,"group","choices"),(0,em._)(this,"order",3),(0,em._)(this,"title",'{{t("Multiple select")}}'),(0,em._)(this,"icon","multipleSelectField"),(0,em._)(this,"default",{type:"array",defaultValue:[],uiSchema:{type:"array","x-component":"Select","x-component-props":{mode:"multiple"},enum:[]}}),(0,em._)(this,"availableTypes",["array"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,"uiSchema.enum":fw}),(0,em._)(this,"filterable",{operators:rA})}}class f1 extends tR{validateSchema(e){return{maximum:{type:"number",title:'{{ t("Maximum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-reactions":"{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Maximum must greater than minimum"),"' : ''\n }}}")},minimum:{type:"number",title:'{{ t("Minimum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-reactions":{dependencies:[".maximum"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Minimum must less than maximum"),"' : ''}}")}}}},format:{type:"string",title:'{{ t("Format") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!0},enum:[{label:'{{ t("Integer") }}',value:"integer"},{label:'{{ t("Odd") }}',value:"odd"},{label:'{{ t("Even") }}',value:"even"}]},pattern:{type:"string",title:'{{ t("Regular expression") }}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{prefix:"/",suffix:"/"}}}}constructor(...e){super(...e),(0,em._)(this,"name","number"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",7),(0,em._)(this,"title",'{{t("Number")}}'),(0,em._)(this,"icon","numberField"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"double",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"}}}),(0,em._)(this,"componentOptions",[{label:'{{t("InputNumber")}}',value:"InputNumber"},{label:'{{t("Slider")}}',value:"Slider"}]),(0,em._)(this,"availableTypes",["double","float","decimal"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,unique:ff,"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"}]},"uiSchema.x-component-props.addonBefore":{type:"string",title:'{{t("Prefix")}}',"x-decorator":"FormItem","x-component":"Input"},"uiSchema.x-component-props.addonAfter":{type:"string",title:'{{t("Suffix")}}',"x-decorator":"FormItem","x-component":"Input"}}),(0,em._)(this,"filterable",{operators:rP}),(0,em._)(this,"titleUsable",!0)}}class f2 extends tR{schemaInitialize(e,t){let{field:n,block:o,readPretty:l,action:r,targetCollection:i}=t;["Table","Kanban"].includes(o)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small"),e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:fX(i)},e["x-component-props"].fieldNames.label=(null==i?void 0:i.titleField)||fX(i)}constructor(...e){super(...e),(0,em._)(this,"name","o2o"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",3),(0,em._)(this,"icon","DeploymentUnitOutlined"),(0,em._)(this,"title",'{{t("One to one")}}'),(0,em._)(this,"description",'{{t("One to one description")}}'),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}}}),(0,em._)(this,"availableTypes",["hasOne"]),(0,em._)(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 an letter.')}}"},type:fy,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-reactions":['{{useAsyncDataSource(loadCollections, ["file"])}}'],"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"}}},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 an letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}}}}}},"reverseField.name":{type:"string",title:'{{t("Inverse field name")}}',"x-hidden":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"}}),(0,em._)(this,"filterable",{nested:!0,operators:r_,children:[]})}}class f6 extends tR{schemaInitialize(e,t){var n;let{field:o,block:l,readPretty:r,action:i,targetCollection:a}=t;["Table","Kanban"].includes(l)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small"),e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:fX(a)},e["x-component-props"].fieldNames.label=(null==(n=e["x-component-props"].fieldNames)?void 0:n.label)||(null==a?void 0:a.titleField)||fX(a)}constructor(...e){super(...e),(0,em._)(this,"name","oho"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",3),(0,em._)(this,"title",'{{t("One to one (has one)")}}'),(0,em._)(this,"description",'{{t("One to one description")}}'),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}}}),(0,em._)(this,"availableTypes",["hasOne"]),(0,em._)(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 an letter.')}}"},type:fy,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-reactions":['{{useAsyncDataSource(loadCollections, ["file"])}}'],"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"}}},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 an letter.')}}","x-decorator":"FormItem","x-component":"ForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}}}}}},...fb,...fC}),(0,em._)(this,"filterable",{nested:!0,operators:r_,children:[]})}}class f3 extends tR{schemaInitialize(e,t){var n;let{field:o,block:l,readPretty:r,action:i,targetCollection:a}=t;["Table","Kanban"].includes(l)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small"),e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:fX(a)},e["x-component-props"].fieldNames.label=(null==(n=e["x-component-props"].fieldNames)?void 0:n.label)||(null==a?void 0:a.titleField)||fX(a)}constructor(...e){super(...e),(0,em._)(this,"name","obo"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",3),(0,em._)(this,"title",'{{t("One to one (belongs to)")}}'),(0,em._)(this,"description",'{{t("One to one description")}}'),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}}}),(0,em._)(this,"availableTypes",["hasOne"]),(0,em._)(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 an letter.')}}"},type:fy,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-reactions":["{{useAsyncDataSource(loadCollections)}}"],"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 an 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 }}"}}}}}}},...fb,...fC}),(0,em._)(this,"filterable",{nested:!0,operators:r_,children:[]})}}class f5 extends tR{constructor(...e){super(...e),(0,em._)(this,"name","password"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"icon","LockOutlined"),(0,em._)(this,"order",9),(0,em._)(this,"title",'{{t("Password")}}'),(0,em._)(this,"default",{type:"password",hidden:!0,uiSchema:{type:"string","x-component":"Password"}}),(0,em._)(this,"availableTypes",["password"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,unique:ff}),(0,em._)(this,"validateSchema",e=>({max:{type:"number",title:'{{ t("Max length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Max length must greater than min length"),"' : ''\n }}}")},min:{type:"number",title:'{{ t("Min length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".max"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Min length must less than max length"),"' : ''}}")}}}}}))}}(0,ec.registerValidateRules)({percentMode(e,t){let{maxValue:n,minValue:o}=t;return n&&e>n?{type:"error",message:"".concat(fG.t("The field value cannot be greater than ")).concat(100*n,"%")}:!o||!(e<o)||{type:"error",message:"".concat(fG.t("The field value cannot be less than ")).concat(100*o,"%")}},percentFormats(e,t){let{percentFormat:n}=t;return!e||"Integer"!==n||!1!==/^-?[1-9]\d*$/.test((100*e).toString())||{type:"error",message:"".concat(fG.t("The field value is not an integer number"))}}});class f4 extends tR{schemaInitialize(e,t){let{field:n,block:o,readPretty:l,action:r}=t,i=e["x-component-props"]=e["x-component-props"]||{};e["x-component-props"].style={...i.style,width:"100%"}}constructor(...e){super(...e),(0,em._)(this,"name","percent"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",8),(0,em._)(this,"title",'{{t("Percent")}}'),(0,em._)(this,"icon","PercentageOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"float",uiSchema:{type:"string","x-component":"Percent","x-component-props":{stringMode:!0,step:"1",addonAfter:"%"}}}),(0,em._)(this,"availableTypes",["float","double","decimal"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,unique:ff,"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%"}]},"uiSchema.x-component-props.addonBefore":{type:"string",title:'{{t("Prefix")}}',"x-decorator":"FormItem","x-component":"Input"},"uiSchema.x-component-props.addonAfter":{type:"string",title:'{{t("Suffix")}}',"x-decorator":"FormItem","x-component":"Input"}}),(0,em._)(this,"filterable",{operators:rP}),(0,em._)(this,"titleUsable",!0),(0,em._)(this,"validateSchema",e=>({maxValue:{type:"number",title:'{{ t("Maximum") }}',"x-decorator":"FormItem","x-component":"Percent","x-component-props":{addonAfter:"%"},"x-reactions":"{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Maximum must greater than minimum"),"' : ''\n }}}")},minValue:{type:"number",title:'{{ t("Minimum") }}',"x-decorator":"FormItem","x-component":"Percent","x-component-props":{addonAfter:"%"},"x-reactions":{dependencies:[".maximum"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Minimum must less than maximum"),"' : ''}}")}}}},percentFormat:{type:"string",title:'{{ t("Format") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!0},enum:[{label:'{{ t("Integer") }}',value:"Integer"}]},pattern:{type:"string",title:'{{ t("Regular expression") }}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{prefix:"/",suffix:"/"}}}))}}class f8 extends tR{constructor(...e){super(...e),(0,em._)(this,"name","phone"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",3),(0,em._)(this,"title",'{{t("Phone")}}'),(0,em._)(this,"icon","TabletOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"string",uiSchema:{type:"string","x-component":"Input","x-component-props":{type:"tel"}}}),(0,em._)(this,"availableTypes",["string"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,unique:ff}),(0,em._)(this,"filterable",{operators:rj}),(0,em._)(this,"titleUsable",!0)}}class f7 extends tR{constructor(...e){super(...e),(0,em._)(this,"name","radioGroup"),(0,em._)(this,"type","object"),(0,em._)(this,"group","choices"),(0,em._)(this,"order",4),(0,em._)(this,"title",'{{t("Radio group")}}'),(0,em._)(this,"icon","TagsOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"string",uiSchema:{type:"string","x-component":"Radio.Group"}}),(0,em._)(this,"availableTypes",["string","integer","boolean","integer"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,"uiSchema.enum":fw}),(0,em._)(this,"filterable",{operators:rN}),(0,em._)(this,"titleUsable",!0)}}class f9 extends tR{schemaInitialize(e,t){let{block:n}=t;["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","richText"),(0,em._)(this,"type","object"),(0,em._)(this,"group","media"),(0,em._)(this,"order",2),(0,em._)(this,"title",'{{t("Rich Text")}}'),(0,em._)(this,"icon","AlignLeftOutlined"),(0,em._)(this,"default",{interface:"richText",type:"text",uiSchema:{type:"string","x-component":"RichText"}}),(0,em._)(this,"availableTypes",["text","json"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF}),(0,em._)(this,"validateSchema",e=>({max:{type:"number",title:'{{ t("Max length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Max length must greater than min length"),"' : ''\n }}}")},min:{type:"number",title:'{{ t("Min length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".max"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Min length must less than max length"),"' : ''}}")}}}}})),(0,em._)(this,"filterable",{operators:rj})}}class ve extends tR{schemaInitialize(e,t){let{block:n}=t,o=e["x-component-props"]=e["x-component-props"]||{};o.style={...o.style,width:"100%"},["Table","Kanban"].includes(n)&&(o.ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","select"),(0,em._)(this,"type","object"),(0,em._)(this,"group","choices"),(0,em._)(this,"order",2),(0,em._)(this,"title",'{{t("Single select")}}'),(0,em._)(this,"icon","SelectOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"string",uiSchema:{type:"string","x-component":"Select",enum:[]}}),(0,em._)(this,"availableTypes",["string","bigInt","boolean"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,"uiSchema.enum":fw}),(0,em._)(this,"filterable",{operators:rN}),(0,em._)(this,"titleUsable",!0)}}class vt extends tR{schemaInitialize(e,t){let{field:n,readPretty:o}=t,l="".concat(n.collectionName,".").concat(n.name);e.type="void",e["x-component"]="TableField",e.properties={block:{type:"void","x-decorator":"TableFieldProvider","x-acl-action":"".concat(n.target,":list"),"x-decorator-props":{collection:n.target,association:l,resource:l,action:"list",params:{paginate:!1},showIndex:!0,dragSort:!1},properties:{actions:{type:"void","x-initializer":"subTable:configureActions","x-component":"TableField.ActionBar","x-component-props":{}},[n.name]:{type:"array","x-initializer":"table:configureColumns","x-component":"TableV2","x-use-component-props":"useTableFieldProps","x-component-props":{rowSelection:{type:"checkbox"}}}}}}}constructor(...e){super(...e),(0,em._)(this,"name","subTable"),(0,em._)(this,"type","object"),(0,em._)(this,"group","relation"),(0,em._)(this,"order",2),(0,em._)(this,"title",'{{t("Sub-table")}}'),(0,em._)(this,"icon","FolderOpenOutlined"),(0,em._)(this,"isAssociation",!0),(0,em._)(this,"default",{type:"hasMany",uiSchema:{type:"void","x-component":"TableField","x-component-props":{}}}),(0,em._)(this,"availableTypes",["hasMany"]),(0,em._)(this,"initialize",e=>{e.target||(e.target="t_".concat((0,ec.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,ec.uid)()))}),(0,em._)(this,"properties",{...fF,subtable:{type:"void","x-component":"SubFieldDataSourceProvider",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{useAction:"{{ ds.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{ t("Add new") }}',"x-component":"AddSubFieldAction","x-component-props":{type:"primary"}}}},children:{type:"array",title:'{{t("Fields")}}',"x-decorator":"FormItem","x-component":"Table.Array","x-component-props":{pagination:!1,expandable:{childrenColumnName:"__nochildren__"},rowKey:"name",rowSelection:{type:"checkbox"},useSelectedRowKeys:"{{ ds.useSelectedRowKeys }}",useDataSource:"{{ ds.useDataSource }}"},properties:{column1:{type:"void",title:'{{ t("Field display name") }}',"x-component":"Table.Column",properties:{"uiSchema.title":{type:"number","x-component":"Input","x-read-pretty":!0}}},column2:{type:"void",title:'{{ t("Field name") }}',"x-component":"Table.Column",properties:{name:{"x-component":"Input","x-read-pretty":!0}}},column3:{type:"void",title:'{{ t("Field interface") }}',"x-component":"Table.Column",properties:{interface:{"x-component":"Input","x-read-pretty":!0}}},column4:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditSubFieldAction","x-component-props":{}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{useAction:"{{ ds.useDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}})}}class vn extends tR{constructor(...e){super(...e),(0,em._)(this,"name","tableoid"),(0,em._)(this,"type","object"),(0,em._)(this,"group","systemInfo"),(0,em._)(this,"order",0),(0,em._)(this,"title",'{{t("Table OID")}}'),(0,em._)(this,"icon","FieldNumberOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(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}}),(0,em._)(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"}}),(0,em._)(this,"filterable",{operators:rR})}}class vo extends tR{schemaInitialize(e,t){let{block:n}=t;["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","textarea"),(0,em._)(this,"type","object"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",2),(0,em._)(this,"title",'{{t("Long text")}}'),(0,em._)(this,"icon","FileTextOutlined"),(0,em._)(this,"default",{interface:"textarea",type:"text",uiSchema:{type:"string","x-component":"Input.TextArea"}}),(0,em._)(this,"availableTypes",["text","json"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF}),(0,em._)(this,"validateSchema",e=>({max:{type:"number",title:'{{ t("Max length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Max length must greater than min length"),"' : ''\n }}}")},min:{type:"number",title:'{{ t("Min length") }}',minimum:0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".max"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Min length must less than max length"),"' : ''}}")}}}}})),(0,em._)(this,"filterable",{operators:rj})}}class vl extends tR{constructor(...e){super(...e),(0,em._)(this,"name","time"),(0,em._)(this,"type","object"),(0,em._)(this,"group","datetime"),(0,em._)(this,"order",2),(0,em._)(this,"title",'{{t("Time")}}'),(0,em._)(this,"icon","FieldTimeOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"time",uiSchema:{type:"string","x-component":"TimePicker"}}),(0,em._)(this,"availableTypes",["time"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,"uiSchema.x-component-props.format":{type:"string",title:'{{t("Time format")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"HH:mm:ss",enum:[{label:'{{t("12 hour")}}',value:"hh:mm:ss a"},{label:'{{t("24 hour")}}',value:"HH:mm:ss"}]}}),(0,em._)(this,"filterable",{operators:rM}),(0,em._)(this,"titleUsable",!0)}}class vr extends tR{constructor(...e){super(...e),(0,em._)(this,"name","updatedAt"),(0,em._)(this,"type","object"),(0,em._)(this,"group","systemInfo"),(0,em._)(this,"order",2),(0,em._)(this,"title",'{{t("Last updated at")}}'),(0,em._)(this,"icon","FieldTimeOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"date",field:"updatedAt",uiSchema:{type:"string",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}}),(0,em._)(this,"availableTypes",["date"]),(0,em._)(this,"properties",{...fF,...fS}),(0,em._)(this,"filterable",{operators:rI}),(0,em._)(this,"titleUsable",!0)}}class vi extends tR{schemaInitialize(e,t){let{block:n}=t;e.properties={viewer:(0,ed.cloneDeep)(fj)},["Table","Kanban"].includes(n)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0)}constructor(...e){super(...e),(0,em._)(this,"name","updatedBy"),(0,em._)(this,"type","object"),(0,em._)(this,"group","systemInfo"),(0,em._)(this,"order",4),(0,em._)(this,"title",'{{t("Last updated by")}}'),(0,em._)(this,"icon","UserOutlined"),(0,em._)(this,"isAssociation",!0),(0,em._)(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}}),(0,em._)(this,"availableTypes",["belongsTo"]),(0,em._)(this,"properties",{...fF}),(0,em._)(this,"filterable",{nested:!0,children:[]})}}class va extends tR{schemaInitialize(e,t){let{block:n}=t}constructor(...e){super(...e),(0,em._)(this,"name","url"),(0,em._)(this,"type","string"),(0,em._)(this,"group","basic"),(0,em._)(this,"order",5),(0,em._)(this,"title",'{{t("URL")}}'),(0,em._)(this,"icon","GlobalOutlined"),(0,em._)(this,"default",{type:"text",uiSchema:{type:"string","x-component":"Input.URL"}}),(0,em._)(this,"componentOptions",[{label:"URL",value:"Input.URL"},{label:"Preview",value:"Input.Preview"}]),(0,em._)(this,"availableTypes",["string","text"]),(0,em._)(this,"properties",{...fF}),(0,em._)(this,"titleUsable",!0),(0,em._)(this,"filterable",{operators:rj})}}class vs extends tR{constructor(...e){super(...e),(0,em._)(this,"name","sort"),(0,em._)(this,"type","object"),(0,em._)(this,"group","advanced"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Sort")}}'),(0,em._)(this,"icon","ProfileOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"titleUsable",!0),(0,em._)(this,"description",'{{t("Used for drag and drop sorting scenarios, supporting grouping sorting")}}'),(0,em._)(this,"default",{type:"sort",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"},"x-validator":"integer"}}),(0,em._)(this,"availableTypes",["bigInt","integer","sort"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Select",enum:"{{scopeKeyOptions}}",description:"{{t('When a field is selected for grouping, it will be grouped first before sorting.')}}"}}),(0,em._)(this,"filterable",{operators:rP}),(0,em._)(this,"validateSchema",e=>({maximum:{type:"number",title:'{{ t("Maximum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(fG.t("Maximum must greater than minimum"),"' : ''\n }}}")},minimum:{type:"number",title:'{{ t("Minimum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".maximum"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(fG.t("Minimum must less than maximum"),"' : ''}}")}}}},format:{type:"string",title:'{{ t("Format") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!0},enum:[{label:'{{ t("Odd") }}',value:"odd"},{label:'{{ t("Even") }}',value:"even"}]},pattern:{type:"string",title:'{{ t("Regular expression") }}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{prefix:"/",suffix:"/"}}}))}}class vc extends tR{constructor(...e){super(...e),(0,em._)(this,"name","uuid"),(0,em._)(this,"type","object"),(0,em._)(this,"group","advanced"),(0,em._)(this,"order",0),(0,em._)(this,"title",'{{t("UUID")}}'),(0,em._)(this,"icon","FieldNumberOutlined"),(0,em._)(this,"hidden",!1),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"uuid",uiSchema:{type:"string","x-component":"Input","x-validator":"uuid"}}),(0,em._)(this,"availableTypes",["string","uid","uuid"]),(0,em._)(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 an letter.')}}"}}),(0,em._)(this,"filterable",{operators:rj}),(0,em._)(this,"titleUsable",!0)}}class vd extends tR{constructor(...e){super(...e),(0,em._)(this,"name","nanoid"),(0,em._)(this,"type","object"),(0,em._)(this,"group","advanced"),(0,em._)(this,"order",0),(0,em._)(this,"title",'{{t("Nano ID")}}'),(0,em._)(this,"hidden",!1),(0,em._)(this,"sortable",!0),(0,em._)(this,"icon","FieldNumberOutlined"),(0,em._)(this,"default",{type:"nanoid",uiSchema:{type:"string","x-component":"NanoIDInput"}}),(0,em._)(this,"availableTypes",["string","uid"]),(0,em._)(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 an 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"}}),(0,em._)(this,"filterable",{operators:rj}),(0,em._)(this,"titleUsable",!0)}}class vu extends tR{constructor(...e){super(...e),(0,em._)(this,"name","unixTimestamp"),(0,em._)(this,"type","object"),(0,em._)(this,"group","datetime"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Unix Timestamp")}}'),(0,em._)(this,"icon","HistoryOutlined"),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"bigInt",uiSchema:{type:"number","x-component":"UnixTimestamp","x-component-props":{accuracy:"millisecond",showTime:!0}}}),(0,em._)(this,"availableTypes",["integet","bigInt"]),(0,em._)(this,"hasDefaultValue",!0),(0,em._)(this,"properties",{...fF,"uiSchema.x-component-props.accuracy":{type:"string",title:'{{t("Accuracy")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"millisecond",enum:[{value:"millisecond",label:'{{t("Millisecond")}}'},{value:"second",label:'{{t("Second")}}'}]}}),(0,em._)(this,"filterable",{operators:rP}),(0,em._)(this,"titleUsable",!0)}}class vp extends e1{getParentCollectionsName(){if(this.parentCollectionsName)return this.parentCollectionsName.slice();let e=[],t=n=>{let o=this.collectionManager.getCollection(n);if(o){let{inherits:n}=o;if(n)for(let o=0;o<n.length;o++){let l=n[o];e.push(l),t(l)}}return(0,ed.uniq)(e)};return this.parentCollectionsName=t(this.name),this.parentCollectionsName}getParentCollections(){return this.parentCollections?this.parentCollections.slice():(this.parentCollections=this.getParentCollectionsName().map(e=>this.collectionManager.getCollection(e)),this.parentCollections)}getChildrenCollectionsName(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?"supportView":"notSupportView";if(this.childrenCollectionsName[t])return this.childrenCollectionsName[t].slice();let n=[],o=this.collectionManager.getCollections(),l=t=>(o.filter(e=>{var n;return null==(n=e.inherits)?void 0:n.includes(t)}).forEach(e=>{let t=e.name;return n.push(t),l(t)}),e&&o.filter(e=>{var n;return(null==(n=e.sources)?void 0:n.length)===1&&(null==e?void 0:e.sources[0])===t}).forEach(e=>{let t=e.name;return n.push(e.name),l(t)}),(0,ed.uniq)(n));return this.childrenCollectionsName[t]=l(this.name),this.childrenCollectionsName[t]}getChildrenCollections(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?"supportView":"notSupportView";return this.childrenCollections[t]?this.childrenCollections[t].slice():(this.childrenCollections[t]=this.getChildrenCollectionsName(e).map(e=>this.collectionManager.getCollection(e)),this.childrenCollections[t])}getInheritedFields(){if(this.inheritsFields)return this.inheritsFields.slice();let e=this.getParentCollectionsName();return this.inheritsFields=e.map(e=>{var t;return null==(t=this.collectionManager.getCollection(e))?void 0:t.getFields()}).flat().filter(Boolean),this.inheritsFields}getFieldsMap(){return this.fieldsMap||(this.fieldsMap=this.getAllFields().reduce((e,t)=>(e[t.name]=t,e),{})),this.fieldsMap}getCurrentFields(e){return super.getFields(e)}getParentCollectionFields(e){if(this.parentCollectionFields||(this.parentCollectionFields={}),this.parentCollectionFields[e])return this.parentCollectionFields[e];let t=this.getCurrentFields(),n=this.getParentCollectionsName(),o=this.collectionManager.getCollection(e).getCurrentFields(),l=n.indexOf(e),r=t;return l>0&&(n.splice(l),n.forEach(e=>{let t=this.collectionManager.getCollection(e);r=r.concat(t.getCurrentFields())})),this.parentCollectionFields[e]=o.filter(e=>!r.find(t=>t.name===e.name)),this.parentCollectionFields[e]}getAllCollectionsInheritChain(){if(this.allCollectionsInheritChain)return this.allCollectionsInheritChain.slice();let e=[this.name],t=n=>{let o=this.collectionManager.getCollection(n);if(o){let{inherits:n}=o,l=o.getChildrenCollectionsName();if(n)for(let o=0;o<n.length;o++){let l=n[o];e.includes(l)||(e.push(l),t(l))}if(l)for(let n=0;n<l.length;n++){let o=this.collectionManager.getCollection(l[n]).name;e.includes(o)||(e.push(o),t(o))}}return e};return this.allCollectionsInheritChain=t(this.name),this.allCollectionsInheritChain||[]}getInheritCollectionsChain(){if(this.inheritCollectionsChain)return this.inheritCollectionsChain.slice();let e=[this.name],t=n=>{let o=this.collectionManager.getCollection(n);if(o){let{inherits:n}=o;if(n)for(let o=0;o<n.length;o++){let l=n[o];e.includes(l)||(e.push(l),t(l))}}return e};return this.inheritCollectionsChain=t(this.name),this.inheritCollectionsChain}getAllFields(e){if(this.allFields)return this.allFields.slice();let t=this.getCurrentFields(),n=this.getInheritedFields(),o=(0,ed.unionBy)((null==t?void 0:t.concat(n))||[],"name").filter(e=>!e.isForeignKey);return this.allFields=o,e?(0,ed.filter)(o,e):o}getForeignKeyFields(){if(this.foreignKeyFields)return this.foreignKeyFields.slice();let e=this.getCurrentFields(),t=this.getInheritedFields();return(0,ed.unionBy)((null==e?void 0:e.concat(t))||[],"name").filter(e=>e.isForeignKey)}constructor(...e){super(...e),(0,em._)(this,"parentCollectionsName",void 0),(0,em._)(this,"parentCollections",void 0),(0,em._)(this,"childrenCollections",{}),(0,em._)(this,"childrenCollectionsName",{}),(0,em._)(this,"inheritsFields",void 0),(0,em._)(this,"currentFields",void 0),(0,em._)(this,"allFields",void 0),(0,em._)(this,"parentCollectionFields",{}),(0,em._)(this,"allCollectionsInheritChain",void 0),(0,em._)(this,"inheritCollectionsChain",void 0),(0,em._)(this,"foreignKeyFields",void 0)}}class vm extends tq{constructor(...e){super(...e),(0,em._)(this,"name","general"),(0,em._)(this,"title",'{{t("General collection")}}'),(0,em._)(this,"order",1),(0,em._)(this,"color","blue"),(0,em._)(this,"default",{fields:[]}),(0,em._)(this,"configurableProperties",fP("title","name","inherits","category","description","presetFields"))}}class vh extends tq{constructor(...e){super(...e),(0,em._)(this,"name","tree"),(0,em._)(this,"title",'{{t("Tree collection")}}'),(0,em._)(this,"order",3),(0,em._)(this,"color","blue"),(0,em._)(this,"default",{tree:"adjacencyList",fields:[{interface:"integer",name:"parentId",type:"bigInt",isForeignKey:!0,uiSchema:{type:"number",title:'{{t("Parent ID")}}',"x-component":"InputNumber","x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"parent",foreignKey:"parentId",treeParent:!0,onDelete:"CASCADE",uiSchema:{title:'{{t("Parent")}}',"x-component":"AssociationField","x-component-props":{multiple:!1,fieldNames:{label:"id",value:"id"}}}},{interface:"o2m",type:"hasMany",name:"children",foreignKey:"parentId",treeChildren:!0,onDelete:"CASCADE",uiSchema:{title:'{{t("Children")}}',"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"id",value:"id"}}}}]}),(0,em._)(this,"events",{beforeSubmit(e){Array.isArray(null==e?void 0:e.fields)&&(null==e||e.fields.map(t=>{t.target=e.name}))}}),(0,em._)(this,"configurableProperties",fP("title","name","inherits","category","description","presetFields"))}}class vx extends tq{constructor(...e){super(...e),(0,em._)(this,"name","expression"),(0,em._)(this,"title",'{{t("Expression collection")}}'),(0,em._)(this,"order",4),(0,em._)(this,"color","orange"),(0,em._)(this,"default",{createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0,sortable:!0,fields:[{name:"engine",type:"string",interface:"radioGroup",uiSchema:{type:"string",title:'{{t("Calculation engine")}}',"x-component":"Radio.Group",enum:(0,eh.getOptions)(),default:"formula.js"}},{name:"sourceCollection",type:"string",interface:"select",uiSchema:{type:"string",title:'{{t("Collection")}}',"x-component":"CollectionSelect","x-component-props":{}}},{name:"expression",type:"text",interface:"expression",uiSchema:{type:"string",title:'{{t("Expression")}}',"x-component":"DynamicExpression"}}]}),(0,em._)(this,"availableFieldInterfaces",{include:[]}),(0,em._)(this,"configurableProperties",fP("title","name","inherits","category","description","presetFields"))}}class vf extends tq{constructor(...e){super(...e),(0,em._)(this,"name","view"),(0,em._)(this,"title",'{{t("Connect to database view")}}'),(0,em._)(this,"order",4),(0,em._)(this,"color","yellow"),(0,em._)(this,"default",{fields:[]}),(0,em._)(this,"divider",!0),(0,em._)(this,"configurableProperties",{title:{type:"string",title:'{{ t("Collection display name") }}',required:!0,"x-decorator":"FormItem","x-component":"Input"},databaseView:{title:'{{t("Connect to database view")}}',type:"single",required:!0,"x-decorator":"FormItem","x-component":"Select","x-reactions":["{{useAsyncDataSource(loadDBViews)}}"],"x-disabled":"{{ !createOnly }}"},name:{type:"string",title:'{{t("Collection 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 an letter.')}}","x-reactions":{dependencies:["databaseView"],when:"{{isPG}}",fulfill:{state:{initialValue:"{{$deps[0]&&$deps[0].match(/^([^_]+)_(.*)$/)?.[2]}}"}},otherwise:{state:{value:null}}}},schema:{type:"string","x-hidden":!0,"x-reactions":{dependencies:["databaseView"],when:"{{isPG}}",fulfill:{state:{value:"{{$deps[0].split('_')?.[0]}}"}},otherwise:{state:{value:null}}}},viewName:{type:"string","x-hidden":!0,"x-reactions":{dependencies:["databaseView"],when:"{{isPG}}",fulfill:{state:{value:"{{$deps[0].match(/^([^_]+)_(.*)$/)?.[2]}}"}},otherwise:{state:{value:"{{$deps[0]}}"}}}},writableView:{type:"boolean","x-content":'{{t("Allow add new, update and delete actions")}}',"x-decorator":"FormItem","x-component":"Checkbox",default:!1},sources:{type:"array",title:'{{ t("Source collections") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!0},"x-reactions":["{{useAsyncDataSource(loadCollections)}}"],"x-disabled":!0},fields:{type:"array","x-component":xz,"x-visible":"{{ createOnly }}","x-reactions":{dependencies:["name"],fulfill:{schema:{"x-component-props":"{{$form.values}}"}}}},preview:{type:"object","x-visible":"{{ createOnly }}","x-component":xG,"x-reactions":{dependencies:["name","fields"],fulfill:{schema:{"x-component-props":"{{$form.values}}"}}}},...fP("category","description")})}}class vv extends tq{constructor(...e){super(...e),(0,em._)(this,"name","sql"),(0,em._)(this,"title",'{{t("SQL collection")}}'),(0,em._)(this,"order",4),(0,em._)(this,"color","yellow"),(0,em._)(this,"default",{fields:[]}),(0,em._)(this,"configurableProperties",{title:{type:"string",title:'{{ t("Collection display name") }}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Collection 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 an letter.')}}"},config:{type:"void","x-decorator":xZ,properties:{sql:{type:"string",title:'{{t("SQL")}}',"x-decorator":"FormItem","x-component":x3,required:!0,"x-validator":(e,t,n)=>{let{form:o}=n;return o.query("sql").take().componentProps.disabled?"":fG.t("Please confirm the SQL statement first")}},sources:{type:"array",title:'{{t("Source collections")}}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!0},"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]},fields:{type:"array",title:'{{t("Fields")}}',"x-decorator":"FormItem","x-component":xJ,required:!0},table:{type:"void",title:'{{t("Preview")}}',"x-decorator":"FormItem","x-component":xQ}}},...fP("category")})}}class vg extends tq{constructor(...e){super(...e),(0,em._)(this,"name","import"),(0,em._)(this,"title",'{{t("Import json collection")}}'),(0,em._)(this,"order",5),(0,em._)(this,"color","blue"),(0,em._)(this,"divider",!0),(0,em._)(this,"default",{fields:[]})}}class vy extends tq{constructor(...e){super(...e),(0,em._)(this,"name","importXlsx"),(0,em._)(this,"title",'{{t("Import xlsx collection")}}'),(0,em._)(this,"order",6),(0,em._)(this,"color","blue"),(0,em._)(this,"divider",!1),(0,em._)(this,"default",{fields:[]})}}class vb extends e8{async getDataSource(){var e;let t=await this.app.apiClient.request({resource:"collections",action:"list",params:{paginate:!1,appends:["fields","category"],filter:{},sort:["sort"]}});return{collections:(null==t||null==(e=t.data)?void 0:e.data)||[]}}}class vC extends eR{async load(){this.dataSourceManager.addCollectionMixins([vp]),this.addFieldInterfaces(),this.addCollectionTemplates(),this.addFieldInterfaces(),this.addFieldInterfaceGroups(),this.dataSourceManager.addDataSource(vb,{key:e9,displayName:te}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("m2o",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("m2m",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("o2m",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("o2o",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("obo",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("select",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("checkbox",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("radioGroup",{label:'{{t("CustomTitle")}}',value:"CustomTitle"}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption("multipleSelect",{label:'{{t("CustomTitle")}}',value:"CustomTitle"})}addFieldInterfaceGroups(){this.dataSourceManager.addFieldInterfaceGroups({basic:{label:'{{t("Basic")}}'},choices:{label:'{{t("Choices")}}'},media:{label:'{{t("Media")}}'},datetime:{label:'{{t("Date & Time")}}'},relation:{label:'{{t("Relation")}}'},advanced:{label:'{{t("Advanced type")}}'},systemInfo:{label:'{{t("System info")}}'},others:{label:'{{t("Others")}}'}})}addFieldInterfaces(){this.dataSourceManager.addFieldInterfaces([fT,fN,fM,fD,fR,fq,f_,fO,fB,fE,fV,f$,fU,fW,fH,fJ,fQ,fZ,f0,f1,fY,f2,f6,f3,f5,f4,f8,f7,f9,ve,vt,vn,vo,vl,vr,vi,va,vs,vc,vd,vu])}addCollectionTemplates(){this.dataSourceManager.addCollectionTemplates([vm,vx,vv,vh,vf,vg,vy])}}function vS(e){var t;if(!e)return[];let n=e.split(":"),o=n.pop();return[null!=(t=n[0])?t:"main",o]}function vw(e,t){return e&&"main"!==e?"".concat(e,":").concat(t):t}let vF=["sort","createdById","createdBy","createdAt","updatedById","updatedBy","updatedAt","password","sequence"],vj=e=>{let{getCollectionFields:t,getAllCollectionsInheritChain:n,getCollection:o,getInterface:l}=sO(),[r]=(0,es.useState)(function(){return(n(e)||[]).map(e=>{var t;return{label:null==(t=o(e))?void 0:t.title,value:e}})}),i=eB(),a=(0,ec.useField)(),s=(e,n)=>{let{exclude:o=[],depth:l=0,maxDepth:r,prefix:a=""}=n;return l>r?[]:t(e).map(e=>{var t;if(o.includes(e.name)||!e.interface||["sort","password","sequence"].includes(e.type))return;let n={type:"duplicate",tag:i(null==(t=e.uiSchema)?void 0:t.title)||e.name},d={...n,role:"button",title:es.createElement(ic,n),key:a?"".concat(a,".").concat(e.name):e.name,isLeaf:!0,field:e};return["belongsTo","belongsToMany"].includes(e.type)?(n.type="reference",d.type="reference",d.title=es.createElement(ic,{...n,type:"reference"}),d.isLeaf=!1,d.children=c(e.target,{depth:l+1,maxDepth:r,prefix:d.key,exclude:vF})):["hasOne","hasMany"].includes(e.type)&&(d.isLeaf=!1,d.children=s(e.target,{depth:l+1,maxDepth:r,prefix:d.key,exclude:["id",...vF]})),d}).filter(Boolean)},c=(e,n)=>{let{prefix:o,maxDepth:l,depth:r=0,exclude:a=[]}=n;return r>l?[]:t(e).map(e=>{var t;if(!e.target||!e.interface||a.includes(e.name))return;let n={type:"preloading",tag:i(null==(t=e.uiSchema)?void 0:t.title)||e.name},s=o?"".concat(o,".").concat(e.name):e.name;return{role:"button",title:es.createElement(ic,n),key:s,isLeaf:!1,field:e,children:c(e.target,{prefix:s,depth:r+1,maxDepth:l,exclude:a})}}).filter(Boolean)},d=e=>e.map(e=>({...e,role:"button",title:es.createElement(ic,{...e,type:e.type}),children:e.children?d(e.children):null})),u=(0,es.useCallback)((e,t,n)=>{var o,l;let r=t.index,i=null==(l=a.initialValue)||null==(o=l.items)?void 0:o[r];if(!e)return[];if((null==i?void 0:i.treeData)||n)return d(n||i.treeData);try{return s(e,{exclude:["id",...vF],maxDepth:1})}catch(e){return console.error(e),[]}},[]),p=(0,es.useCallback)(e=>t=>new Promise(n=>{if(t.children.length)return t.children.forEach(t=>{vA({node:t,traverseAssociations:c,traverseFields:s,systemKeys:vF,fields:e})}),n(void 0);vA({node:t,traverseAssociations:c,traverseFields:s,systemKeys:vF,fields:e}),n(void 0)}),[]);return{collectionList:r,getEnableFieldTree:u,getOnLoadData:p,getOnCheck:(0,es.useCallback)(e=>t=>{e.value=t},[]),getScopeDataSource:e=>{let n=t(e),o=(e,n)=>{let r=[];return e.forEach(e=>{let i=((e,n)=>{var r,i;if(!e.interface)return;let a=l(e.interface);if(!(null==a?void 0:a.filterable))return;let{nested:s,children:c,operators:d}=a.filterable,u={name:e.name,title:(null==e||null==(r=e.uiSchema)?void 0:r.title)||e.name,schema:null==e?void 0:e.uiSchema,operators:(null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[],interface:e.interface};if(!e.target||!(n>2)){if(n>2)return u;if((null==c?void 0:c.length)&&(u.children=c),s){let l=o(t(e.target),n+1).filter(Boolean);u.children=u.children||[],u.children.push(...l)}return u}})(e,n);i&&r.push(i)}),r};return o(n,1)},useTitleFieldDataSource:e=>{let n=e.path.entire.replace("titleField","collection"),o=t(e.query(n).get("value")).filter(e=>{var t;return!e.isForeignKey&&(null==(t=l(e.interface))?void 0:t.titleUsable)}).map(e=>{var t;return{value:null==e?void 0:e.name,label:i(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});e.dataSource=o}}};function vA(e){let{node:t,traverseAssociations:n,traverseFields:o,systemKeys:l,fields:r}=e,i=function(e,t){let n=[...e];for(;n.length;){let e=n.shift();if(e.key===t.key)return e;e.children&&n.push(...e.children)}}(r.dataSource||r.componentProps.treeData,t),a=[];return["belongsTo","belongsToMany"].includes(t.field.type)&&(null==t?void 0:t.type)==="reference"?a=n(t.field.target,{exclude:l,prefix:t.key,maxDepth:1}):(["hasOne","hasMany"].includes(t.field.type)||(null==t?void 0:t.type)==="duplicate")&&(a=o(t.field.target,{exclude:["id",...l],prefix:t.key,maxDepth:1})),a.length?i.children=a:i.isLeaf=!0,a}let vk=()=>{var e;let t=(0,ec.useFieldSchema)(),n=tg(),o=(0,ec.useField)(),l=null==n||null==(e=n.dataSource.options)?void 0:e.collections.map(e=>({label:e.title,value:e.name})),{dn:r}=eY();return(0,A.jsx)(aW,{title:"Edit Collection",options:l,value:t.collectionName,onChange:e=>{o.setValue("");let l=n.getCollection(e).titleField;t.collectionName=e,t.default="",t["x-component-props"]={...t["x-component-props"],collection:e,fieldNames:{label:l,value:l},defaultValue:""},t["x-decorator-props"]=e,o.componentProps=t["x-component-props"],r.emit("patch",{schema:{"x-uid":t["x-uid"],collectionName:t.collectionName,"x-component-props":t["x-component-props"],"x-decorator-props":t["x-decorator-props"],default:""}}),r.refresh()}},"component-field")},vI=new mL({name:"assignFieldValuesForm:configureFields",wrap:pO,icon:"SettingOutlined",title:'{{t("Configure fields")}}',items:[{type:"itemGroup",title:'{{t("Configure fields")}}',name:"configureFields",useChildren:e=>{var t;let{name:n,currentFields:o}=tJ(),{getInterface:l,getCollection:r}=sO(),i=(0,ec.useForm)(),{readPretty:a=i.readPretty,block:s="Form"}=e||{},c=pV();return null==o||null==(t=o.filter(e=>{var t;return(null==e?void 0:e.interface)&&!(null==e||null==(t=e.uiSchema)?void 0:t["x-read-pretty"])&&"snapshot"!==e.interface&&"sequence"!==e.type}))?void 0:t.map(e=>{var t,o,i;let d=l(e.interface),u={type:"string",name:e.name,title:(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem","x-component":"AssignedField","x-decorator":"FormItem","x-collection-field":"".concat(n,".").concat(e.name)};return{name:(null==e||null==(o=e.uiSchema)?void 0:o.title)||e.name,type:"item",title:(null==e||null==(i=e.uiSchema)?void 0:i.title)||e.name,Component:"CollectionFieldInitializer",remove:c,schemaInitialize:t=>{var n;null==d||null==(n=d.schemaInitialize)||n.call(d,t,{field:e,block:s,readPretty:a,targetCollection:r(e.target)})},schema:u}})}},{name:"parentCollectionFields",Component:()=>{let e=pX({component:"AssignedField"}),{t}=(0,eT.useTranslation)(),n=eB();if(!(null==e?void 0:e.length))return null;let o=[];return e.forEach(e=>{Object.values(e)[0].length&&o.push({type:"itemGroup",divider:!0,title:t("Parent collection fields")+"("+n("".concat(Object.keys(e)[0]))+")",children:Object.values(e)[0]})}),(0,A.jsx)(mb,{children:o})}}]}),vP=()=>{let e=pX(),{t}=(0,eT.useTranslation)(),n=eB();if(!(null==e?void 0:e.length))return null;let o=[];return e.forEach(e=>{Object.values(e)[0].length&&o.push({type:"itemGroup",divider:!0,title:t("Parent collection fields")+"("+n("".concat(Object.keys(e)[0]))+")",children:Object.values(e)[0]})}),(0,A.jsx)(mb,{children:o})},vT=e=>{let t=th(),n=(0,ec.useForm)(),o=eB(),{getInterface:l,getCollection:r}=sO(),{fieldSchema:i}=co();if(!t)return null;let a=t.map(e=>{var t,a;let s=n.readPretty,c=null==i?void 0:i["x-action"];return{type:"subMenu",title:o(e.title),children:null==(a=e.fields)||null==(t=a.filter(e=>(null==e?void 0:e.interface)&&!(null==e?void 0:e.isForeignKey)&&!(null==e?void 0:e.treeChildren)))?void 0:t.map(t=>{var n,o,i,a;let d=l(t.interface),u=r(t.target),p=(null==t?void 0:t.target)&&(null==(n=r(null==t?void 0:t.target))?void 0:n.template)==="file",m=null==t||null==(o=t.uiSchema["x-component-props"])?void 0:o.fieldNames,h={type:"string",name:t.name,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"".concat(e.name,".").concat(t.name),"x-component-props":p?{fieldNames:{label:"preview",value:"id"}}:u&&m?{fieldNames:{...m,label:(null==u?void 0:u.titleField)||m.label}}:{},"x-read-pretty":null==t||null==(i=t.uiSchema)?void 0:i["x-read-pretty"]};return{type:"item",name:t.name,title:(null==t||null==(a=t.uiSchema)?void 0:a.title)||t.name,Component:"CollectionFieldInitializer",remove:pE,schemaInitialize:e=>{var n;null==d||null==(n=d.schemaInitialize)||n.call(d,e,{field:t,block:"Form",readPretty:s,action:c,targetCollection:u})},schema:h}})}}),s=[];return s.push({type:"itemGroup",title:'{{ t("Extend collections") }}',children:a}),(0,A.jsx)(mb,{children:s})},vN=()=>{let e=pW({readPretty:!0,block:"Form"}),{t}=(0,eT.useTranslation)();if(0===e.length)return null;let n=[{type:"itemGroup",title:t("Display association fields"),children:e}];return(0,A.jsx)(mb,{children:n})},vM=()=>{let e=(e=>{let{name:t}=tJ(),{getInterface:n,getInheritCollections:o,getCollection:l,getParentCollectionFields:r}=sO(),i=o(t),{snapshot:a}=co(),s=(0,ec.useForm)();return null==i?void 0:i.map(o=>{var i;let a=r(o,t),{readPretty:c=s.readPretty,block:d="Form"}=e||{};return{[l(o).title]:null==a||null==(i=a.filter(e=>{var t;return(null==e?void 0:e.interface)&&!(null==e?void 0:e.isForeignKey)&&(null==(t=n(e.interface))?void 0:t.filterable)}))?void 0:i.map(e=>{var o,r,i,a;let s=n(e.interface),u=l(e.target),p={type:"string",name:e.name,title:(null==e||null==(o=e.uiSchema)?void 0:o.title)||e.name,required:!1,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FilterFormItem","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"".concat(t,".").concat(e.name),"x-component-props":{},"x-read-pretty":null==e||null==(r=e.uiSchema)?void 0:r["x-read-pretty"]};return{name:(null==e||null==(i=e.uiSchema)?void 0:i.title)||e.name,type:"item",title:(null==e||null==(a=e.uiSchema)?void 0:a.title)||e.name,Component:"CollectionFieldInitializer",remove:pE,schemaInitialize:t=>{var n;null==s||null==(n=s.schemaInitialize)||n.call(s,t,{field:e,block:d,readPretty:c,targetCollection:u})},schema:p}})}})})(),{t}=(0,eT.useTranslation)(),n=eB(),o=[];return(null==e?void 0:e.length)>0&&e.forEach(e=>{Object.values(e)[0].length&&o.push({divider:!0,type:"itemGroup",title:t("Parent collection fields")+"("+n("".concat(Object.keys(e)[0]))+")",children:Object.values(e)[0]})}),(0,A.jsx)(mb,{children:o})},vD=()=>{let e=(()=>{var e;let{name:t,fields:n}=tJ(),{getCollectionFields:o}=sO(),l=["m2o","obo","oho","o2m","m2m"];return null==n||null==(e=n.filter(e=>l.includes(e.interface)))?void 0:e.map(e=>pH(e,e.name,t,o,[],0))})(),{t}=(0,eT.useTranslation)(),n=[{type:"itemGroup",title:t("Display association fields"),children:e}];return(0,A.jsx)(mb,{children:n})};var vR=n(16783);let vq=e=>{let{value:t,onChange:n}=e,{t:o}=(0,eT.useTranslation)(),[l,r]=(0,es.useState)(t),i=es.useRef(null);return(0,es.useEffect)(()=>{r(t)},[t]),(0,es.useEffect)(()=>{i.current.input.focus();let e=new IntersectionObserver(e=>{e[0].isIntersecting&&i.current.input.focus()});return e.observe(i.current.input),()=>{e.disconnect()}},[]),(0,A.jsxs)("div",{style:{width:210},onClick:e=>e.stopPropagation(),children:[(0,A.jsx)(nJ.A,{ref:i,allowClear:!0,style:{padding:"0 4px 6px",boxShadow:"none"},bordered:!1,placeholder:o("Search and select collection"),value:l,onClick:e=>{e.stopPropagation()},onChange:e=>{n(e.target.value),r(e.target.value)}}),(0,A.jsx)(mA.A,{style:{margin:0}})]})},v_=e=>{let{loadMore:t,maxHeight:n}=e,o=(0,es.useRef)(null);return(0,es.useEffect)(()=>{let e=o.current;if(!e)return;let l=e.parentElement;for(;l&&"UL"!==l.tagName;)l=l.parentElement;let r=function(){l&&40>=Math.abs(l.scrollHeight-l.scrollTop-l.clientHeight)&&t()};return l&&(l.style.height="".concat(n-40,"px"),l.style.maxHeight="inherit",l.style.overflowY="scroll",l.addEventListener("scroll",r)),()=>{l&&(l.removeEventListener("scroll",r),delete l.style.height)}},[t,n]),(0,A.jsx)("div",{ref:o,onClick:e=>e.stopPropagation(),children:(0,A.jsx)(eD.A,{size:"small",style:{width:"100%"}})})};function vO(e){let{data:t,openKeys:n,showType:o,hideSearch:l}=e,[r,i]=(0,es.useState)(""),[a,s]=(0,es.useState)(15),c=(0,es.useMemo)(()=>t.length>1,[t]),d=(0,es.useMemo)(()=>c?null==n?void 0:n[1]:(null==n?void 0:n.length)>0,[n]);(0,es.useEffect)(()=>{d||i("")},[d]);let u=(0,es.useMemo)(()=>{var e,n;return c?d&&(null==(n=t.find(e=>(e.key||e.name)===d))?void 0:n.children)||[]:(null==(e=t[0])?void 0:e.children)||[]},[t,c,d]),p=(0,es.useMemo)(()=>{if(!r)return u;let e=r.toLocaleLowerCase();return u.filter(t=>(t.label||t.title)&&String(t.label||t.title).toLocaleLowerCase().includes(e))},[r,u]),m=(0,es.useMemo)(()=>p.length>a,[a,p]),h=(0,es.useMemo)(()=>p.slice(0,a),[p,a]),x=(0,es.useMemo)(()=>{let e=[];return l||e.push(Object.assign({key:"search",label:(0,A.jsx)(vq,{value:r,onChange:e=>{s(15),i(e)}}),onClick(e){let{domEvent:t}=e;t.stopPropagation()}},o?{isMenuType:!0}:{})),h.length>0?(e.push(...h),m&&e.push(Object.assign({key:"load-more",label:(0,A.jsx)(v_,{maxHeight:600,loadMore:()=>{s(e=>e+15)}})},o?{isMenuType:!0}:{}))):e.push(Object.assign({key:"empty",style:{height:150},label:(0,A.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,A.jsx)(op.A,{image:op.A.PRESENTED_IMAGE_SIMPLE})})},o?{isMenuType:!0}:{})),e},[l,h,r,m,o]);return(0,es.useMemo)(()=>c?t.map(e=>d&&e.key===d?{...e,children:x}:{...e,children:[]}):x,[t,c,d,x])}let vB=e=>{var t;let{templateWrap:n,onCreateBlockSchema:o,componentType:l,icon:r=vR.A,name:i,title:a,filter:s,onlyCurrentDataSource:c,hideSearch:d,showAssociationFields:u,hideChildrenIfSingleCollection:p,filterDataSource:m,items:h,fromOthersInPopup:x,hideOtherRecordsInPopup:f}=e,{insert:v,setVisible:g}=me(),y=eB(),{getTemplateSchemaByMode:b}=rg(),C=(0,es.useCallback)(async e=>{let{item:t}=e;if(t.template){let e=await b(t);n?v(n(e,{item:t,fromOthersInPopup:x})):v(e)}else o&&o({item:t,fromOthersInPopup:x});g(!1)},[x,b,v,o,g,n]),S=h||p2({componentName:l,filter:s,filterDataSource:m,onlyCurrentDataSource:c,showAssociationFields:u,dataBlockInitializerProps:e,hideOtherRecordsInPopup:f}),w=mE(C),F=(0,es.useMemo)(()=>w(S,i),[w,S,i]),[j,k]=(0,es.useState)([]),I=vO({data:F,openKeys:j,hideSearch:d}),P=(0,es.useMemo)(()=>{let t=I.filter(e=>"search"!==e.key&&"empty"!==e.key);return t=p&&1===t.length?t[0].children:I,[{key:i,label:y(a),icon:"string"==typeof r?(0,A.jsx)(i6,{type:r}):r,onClick:t=>{t.key===i&&C({...t,item:e})},children:t}]},[I,p,i,y,a,r,C,e]);return F.length>1||1===F.length&&(null==(t=F[0].children)?void 0:t.length)>0?(0,A.jsx)(mm,{onOpenChange:e=>{k(e)},items:P}):(0,A.jsx)(mf,{...e,onClick:C})};function vE(e){let{collectionName:t,dataSource:n,association:o,templateSchema:l,hideActionInitializer:r,rowKey:i}=e;if(!n||!i)throw Error("dataSource and rowKey are required");return{type:"void","x-acl-action":"".concat(o||t,":view"),"x-decorator":"DetailsBlockProvider","x-use-decorator-props":"useDetailsWithPaginationDecoratorProps","x-decorator-props":{dataSource:n,collection:t,association:o,readPretty:!0,action:"list",params:{pageSize:1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:detailsWithPagination","x-component":"CardItem",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Details","x-read-pretty":!0,"x-use-component-props":"useDetailsWithPaginationProps",properties:{[(0,ec.uid)()]:{type:"void","x-initializer":r?void 0:"details:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{}},grid:l||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}},pagination:{type:"void","x-component":"Pagination","x-use-component-props":"useDetailsPaginationProps"}}}}}}let vV=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideSearch:o,componentType:l="Details",createBlockSchema:r,templateWrap:i,showAssociationFields:a,hideChildrenIfSingleCollection:s}=e,c=mn(),{createDetailsBlock:d}=vz();return(0,A.jsx)(vB,{...c,icon:(0,A.jsx)(vR.A,{}),componentType:l,onCreateBlockSchema:async e=>{if(r)return r(e);d(e)},onlyCurrentDataSource:!!n,hideSearch:o,filter:t,templateWrap:i,showAssociationFields:a,hideChildrenIfSingleCollection:s})},vz=()=>{let{insert:e}=me(),t=tg();return{createDetailsBlock:(0,es.useCallback)(n=>{let{item:o}=n,l=t.getCollection(o.name);e(vE({collectionName:o.name,dataSource:o.dataSource,rowKey:l.filterTargetKey||"id",hideActionInitializer:!(("view"!==l.template||(null==l?void 0:l.writableView))&&"sql"!==l.template)}))},[t,e])}};var vL=n(18799);function vG(e){let{collectionName:t,dataSource:n,association:o,templateSchema:l}=e,r=e.isCurrent?{"x-is-current":!0}:{};if(!n)throw Error("dataSource are required");return{type:"void","x-acl-action":"".concat(o||t,":get"),"x-decorator":"DetailsBlockProvider","x-use-decorator-props":"useDetailsDecoratorProps","x-decorator-props":{dataSource:n,collection:t,association:o,readPretty:!0,action:"get"},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:details","x-component":"CardItem",...r,properties:{[(0,ec.uid)()]:{type:"void","x-component":"Details","x-read-pretty":!0,"x-use-component-props":"useDetailsProps",properties:{[(0,ec.uid)()]:{type:"void","x-initializer":"details:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{}},grid:l||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}}}let vK=()=>{let{icon:e=!0,targetCollection:t,...n}=mn(),o=tJ(),l=t||o,{createSingleDetailsSchema:r}=v$();return(0,A.jsx)(mf,{icon:e&&(0,A.jsx)(vL.A,{}),...n,onClick:e=>r(e),items:p1("ReadPrettyFormItem",null,null==l?void 0:l.name)})};function v$(){let{insert:e}=me(),{getTemplateSchemaByMode:t}=rg(),n=tN(),o=(0,es.useCallback)((e,t)=>{let{item:o}=t;if("ReadPrettyFormItem"!==o.template.componentName)return e;{let t=vG(n?{association:n,dataSource:o.dataSource,templateSchema:e,isCurrent:!0}:{collectionName:o.collectionName||o.name,dataSource:o.dataSource,templateSchema:e});return"reference"===o.mode&&(t["x-template-key"]=o.template.key),t}},[n]);return{createSingleDetailsSchema:(0,es.useCallback)(async l=>{let{item:r}=l;r.template?e(o(await t(r),{item:r})):e(vG(n?{association:n,dataSource:r.dataSource,isCurrent:!0}:{collectionName:r.collectionName||r.name,dataSource:r.dataSource}))},[n,t,e,o]),templateWrap:o}}var vU=n(5752);let vW=e=>{let{collectionName:t,association:n,templateSchema:o,dataSource:l,rowKey:r}=e;if(!l)throw Error("dataSource are required");return{type:"void","x-acl-action":"".concat(n||t,":view"),"x-decorator":"GridCard.Decorator","x-use-decorator-props":"useGridCardBlockDecoratorProps","x-decorator-props":{collection:t,association:n,dataSource:l,readPretty:!0,action:"list",params:{pageSize:12},runWhenParamsChanged:!0,rowKey:r,isLinkable:!1,needInfiniteScroll:!1,layoutDirection:"column"},"x-component":"BlockItem","x-use-component-props":"useGridCardBlockItemProps","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:gridCard",properties:{actionBar:{type:"void","x-initializer":"gridCard:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}}},list:{type:"array","x-component":"GridCard","x-use-component-props":"useGridCardBlockProps",properties:{item:{type:"object","x-component":"GridCard.Item","x-read-pretty":!0,"x-use-component-props":"useGridCardItemProps",properties:{grid:o||{type:"void","x-component":"Grid","x-initializer":"details:configureFields"},actionBar:{type:"void","x-align":"left","x-initializer":"gridCard:configureItemActions","x-component":"ActionBar","x-use-component-props":"useGridCardActionBarProps","x-component-props":{layout:"one-column"}}}}}}}}},vH=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideSearch:o,createBlockSchema:l,componentType:r="FormItem",templateWrap:i,showAssociationFields:a}=e,s=mn(),{createGridCardBlock:c}=vY();return(0,A.jsx)(vB,{...s,icon:(0,A.jsx)(vU.A,{}),componentType:"GridCard",onCreateBlockSchema:async e=>{if(l)return l(e);c(e)},onlyCurrentDataSource:n,hideSearch:o,filter:t,showAssociationFields:a})},vY=()=>{let{insert:e}=me(),{getCollection:t}=sO();return{createGridCardBlock:n=>{let{item:o}=n,l=t(o.name,o.dataSource);e(vW({collectionName:o.name,dataSource:o.dataSource,rowKey:l.filterTargetKey||"id"}))}}},vX=e=>{let{collectionName:t,dataSource:n,association:o,templateSchema:l,rowKey:r}=e;return{type:"void","x-acl-action":"".concat(o||t,":view"),"x-decorator":"List.Decorator","x-use-decorator-props":"useListBlockDecoratorProps","x-decorator-props":{collection:t,dataSource:n,association:o,readPretty:!0,action:"list",params:{pageSize:10},runWhenParamsChanged:!0,rowKey:r},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:list",properties:{actionBar:{type:"void","x-initializer":"list:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}}},list:{type:"array","x-component":"List","x-use-component-props":"useListBlockProps",properties:{item:{type:"object","x-component":"List.Item","x-read-pretty":!0,"x-use-component-props":"useListItemProps",properties:{grid:l||{type:"void","x-component":"Grid","x-initializer":"details:configureFields"},actionBar:{type:"void","x-align":"left","x-initializer":"list:configureItemActions","x-component":"ActionBar","x-use-component-props":"useListActionBarProps","x-component-props":{layout:"one-column"}}}}}}}}},vJ=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideSearch:o,createBlockSchema:l,componentType:r="FormItem",templateWrap:i,showAssociationFields:a}=e,s=mn(),{createListBlock:c}=vQ();return(0,A.jsx)(vB,{...s,icon:(0,A.jsx)(vU.A,{}),componentType:"List",onCreateBlockSchema:async e=>{if(l)return l(e);c(e)},onlyCurrentDataSource:n,hideSearch:o,filter:t,showAssociationFields:a})},vQ=()=>{let{getCollection:e}=sO(),{insert:t}=me();return{createListBlock:n=>{let{item:o}=n,l=e(o.name,o.dataSource);t(vX({collectionName:o.name,dataSource:o.dataSource,rowKey:l.filterTargetKey||"id"}))}}},vZ=e=>["linkTo","subTable","o2m","m2m","obo","oho","o2o","m2o"].includes(e.interface),v0=new mL({name:"popup:common:addBlock",wrap:pO,title:'{{t("Add block")}}',icon:"PlusOutlined",items:[{type:"itemGroup",name:"dataBlocks",title:'{{t("Data blocks")}}',useChildren:function(){let e=tS(),{getChildrenCollections:t}=sO(),n=t(e.name,!0,e.dataSource).filter(e=>null==e?void 0:e.filterTargetKey);return[{name:"details",title:'{{t("Details")}}',Component:"DetailsBlockInitializer",collectionName:e.name,dataSource:e.dataSource,useComponentProps(){let e=tJ(),{createSingleDetailsSchema:t,templateWrap:o}=v$(),{createAssociationDetailsBlock:l}=yl(),{createAssociationDetailsWithoutPagination:r,templateWrap:i}=ym(),{createDetailsBlock:a}=vz(),s=[e,...n];return{filterCollections(e){let{collection:t,associationField:n}=e;return t?s.some(e=>e.name===t.name):!!n},onlyCurrentDataSource:!0,hideSearch:!0,componentType:"ReadPrettyFormItem",createBlockSchema:(0,es.useCallback)(e=>{let{item:n,fromOthersInPopup:o}=e;return o?a({item:n}):n.associationField?["hasOne","belongsTo"].includes(n.associationField.type)?r({item:n}):l({item:n}):t({item:n})},[l,r,a,t]),templateWrap:(0,es.useCallback)((e,t)=>{let{item:n}=t;return n.associationField?["hasOne","belongsTo"].includes(n.associationField.type)?i(e,{item:n}):e:o(e,{item:n})},[o,i]),showAssociationFields:!0}}},{name:"editForm",title:'{{t("Form (Edit)")}}',Component:"FormBlockInitializer",collectionName:e.name,dataSource:e.dataSource,useComponentProps(){let e=tJ(),{createEditFormBlock:t,templateWrap:o}=br(),l=[e,...n];return{filterCollections(e){let{collection:t}=e;return!t||l.some(e=>e.name===t.name)},onlyCurrentDataSource:!0,hideSearch:!0,componentType:"FormItem",createBlockSchema:t,templateWrap:o,hideOtherRecordsInPopup:!0,showAssociationFields:!0}},useVisible:()=>("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template},{name:"createForm",title:'{{t("Form (Add new)")}}',Component:"FormBlockInitializer",collectionName:e.name,dataSource:e.dataSource,useComponentProps(){let{createAssociationFormBlock:e,templateWrap:t}=ya(),{createFormBlock:n,templateWrap:o}=bt();return{filterCollections(e){let{collection:t,associationField:n}=e;return!!n&&["hasMany","belongsToMany"].includes(n.type)},onlyCurrentDataSource:!0,hideSearch:!0,componentType:"FormItem",createBlockSchema:t=>{let{item:o,fromOthersInPopup:l}=t;if(l)return n({item:o,fromOthersInPopup:l});e({item:o})},templateWrap:(e,n)=>{let{item:l,fromOthersInPopup:r}=n;if(r)return o(e,{item:l});t(e,{item:l})},showAssociationFields:!0}}},{name:"table",title:'{{t("Table")}}',Component:"TableBlockInitializer",useComponentProps(){let{createAssociationTableBlock:e}=yn(),{createTableBlock:t}=bS();return{hideSearch:!0,onlyCurrentDataSource:!0,filterCollections(e){let{associationField:t}=e;return!!t&&["hasMany","belongsToMany"].includes(t.type)},createBlockSchema:n=>{let{item:o,fromOthersInPopup:l}=n;if(l)return t({item:o});e({item:o})},showAssociationFields:!0}}},{name:"list",title:'{{t("List")}}',Component:"ListBlockInitializer",useComponentProps(){let{createAssociationListBlock:e}=yu(),{createListBlock:t}=vQ();return{hideSearch:!0,onlyCurrentDataSource:!0,filterCollections(e){let{associationField:t}=e;return!!t&&["hasMany","belongsToMany"].includes(t.type)},createBlockSchema:n=>{let{item:o,fromOthersInPopup:l}=n;if(l)return t({item:o});e({item:o})},showAssociationFields:!0}}},{name:"gridCard",title:'{{t("Grid Card")}}',Component:"GridCardBlockInitializer",useComponentProps(){let{createAssociationGridCardBlock:e}=yc(),{createGridCardBlock:t}=vY();return{hideSearch:!0,onlyCurrentDataSource:!0,filterCollections(e){let{associationField:t}=e;return!!t&&["hasMany","belongsToMany"].includes(t.type)},createBlockSchema:n=>{let{item:o,fromOthersInPopup:l}=n;if(l)return t({item:o});e({item:o})},showAssociationFields:!0}}}]}},{name:"filterBlocks",title:'{{t("Filter blocks")}}',type:"itemGroup",useVisible(){let e=tS();return(0,es.useMemo)(()=>e.fields.some(e=>vZ(e)&&["hasMany","belongsToMany"].includes(e.type)),[e.fields])},children:[{name:"filterForm",title:'{{t("Form")}}',Component:"FilterFormBlockInitializer",useComponentProps(){let e=tS(),t=(0,es.useMemo)(()=>e.fields.filter(e=>["hasMany","belongsToMany"].includes(e.type)),[e.fields]);return{filterCollections(e){let{collection:n}=e;if(n)return t.some(e=>e.target===n.name)},onlyCurrentDataSource:!0}}},{name:"filterCollapse",title:'{{t("Collapse")}}',Component:"FilterCollapseBlockInitializer",useComponentProps(){let e=tS(),t=(0,es.useMemo)(()=>e.fields.filter(e=>["hasMany","belongsToMany"].includes(e.type)),[e.fields]);return{filterCollections(e){let{collection:n}=e;if(n)return t.some(e=>e.target===n.name)},onlyCurrentDataSource:!0}}},{name:"filterTree",title:'{{t("Tree")}}',Component:"FilterTreeBlockInitializer",useComponentProps(){let e=tS(),t=(0,es.useMemo)(()=>e.fields.filter(e=>["hasMany","belongsToMany"].includes(e.type)),[e.fields]);return{filterCollections(e){let{collection:n}=e;if(n)return t.some(e=>e.target===n.name)},onlyCurrentDataSource:!0}}}]},{type:"itemGroup",name:"otherBlocks",title:'{{t("Other blocks")}}',children:[{name:"markdown",title:'{{t("Demonstration text")}}',Component:"MarkdownBlockInitializer"}]}]}),v1=new mL({name:"subTable:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",title:"{{t('Enable actions')}}",name:"enableActions",children:[{name:"addNew",title:"{{t('Add new')}}",Component:"CreateActionInitializer",schema:{"x-align":"right"}},{name:"delete",title:"{{t('Delete')}}",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right"}}]}]}),v2=e=>{let{designable:t,insertBeforeEnd:n}=eY();(0,ec.useFieldSchema)();let{message:o}=eX.A.useApp(),{isCreate:l,isBulkEdit:r,options:i}=e,{gridInitializer:a}=i,{getAriaLabel:s}=mq(),c=m3(),d=()=>{let e=(0,ec.useForm)(),t=co(),o=a;return!o&&(o="popup:common:addBlock",l||!c?o="popup:addNew:addBlock":r&&(o="popup:bulkEdit:addBlock")),{async run(){await e.submit();let{title:l,icon:r}=e.values;n({type:"void",title:l,"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{icon:r},properties:{grid:{type:"void","x-component":"Grid","x-initializer":o,properties:{}}}}),await e.reset(),t.setVisible(!1)}}},u=(0,es.useMemo)(()=>({type:"void",properties:{fixStyle:{type:"void","x-component":"div","x-component-props":{style:{display:"flex"}},properties:{action1:{type:"void","x-component":"Action","x-component-props":{icon:"PlusOutlined",style:{borderColor:"var(--colorSettings)",color:"var(--colorSettings)"},type:"dashed","aria-label":s()},title:'{{t("Add tab")}}',properties:{drawer1:{"x-decorator":"Form","x-component":"Action.Modal","x-component-props":{width:520},type:"void",title:'{{t("Add tab")}}',properties:{title:{title:'{{t("Tab name")}}',required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:'{{t("Icon")}}',"x-component":"IconPicker","x-decorator":"FormItem"},footer:{"x-component":"Action.Modal.Footer",type:"void",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:()=>{let e=co();return{async run(){e.setVisible(!1)}}}}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:d}}}}}}}}}}}}),[]);return t?(0,A.jsx)(al,{schema:u}):null},v6=e=>(0,A.jsx)(v2,{...e,isCreate:!0}),v3=e=>(0,A.jsx)(v2,{...e,isBulkEdit:!0}),v5=new mL({name:"TabPaneInitializers",Component:v2,popover:!1}),v4=new mL({name:"popup:addTab",Component:v2,popover:!1}),v8=new mL({name:"TabPaneInitializersForCreateFormBlock",Component:v6,popover:!1}),v7=new mL({name:"TabPaneInitializersForBulkEditFormBlock",Component:v3,popover:!1}),v9=new mL({name:"AssociationFilter.FilterBlockInitializer",style:{marginTop:16},icon:"SettingOutlined",title:'{{t("Configure fields")}}',items:[{type:"itemGroup",name:"associationFields",title:'{{t("Association fields")}}',useChildren:()=>pN().map(e=>{var t,n;return{name:e.key,title:null==(t=e.uiSchema)?void 0:t.title,Component:"AssociationFilterDesignerDisplayField",schema:{name:e.name,title:null==(n=e.uiSchema)?void 0:n.title,type:"void","x-toolbar":"CollapseItemSchemaToolbar","x-settings":"fieldSettings:FilterCollapseItem","x-component":"AssociationFilter.Item","x-use-component-props":"useAssociationFilterBlockProps","x-component-props":{fieldNames:{label:e.targetKey||"id"}},properties:{}}}})},{name:"choicesFields",type:"itemGroup",title:'{{t("Choices fields")}}',hideIfNoChildren:!0,useChildren:()=>u4().map(e=>({name:e.key,title:e.uiSchema.title,Component:"AssociationFilterDesignerDisplayField",schema:{name:e.name,title:e.uiSchema.title,interface:e.interface,type:"void","x-toolbar":"CollapseItemSchemaToolbar","x-settings":"fieldSettings:FilterCollapseItem","x-component":"AssociationFilter.Item","x-component-props":{fieldNames:{label:e.name},useProps:"{{useAssociationFilterBlockProps}}"},properties:{}}}))}]}),ge=new mL({name:"filterCollapse:configureFields",style:{marginTop:16},icon:"SettingOutlined",title:'{{t("Configure fields")}}',items:[{type:"itemGroup",name:"associationFields",title:'{{t("Association fields")}}',useChildren(){let e=pN(),t=tg();return e.map(e=>{var n,o,l;return{name:e.key,title:null==(n=e.uiSchema)?void 0:n.title,Component:"AssociationFilterDesignerDisplayField",schema:{name:e.name,title:null==(o=e.uiSchema)?void 0:o.title,type:"void","x-toolbar":"CollapseItemSchemaToolbar","x-settings":"fieldSettings:FilterCollapseItem","x-component":"AssociationFilter.Item","x-use-component-props":"useAssociationFilterBlockProps","x-component-props":{fieldNames:{label:(null==(l=t.getCollection(e.target))?void 0:l.getPrimaryKey())||"id"}},properties:{}}}})}},{name:"choicesFields",type:"itemGroup",title:'{{t("Choices fields")}}',hideIfNoChildren:!0,useChildren:()=>u4().map(e=>({name:e.key,title:e.uiSchema.title,Component:"AssociationFilterDesignerDisplayField",schema:{name:e.name,title:e.uiSchema.title,interface:e.interface,type:"void","x-toolbar":"CollapseItemSchemaToolbar","x-settings":"fieldSettings:FilterCollapseItem","x-component":"AssociationFilter.Item","x-use-component-props":"useAssociationFilterBlockProps","x-component-props":{fieldNames:{label:e.name}},properties:{}}}))}]}),gt=new mL({name:"AssociationFilter.Initializer",style:{marginTop:16},icon:"SettingOutlined",title:'{{t("Configure fields")}}',items:[{name:"associationFields",type:"itemGroup",title:'{{t("Association fields")}}',useChildren:()=>pN().map(e=>{var t,n;return{type:"item",name:e.key,title:null==(t=e.uiSchema)?void 0:t.title,Component:"AssociationFilterDesignerDisplayField",schema:{name:e.name,title:null==(n=e.uiSchema)?void 0:n.title,type:"void","x-toolbar":"CollapseItemSchemaToolbar","x-settings":"fieldSettings:FilterCollapseItem","x-component":"AssociationFilter.Item","x-use-component-props":"useAssociationFilterProps","x-component-props":{fieldNames:{label:e.targetKey||"id"}},properties:{}}}})},{name:"divider",type:"divider"},{name:"delete",title:'{{t("Delete")}}',Component:"AssociationFilterDesignerDelete"}]});var gn=n(35658);let go=es.forwardRef((e,t)=>{let{value:n,onChange:o,space:l=2,...r}=e,i=(0,ec.useField)(),[a,s]=(0,es.useState)("");return(0,es.useEffect)(()=>{try{null!=n?s(JSON.stringify(n,null,l)):s(void 0)}catch(e){}},[l,n]),(0,A.jsx)(nJ.A.TextArea,{...r,style:{fontSize:"80%",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",...r.style},ref:t,value:a,onChange:e=>{s(e.target.value);try{""!==e.target.value.trim()&&JSON.parse(e.target.value),""!==e.target.value.trim()&&JSON.parse(e.target.value),i.setFeedback({})}catch(e){i.setFeedback({type:"error",code:"JSONSyntaxError",messages:[e.message]})}},onBlur:e=>{try{let t=""!==e.target.value.trim()?JSON.parse(e.target.value):null;i.setFeedback({}),null==o||o(t)}catch(e){i.setFeedback({type:"error",code:"JSONSyntaxError",messages:[e.message]})}}})});go.displayName="Json";var gl=n(62856);let gr={overflow:"hidden",overflowWrap:"break-word",textOverflow:"ellipsis",whiteSpace:"nowrap",wordBreak:"break-all"},gi=(0,es.forwardRef)((e,t)=>{let[n,o]=(0,es.useState)(!1),[l,r]=(0,es.useState)(!1),i=(0,es.useRef)();if((0,es.useImperativeHandle)(t,()=>({setPopoverVisible:r})),!e.ellipsis)return(0,A.jsx)(A.Fragment,{children:e.children});let{popoverContent:a}=e;return(0,A.jsx)(dB.A,{open:n&&l,onOpenChange:e=>{r(n&&e)},content:(0,A.jsx)("div",{style:{width:300,overflow:"auto",maxHeight:400},children:a||e.children}),children:(0,A.jsx)("div",{ref:i,style:{...gr},onMouseEnter:e=>{var t;let n=e.target;(e=>{if(e){let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect().width}})(i.current)>(null==(t=i.current)?void 0:t.offsetWidth)&&o(n.scrollWidth>=n.clientWidth)},children:e.children})})});function ga(){let e=(0,ns._)(["\n margin-bottom: 0;\n line-height: 1.5;\n font-size: 90%;\n "]);return ga=function(){return e},e}gi.displayName="EllipsisWithTooltip";let gs=()=>null,gc={small:24,middle:48,large:72,oversized:120};gs.Input=e=>{let t=(0,eh.usePrefixCls)("description-input",e),n=eB();return(0,A.jsxs)("div",{className:r6()(t,e.className),style:{overflowWrap:"break-word",whiteSpace:"normal",...e.style},children:[n(e.addonBefore),n(e.prefix),(0,A.jsx)(gi,{ellipsis:e.ellipsis,children:n(e.value)}),n(e.suffix),n(e.addonAfter)]})},gs.TextArea=e=>{var t;let n=(0,eh.usePrefixCls)("description-textarea",e),o=eB()(null!=(t=e.value)?t:""),{autop:l=!0,ellipsis:r,text:i}=e,a=(0,A.jsx)("div",{style:{lineHeight:1.612},dangerouslySetInnerHTML:{__html:pi(o).split("\n").join("<br/>")}}),s=r?(0,A.jsx)(gi,{ellipsis:r,popoverContent:l?a:o,children:i||o}):l?a:o;return(0,A.jsxs)("div",{className:r6()(n,e.className),style:{overflowWrap:"break-word",...e.style},children:[e.addonBefore,e.prefix,s,e.suffix,e.addonAfter]})},gs.URL=e=>{var t;let n=(0,eh.usePrefixCls)("description-url",e),o=e.value&&(0,A.jsx)(e2.A.Link,{ellipsis:!0,target:"_blank",href:e.value,children:null==(t=e.value)?void 0:t.toString()});return(0,A.jsxs)("div",{className:r6()(n,e.className),style:e.style,children:[e.addonBefore,e.prefix,o,e.suffix,e.addonAfter]})},gs.Html=e=>{var t;let n,o,l=(0,eh.usePrefixCls)("description-textarea",e),r=eB()(null!=(t=e.value)?t:""),{autop:i=!0,ellipsis:a}=e,s=(0,A.jsx)("div",{dangerouslySetInnerHTML:{__html:r}}),c=((n=document.createElement("div")).innerHTML=r,(null==(o=n.innerText)?void 0:o.replace(/[\n\r]/g,""))||""),d=(0,A.jsx)(gi,{ellipsis:a,popoverContent:i?s:r,children:a?c:s});return(0,A.jsxs)("div",{className:r6()(l,e.className),style:{overflowWrap:"break-word",...e.style},children:[e.addonBefore,e.prefix,d,e.suffix,e.addonAfter]})},gs.JSON=e=>{var t;let n=(0,eh.usePrefixCls)("json",e);return(0,A.jsx)("pre",{className:r6()(n,e.className,(0,iS.css)(ga())),style:e.style,children:null!=e.value?JSON.stringify(e.value,null,null!=(t=e.space)?t:2):""})},gs.Preview=e=>{var t,n;let o=(0,ec.useFieldSchema)(),l=(null==(t=o["x-component-props"])?void 0:t.size)||"small",r=(null==(n=o["x-component-props"])?void 0:n.objectFit)||"cover";return e.value?(0,A.jsx)(gl.A,{style:["small","middle","large","oversized"].includes(l)?{width:gc[l],height:gc[l],objectFit:r}:{},src:e.value}):e.value};let gd=Object.assign((0,ec.connect)(nJ.A,(0,ec.mapProps)((e,t)=>({...e,suffix:(0,A.jsx)("span",{children:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffix})})),(0,ec.mapReadPretty)(gs.Input)),{TextArea:(0,ec.connect)(nJ.A.TextArea,(0,ec.mapProps)((e,t)=>({autoSize:{maxRows:10,minRows:3},...e})),(0,ec.mapReadPretty)(gs.TextArea)),URL:(0,ec.connect)(nJ.A,(0,ec.mapReadPretty)(gs.URL)),JSON:(0,ec.connect)(go,(0,ec.mapReadPretty)(gs.JSON)),ReadPretty:gs.Input,Preview:gs.Preview});var gu=n(90406),gp=n(76680),gm=n(37619);let gh=[{ext:/\.docx?$/i,icon:"//img.alicdn.com/tfs/TB1n8jfr1uSBuNjy1XcXXcYjFXa-200-200.png"},{ext:/\.pptx?$/i,icon:"//img.alicdn.com/tfs/TB1ItgWr_tYBeNjy1XdXXXXyVXa-200-200.png"},{ext:/\.jpe?g$/i,icon:"//img.alicdn.com/tfs/TB1wrT5r9BYBeNjy0FeXXbnmFXa-200-200.png"},{ext:/\.pdf$/i,icon:"//img.alicdn.com/tfs/TB1GwD8r9BYBeNjy0FeXXbnmFXa-200-200.png"},{ext:/\.png$/i,icon:"//img.alicdn.com/tfs/TB1BHT5r9BYBeNjy0FeXXbnmFXa-200-200.png"},{ext:/\.eps$/i,icon:"//img.alicdn.com/tfs/TB1G_iGrVOWBuNjy0FiXXXFxVXa-200-200.png"},{ext:/\.ai$/i,icon:"//img.alicdn.com/tfs/TB1B2cVr_tYBeNjy1XdXXXXyVXa-200-200.png"},{ext:/\.gif$/i,icon:"//img.alicdn.com/tfs/TB1DTiGrVOWBuNjy0FiXXXFxVXa-200-200.png"},{ext:/\.svg$/i,icon:"//img.alicdn.com/tfs/TB1uUm9rY9YBuNjy0FgXXcxcXXa-200-200.png"},{ext:/\.xlsx?$/i,icon:"//img.alicdn.com/tfs/TB1any1r1OSBuNjy0FdXXbDnVXa-200-200.png"},{ext:/\.psd?$/i,icon:"//img.alicdn.com/tfs/TB1_nu1r1OSBuNjy0FdXXbDnVXa-200-200.png"},{ext:/\.(wav|aif|aiff|au|mp1|mp2|mp3|ra|rm|ram|mid|rmi)$/i,icon:"//img.alicdn.com/tfs/TB1jPvwr49YBuNjy0FfXXXIsVXa-200-200.png"},{ext:/\.(avi|wmv|mpg|mpeg|vob|dat|3gp|mp4|mkv|rm|rmvb|mov|flv)$/i,icon:"//img.alicdn.com/tfs/TB1FrT5r9BYBeNjy0FeXXbnmFXa-200-200.png"},{ext:/\.(zip|rar|arj|z|gz|iso|jar|ace|tar|uue|dmg|pkg|lzh|cab)$/i,icon:"//img.alicdn.com/tfs/TB10jmfr29TBuNjy0FcXXbeiFXa-200-200.png"},{ext:/\.[^.]+$/i,icon:"//img.alicdn.com/tfs/TB10.R4r3mTBuNjy1XbXXaMrVXa-200-200.png"}],gx=e=>(0,ec.isValid)(e)&&0!==Object.keys(e).length?(0,ec.toArr)(e):[],gf=(e,t)=>t&&(0,ec.isArr)(t.include)?t.include.some(t=>e.test(t)):!(t&&(0,ec.isArr)(t.exclude))||!t.exclude.some(t=>e.test(t)),gv=(e,t)=>{for(let n=0;n<gh.length;n++)if(gh[n].ext.test(e)&&gf(gh[n].ext,t))return gh[n].icon||e;return e},gg=e=>(null==e?void 0:e.url)||(null==e?void 0:e.downloadURL)||(null==e?void 0:e.imgURL),gy=e=>(null==e?void 0:e.thumbUrl)||(null==e?void 0:e.url)||(null==e?void 0:e.downloadURL)||(null==e?void 0:e.imgURL),gb=e=>(null==e?void 0:e.errorMessage)||(null==e?void 0:e.errMsg)||(null==e?void 0:e.errorMsg)||(null==e?void 0:e.message)||"string"==typeof(null==e?void 0:e.error)?e.error:"",gC=e=>(null==e?void 0:e.success)===!1||(null==e?void 0:e.failed)===!0||(null==e?void 0:e.error)?"error":(null==e?void 0:e.state)||(null==e?void 0:e.status),gS=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Upload Service Error";e=(0,ec.useField)(),(0,es.useEffect)(()=>{let n=(0,ec.reaction)(()=>e.value,n=>{let o=(e=>{let n=gx(e);for(let e=0;e<n.length;e++){var o,l;if((null==(o=n[e])?void 0:o.status)==="error")return gb(null==(l=n[e])?void 0:l.response)||gb(n[e])||t}})(n);e.setFeedback({type:"error",code:"UploadError",messages:o?[o]:[]})});return()=>{n()}},[])};function gw(e){let{serviceErrorMessage:t,...n}=e;gS(t);let o=eC();return{...n,customRequest(e){let{action:t,data:n,file:l,filename:r,headers:i,onError:a,onProgress:s,onSuccess:c,withCredentials:d}=e,u=new FormData;return n&&Object.keys(n).forEach(e=>{u.append(e,n[e])}),u.append(r,l),o.axios.post(t,u,{withCredentials:d,headers:i,onUploadProgress:e=>{let{total:t,loaded:n}=e;s({percent:Math.round(n/t*100).toFixed(2)},l)}}).then(e=>{let{data:t}=e;c(t,l)}).catch(a).finally(()=>{}),{abort(){console.warn("upload progress is aborted.")}}},onChange:e=>{var t,o;null==(t=n.onChange)||t.call(n,(o=[...e.fileList]).length?o.map((e,t)=>({...e,uid:e.uid||"".concat(t),status:gC(e.response)||gC(e),url:gg(e)||gg(null==e?void 0:e.response),thumbUrl:gv(gy(e)||gy(null==e?void 0:e.response),{exclude:[".png",".jpg",".jpeg",".gif"]})})):[])}}}let gF=e=>{var t;return(null==e||null==(t=e.response)?void 0:t.data)&&(e={uid:e.uid,...e.response.data}),{...e,id:e.id||e.uid,title:e.title||e.name,imageUrl:gv(e.url,{exclude:[".png",".jpg",".jpeg",".gif"]})}},gj=e=>gx(e).filter(Boolean).map(gF),gA=e=>gx(e).filter(e=>!e.response||"done"===e.status).map(e=>{var t;return(null==e||null==(t=e.response)?void 0:t.data)||e}),gk=cP("upload",e=>{let{componentCls:t,antCls:n}=e;return{["".concat(t,"-wrapper")]:{"&.tb-upload-small":{["".concat(t,"-list-picture-card-container").concat(t,"-list-picture-card-container")]:{margin:"0 3px 3px 0 !important",height:"32px !important",width:"32px !important",marginBlock:"0 !important"},["".concat(t,"-list-picture-card ").concat(t,"-list-item-name").concat(t,"-list-item-name")]:{display:"none !important"},["".concat(t,"-list-picture ").concat(t,"-list-item, ").concat(t,"-list-picture-card ").concat(t,"-list-item")]:{padding:"1px !important"}},"&.tb-upload-large":{["".concat(t,"-list-picture-card-container").concat(t,"-list-picture-card-container")]:{margin:"0 3px 3px 0 !important",height:"160px !important",width:"160px !important",marginBlock:"0 28px !important"}},"&.tb-upload":{["".concat(t,"-list-item").concat(t,"-list-item-list-type-picture-card")]:{padding:"3px !important"},["".concat(t,"-list-item-thumbnail")]:{img:{objectFit:"cover !important"}},["".concat(t,"-list-item-actions")]:{left:"auto !important",right:"2px !important",top:"2px !important",transform:"none !important",width:"fit-content !important",["".concat(n,"-btn-text:hover, ").concat(n,"-btn-text:focus")]:{background:"rgba(0, 0, 0, 0.4)"}},["".concat(t,"-list-picture-card ").concat(t,"-list-item-info")]:{overflow:"inherit",width:"100%",height:"100%"},["".concat(t,"-list-picture-card ").concat(t,"-list-item-name")]:{display:"block !important",marginTop:"10px",fontSize:"13px",color:"#636363"},["".concat(t,"-list-picture-card ").concat(t,"-list-item::before")]:{display:"none !important"},["".concat(t,"-list-picture-card ").concat(t,"-list-item-progress")]:{bottom:"calc(50% - 11px)",pointerEvents:"none"},["".concat(n,"-btn")]:{background:"rgba(0, 0, 0, 0.5)"},["".concat(t,"-list-picture-card-container")]:{marginBlock:"0 28px !important"}}}}}),gI=()=>null;gI.File=function(e){var t,n,o,l;let{size:r,showCount:i=0}=e,a=m3(),s=(0,ec.useField)(),c=(0,eh.isString)(s.value)?a:gj(s.value),d=os(),[u,p]=(0,es.useState)(0),[m,h]=(0,es.useState)(!1),{wrapSSR:x,hashId:f,componentCls:v}=gk(),g=gm.A.default?gm.A.default:gm.A,y=d.AttachmentPreviewManager.get();return g(v),x((0,A.jsxs)("div",{children:[(0,A.jsx)("div",{className:r6()("".concat(v,"-wrapper"),"".concat(v,"-picture-card-wrapper"),"tb-upload",r?"tb-upload-".concat(r):null,f),children:(0,A.jsx)("div",{className:r6()("".concat(v,"-list"),"".concat(v,"-list-picture-card")),children:c.map((e,t)=>"small"===r?0===t&&(0,A.jsx)(gP,{file:e,prefixCls:v,size:r,images:c,setFileIndex:p,setVisible:h,preview:y[null==e?void 0:e.mimetype]||y.default},t):(0,A.jsx)(gP,{file:e,prefixCls:v,size:r,images:c,setFileIndex:p,setVisible:h,preview:y["image/jpeg"]},t))})}),m&&(0,A.jsx)(eh.Lightbox,{mainSrc:null==(t=c[u])?void 0:t.imageUrl,nextSrc:null==(n=c[(u+1)%c.length])?void 0:n.imageUrl,prevSrc:null==(o=c[(u+c.length-1)%c.length])?void 0:o.imageUrl,mainFile:c[u],nextFile:c[(u+1)%c.length],prevFile:c[(u+c.length-1)%c.length],previewList:y,onCloseRequest:e=>{e.preventDefault(),e.stopPropagation(),h(!1)},onMovePrevRequest:()=>p((u+c.length-1)%c.length),onMoveNextRequest:()=>p((u+1)%c.length),imageTitle:null==(l=c[u])?void 0:l.title,toolbarButtons:[(0,A.jsx)("button",{style:{fontSize:22,background:"none",lineHeight:1},type:"button","aria-label":"Zoom in",title:"Zoom in",className:"ril-zoom-in ril__toolbarItemChild ril__builtinButton",onClick:e=>{e.preventDefault(),e.stopPropagation();let t=c[u];(0,sp.saveAs)(t.url,"".concat(t.title).concat(t.extname))},children:(0,A.jsx)(gu.A,{})},"download")]})]}))},gI.Upload=function(){return((0,ec.useField)().value||[]).map(e=>(0,A.jsx)("div",{children:e.url?(0,A.jsx)("a",{target:"_blank",href:e.url,rel:"noreferrer",children:e.name}):(0,A.jsx)("span",{children:e.name})},e.name))};let gP=e=>{let{file:t,prefixCls:n,size:o,images:l,setFileIndex:r,setVisible:i,preview:a}=e,{viewComponet:s}=a,c=e=>{let n=l.indexOf(t);e.preventDefault(),e.stopPropagation(),i(!0),r(n)};return(0,A.jsxs)("div",{className:r6()("".concat(n,"-list-picture-card-container"),"".concat(n,"-list-item-container")),style:{position:"relative"},children:[(0,A.jsxs)("div",{className:r6()("".concat(n,"-list-item"),"".concat(n,"-list-item-done"),"".concat(n,"-list-item-list-type-picture-card")),children:[(0,A.jsx)("div",{className:"".concat(n,"-list-item-info"),children:(0,A.jsxs)("span",{className:"".concat(n,"-span"),children:[(0,A.jsx)("a",{className:"".concat(n,"-list-item-thumbnail"),href:t.url,target:"_blank",rel:"noopener noreferrer",onClick:c,style:{lineHeight:"100%"},children:s({images:l,size:o,prefixCls:n,file:t,setFileIndex:r,setVisible:i})}),(0,A.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"".concat(n,"-list-item-name"),title:t.title,href:t.url,onClick:c,children:t.title})]})}),"small"!==o&&(0,A.jsx)("span",{className:"".concat(n,"-list-item-actions"),children:(0,A.jsx)(of.A,{size:3,children:(0,A.jsx)(e3.Ay,{size:"small",type:"text",icon:(0,A.jsx)(gu.A,{}),onClick:e=>{e.preventDefault(),e.stopPropagation(),(0,sp.saveAs)(t.url,"".concat(t.title).concat(t.extname))}})})})]}),l.length>1&&"small"===o&&(0,A.jsx)("div",{style:{position:"absolute",bottom:"0",right:"0",backgroundColor:"#9b999992",width:"50%",height:"30%",lineHeight:"30%",borderRadius:"40%",textAlign:"center"},children:"..."})]},t.name)},gT=(0,ec.connect)(e=>(0,A.jsx)(gI.File,{...e}),(0,ec.mapReadPretty)(gI.File)),gN=e=>{var t,n,o,l;let{disabled:r,multiple:i,value:a,quickUpload:s,selectFile:c,onRemove:d,onSelect:u}=e,p=gw({...e}),[m,h]=(0,es.useState)([]),[x,f]=(0,es.useState)(0),[v,g]=(0,es.useState)(!1),{t:y}=(0,eT.useTranslation)(),b=(0,es.useRef)([]),{wrapSSR:C,hashId:S,componentCls:w}=gk();(0,es.useEffect)(()=>{let e=gj(a);h(e),b.current=e},[a]);let F=e=>(null==d||d(e),!0),j=e=>{e.preventDefault(),e.stopPropagation(),null==u||u()},k=m.length?i?m:[m[m.length-1]]:[];return C((0,A.jsxs)("div",{children:[(0,A.jsx)("div",{className:r6()("".concat(w,"-wrapper"),"".concat(w,"-picture-card-wrapper"),"tb-upload",S),children:(0,A.jsxs)("div",{className:r6()("".concat(w,"-list"),"".concat(w,"-list-picture-card")),children:[k.map(e=>{let t=t=>{var n;t.preventDefault(),t.stopPropagation();let o=m.indexOf(e);(n=e.extname,/\.(png|jpg|gif|jpeg|webp)$/.test(n))?(g(!0),f(o)):(0,sp.saveAs)(e.url,"".concat(e.title).concat(e.extname))};return(0,A.jsx)("div",{className:"".concat(w,"-list-picture-card-container ").concat(w,"-list-item-container"),children:(0,A.jsxs)("div",{className:r6()("".concat(w,"-list-item"),"".concat(w,"-list-item-done"),"".concat(w,"-list-item-list-type-picture-card")),children:[(0,A.jsx)("div",{className:"".concat(w,"-list-item-info"),children:(0,A.jsxs)("span",{className:"".concat(w,"-span"),children:[(0,A.jsx)("a",{className:"".concat(w,"-list-item-thumbnail"),href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:t,children:e.imageUrl&&(0,A.jsx)("img",{src:e.imageUrl,alt:e.title,className:"".concat(w,"-list-item-image")})}),(0,A.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"".concat(w,"-list-item-name"),title:e.title,href:e.url,onClick:t,children:"uploading"===e.status?y("Uploading"):e.title})]})}),(0,A.jsx)("span",{className:"".concat(w,"-list-item-actions"),children:(0,A.jsxs)(of.A,{size:3,children:[(0,A.jsx)(e3.Ay,{size:"small",type:"text",icon:(0,A.jsx)(gu.A,{}),onClick:()=>{(0,sp.saveAs)(e.url,"".concat(e.title).concat(e.extname))}}),!r&&(0,A.jsx)(e3.Ay,{size:"small",type:"text",icon:(0,A.jsx)(x7.A,{}),onClick:()=>{F(e),b.current=b.current.filter(t=>t.uid!==e.uid)}})]})}),"uploading"===e.status&&(0,A.jsx)("div",{className:"".concat(w,"-list-item-progress"),children:(0,A.jsx)(gp.A,{strokeWidth:2,type:"line",showInfo:!1,percent:e.percent})})]})},e.uid||e.id)}),(0,A.jsxs)(A.Fragment,{children:[void 0===c&&void 0===s?(0,A.jsx)("div",{className:r6()("".concat(w,"-list-picture-card-container"),"".concat(w,"-list-item-container")),children:(0,A.jsx)(xg.A,{disabled:r,multiple:i,listType:"picture-card",showUploadList:!1,onRemove:F,children:(0,A.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},onClick:j,children:[(0,A.jsx)(sF.A,{}),y("Select")]})})}):null,s?(0,A.jsx)("div",{className:r6()("".concat(w,"-list-picture-card-container"),"".concat(w,"-list-item-container")),children:(0,A.jsx)(xg.A,{...p,disabled:r,multiple:i,listType:"picture-card",fileList:m,showUploadList:!1,onRemove:F,onChange:e=>{var t,n;let o,l,r=(n=e.file,-1===(l=(o=[...b.current]).findIndex(e=>{let{uid:t}=e;return t===n.uid}))?o.push(n):o[l]=n,o);b.current=r,h(gj(r)),null==(t=p.onChange)||t.call(p,{fileList:r})},children:(0,A.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[(0,A.jsx)(sF.A,{}),y("Upload")]})})}):null,c?(0,A.jsx)("div",{className:r6()("".concat(w,"-list-picture-card-container"),"".concat(w,"-list-item-container")),children:(0,A.jsx)(xg.A,{disabled:r,multiple:i,listType:"picture-card",showUploadList:!1,onRemove:F,children:(0,A.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},onClick:j,children:[(0,A.jsx)(sF.A,{}),y("Select")]})})}):null]})]})}),v&&(0,A.jsx)(eh.Lightbox,{mainSrc:null==(t=m[x])?void 0:t.imageUrl,nextSrc:null==(n=m[(x+1)%m.length])?void 0:n.imageUrl,prevSrc:null==(o=m[(x+m.length-1)%m.length])?void 0:o.imageUrl,onCloseRequest:()=>g(!1),onMovePrevRequest:()=>f((x+m.length-1)%m.length),onMoveNextRequest:()=>f((x+1)%m.length),imageTitle:null==(l=m[x])?void 0:l.title,toolbarButtons:[(0,A.jsx)("button",{style:{fontSize:22,background:"none",lineHeight:1},type:"button","aria-label":"Zoom in",title:"Zoom in",className:"ril-zoom-in ril__toolbarItemChild ril__builtinButton",onClick:e=>{e.preventDefault();let t=m[x];(0,sp.saveAs)(t.url,"".concat(t.title).concat(t.extname))},children:(0,A.jsx)(gu.A,{})},"preview-img")]})]}))},gM=e=>{var t,n,o,l,r;let i=(0,ec.useFieldSchema)();return{label:"label",value:"value",...(null==(l=i["x-component-props"])||null==(o=l.field)||null==(n=o.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames)||(null==i||null==(r=i["x-component-props"])?void 0:r.fieldNames)||e.fieldNames}},gD=(e,t)=>{let{getCollectionJoinField:n}=sO();if(!e)return;let o=n("".concat(e.target,".").concat(t));return null==o?void 0:o.uiSchema},gR=e=>{let t=(0,eh.getDefaultFormat)(e),n=(0,eh.str2moment)(e.value,e),o=n&&n.isValid()?n.format(t):e.value;return(0,ec.isArr)(o)?o.join("~"):o},gq=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(null==e?void 0:e.enum)&&t){let o=e.enum.find(e=>e.value===t);return n?es.createElement(nz.A,{color:null==o?void 0:o.color},null==o?void 0:o.label):null==o?void 0:o.label}return(null==e?void 0:e["x-component"])==="DatePicker"?gR({...null==e?void 0:e["x-component-props"],value:t}):t},g_=(0,es.createContext)(null);g_.displayName="RecordPickerContext";let gO=()=>{let e=(0,ec.useField)(),{multiple:t,options:n=[],setSelectedRows:o,selectedRows:l=[],onChange:r}=(0,es.useContext)(g_),{onRowSelectionChange:i,rowKey:a="id",...s}=l6(),{setVisible:c}=co();return{...s,rowKey:a,rowSelection:{type:t?"checkbox":"radio",selectedRowKeys:null==l?void 0:l.filter(e=>n.every(t=>t[a]!==e[a])).map(e=>e[a])},onRowSelectionChange(n,s){if(t){let t=function e(t){let n=[];for(let o=0;o<t.length;o++){let l=t[o].children;Array.isArray(l)&&n.push(...e(l)),n.push({...t[o]})}return n}(e.value)||[],n=l||[],r=(0,ed.differenceBy)(n,t,a),c=(0,ed.unionBy)(r,s,a),d=c.map(e=>e[a]);null==o||o(c),null==i||i(d,c)}else null==o||o(s),null==i||i(n,s),r((null==s?void 0:s[0])||null),c(!1)}}},gB=()=>{let{setVisible:e}=co(),{multiple:t,selectedRows:n,onChange:o,options:l,collectionField:r}=(0,es.useContext)(g_);return{onClick(){t?o((0,ed.unionBy)(n,l,(null==r?void 0:r.targetKey)||"id")):o((null==n?void 0:n[0])||null),e(!1)}}},gE=e=>{let{value:t,multiple:n,onChange:o,quickUpload:l,selectFile:r,...i}=e,a=gM(e),[s,c]=(0,es.useState)(!1),d=(0,ec.useFieldSchema)(),u=(e=>{let t=(0,ec.useFieldSchema)(),{association:n}=e,{getField:o}=tJ();return n||o(t.name)})(e),p=eB(),m=gD(u,(null==a?void 0:a.label)||"label"),h=gL(m),[x,f]=(0,es.useState)([]),[v,g]=(0,es.useState)([]);return(0,es.useEffect)(()=>{t&&g((Array.isArray(t)?t:t?[t]:[]).map(e=>{let t=e[a.label];return{...e,[a.label]:gq(m,p(t))}}))},[t,null==a?void 0:a.label]),(0,A.jsxs)("div",{children:[h?(0,A.jsx)(gN,{value:v,multiple:n,quickUpload:l,selectFile:r,action:"".concat(null==u?void 0:u.target,":create"),onSelect:()=>{c(!0),f([])},onRemove:e=>{let t=v.filter(t=>t.id!==e.id);if(g(t),0===t.length)return o(null);o(t)},onChange:e=>{e.every(e=>"uploading"!==e.status)&&(e=e.filter(e=>"done"===e.status).map(e=>e.response.data),n?o([...v,...e]):o(e[0]))}}):(0,A.jsx)(oo.A,{...i,mode:n?"multiple":e.mode,fieldNames:a,popupMatchSelectWidth:!1,onDropdownVisibleChange:e=>{c(!0)},allowClear:!0,onChange:e=>{if(e){if(Array.isArray(e)){if(!e.length){o([]),f([]);return}let t=null==v?void 0:v.filter(t=>e.includes(t[a.value]));o(t),f(t)}}else{let e=n?[]:null;o(e),f(e),g([])}},options:v,value:null==n?null:Array.isArray(t)?null==t?void 0:t.map(e=>e[a.value]):null==t?void 0:t[a.value],open:!1}),gz({multiple:n,onChange:o,selectedRows:x,setSelectedRows:f,collectionField:u,visible:s,setVisible:c,fieldSchema:d,options:v})]})},gV=e=>{let{multiple:t,onChange:n,selectedRows:o,setSelectedRows:l,options:r,collectionField:i,...a}=e;return(0,A.jsx)(g_.Provider,{value:{multiple:t,onChange:n,selectedRows:o,setSelectedRows:l,options:r,collectionField:i,...a},children:e.children})},gz=e=>{let t,n,{multiple:o,onChange:l,selectedRows:r,setSelectedRows:i,collectionField:a,visible:s,setVisible:c,fieldSchema:d,options:u}=e;return(0,A.jsx)(gV,{...{multiple:o,onChange:l,selectedRows:r,setSelectedRows:i,options:u,collectionField:a},children:(0,A.jsx)(hH,{allowNull:!0,name:null==a?void 0:a.target,children:(0,A.jsx)(ct,{openMode:"drawer",visible:s,setVisible:c,children:(0,A.jsx)(ae,{children:(0,A.jsx)(lQ,{params:{filter:(t=(null==a?void 0:a.targetKey)||"id",(n=u.map(e=>e[t]).filter(Boolean)).length?{$and:[{["".concat(t,".$ne")]:n}]}:{})},children:(0,A.jsx)(i8,{scope:{useTableSelectorProps:gO,usePickActionProps:gB},children:(0,A.jsx)(ec.RecursionField,{schema:d,onlyRenderProperties:!0,filterProperties:e=>"RecordPicker.Selector"===e["x-component"]})})})})})})})};function gL(e){return(null==e?void 0:e["x-component"])==="Preview"}let gG=(0,ec.observer)(e=>{var t,n,o;let l,{ellipsis:r}=e,i=(0,ec.useFieldSchema)(),a=m3(),{getCollectionJoinField:s}=sO(),c=gM(e),[d,u]=(0,es.useState)(!1),{getField:p}=tJ(),m=p(i.name)||s(null==i?void 0:i["x-collection-field"]),[h,x]=(0,es.useState)({}),f=eB(),v=gD(m,(null==c?void 0:c.label)||"label"),g=gL(v),{snapshot:y}=co(),b=(null==(t=i["x-component-props"])?void 0:t.mode)==="tags",C=(0,es.useRef)();if(g)return m?(0,A.jsx)(gT,{...e}):null;let S=()=>(0,A.jsx)(l$.Provider,{value:!0,children:(0,A.jsx)(ae,{children:(0,A.jsx)(ec.RecursionField,{schema:i,onlyRenderProperties:!0,filterProperties:e=>"RecordPicker.Viewer"===e["x-component"]})})});return m?(0,A.jsx)("div",{children:(0,A.jsx)(nb.Provider,{value:"".concat(m.collectionName,".").concat(m.name),children:(0,A.jsxs)(hH,{name:null!=(n=m.target)?n:m.targetCollection,children:[(0,A.jsx)(gi,{ellipsis:r,ref:C,children:(0,ec.toArr)(e.value).map((e,t,n)=>{var o;let l=gq(v,null==(o=f(null==e?void 0:e[(null==c?void 0:c.label)||"label"]))?"N/A":o,!0);return(0,A.jsxs)(es.Fragment,{children:[(0,A.jsx)("span",{className:"test-record-picker-read-pretty-item",children:y||b?l:(0,A.jsx)("a",{onClick:t=>{var n;t.stopPropagation(),t.preventDefault(),u(!0),x(e),null==C||null==(n=C.current)||n.setPopoverVisible(!1)},children:l})}),t<n.length-1?(0,A.jsx)("span",{style:{marginRight:4,color:"#aaa"},children:","}):null]},"".concat(e[c.value],"_").concat(t))})}),(0,A.jsx)(ct,{value:{visible:d,setVisible:u,openMode:"drawer",snapshot:"snapshot"===m.interface},children:(l=null==i||null==(o=i["x-collection-field"])?void 0:o.split("."))&&l.length>2?(0,A.jsx)(m1,{record:h,parent:a[l[1]],children:S()}):(0,A.jsx)(m1,{record:h,parent:a,children:S()})})]})})}):null},{displayName:"ReadPrettyRecordPicker"}),gK=(0,ec.connect)(gE,(0,ec.mapReadPretty)(gG));gK.Viewer=cJ,gK.Selector=cJ;let g$=cP("tb-association-filter-item",e=>{let{componentCls:t}=e;return{[t]:{"&.SortableItem":{position:"relative","&:hover":{"> .general-schema-designer":{display:"block"}},"&.tb-form-item:hover":{"> .general-schema-designer":{background:"var(--colorBgSettingsHover) !important",border:"0 !important",top:"-".concat(e.sizeXXS,"px !important"),bottom:"-".concat(e.sizeXXS,"px !important"),left:"-".concat(e.sizeXXS,"px !important"),right:"-".concat(e.sizeXXS,"px !important")}},"> .general-schema-designer":{position:"absolute",zIndex:999,top:"0",bottom:"0",left:"0",right:"0",display:"none",border:"2px solid var(--colorBorderSettingsHover)",pointerEvents:"none","> .general-schema-designer-icons":{position:"absolute",right:"2px",top:"2px",lineHeight:"16px",pointerEvents:"all",".ant-space-item":{backgroundColor:"var(--colorSettings)",color:"#fff",lineHeight:"16px",width:"16px",paddingLeft:"1px"}}}},".Panel":{"& .ant-collapse-content-box":{padding:"0 ".concat(e.paddingXS,"px !important"),maxHeight:"400px",overflow:"auto"},"& .ant-collapse-header.ant-collapse-header.ant-collapse-header":{background:e.colorFillQuaternary,borderRadius:0}},".headerRow":{alignItems:"center",width:"100%",minWidth:"0",height:"22px",flexWrap:"nowrap"},".headerCol":{flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",".search":{outline:"none",background:e.colorFillQuaternary,width:"100%",border:"none",height:"20px",padding:"4px","&::placeholder":{color:e.colorTextPlaceholder}}},".CloseOutlined":{color:"".concat(e.colorIcon," !important"),fontSize:"11px"},".SearchOutlined":{color:"".concat(e.colorIcon," !important")},".Tree":{padding:"".concat(e.padding,"px 0"),".ant-tree-node-content-wrapper":{overflowX:"hidden"}}}}}),{Panel:gU}=r0.A,gW=Tr(e=>{var t,n,o,l;let{wrapSSR:r,componentCls:i,hashId:a}=g$(),{token:s}=iw.A.useToken(),c=gX.useAssociationField(),d=(0,ec.useFieldSchema)(),u=SF(),p=eB(),{list:m,onSelected:h,handleSearchInput:x,params:f,run:v,valueKey:g,labelKey:y,defaultCollapse:b}=iq(e),[C,S]=(0,es.useState)(!1),w=(0,es.useMemo)(()=>b&&(null==c?void 0:c.name)?[c.name]:[],[]),F=g||(null==c?void 0:c.targetKey)||"id",j=y||(null==(n=d["x-component-props"])||null==(t=n.fieldNames)?void 0:t.label)||F,k={title:j||F,key:F},[I,P]=(0,es.useState)([]),[T,N]=(0,es.useState)([]),[M,D]=(0,es.useState)(!0),R=gD(c,(null==k?void 0:k.title)||"label");if(!c)return null;let q=e=>{var t;let n=null==f||null==(t=f[0])?void 0:t.filter;(C||n)&&v({...null==f?void 0:f[0],filter:void 0}),S(!C),e.stopPropagation()},_=null!=(l=d.title)?l:null==c||null==(o=c.uiSchema)?void 0:o.title;return r((0,A.jsxs)(SE,{className:r6()(i,a,"tb-block-item",e.className,"SortableItem"),children:[(0,A.jsx)(u,{}),(0,A.jsx)(r0.A,{defaultActiveKey:w,ghost:!0,expandIcon:C?()=>null:void 0,children:(0,A.jsx)(gU,{className:"Panel",header:(0,A.jsxs)(nc.A,{className:"headerRow",style:{borderBottom:C?"1px solid ".concat(s.colorBorder):"none"},gutter:5,children:[(0,A.jsx)(nd.A,{title:p(_),className:"headerCol",children:C?(0,A.jsx)(nJ.A,{bordered:!1,autoFocus:!0,placeholder:"Search...",className:"search",onClick:e=>{e.stopPropagation()},onChange:e=>{x(e)}}):p(_)}),(0,A.jsx)(nd.A,{style:{flex:"0 0 auto"},children:C?(0,A.jsx)(cp.A,{className:"CloseOutlined",onClick:q}):(0,A.jsx)(gn.A,{className:"SearchOutlined",onClick:q})})]}),children:(0,A.jsx)(rS.A,{className:"Tree",onExpand:e=>{P(e),D(!1)},expandedKeys:I,autoExpandParent:M,treeData:m,onSelect:e=>{N(e),h(e)},fieldNames:k,titleRender:e=>(0,A.jsx)(gi,{ellipsis:!0,children:gq(R,p(e[j]))}),selectedKeys:T,blockNode:!0})},w[0])})]}))},{displayName:"AssociationFilterItem"});function gH(){let e=(0,ns._)(["\n height: 100%;\n overflow-y: auto;\n position: relative;\n border-radius: ","px;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.tb-form-item:hover {\n > .general-schema-designer {\n background: var(--colorBgSettingsHover) !important;\n border: 0 !important;\n top: -5px !important;\n bottom: -5px !important;\n left: -5px !important;\n right: -5px !important;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n border: 2px solid var(--colorBorderSettingsHover);\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return gH=function(){return e},e}let gY=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{container:t(gH(),n.borderRadiusLG)}}),gX=e=>{let t=SF(),n=(0,ec.useFieldSchema)(),{styles:o}=gY(),{render:l}=mz(n["x-initializer"],n["x-initializer-props"]);return(0,A.jsx)(SM,{children:(0,A.jsxs)(SE,{className:r6()("tb-block-item",e.className,o.container),children:[(0,A.jsx)(t,{}),e.children,l()]})})};gX.Provider=lV,gX.Item=gW,gX.Item.Designer=e=>{var t,n,o,l,r;let i=(0,ec.useFieldSchema)(),{form:a}=Tp(),s=(0,ec.useField)(),{t:c}=(0,eT.useTranslation)(),{getCollectionJoinField:d}=sO(),{getField:u}=tJ(),p=u(i.name)||d(i["x-collection-field"]),{getCollectionFields:m}=sO(),h=eB(),{dn:x}=eY(),f=((null==p?void 0:p.target)?m(null==p?void 0:p.target):[]).filter(e=>!(null==e?void 0:e.target)&&"boolean"!==e.type).map(e=>{var t;return{value:null==e?void 0:e.name,label:h(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return(0,A.jsxs)(sP,{...e,disableInitializer:!0,children:[(0,A.jsx)(aQ,{title:c("Custom title"),schema:{type:"object",title:c("Custom title"),properties:{title:{default:null==i?void 0:i.title,description:"".concat(c("Original title: ")).concat((null==p||null==(t=p.uiSchema)?void 0:t.title)||(null==i?void 0:i.title)),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:e=>{let{title:t}=e;t&&(i.title=t,x.emit("patch",{schema:{"x-uid":i["x-uid"],title:i.title}})),x.refresh()}}),(0,A.jsx)(aY,{title:c("Default collapse"),checked:s.componentProps.defaultCollapse,onChange:e=>{s.componentProps.defaultCollapse=e,eu().set(i,"x-component-props.defaultCollapse",e),x.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":i["x-component-props"]}}),x.refresh()}}),(0,A.jsx)(il,{collectionName:null==p?void 0:p.target,defaultFilter:(null==i||null==(o=i["x-component-props"])||null==(n=o.params)?void 0:n.filter)||{},form:a,onSubmit:e=>{var t;let{filter:n}=e;eu().set(s.componentProps,"params",{...null==(t=s.componentProps)?void 0:t.params,filter:n}),i["x-component-props"].params=s.componentProps.params,x.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":i["x-component-props"]}})}}),(0,A.jsx)(a0,{name:null==p?void 0:p.target}),(0,A.jsx)(aW,{title:c("Title field"),options:f,value:null==(r=i["x-component-props"])||null==(l=r.fieldNames)?void 0:l.label,onChange:e=>{var t,n,o;let l={"x-uid":i["x-uid"]},r={...null==p||null==(n=p.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...null==(o=i["x-component-props"])?void 0:o.fieldNames,label:e};i["x-component-props"]=i["x-component-props"]||{},i["x-component-props"].fieldNames=r,l["x-component-props"]=i["x-component-props"],x.emit("patch",{schema:l}),x.refresh()}},"title-field"),(0,A.jsx)(a$,{breakRemoveOn:{"x-component":"Grid"}})]})},gX.BlockDesigner=()=>{var e,t;let{name:n,title:o}=tJ(),l=rh(),r=(0,ec.useFieldSchema)(),{t:i}=(0,eT.useTranslation)(),a=(null==r||null==(e=r["x-decorator-props"])?void 0:e.resource)||(null==r||null==(t=r["x-decorator-props"])?void 0:t.association);return(0,A.jsxs)(sP,{template:l,title:o||n,children:[(0,A.jsx)(aZ,{}),(0,A.jsx)(aB,{componentName:"FilterCollapse",collectionName:n,resourceName:a}),(0,A.jsx)(aU,{type:pj.COLLAPSE,emptyDescription:i("No blocks to connect")}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})},gX.useAssociationField=()=>{let e=(0,ec.useFieldSchema)(),{getField:t}=tJ();return es.useMemo(()=>t(e.name),[e.name])};class gJ extends eR{async load(){this.app.schemaInitializerManager.add(v9),this.app.schemaInitializerManager.add(ge),this.app.schemaInitializerManager.add(gt)}}let gQ=e=>{var t;let{type:n,schema:o,item:l,remove:r,disabled:i}=e,{exists:a,remove:s}=p0((null==o?void 0:o[n])||(null==l||null==(t=l.schema)?void 0:t[n]),n,l.find,null!=r?r:l.remove),{insert:c}=me();return(0,A.jsx)(mg,{checked:a,disabled:i,title:l.title,onClick:()=>{var e;if(i)return;if(a)return s();let t=(0,ec.merge)(o||{},l.schema||{});null==l||null==(e=l.schemaInitialize)||e.call(l,t),c(t)}})},gZ=e=>{let t=mn();return(0,A.jsx)(gQ,{...t,...e,item:t,type:"x-action"})},g0=e=>{let{refresh:t}=(0,es.useContext)(eV),n=(0,ec.useFieldSchema)(),o=eC(),{t:l}=(0,eT.useTranslation)(),r=ez({t:l,api:o,refresh:t,current:n}),{service:i,props:a}=nj();r.loadAPIClientEvents();let s={...e,insert:e=>{r.insertBeforeBegin(e)},remove:(e,t)=>{var n,o;t(e),i.run({...null==(n=i.params)?void 0:n[0],filter:pA([null==a||null==(o=a.params)?void 0:o.filter])})},wrap:e=>e};return(0,A.jsx)(gZ,{...s,schema:{type:"void","x-action":"associateFilter","x-initializer":"AssociationFilter.Initializer","x-component":"AssociationFilter",properties:{}}})},g1=()=>{let e=mn(),{refresh:t}=(0,es.useContext)(eV),n=(0,ec.useFieldSchema)(),o=eC(),{t:l}=(0,eT.useTranslation)(),r=ez({t:l,api:o,refresh:t,current:n});return r.loadAPIClientEvents(),(0,A.jsx)(mf,{onClick:()=>{r.remove(n)},children:(0,A.jsx)("div",{children:e.title})})},g2=()=>{let e=mn(),{schema:t}=e,{exists:n,remove:o}=p0(t.name,"name",e.find,e.remove),{insert:l}=me();return(0,A.jsx)(mg,{checked:n,title:e.title,onClick:()=>{var r;if(n)return o();let i=(0,ec.merge)(t||{},e.schema||{});null==e||null==(r=e.schemaInitialize)||r.call(e,i),l(i)}})},g6=e=>{let{item:t,schema:n,...o}=e,{insert:l}=me();return(0,A.jsx)(mf,{...o,onClick:()=>{var o,r;let i=(0,ec.merge)(n||{},t.schema||{});null==t||null==(o=t.schemaInitialize)||o.call(t,i),l(i),null==(r=e.onClick)||r.call(e,i)}})},g3=()=>{let e=mn(),{schema:t,...n}=e;return(0,A.jsx)(g6,{...n,item:e})},g5=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Filter") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useFilterBlockActionProps","x-designer":"Action.Designer","x-component-props":{type:"primary",htmlType:"submit"}}}),g4=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Reset") }}',"x-component":"Action","x-use-component-props":"useResetBlockActionProps","x-designer":"Action.Designer"}}),g8=()=>{let e=mn();return(0,A.jsx)(g6,{...e,item:e})},g7=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Delete Event") }}',"x-action":"deleteEvent","x-component":"Action","x-designer":"Action.Designer","x-component-props":{icon:"DeleteOutlined"},properties:{modal:{"x-component":"CalendarV2.DeleteEvent"}}}}),g9=()=>{let e=mn(),{insert:t}=me();return(0,A.jsx)(mf,{...e,onClick:()=>{t({...e.schema})}})},ye=e=>{let{collectionName:t,dataSource:n,rowKey:o,association:l}=e;if(!n)throw Error("dataSource is required");return{type:"void","x-decorator":"TableBlockProvider","x-acl-action":"".concat(l||t,":list"),"x-use-decorator-props":"useTableBlockDecoratorProps","x-decorator-props":{collection:t,association:l,dataSource:n,action:"list",params:{pageSize:20},rowKey:o,showIndex:!0,dragSort:!1},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table","x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-initializer":"table:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{}},[(0,ec.uid)()]:{type:"array","x-initializer":"table:configureColumns","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:150,fixed:"right"},"x-toolbar":"TableColumnSchemaToolbar","x-initializer":"table:configureItemActions","x-designer":"TableV2.ActionColumnDesigner","x-toolbar-props":{initializer:"table:configureItemActions"},properties:{[(0,ec.uid)()]:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"}}}}}}}}},yt=()=>{let e=mn(),{onCreateBlockSchema:t,componentType:n,createBlockSchema:o,...l}=e,{insert:r}=me(),{getTemplateSchemaByMode:i}=rg(),{getCollection:a}=sO(),s=e.field,c=a(s.target),d="".concat(s.collectionName,".").concat(s.name);return(0,A.jsx)(mf,{icon:(0,A.jsx)(vR.A,{}),...l,onClick:async e=>{let{item:t}=e;t.template?r(await i(t)):r(ye({rowKey:c.filterTargetKey,dataSource:c.dataSource,association:d}))},items:p1("Table",e,s.target,d)})};function yn(){let{insert:e}=me(),{getCollection:t}=sO();return{createAssociationTableBlock:(0,es.useCallback)(n=>{let{item:o}=n,l=o.associationField,r=t(l.target);e(ye({rowKey:r.filterTargetKey,dataSource:r.dataSource,association:"".concat(l.collectionName,".").concat(l.name)}))},[t,e])}}let yo=()=>{let e=mn(),{onCreateBlockSchema:t,componentType:n,createBlockSchema:o,...l}=e,{insert:r}=me(),{getTemplateSchemaByMode:i}=rg(),{getCollection:a}=sO(),s=e.field,c=a(s.target),d="".concat(s.collectionName,".").concat(s.name);return(0,A.jsx)(mf,{icon:(0,A.jsx)(vL.A,{}),...l,onClick:async e=>{let{item:t}=e;t.template?r(await i(t)):r(vE({dataSource:c.dataSource,association:d,rowKey:c.filterTargetKey||"id"}))},items:p1("Details",e,s.target,d)})};function yl(){let{insert:e}=me(),{getCollection:t}=sO();return{createAssociationDetailsBlock:(0,es.useCallback)(n=>{let{item:o}=n,l=o.associationField,r=t(l.target);e(vE({dataSource:r.dataSource,association:"".concat(l.collectionName,".").concat(l.name),rowKey:r.filterTargetKey||"id"}))},[t,e])}}function yr(e){let{collectionName:t,association:n,dataSource:o,templateSchema:l,isCusomeizeCreate:r}=e;if(!o)throw Error("dataSource are required");return{type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"".concat(n||t,":create"),"x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:o,collection:t,association:n,isCusomeizeCreate:r},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:createForm","x-component":"CardItem",properties:{[(0,ec.uid)()]:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{[(0,ec.uid)()]:{type:"void","x-initializer":"createForm:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}}},grid:l||{type:"void","x-component":"Grid","x-initializer":"form:configureFields",properties:{}}}}}}}let yi=()=>{let e=mn(),{onCreateBlockSchema:t,componentType:n,createBlockSchema:o,...l}=e,{insert:r}=me(),{getCollection:i}=sO(),{getTemplateSchemaByMode:a}=rg(),s=e.field,c=s.target,d=(0,es.useMemo)(()=>i(c),[c]);return(0,A.jsx)(mf,{icon:(0,A.jsx)(vL.A,{}),...l,onClick:async e=>{let{item:t}=e;if(t.template){let e=await a(t);if("FormItem"===t.template.componentName){let n=yr({dataSource:d.dataSource,association:"".concat(s.collectionName,".").concat(s.name),templateSchema:e});"reference"===t.mode&&(n["x-template-key"]=t.template.key),r(n)}else r(e)}else r(yr({dataSource:d.dataSource,association:"".concat(s.collectionName,".").concat(s.name)}))},items:p1("FormItem",e,d,"".concat(s.collectionName,".").concat(s.name))})};function ya(){let{insert:e}=me(),{getCollection:t}=sO();return{createAssociationFormBlock:(0,es.useCallback)(n=>{let{item:o}=n,l=o.associationField;e(yr({dataSource:t(l.target).dataSource,association:"".concat(l.collectionName,".").concat(l.name)}))},[t,e]),templateWrap:(0,es.useCallback)((e,n)=>{let{item:o}=n,l=o.associationField,r=t(l.target);if("FormItem"!==o.template.componentName)return e;{let t=yr({dataSource:r.dataSource,association:"".concat(l.collectionName,".").concat(l.name),templateSchema:e});return"reference"===o.mode&&(t["x-template-key"]=o.template.key),t}},[t])}}let ys=()=>{let e=mn(),{onCreateBlockSchema:t,componentType:n,createBlockSchema:o,...l}=e,{insert:r}=me(),{getTemplateSchemaByMode:i}=rg(),{getCollection:a}=sO(),s=e.field,c=a(s.target),d="".concat(s.collectionName,".").concat(s.name);return(0,A.jsx)(mf,{icon:(0,A.jsx)(vR.A,{}),...l,onClick:async e=>{let{item:t}=e;t.template?r(await i(t)):r(vW({rowKey:c.filterTargetKey,dataSource:c.dataSource,association:d}))},items:p1("GridCard",e,s.target,d)})};function yc(){let{insert:e}=me(),{getCollection:t}=sO();return{createAssociationGridCardBlock:(0,es.useCallback)(n=>{let{item:o}=n,l=o.associationField,r=t(l.target);e(vW({rowKey:r.filterTargetKey,dataSource:r.dataSource,association:"".concat(l.collectionName,".").concat(l.name)}))},[t,e])}}let yd=()=>{let e=mn(),{onCreateBlockSchema:t,componentType:n,createBlockSchema:o,...l}=e,{insert:r}=me(),{getTemplateSchemaByMode:i}=rg(),{getCollection:a}=sO(),s=e.field,c=a(s.target),d="".concat(s.collectionName,".").concat(s.name);return(0,A.jsx)(mf,{icon:(0,A.jsx)(vR.A,{}),...l,onClick:async e=>{let{item:t}=e;t.template?r(await i(t)):r(vX({rowKey:c.filterTargetKey,dataSource:c.dataSource,association:d}))},items:p1("List",e,s.target,d)})};function yu(){let{insert:e}=me(),{getCollection:t}=sO();return{createAssociationListBlock:(0,es.useCallback)(n=>{let{item:o}=n,l=o.associationField,r=t(l.target);e(vX({rowKey:r.filterTargetKey,dataSource:r.dataSource,association:"".concat(l.collectionName,".").concat(l.name)}))},[t,e])}}let yp=()=>{let e=mn(),{onCreateBlockSchema:t,componentType:n,createBlockSchema:o,...l}=e,{insert:r}=me(),{getCollection:i}=sO(),{getTemplateSchemaByMode:a}=rg(),s=e.field,c=i(s.target),d="".concat(s.collectionName,".").concat(s.name);return(0,A.jsx)(mf,{icon:(0,A.jsx)(vL.A,{}),...l,onClick:async e=>{let{item:t}=e;if(t.template){let e=await a(t);if("ReadPrettyFormItem"===t.template.componentName){let n=vG({dataSource:c.dataSource,association:d,templateSchema:e});"reference"===t.mode&&(n["x-template-key"]=t.template.key),r(n)}else r(e)}else r(vG({association:d,dataSource:c.dataSource}))},items:p1("ReadPrettyFormItem",e,c,d)})};function ym(){let{insert:e}=me(),{getCollection:t}=sO();return{createAssociationDetailsWithoutPagination:(0,es.useCallback)(n=>{let{item:o}=n,l=o.associationField;e(vG({dataSource:t(l.target).dataSource,association:"".concat(l.collectionName,".").concat(l.name)}))},[t,e]),templateWrap:(0,es.useCallback)((e,n)=>{let{item:o}=n,l=o.associationField,r=t(l.target);if("ReadPrettyFormItem"!==o.template.componentName)return e;{let t=vG({dataSource:r.dataSource,association:"".concat(l.collectionName,".").concat(l.name),templateSchema:e});return"reference"===o.mode&&(t["x-template-key"]=o.template.key),t}},[t])}}let yh=e=>{let t={type:"void",title:'{{ t("Select") }}',"x-action":"update","x-designer":"Action.Designer","x-component":"Action","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void","x-component":"AssociationField.Selector",title:'{{ t("Select record") }}',"x-component-props":{className:"tb-record-picker-selector"},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:tableSelector:addBlock",properties:{}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:submit","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}};return(0,A.jsx)(gZ,{...e,schema:t})},yx=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:submit","x-component-props":{type:"primary",htmlType:"submit"}}}),yf=()=>{let e={type:"void",title:'{{ t("Actions") }}',"x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:150,fixed:"right"},"x-designer":"TableV2.ActionColumnDesigner","x-initializer":"table:configureItemActions","x-action-column":"actions",properties:{[(0,ec.uid)()]:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{}}}},t=mn();return(0,A.jsx)(gQ,{...t,schema:e,item:t,type:"x-action-column"})},yv={name:"",token:{colorPrimaryHeader:"#3791e7",colorBgHeader:"#3791e7",colorBgHeaderMenuHover:"#ffffff1a",colorBgHeaderMenuActive:"#ffffff1a",colorTextHeaderMenu:"#ffffffa6",colorTextHeaderMenuHover:"#ffffff",colorTextHeaderMenuActive:"#ffffff",colorSettings:"#2196f3",colorBgSettingsHover:"rgba(33,150,243, 0.06)",colorBorderSettingsHover:"rgba(33,150,243, 0.3)",motionUnit:.03,motion:!0}},yg=(0,es.memo)(e=>{let{children:t}=e,n=os(),{notification:o}=eX.A.useApp(),l=eC();return(0,es.useEffect)(()=>{l.notification=o,n.notification=o},[o]),(0,A.jsx)(A.Fragment,{children:t})});yg.displayName="AppInner";let yy=e=>{let{children:t}=e;return(0,A.jsx)(eX.A,{style:{height:"100%"},children:(0,A.jsx)(yg,{children:t})})};yy.displayName="AntdAppProvider";let yb=yy,yC=(0,es.createContext)(null);yC.displayName="GlobalThemeContext";let yS=()=>(0,es.useContext)(yC)||{theme:{},isDarkTheme:!1},yw=e=>{let{children:t,theme:n}=e,[o,l]=(0,es.useState)(n||yv),r=(0,es.useRef)(null),i=(0,es.useRef)(null),a=(0,es.useMemo)(()=>{let e=null==o?void 0:o.algorithm;return Array.isArray(e)?e.includes(iw.A.darkAlgorithm):e===iw.A.darkAlgorithm},[null==o?void 0:o.algorithm]),s=(0,es.useCallback)(e=>{i.current=e?eu().cloneDeep(e):e},[]),c=(0,es.useCallback)(()=>i.current,[]),d=(0,es.useCallback)(e=>{r.current=e?eu().cloneDeep(e):e},[]),u=(0,es.useCallback)(()=>r.current,[]),p=(0,es.useMemo)(()=>({theme:o,setTheme:l,setCurrentSettingTheme:d,getCurrentSettingTheme:u,setCurrentEditingTheme:s,getCurrentEditingTheme:c,isDarkTheme:a}),[c,u,a,s,d,o]);return(0,A.jsx)(yC.Provider,{value:p,children:(0,A.jsx)(og.Ay,{theme:yv,children:(0,A.jsx)(og.Ay,{theme:o,children:t})})})};function yF(){let e=(0,ns._)(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]);return yF=function(){return e},e}function yj(){let e=(0,ns._)(["\n > .ant-formily-item-label {\n display: none;\n }\n "]);return yj=function(){return e},e}let yA=(0,ec.observer)(e=>{let{scope:t,components:n}=(0,es.useContext)(ec.SchemaOptionsContext),o={type:"object",properties:{options:{title:'{{t("Options")}}',type:"array","x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},label:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Option label")}}'},required:!0},value:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Option value")}}'},required:!0},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("add")}}',"x-component":"ArrayItems.Addition"}}}}};return(0,A.jsx)(i8,{scope:{...t},components:{ArrayItems:eh.ArrayItems,FormItem:pu,Space:of.A},children:(0,A.jsx)(al,{schema:o,...e})})},{displayName:"FieldComponentProps"}),yk=()=>{let{t:e}=(0,eT.useTranslation)(),t=[{label:e("Input"),value:"Input"},{label:e("AutoComplete"),value:"AutoComplete"},{label:e("Select"),value:"Select"},{label:e("AssociationCascader"),value:"AssociationCascader"},{label:e("DatePicker"),value:"DatePicker"},{label:e("Radio group"),value:"Radio.Group"},{label:e("Checkbox group"),value:"Checkbox.Group"}];return{options:t,values:t.map(e=>e.value)}},yI=(0,es.memo)(e=>{let{locale:t}=(0,es.useContext)(og.Ay.ConfigContext),{t:n}=(0,eT.useTranslation)(),{scope:o,components:l}=(0,es.useContext)(ec.SchemaOptionsContext),{theme:r}=yS(),i=eB(),{insert:a}=e,s=mn(),{getInterface:c}=sO(),{collections:d,getCollectionFields:u}=sO(),p=d.map(e=>({label:e.title,value:e.name})),m=tg(),{options:h,values:x}=yk();eC();let f=(0,es.useCallback)(async()=>{var e,s,d;let{title:x,component:f,collection:v,associationField:g,props:y}=await AE(n("Add custom field"),()=>(0,A.jsx)(i8,{scope:{...o,useCollectionManager_deprecated:sO,useAssociationFields(e){var t,n;return null!=(n=null==(t=u(e))?void 0:t.map(e=>{var t;return{value:e.name,label:i(null==(t=e.uiSchema)?void 0:t.title)}}))?n:[]}},components:{...l,FieldComponentProps:yA,Select:wt},children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(og.Ay,{locale:t,children:(0,A.jsx)(al,{schema:{properties:{name:{type:"string",required:!0},title:{type:"string",title:n("Field title"),"x-component":"Input","x-decorator":"FormItem",required:!0},component:{type:"string",title:n("Field component"),"x-component":"Select","x-decorator":"FormItem",required:!0,enum:h},collection:{type:"string",title:n("Field collection"),"x-decorator":"FormItem","x-component":"Select",enum:p,description:n("Select a collection field to use metadata of the field"),"x-visible":!1},associationField:{type:"string",title:n("Parent Association field"),"x-decorator":"FormItem","x-component":"Select","x-visible":!1,required:!0,"x-reactions":[{dependencies:["collection","component"],fulfill:{schema:{"x-visible":"{{$deps[0] && $deps[1] === 'AssociationCascader'}}",enum:"{{ useAssociationFields($deps[0]) }}"}}}]},props:{type:"object",title:n("Component properties"),"x-decorator":"FormItem","x-component":"FieldComponentProps","x-visible":!1,"x-reactions":[{dependencies:["component"],fulfill:{schema:{"x-visible":"{{$deps[0] === 'Radio.Group' || $deps[0]==='Checkbox.Group'}}"}}}]}}}})})})}),r).open({values:{name:"f_".concat((0,ec.uid)())},effects(){(0,ec.onFieldValueChange)("component",e=>{let t=e.value,n=e.query(".collection").take(),o=e.query(".props").take();"Select"===t||"AutoComplete"===t||"AssociationCascader"===t?(n.setDisplay("visible"),n.setRequired(!0),o.setDisplay("none"),o.setRequired(!1)):"CustomSelect"===t?(n.setDisplay("none"),n.setRequired(!1),o.setDisplay("visible"),o.setRequired(!0)):(n.setDisplay("none"),n.setRequired(!1),o.setDisplay("none"),o.setRequired(!1))})}}),b=(null==(s=c(f))||null==(e=s.default)?void 0:e.uiSchema)||{},C=null==(d=m.getCollection(v))?void 0:d.titleField,S=(0,ec.uid)(),w={...b,type:"string",title:x,name:"__custom."+S,required:!1,"x-component":f,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FilterFormCustomSettings","x-decorator":"FilterFormItem","x-decorator-props":v,"x-component-props":{...b["x-component-props"],fieldNames:{label:C,value:C},associationField:g,collection:v,objectValue:!0,component:f,...y},collectionName:v};"DatePicker"===f&&(w["x-settings"]="fieldSettings:FilterFormItem",w["x-designer-props"]={interface:"datetime"}),a(pO(w))},[r]);return(0,A.jsx)(mf,{...s,...e,onClick:f})}),yP=()=>{let{insertAdjacent:e}=eY();return(0,A.jsx)(yI,{insert:t=>e("beforeEnd",t)})},yT=()=>{var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),l=o.name,r=l.includes("__custom")?o.collectionName:l,{form:i}=Tp(),a=(0,ec.useField)(),{dn:s}=eY(),c=o["x-component"];return(0,A.jsxs)(sP,{children:[(0,A.jsx)(ph,{}),(0,A.jsx)(px,{}),"Input"!==c?(0,A.jsx)(il,{collectionName:r,defaultFilter:(null==o||null==(t=o["x-component-props"])||null==(e=t.params)?void 0:e.filter)||{},form:i,onSubmit:e=>{var t;let{filter:n}=e;eu().set(a.componentProps,"params",{...null==(t=a.componentProps)?void 0:t.params,filter:n}),o["x-component-props"].params=a.componentProps.params,s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"]}})}}):null,"Select"===c||"AutoComplete"===c?(0,A.jsx)(vk,{}):null,"Select"===c||"AutoComplete"===c?(0,A.jsx)(Ci,{}):null,"Select"===c||"AutoComplete"===c?(0,A.jsx)(pF,{}):null,"Select"===c||"AutoComplete"===c?(0,A.jsx)(y8,{}):null,(0,A.jsx)(Cs,{}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{})]})},yN=e=>{let{getCollection:t,getCollectionField:n}=sO();return(0,es.useMemo)(()=>{let o;if(!e)return;let[l,...r]=e.split(".");if(!(null==r?void 0:r.length))return;let i=t(l),a=l,s=ec.Schema.compile(null==i?void 0:i.title,{t:fG.t});for(;a&&r.length>0;){var c;let e=r.shift(),t=(null==(o=n("".concat(a,".").concat(e)))||null==(c=o.uiSchema)?void 0:c.title)||(null==o?void 0:o.name);t&&(s+=" / ".concat(ec.Schema.compile(t,{t:fG.t}))),a=(null==o?void 0:o.target)?o.target:null}return s},[e])},yM=(0,ec.observer)(e=>{var t,n;let o=(0,ec.useField)(),l=null==(n=null==(t=(0,ec.useFieldSchema)()["x-decorator-props"])?void 0:t.showTitle)||n,r=(0,es.useMemo)(()=>"string"==typeof o.description?(0,A.jsx)("div",{dangerouslySetInnerHTML:{__html:pi(o.description).split("\n").join("<br/>")}}):o.description,[o.description]),i=(0,es.useMemo)(()=>(0,iS.cx)((0,iS.css)(yF()),{[(0,iS.css)(yj())]:!1===l}),[l]);return(0,A.jsx)(NM,{children:(0,A.jsx)(pr,{className:"tb-form-item",children:(0,A.jsx)(pu,{className:i,...e,extra:r})})})},{displayName:"FilterFormItem"}),yD=e=>{let t={type:"void",title:'{{ t("Add child") }}',"x-action":"create","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:addChild","x-component":"Action","x-visible":"{{treeTable}}","x-component-props":{openMode:"drawer",type:"link",addChild:!0,style:{padding:"0px",marginTop:"-5px"},component:"CreateRecordAction"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializersForCreateFormBlock",properties:{tab1:{type:"void",title:'{{t("Add new")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addNew:addBlock",properties:{}}}}}}}}}};return(0,A.jsx)(gZ,{...e,schema:t})},yR=()=>{let e={type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:addNew","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab","x-initializer-props":{gridInitializer:"popup:addNew:addBlock"},properties:{tab1:{type:"void",title:'{{t("Add new")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addNew:addBlock",properties:{}}}}}}}}}},t=mn();return(0,A.jsx)(gZ,{...t,item:t,schema:e})},yq=new mL({name:"popup:addNew:addBlock",wrap:pO,title:'{{t("Add block")}}',icon:"PlusOutlined",items:[{type:"itemGroup",title:'{{t("Data blocks")}}',name:"dataBlocks",useChildren(){let e=tS(),{t}=(0,eT.useTranslation)();return[{name:"form",title:'{{t("Form")}}',Component:"FormBlockInitializer",collectionName:e.name,dataSource:e.dataSource,componentProps:{filterCollections(t){let{collection:n,associationField:o}=t;return!o&&(n.name===e.name||void 0)},showAssociationFields:!0,onlyCurrentDataSource:!0,hideSearch:!0,componentType:"FormItem",currentText:t("Current collection"),otherText:t("Other collections")}}]}},{type:"itemGroup",title:'{{t("Other blocks")}}',name:"otherBlocks",children:[{name:"markdown",title:'{{t("Demonstration text")}}',Component:"MarkdownBlockInitializer"}]}]}),y_=()=>{let e={type:"void",title:'{{t("Add record")}}',"x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:addRecord","x-component":"Action","x-action":"customize:create","x-component-props":{openMode:"drawer",icon:"PlusOutlined"},properties:{drawer:{type:"void",title:'{{t("Add record")}}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializersForCreateFormBlock","x-initializer-props":{gridInitializer:"popup:addRecord:addBlock"},properties:{tab1:{type:"void",title:'{{t("Add record")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addRecord:addBlock",properties:{}}}}}}}}}},t=mn();return(0,A.jsx)(g6,{...t,schema:e,item:t})},yO=new mL({name:"popup:addRecord:addBlock",wrap:pO,title:'{{t("Add block")}}',icon:"PlusOutlined",items:[{type:"itemGroup",title:'{{t("Data blocks")}}',name:"dataBlocks",children:[{name:"form",title:'{{t("Form")}}',Component:"FormBlockInitializer",isCusomeizeCreate:!0}]},{type:"itemGroup",title:'{{t("Other blocks")}}',name:"otherBlocks",children:[{name:"markdown",title:'{{t("Demonstration text")}}',Component:"MarkdownBlockInitializer"}]}]}),yB=()=>{let e={type:"void","x-action":"associate","x-acl-action":"associate",title:"{{t('Associate')}}","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:associate","x-component":"Action","x-component-props":{actionType:"associations",openMode:"drawer",type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void",title:'{{ t("Select record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-record-picker-selector"},"x-decorator":"AssociateActionProvider",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:tableSelector:addBlock",properties:{}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:submit","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}},t=mn();return(0,A.jsx)(gZ,{item:t,schema:e})},yE=()=>{let{setSelectedRows:e}=(0,es.useContext)(g_),{onRowSelectionChange:t,rowKey:n="id",...o}=l6();return{...o,rowKey:n,rowSelection:{type:"checkbox"},onRowSelectionChange(n,o){null==e||e(n),null==t||t(n,o)}}},yV=e=>{let[t,n]=(0,es.useState)([]),o=tS(),{resource:l,service:r,block:i,__parent:a}=nj(),s={size:"small",onChange:null==e?void 0:e.onChange,selectedRows:t,setSelectedRows:n};return(0,A.jsx)(gV,{...s,children:(0,A.jsx)(i8,{scope:{useTableSelectorProps:yE,usePickActionProps:()=>{let{selectedRows:e}=(0,es.useContext)(g_),{setVisible:t,setFormValueChanged:n}=co();return{async onClick(o,r){if(await l.add({values:e}),null==r||r(),null==t||t(!1),i&&"TableField"!==i){var s,c;null==a||null==(c=a.service)||null==(s=c.refresh)||s.call(c),null==n||n(!1)}}}}},children:(0,A.jsx)(lQ,{params:{filter:(()=>{var e,t;let n=(null==o?void 0:o.filterTargetKey)||"id";if(null==(e=r.data)?void 0:e.data){let e=null==(t=r.data)?void 0:t.data.map(e=>e[n]).filter(Boolean);return e.length?{$and:[{["".concat(n,".$ne")]:e}]}:{}}return{}})()},children:e.children})})})},yz=e=>{let t=tJ(),n={title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:bulkDelete","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0},"x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-action-settings":{triggerWorkflows:[]}};return t&&(n["x-acl-action"]="".concat(t.name,":destroy")),(0,A.jsx)(gZ,{...e,schema:n})},yL=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-use-component-props":"useDestroyActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:delete","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-action-settings":{triggerWorkflows:[]}}}),yG=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Disassociate") }}',"x-action":"disassociate","x-component":"Action","x-use-component-props":"useDisassociateActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:disassociate","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Disassociate record')}}",content:"{{t('Are you sure you want to disassociate it?')}}"}},"x-action-settings":{triggerWorkflows:[]}}}),yK=e=>(0,A.jsx)(gZ,{...e,schema:{"x-action":"expandAll","x-component":"Action","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:expendable","x-component-props":{titleExpand:"{{t('Expand all')}}",titleCollapse:"{{t('Collapse all')}}",iconExpand:"nodeexpandoutlined",iconCollapse:"nodecollapseoutlined",component:"Expand.Action",useAction:()=>({run(){}})}}}),y$=e=>(0,A.jsx)(gZ,{...e,schema:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"}}}),yU=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"}}}),yW=()=>{let e=mn();return(0,A.jsx)(g6,{...e,schema:{title:'{{ t("Save record") }}',"x-action":"customize:save","x-component":"Action","x-use-component-props":"useCreateActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:saveRecord","x-designer-props":{modalTip:'{{ t("When the button is clicked, the following fields will be assigned and saved together with the fields in the form. If there are overlapping fields, the value here will overwrite the value in the form.") }}'},"x-action-settings":{assignedValues:{},skipValidator:!1,onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Submitted successfully")}}'},triggerWorkflows:[]}},item:e})},yH=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:createSubmit","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{assignedValues:{},triggerWorkflows:[],pageMode:!1}}}),yY=e=>(0,A.jsx)(gZ,{...e,schema:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:updateSubmit","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1}}}),yX=e=>{let t={title:'{{ t("Update record") }}',"x-component":(null==e?void 0:e["x-component"])||"Action.Link","x-use-component-props":"useCustomizeUpdateActionProps","x-action":"customize:update","x-decorator":"ACLActionProvider","x-acl-action":"update","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:updateRecord","x-action-settings":{assignedValues:{},onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},triggerWorkflows:[]}},n=mn();return(0,A.jsx)(g6,{...n,schema:t,item:n})},yJ=e=>{let t={type:"void",title:'{{ t("Popup") }}',"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:popup","x-component":(null==e?void 0:e["x-component"])||"Action.Link","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("Popup") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}}}},n=mn();return(0,A.jsx)(g6,{...n,schema:t,item:n})},yQ=new mL({name:"RecordFormBlockInitializers",title:'{{ t("Add block") }}',icon:"PlusOutlined",wrap:pO,items:[{type:"itemGroup",title:'{{ t("Data blocks") }}',name:"dataBlocks",children:[{name:"form",title:'{{ t("Form") }}',Component:"RecordFormBlockInitializer"}]},{type:"itemGroup",title:'{{t("Other blocks")}}',name:"otherBlocks",children:[{name:"markdown",title:'{{t("Demonstration text")}}',Component:"MarkdownBlockInitializer"}]}]}),yZ=e=>{let t={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:edit","x-component":"Action","x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Edit")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}}}};return(0,A.jsx)(gZ,{...e,schema:t})},y0=e=>{let t={type:"void",title:'{{ t("View") }}',"x-action":"view","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:view","x-component":"Action","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("View record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}}}};return(0,A.jsx)(gZ,{...e,schema:t})},y1=new mL({name:"detailsWithPaging:configureActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",title:'{{t("Enable actions")}}',name:"enableActions",children:[{name:"edit",title:'{{t("Edit")}}',Component:"UpdateActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{type:"primary"}}},{name:"delete",title:'{{t("Delete")}}',Component:"DestroyActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"}}]}]}),y2=()=>{let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template},y6=new mL({name:"details:configureActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:'{{t("Enable actions")}}',children:[{title:'{{t("Edit")}}',name:"edit",Component:"UpdateActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{type:"primary"}},useVisible:y2},{title:'{{t("Delete")}}',name:"delete",Component:"DestroyActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},useVisible:y2}]},{name:"divider",type:"divider"},{type:"subMenu",name:"customize",title:'{{t("Customize")}}',children:[{name:"popup",title:'{{t("Popup")}}',Component:"PopupActionInitializer",useComponentProps:()=>({"x-component":"Action"})},{name:"updateRecord",title:'{{t("Update record")}}',Component:"UpdateRecordActionInitializer",useComponentProps:()=>({"x-component":"Action"}),useVisible:y2},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer",useVisible:y2}]}]}),y3=new mL({name:"details:configureFields",wrap:pO,icon:"SettingOutlined",title:'{{t("Configure fields")}}',items:[{type:"itemGroup",name:"displayFields",title:'{{t("Display fields")}}',useChildren:pU},{name:"parentCollectionFields",Component:()=>{let e=pX(),{t}=(0,eT.useTranslation)(),n=eB();if(!(null==e?void 0:e.length))return null;let o=[];return e.forEach(e=>{Object.values(e)[0].length&&o.push({type:"itemGroup",divider:!0,title:t("Parent collection fields")+"("+n("".concat(Object.keys(e)[0]))+")",children:Object.values(e)[0]})}),(0,A.jsx)(mb,{children:o})}},{name:"associationFields",Component:()=>{let e=pW({readPretty:!0,block:"Form"}),{t}=(0,eT.useTranslation)();if(0===e.length)return null;let n=[{type:"itemGroup",title:t("Display association fields"),children:e}];return(0,A.jsx)(mb,{children:n})}},{name:"divider",type:"divider"},{name:"addText",title:'{{t("Add text")}}',Component:"BlockItemInitializer",schema:{type:"void","x-editable":!1,"x-decorator":"FormItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:markdown","x-component":"Markdown.Void","x-component-props":{content:'{{t("This is a demo text, **supports Markdown syntax**.")}}'}}}]}),y5=()=>{let{onCreateBlockSchema:e,componentType:t,createBlockSchema:n,...o}=mn(),{getTemplateSchemaByMode:l}=rg(),{insert:r}=me(),i=nN(),a=tJ();return(0,A.jsx)(mf,{icon:(0,A.jsx)(vL.A,{}),...o,onClick:async e=>{let{item:t}=e;if(t.template){let e=await l(t);if("FormItem"===t.template.componentName){let n=yr(i?{association:i,dataSource:a.dataSource,templateSchema:e}:{collectionName:a.name,dataSource:a.dataSource,templateSchema:e});"reference"===t.mode&&(n["x-template-key"]=t.template.key),r(n)}else r(e)}else r(yr(i?{association:i,dataSource:a.dataSource}:{collectionName:a.name,dataSource:a.dataSource}))},items:p1("FormItem")})};function y4(){let e=eB(),{getCollectionJoinField:t,getCollectionFields:n}=sO(),{getField:o}=tJ(),{fieldSchema:l}=sb(),r=(0,ec.useFieldSchema)(),i=l||r,a=sO().collections.filter(e=>e.name===i["x-decorator-props"])[0],s=o(i.name)||t(i["x-collection-field"]),c=s&&["hasOne","hasMany","belongsTo","belongsToMany"].includes(s.type),d=[];s?d=n(s?s.target?s.target:s.collectionName:i.name):a&&(d=a.fields);let u=[];return null==d||d.forEach(t=>{var o,l,r,a;!["m2m","o2m"].includes(t.interface)&&c&&t.uiSchema&&u.push({label:e(t.uiSchema.title),value:t.name,children:null!=(l=null==(o=n(t.target))?void 0:o.filter(e=>e.uiSchema).map(t=>({label:t.uiSchema?e(t.uiSchema.title):"",value:t.name})))?l:[]}),c||t.name!==i.name||u.push({label:e(t.uiSchema.title),value:t.name,children:null!=(a=null==(r=n(t.target))?void 0:r.filter(e=>e.uiSchema).map(t=>({label:t.uiSchema?e(t.uiSchema.title):"",value:t.name})))?a:[]})}),u}function y8(){var e,t,n;let{getCollectionJoinField:o,collections:l}=sO(),{getField:r}=tJ(),i=(0,ec.useField)(),a=(0,ec.useFieldSchema)(),{t:s}=(0,eT.useTranslation)(),{dn:c}=eY(),d=r(a.name)||o(a["x-collection-field"]);d=d||(null==(e=l.find(e=>e.name===a["x-decorator-props"]))?void 0:e.fields);let u=y4(),p=async e=>{var t,n;let o={"x-uid":a["x-uid"]},l={...null==d||null==(n=d.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...i.componentProps.fieldNames,formula:e};a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].fieldNames=l,o["x-component-props"]=a["x-component-props"],i.componentProps.fieldNames=a["x-component-props"].fieldNames,c.emit("patch",{schema:o}),c.refresh()};return(0,A.jsx)(aQ,{title:s("Custom option label"),schema:{type:"object",title:s("Custom option label"),properties:{formula:{required:!0,"x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:u},default:(null==i||null==(n=i.componentProps)||null==(t=n.fieldNames)?void 0:t.formula)||""}}},onSubmit:e=>{let{formula:t}=e;t&&p(t)}},"edit-field-title")}let y7=()=>{var e,t,n;let o=(0,ec.useFieldSchema)();return y4().length>0&&((null==(e=o["x-component-props"])?void 0:e.mode)==="Select"||"CollectionField"===o["x-component"])&&(null==(n=o["x-component-props"])||null==(t=n.fieldNames)?void 0:t.value)!==void 0},y9=new or({name:"fieldSettings:FilterFormCustomSettings",items:[{name:"editFieldTitle",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useFieldSchema)(),l=(0,ec.useField)(),{getCollectionJoinField:r}=sO(),{getField:i}=tJ(),a=i(o.name)||r(o["x-collection-field"]);return{title:t("Edit field title"),schema:{type:"object",title:t("Edit field title"),properties:{title:{title:t("Field title"),default:null==l?void 0:l.title,description:"".concat(t("Original field title: ")).concat(null==a||null==(e=a.uiSchema)?void 0:e.title),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit(e){let{title:t}=e;t&&(l.title=t,o.title=t,n.emit("patch",{schema:{"x-uid":o["x-uid"],title:o.title}})),n.refresh()}}}},{name:"editDescription",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{dn:t}=eY(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)();return{title:e("Edit description"),schema:{type:"object",title:e("Edit description"),properties:{description:{default:null==n?void 0:n.description,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit(e){let{description:l}=e;n.description=l,o.description=l,t.emit("patch",{schema:{"x-uid":o["x-uid"],description:o.description}}),t.refresh()}}}},{name:"setTheDataScope",Component:il,useComponentProps(){var e,t;let n=(0,ec.useFieldSchema)(),{form:o}=Tp(),l=(0,ec.useField)(),{dn:r}=eY(),i=n.name;return{collectionName:i.includes("__custom")?n.collectionName:i,defaultFilter:(null==n||null==(t=n["x-component-props"])||null==(e=t.params)?void 0:e.filter)||{},form:o,onSubmit:e=>{var t;let{filter:o}=e;eu().set(l.componentProps,"params",{...null==(t=l.componentProps)?void 0:t.params,filter:o}),n["x-component-props"].params=l.componentProps.params,r.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":n["x-component-props"]}})}}},useVisible(){let e=(0,ec.useFieldSchema)();return null==e?void 0:e.collectionName}},{name:"fieldCollection",Component:vk,useVisible(){let e=(0,ec.useFieldSchema)()["x-component"];return"Select"===e||"AutoComplete"===e}},{name:"fieldComponent",Component:Ci,useVisible:()=>["Select","AutoComplete","Radio.Group","Checkbox.Group"].includes((0,ec.useFieldSchema)()["x-component"])},{name:"titleField",type:"select",useComponentProps(){var e,t,n,o;let{getCollectionFields:l,getCollectionJoinField:r}=sO(),{getField:i}=tJ(),a=(0,ec.useField)(),s=(0,ec.useFieldSchema)(),{t:c}=(0,eT.useTranslation)(),{dn:d}=eY(),u=eB(),p=sO(),m=(null!=(n=null==s?void 0:s.name)?n:"").startsWith("__custom."),h=m?p.collections.filter(e=>e.name===s["x-decorator-props"])[0]:{},x=i(s.name)||r(s["x-collection-field"]),f=[];x?f=(null==x?void 0:x.target)?l(null==x?void 0:x.target):null!=(o=l(null==x?void 0:x.targetCollection))?o:[]:h&&(f=h.fields);let v=f.filter(e=>!(null==e?void 0:e.target)&&"boolean"!==e.type).map(e=>{var t;return{value:null==e?void 0:e.name,label:u(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return{title:c("Title field"),options:v,value:(null==(t=s["x-component-props"])||null==(e=t.fieldNames)?void 0:e.label)||"id",onChange(e){var t,n;let o={"x-uid":s["x-uid"]},l={...null==x||null==(n=x.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...a.componentProps.fieldNames,label:e};m&&(l.value=e),s["x-component-props"]=s["x-component-props"]||{},s["x-component-props"].fieldNames=l,o["x-component-props"]=s["x-component-props"],a.componentProps=s["x-component-props"],d.emit("patch",{schema:o}),d.refresh()}}},useVisible(){let e=(0,ec.useFieldSchema)()["x-component"];return"Select"===e||"AutoComplete"===e}},{name:"EditFormulaTitleField",Component:y8,useVisible(){let e=(0,ec.useFieldSchema)()["x-component"];return"Select"===e||"AutoComplete"===e}},{name:"EditCustomDefaultValue",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{dn:t}=eY(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),l=o.title;return{title:e("Set default value"),schema:{type:"void",title:e("Set default value"),properties:{default:{title:l,"x-decorator":"FormItem","x-component":Cc,"x-component-props":{fieldSchema:o}}}},onSubmit(e){let{default:{value:l=null}}=e;n.setValue(l),o.default=l,o["x-component-props"].defaultValue=l,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"],default:o.default}}),t.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove"}]}),be=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideSearch:o,createBlockSchema:l,componentType:r="FormItem",templateWrap:i,showAssociationFields:a,hideChildrenIfSingleCollection:s,hideOtherRecordsInPopup:c,currentText:d,otherText:u}=e,p=mn(),{createFormBlock:m,templateWrap:h}=bt(),x=(0,es.useCallback)(e=>{if(l)return l(e);m(e)},[l,m]);return(0,A.jsx)(vB,{...p,icon:(0,A.jsx)(vL.A,{}),componentType:r,templateWrap:(e,t)=>i?i(e,t):h(e,t),onCreateBlockSchema:x,filter:t,onlyCurrentDataSource:n,hideSearch:o,showAssociationFields:a,hideChildrenIfSingleCollection:s,hideOtherRecordsInPopup:c,currentText:d,otherText:u})},bt=()=>{let{insert:e}=me(),t=tN(),{isCusomeizeCreate:n}=mn();return{createFormBlock:(0,es.useCallback)(o=>{let{item:l,fromOthersInPopup:r}=o;r?e(yr({collectionName:l.collectionName||l.name,dataSource:l.dataSource,isCusomeizeCreate:!0})):e(yr(t?{association:t,dataSource:l.dataSource,isCusomeizeCreate:n}:{collectionName:l.collectionName||l.name,dataSource:l.dataSource,isCusomeizeCreate:n}))},[t,e,n]),templateWrap:(e,o)=>{let{item:l}=o,r=yr({isCusomeizeCreate:n,dataSource:l.dataSource,templateSchema:e,collectionName:l.name,association:t});return l.template&&"reference"===l.mode&&(r["x-template-key"]=l.template.key),r}}},bn=e=>(0,A.jsx)(sN,{showBorder:!1,showBackground:!0,...e});function bo(e){let{collectionName:t,dataSource:n,association:o,templateSchema:l}=e,r=e.isCurrent?{"x-is-current":!0}:{};if(!n)throw Error("dataSource are required");return{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"".concat(o||t,":update"),"x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:n,collection:t,association:o},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:editForm","x-component":"CardItem",...r,properties:{[(0,ec.uid)()]:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{[(0,ec.uid)()]:{type:"void","x-initializer":"editForm:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}}},grid:l||{type:"void","x-component":"Grid","x-initializer":"form:configureFields",properties:{}}}}}}}let bl=()=>{let{targetCollection:e,...t}=mn(),{insert:n}=me(),{getTemplateSchemaByMode:o}=rg(),l=tJ(),r=e||l,{createEditFormBlock:i,templateWrap:a}=br();return(0,A.jsx)(mf,{icon:(0,A.jsx)(vL.A,{}),...t,onClick:async e=>{let{item:t}=e;t.template?n(a(await o(t),{item:t})):i({item:t})},items:p1("FormItem",null,null==r?void 0:r.name)})};function br(){let{insert:e}=me(),t=tg(),n=(0,ec.useFieldSchema)(),o=null==n?void 0:n.actionType,l=tN();return{createEditFormBlock:(0,es.useCallback)(n=>{let{item:r}=n,i=r.associationField,a=(null==i?void 0:i.target)?t.getCollection(i.target).name:r.collectionName||r.name;if(r.associationField){let t=r.associationField;e(bo({dataSource:r.dataSource,association:"".concat(t.collectionName,".").concat(t.name)}))}else e(bo(l&&!o?{association:l,dataSource:r.dataSource,isCurrent:!0}:{dataSource:r.dataSource,collectionName:a}))},[l,e]),templateWrap:(0,es.useCallback)((e,t)=>{let{item:n}=t;if("FormItem"!==n.template.componentName)return e;{let t={dataSource:n.dataSource,templateSchema:e};if(n.associationField){let e=n.associationField;t.association="".concat(e.collectionName,".").concat(e.name)}else l?(t.association=l,t.isCurrent=!0):t.collectionName=n.collectionName||n.name;let o=bo(t);return"reference"===n.mode&&(o["x-template-key"]=n.template.key),o}},[l])}}let bi=new mL({name:"createForm:configureActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",title:'{{t("Enable actions")}}',name:"enableActions",children:[{name:"submit",title:'{{t("Submit")}}',Component:"CreateSubmitActionInitializer",schema:{"x-action-settings":{}}}]},{name:"divider",type:"divider"},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[{name:"saveRecord",title:'{{t("Save record")}}',Component:"SaveRecordActionInitializer"},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer"}]}]}),ba=new or({name:"blockSettings:creationForm",items:[{name:"title",Component:aZ},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"dataTemplates",Component:a6,useVisible(){let{action:e}=Tp();return!e},useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"divider",type:"divider"},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"FormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),bs=new or({name:"blockSettings:createForm",items:[{name:"title",Component:aZ},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"dataTemplates",Component:a6,useVisible(){let{action:e}=Tp();return!e},useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"divider",type:"divider"},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"FormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),bc=new or({name:"blockSettings:editForm",items:[{name:"title",Component:aZ},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"dataTemplates",Component:a6,useVisible(){let{action:e}=Tp();return!e},useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"divider",type:"divider"},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"FormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),bd=new or({name:"fieldSettings:FormItem",items:[{name:"decoratorOptions",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Generic properties")}},useChildren:()=>[{name:"editFieldTitle",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{getCollectionJoinField:r}=sO(),{getField:i}=tJ(),a=i(l.name)||r(l["x-collection-field"]);return{title:t("Edit field title"),schema:{type:"object",title:t("Edit field title"),properties:{title:{title:t("Field title"),default:null==o?void 0:o.title,description:"".concat(t("Original field title: ")).concat(null==a||null==(e=a.uiSchema)?void 0:e.title),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit(e){let{title:t}=e;t&&(o.title=t,l.title=t,n.emit("patch",{schema:{"x-uid":l["x-uid"],title:l.title}})),n.refresh()}}}},{name:"displayTitle",type:"switch",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),{dn:o}=eY(),l=(0,ec.useField)(),r=(0,ec.useFieldSchema)();return{title:n("Display title"),checked:null==(t=null==(e=r["x-decorator-props"])?void 0:e.showTitle)||t,onChange(e){r["x-decorator-props"]=r["x-decorator-props"]||{},r["x-decorator-props"].showTitle=e,l.decoratorProps.showTitle=e,o.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":{...r["x-decorator-props"],showTitle:e}}}),o.refresh()}}}},{name:"editDescription",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{dn:t}=eY(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)();return{title:e("Edit description"),schema:{type:"object",title:e("Edit description"),properties:{description:{default:null==n?void 0:n.description,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit(e){let{description:l}=e;n.description=l,o.description=l,t.emit("patch",{schema:{"x-uid":o["x-uid"],description:o.description}}),t.refresh()}}}},{name:"editTooltip",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)();return{title:t("Edit tooltip"),schema:{type:"object",title:t("Edit tooltip"),properties:{tooltip:{default:null==l||null==(e=l["x-decorator-props"])?void 0:e.tooltip,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit(e){let{tooltip:t}=e;o.decoratorProps.tooltip=t,l["x-decorator-props"]=l["x-decorator-props"]||{},l["x-decorator-props"].tooltip=t,n.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}}),n.refresh()}}}},{name:"required",type:"switch",useVisible(){let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{required:n=!0}=sw();return!e.readPretty&&"FormField"!==t["x-component"]&&n},useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o,refresh:l}=eY();return{title:e("Required"),checked:n.required,onChange(e){let r={"x-uid":n["x-uid"]};t.required=e,n.required=e,r.required=e,o.emit("patch",{schema:r}),l()}}}},{name:"setDefaultValue",Component:sq},{name:"layoutDirection",type:"select",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{layoutDirection:r="column"}=tY(),i=(null==(e=l["x-decorator-props"])?void 0:e.layoutDirection)||r;return{title:t("Layout Direction"),options:[{label:t("Row"),value:"row"},{label:t("Column"),value:"column"}],value:i,onChange(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"column",r={...null==(e=l["x-decorator-props"])?void 0:e.style,display:"flex",flexDirection:t,alignItems:"".concat("row"===t?"baseline":"unset")};eu().set(o,"decoratorProps.style",r),eu().set(o,"decoratorProps.layoutDirection",t),n.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":{...l["x-decorator-props"],layoutDirection:t,style:r}}}),n.refresh()}}}},{name:"pattern",type:"select",useVisible(){let{form:e}=Tp(),t=(0,ec.useFieldSchema)();return e&&!(null==e?void 0:e.readPretty)&&!sB(t)},useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o}=eY(),l="editable";return!0===n["x-disabled"]&&(l="readonly"),!0===n["x-read-pretty"]&&(l="read-pretty"),{title:e("Pattern"),options:[{label:e("Editable"),value:"editable"},{label:e("Readonly"),value:"readonly"},{label:e("Easy-reading"),value:"read-pretty"}],value:l,onChange(e){let l={"x-uid":n["x-uid"]};switch(e){case"readonly":n["x-read-pretty"]=!1,n["x-disabled"]=!0,l["x-read-pretty"]=!1,l["x-disabled"]=!0,t.readPretty=!1,t.disabled=!0,eu().set(t,"initStateOfLinkageRules.pattern",c9(!0,am.ReadOnly));break;case"read-pretty":n["x-read-pretty"]=!0,n["x-disabled"]=!1,l["x-read-pretty"]=!0,l["x-disabled"]=!1,t.readPretty=!0,eu().set(t,"initStateOfLinkageRules.pattern",c9(!0,am.ReadPretty));break;default:n["x-read-pretty"]=!1,n["x-disabled"]=!1,l["x-read-pretty"]=!1,l["x-disabled"]=!1,t.readPretty=!1,t.disabled=!1,eu().set(t,"initStateOfLinkageRules.pattern",c9(!0,am.Editable))}o.emit("patch",{schema:l}),o.refresh()}}}},{name:"setValidationRules",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o,refresh:l}=eY(),r=up(),{getCollectionJoinField:i}=sO(),{getField:a}=tJ(),s=a(n.name)||i(n["x-collection-field"]);return{title:e("Set validation rules"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:e("Set validation rules"),properties:{rules:{type:"array",default:null==n?void 0:n["x-validator"],"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},maxItems:3,items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{header:'{{ t("Validation rule") }}'},properties:{index:{type:"void","x-component":"ArrayCollapse.Index"},layout:{type:"void","x-component":"FormLayout","x-component-props":{labelStyle:{marginTop:"6px"},labelCol:8,wrapperCol:16},properties:{...r,message:{type:"string",title:'{{ t("Error message") }}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:2,maxRows:2}}}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"}}},properties:{add:{type:"void",title:'{{ t("Add validation rule") }}',"x-component":"ArrayCollapse.Addition","x-reactions":{dependencies:["rules"],fulfill:{state:{disabled:"{{$deps[0].length >= 3}}"}}}}}}}},onSubmit(e){var r;let i=[];for(let t of e.rules)i.push(eu().pickBy(t,eu().identity));let a={"x-uid":n["x-uid"]};if(["percent"].includes(null==s?void 0:s.interface))for(let e of i)(e.maxValue||e.minValue)&&(e.percentMode=!0),e.percentFormat&&(e.percentFormats=!0);t.validator=eu().concat([],(null==s||null==(r=s.uiSchema)?void 0:r["x-validator"])||[],i),n["x-validator"]=i,a["x-validator"]=i,o.emit("patch",{schema:a}),l()}}},useVisible(){let{form:e}=Tp(),t=uo(),n=up();return e&&!t&&n}}]},{name:"componentOptions",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Specific properties")}},useChildren(){let e=os(),t=ux(),n=e.schemaSettingsManager.get("fieldSettings:component:".concat(t));return(null==n?void 0:n.items)||[]}},{name:"divider",type:"divider"},{name:"delete",type:"remove",sort:100,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{removeParentsIfNoChildren:!0,confirm:{title:e("Delete field")},breakRemoveOn:{"x-component":"Grid"}}}}]}),bu=new mL({name:"FormActionInitializers",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",name:"enableActions",title:'{{t("Enable actions")}}',children:[{name:"submit",title:'{{t("Submit")}}',Component:"CreateSubmitActionInitializer",schema:{"x-action-settings":{}}}]},{name:"divider",type:"divider"},{name:"customize",type:"subMenu",title:'{{t("Customize")}}',children:[{name:"saveRecord",title:'{{t("Save record")}}',Component:"SaveRecordActionInitializer"},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer"}]}]}),bp=new mL({name:"form:configureFields",wrap:pO,icon:"SettingOutlined",title:'{{t("Configure fields")}}',items:[{type:"itemGroup",name:"displayFields",title:'{{t("Display fields")}}',useChildren:pU},{name:"parentCollectionFields",Component:vP},{name:"extendCollectionFields",Component:vT},{name:"associationFields",Component:vN},{name:"divider",type:"divider"},{name:"addText",title:'{{t("Add text")}}',Component:"MarkdownFormItemInitializer"}]}),bm=new mL({name:"editForm:configureActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",title:'{{t("Enable actions")}}',name:"enableActions",children:[{name:"submit",title:'{{t("Submit")}}',Component:"UpdateSubmitActionInitializer",schema:{"x-action-settings":{}}}]},{name:"divider",type:"divider"},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[{name:"popup",title:'{{t("Popup")}}',Component:"PopupActionInitializer",useComponentProps:()=>({"x-component":"Action"})},{name:"saveRecord",title:'{{t("Save record")}}',Component:"SaveRecordActionInitializer"},{type:"item",name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer"}]}]}),bh=new mL({name:"gridCard:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",title:"{{t('Enable actions')}}",name:"enableActions",children:[{name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{name:"addNew",title:"{{t('Add new')}}",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){let e=tS();return!["view","file","sql"].includes(e.template)||(null==e?void 0:e.writableView)}},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}},{name:"import",title:"{{t('Import')}}",Component:"ImportActionInitializer",schema:{"x-align":"right","x-acl-action":"importXlsx","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"export",title:"{{t('Export')}}",Component:"ExportActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}}}]}]}),bx=new mL({name:"gridCard:configureItemActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",title:'{{t("Enable actions")}}',name:"enable-actions",children:[{name:"view",title:'{{t("View")}}',Component:"ViewActionInitializer",schema:{"x-component":"Action.Link","x-action":"view","x-decorator":"ACLActionProvider","x-align":"left"}},{name:"edit",title:'{{t("Edit")}}',Component:"UpdateActionInitializer",schema:{"x-component":"Action.Link","x-action":"update","x-decorator":"ACLActionProvider","x-align":"left"},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"delete",title:'{{t("Delete")}}',Component:"DestroyActionInitializer",schema:{"x-component":"Action.Link","x-action":"destroy","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:()=>"sql"!==tS().template}]},{name:"divider",type:"divider"},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[{name:"popup",title:'{{t("Popup")}}',Component:"PopupActionInitializer",useComponentProps:()=>({"x-component":"Action.Link"})},{name:"update-record",title:'{{t("Update record")}}',Component:"UpdateRecordActionInitializer",useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer",schema:{"x-action":"customize:table:request"},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}}]}]}),bf=new mL({name:"list:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:"{{t('Enable actions')}}",children:[{name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{name:"addNew",title:"{{t('Add new')}}",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"file"!==e.template&&"sql"!==e.template}},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}},{name:"import",title:"{{t('Import')}}",Component:"ImportActionInitializer",schema:{"x-align":"right","x-acl-action":"importXlsx","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"export",title:"{{t('Export')}}",Component:"ExportActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}}}]}]}),bv=new mL({name:"list:configureItemActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",name:"enableActions",title:'{{t("Enable actions")}}',children:[{name:"view",title:'{{t("View")}}',Component:"ViewActionInitializer",schema:{"x-component":"Action.Link","x-action":"view","x-decorator":"ACLActionProvider","x-align":"left"}},{name:"edit",title:'{{t("Edit")}}',Component:"UpdateActionInitializer",schema:{"x-component":"Action.Link","x-action":"update","x-decorator":"ACLActionProvider","x-align":"left"},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"delete",title:'{{t("Delete")}}',Component:"DestroyActionInitializer",schema:{"x-component":"Action.Link","x-action":"destroy","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:()=>"sql"!==tS().template}]},{name:"divider",type:"divider"},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[{name:"popup",title:'{{t("Popup")}}',Component:"PopupActionInitializer",useComponentProps:()=>({"x-component":"Action.Link"})},{name:"updateRecord",title:'{{t("Update record")}}',Component:"UpdateRecordActionInitializer",useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer",schema:{"x-action":"customize:table:request"},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}}]}]}),bg=()=>{var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useFieldSchema)();return(0,A.jsx)(mN,{title:t("Column width"),component:es.forwardRef((e,n)=>{let{children:o,onClick:l,...r}=e,{setVisible:i}=me();return(0,A.jsx)(mf,{ref:n,onClick:e=>{let{event:t}=e;i(!1),l(t)},...r,title:t("Column width")})}),schema:{type:"object",title:t("Column width"),properties:{width:{"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{},default:(null==o||null==(e=o["x-component-props"])?void 0:e.width)||200}}},onSubmit:e=>{let{width:t}=e,l=o["x-component-props"]||{};l.width=t;let r={"x-uid":o["x-uid"]};r["x-component-props"]=l,o["x-component-props"]=l,n.emit("patch",{schema:r}),n.refresh()}})},by=new mL({name:"table:configureItemActions",insertPosition:"beforeEnd",useInsert:function(){let{refresh:e}=eY(),t=(0,ec.useFieldSchema)(),n=eC(),{t:o}=(0,eT.useTranslation)();return function(l){let r=t.reduceProperties((e,t)=>"Space"===t["x-component"]?t:e,null);if(!r)return;eu().set(l,"x-designer-props.linkageAction",!0);let i=ez({t:o,api:n,refresh:e,current:r});i.loadAPIClientEvents(),i.insertBeforeEnd(l)}},Component:e=>{let{getAriaLabel:t}=sc();return(0,A.jsx)(ss.A,{...e,role:"button","aria-label":t("schema-settings"),style:{cursor:"pointer"}})},items:[{type:"itemGroup",name:"actions",title:'{{t("Enable actions")}}',children:[{type:"item",title:'{{t("View")}}',name:"view",Component:"ViewActionInitializer",schema:{"x-component":"Action.Link","x-action":"view","x-decorator":"ACLActionProvider"}},{type:"item",name:"edit",title:'{{t("Edit")}}',Component:"UpdateActionInitializer",schema:{"x-component":"Action.Link","x-action":"update","x-decorator":"ACLActionProvider"},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{type:"item",title:'{{t("Delete")}}',name:"delete",Component:"DestroyActionInitializer",schema:{"x-component":"Action.Link","x-action":"destroy","x-decorator":"ACLActionProvider"},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{type:"item",title:'{{t("Disassociate")}}',name:"disassociate",Component:"DisassociateActionInitializer",schema:{"x-component":"Action.Link","x-action":"disassociate","x-acl-action":"destroy","x-decorator":"ACLActionProvider"},useVisible(){let e=t7(),t=tS();return!!(null==e?void 0:e.association)&&("view"!==t.template||(null==t?void 0:t.writableView))&&"sql"!==t.template}},{type:"item",title:'{{t("Add child")}}',name:"addChildren",Component:"CreateChildInitializer",schema:{"x-component":"Action.Link","x-action":"create","x-decorator":"ACLActionProvider"},useVisible(){var e;let t=(0,ec.useFieldSchema)(),n=tS(),{treeTable:o}=(null==t||null==(e=t.parent)?void 0:e.parent["x-decorator-props"])||{};return n.tree&&!1!==o}}]},{name:"divider",type:"divider"},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[{type:"item",title:'{{t("Popup")}}',name:"popup",Component:"PopupActionInitializer"},{type:"item",title:'{{t("Update record")}}',name:"updateRecord",Component:"UpdateRecordActionInitializer",useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer",schema:{"x-action":"customize:table:request"},useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}}]},{name:"divider2",type:"divider"},{type:"item",name:"columnWidth",title:'t("Column width")',Component:bg}]}),bb=new mL({name:"table:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:"{{t('Enable actions')}}",children:[{type:"item",name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{type:"item",title:"{{t('Add new')}}",name:"addNew",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){let e=tS();return!["view","file","sql"].includes(e.template)||(null==e?void 0:e.writableView)}},{type:"item",title:"{{t('Associate')}}",name:"associate",Component:"AssociateActionInitializer",useVisible(){let e=tS();return t7().association&&(!["view","file","sql"].includes(e.template)||(null==e?void 0:e.writableView))}},{type:"item",title:"{{t('Delete')}}",name:"delete",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider"},useVisible(){let e=tS();return!["view","sql"].includes(e.template)||(null==e?void 0:e.writableView)}},{type:"item",title:"{{t('Refresh')}}",name:"refresh",Component:"RefreshActionInitializer",schema:{"x-align":"right"}},{name:"toggle",title:"{{t('Expand/Collapse')}}",Component:"ExpandableActionInitializer",schema:{"x-align":"right"},useVisible(){var e;let t=(0,ec.useFieldSchema)(),n=tS(),{treeTable:o}=(null==t||null==(e=t.parent)?void 0:e["x-decorator-props"])||{};return n.tree&&!1!==o}}]},{name:"divider",type:"divider",useVisible(){let e=tS();return!["view","sql"].includes(e.template)||(null==e?void 0:e.writableView)}},{type:"subMenu",name:"customize",title:'{{t("Customize")}}',children:[{type:"item",title:'{{t("Add record")}}',name:"addRecord",Component:"CustomizeAddRecordActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action":"create","x-acl-action-props":{skipScopeCheck:!0}}}],useVisible(){let e=tS();return!["view","sql"].includes(e.template)||(null==e?void 0:e.writableView)}}]}),bC=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideSearch:o,createBlockSchema:l,templateWrap:r,showAssociationFields:i}=e,{createTableBlock:a}=bS(),s=mn();return(0,A.jsx)(vB,{...s,icon:(0,A.jsx)(vR.A,{}),componentType:"Table",onCreateBlockSchema:async e=>{if(l)return l(e);a(e)},onlyCurrentDataSource:n,hideSearch:o,filter:t,showAssociationFields:i})},bS=()=>{let{insert:e}=me(),{getCollection:t}=sO();return{createTableBlock:n=>{let{item:o}=n,l=t(o.name,o.dataSource);e(ye({collectionName:o.name,dataSource:o.dataSource,rowKey:l.filterTargetKey||"id"}))}}},bw=e=>(0,A.jsx)(A$.Provider,{value:null,children:(0,A.jsx)(sN,{initializer:e.initializer||!1,showBorder:!1,showBackground:!0,...eu().omit(e,"initializer")})});function bF(){let e=(0,ns._)(["\n overflow: hidden;\n position: relative;\n .tb-card-item {\n height: 100%;\n .ant-card {\n display: flex;\n flex-direction: column;\n height: 100%;\n .ant-card-body {\n height: 1px;\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n }\n }\n "]);return bF=function(){return e},e}let bj=es.createContext({setFixedBlock:()=>{},height:0,fixedBlockUID:!1,fixedBlockUIDRef:{current:!1},inFixedBlock:!1}),bA=()=>{var e;let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{setFixedBlock:o,fixedBlockUID:l,fixedBlockUIDRef:r}=bk(),i=(0,es.useRef)(!1);return(0,es.useEffect)(()=>{if(!r.current||i.current){var e;o(null!=t&&null!=(e=t.decoratorProps)&&!!e.fixedBlock&&n["x-uid"]),i.current=!0}},[null==t||null==(e=t.decoratorProps)?void 0:e.fixedBlock]),n["x-uid"]===l},bk=()=>(0,es.useContext)(bj),bI=e=>{let t=bA(),{height:n,fixedBlockUID:o}=bk();return!t&&o?(0,A.jsx)(A.Fragment,{children:e.children}):(0,A.jsx)("div",{className:"tb-fixed-block",style:{height:o?"calc(100vh - ".concat(n,")"):void 0},children:e.children})},bP=(0,nu.rU)(e=>{let{css:t}=e;return{fixedBlockCss:t(bF())}}),bT=e=>{let{height:t}=e,{styles:n}=bP(),[o,l]=(0,es.useState)(!1),r=(0,es.useRef)(o);return(0,A.jsx)(bj.Provider,{value:{inFixedBlock:!0,height:t,setFixedBlock:e=>{r.current=e,l(e)},fixedBlockUID:o,fixedBlockUIDRef:r},children:(0,A.jsx)("div",{className:o?n.fixedBlockCss:"",style:{height:o?"calc(100vh - ".concat(t,")"):void 0},children:e.children})})},bN=()=>{let{visible:e}=co();return{isBlockInPage:(0,es.useCallback)(()=>!e,[e])}},bM=()=>{var e;let t=(0,ec.useField)(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY(),{inFixedBlock:r}=bk(),{isBlockInPage:i}=bN(),{service:a}=nj();return i()&&r?(0,A.jsx)(aY,{title:n("Fix block"),checked:null==(e=o["x-decorator-props"])?void 0:e.fixedBlock,onChange:async e=>{var n;let r={...o["x-decorator-props"],fixedBlock:e};await l.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":r}}),t.decoratorProps=o["x-decorator-props"]=r,null==a||null==(n=a.refresh)||n.call(a)}}):null},bD=new or({name:"blockSettings:table",items:[{name:"editBlockTitle",Component:aZ},{name:"treeTable",type:"switch",useComponentProps:()=>{var e;let{getCollectionField:t,getCollection:n}=sO(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{service:r}=lz(),{t:i}=(0,eT.useTranslation)(),{dn:a}=eY(),s=tJ(),{resource:c}=o.decoratorProps,d=c&&t(c),u=(null==c?void 0:c.includes("."))?null==(e=n(null==d?void 0:d.target))?void 0:e.tree:!!(null==s?void 0:s.tree);return{title:i("Tree table"),defaultChecked:!0,checked:!!u&&!1!==o.decoratorProps.treeTable,onChange:e=>{var t;o.decoratorProps.treeTable=e,l["x-decorator-props"].treeTable=e;let n={...null==(t=r.params)?void 0:t[0],tree:!!e||null};a.emit("patch",{schema:l}),a.refresh(),r.run(n)}}},useVisible:()=>{let{getCollectionField:e}=sO(),t=(0,ec.useField)(),n=tJ(),{resource:o}=t.decoratorProps,l=o&&e(o);return(null==n?void 0:n.tree)&&(null==l?void 0:l.collectionName)===(null==l?void 0:l.target)}},{name:"enableDragAndDropSorting",type:"switch",useComponentProps:()=>{let{getCollectionField:e}=sO(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{service:o}=lz(),{t:l}=(0,eT.useTranslation)(),{dn:r}=eY(),{resource:i}=t.decoratorProps,a=i&&e(i),s=eC();return{title:l("Enable drag and drop sorting"),checked:t.decoratorProps.dragSort,onChange:async e=>{var l,i,c;if(e&&a){let{data:e}=await s.resource("collections.fields",a.collectionName).update({filterByTk:a.name,values:{sortable:!0}}),t=null==e||null==(c=e.data)||null==(i=c[0])?void 0:i.sortBy;n["x-decorator-props"].dragSortBy=t}e||(n["x-decorator-props"].dragSortBy=null,t.decoratorProps.dragSortBy=null),t.decoratorProps.dragSort=e,n["x-decorator-props"].dragSort=e,o.run({...null==(l=o.params)?void 0:l[0],sort:n["x-decorator-props"].dragSortBy}),r.emit("patch",{schema:{"x-uid":n["x-uid"],"x-decorator-props":n["x-decorator-props"]}})}}}},{name:"SortField",Component:a4,useVisible:()=>(0,ec.useField)().decoratorProps.dragSort},{name:"FixBlock",Component:bM},{name:"SetTheDataScope",Component:il,useComponentProps:()=>{var e,t;let{name:n}=tJ(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{form:r}=Tp(),{service:i}=lz(),{dn:a}=eY(),s=tZ(),c=(0,es.useCallback)(e=>{var t,n,r;let{filter:c}=e;c=d5(c);let d=o.decoratorProps.params||{};d.filter=c,o.decoratorProps.params=d,l["x-decorator-props"].params=d;let u=(null==(n=i.params)||null==(t=n[1])?void 0:t.filters)||{};"auto"===s&&i.run({...null==(r=i.params)?void 0:r[0],filter:pA([...Object.values(u),c]),page:1},{filters:u}),a.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}})},[a,o.decoratorProps,l,i]);return{collectionName:n,defaultFilter:(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:r,onSubmit:c}}},{name:"SetDefaultSortingRules",type:"modal",useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),r=hd(n),{service:i}=lz(),{t:a}=(0,eT.useTranslation)(),{dn:s}=eY(),c=(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],d=null==c?void 0:c.map(e=>(null==e?void 0:e.startsWith("-"))?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return{title:a("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:a("Set default sorting rules"),properties:{sort:{type:"array",default:d,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:r,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:a("ASC"),value:"asc"},{label:a("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:a("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{var t;let{sort:n}=e,r=n.map(e=>"desc"===e.direction?"-".concat(e.field):e.field),a=o.decoratorProps.params||{};a.sort=r,o.decoratorProps.params=a,l["x-decorator-props"].params=a,s.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}}),i.run({...null==(t=i.params)?void 0:t[0],sort:r})}}},useVisible(){let{dragSort:e}=(0,ec.useField)().decoratorProps;return!e}},{name:"setDataLoadingMode",Component:t0},{name:"RecordsPerPage",type:"select",useComponentProps(){var e,t;let n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{service:l}=lz(),{t:r}=(0,eT.useTranslation)(),{dn:i}=eY();return{title:r("Records per page"),value:(null==(t=n.decoratorProps)||null==(e=t.params)?void 0:e.pageSize)||20,options:[{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:e=>{var t;let r=n.decoratorProps.params||{};r.pageSize=e,n.decoratorProps.params=r,o["x-decorator-props"].params=r,l.run({...null==(t=l.params)?void 0:t[0],pageSize:e,page:1}),i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:aU,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{type:pj.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider",useVisible:()=>{var e;let t=(0,ec.useFieldSchema)();return!(null==t||null==(e=t["x-decorator-props"])?void 0:e.disableTemplate)}},{name:"ConvertReferenceToDuplicate",Component:aB,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"Table",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}},useVisible:()=>{var e;let t=(0,ec.useFieldSchema)();return!(null==t||null==(e=t["x-decorator-props"])?void 0:e.disableTemplate)}},{name:"divider2",type:"divider"},{name:"delete",type:"remove",useComponentProps:()=>({removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}]}),bR=new or({name:"fieldSettings:TableColumn",items:[{name:"decoratorOptions",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Generic properties")}},children:[{name:"customColumnTitle",type:"modal",useComponentProps(){var e;let{fieldSchema:t,collectionField:n}=sb(),o=(0,ec.useField)(),{t:l}=(0,eT.useTranslation)(),r=(0,ec.useFieldSchema)(),{dn:i}=eY();return{title:l("Custom column title"),schema:{type:"object",title:l("Custom column title"),properties:{title:{title:l("Column title"),default:null==r?void 0:r.title,description:"".concat(l("Original field title: ")).concat((null==n||null==(e=n.uiSchema)?void 0:e.title)||(null==t?void 0:t.title)),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:e=>{let{title:t}=e;t&&(o.title=t,r.title=t,i.emit("patch",{schema:{"x-uid":r["x-uid"],title:r.title}})),i.refresh()}}}},{name:"columnWidth",type:"modal",useComponentProps(){var e;let t=(0,ec.useField)(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY();return{title:n("Column width"),schema:{type:"object",title:n("Column width"),properties:{width:{default:(null==o||null==(e=o["x-component-props"])?void 0:e.width)||200,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{}}}},onSubmit:e=>{let{width:n}=e,r=o["x-component-props"]||{};r.width=n;let i={"x-uid":o["x-uid"]};i["x-component-props"]=r,o["x-component-props"]=r,t.componentProps.width=n,l.emit("patch",{schema:i}),l.refresh()}}}},{name:"columnAlign",type:"select",useComponentProps(){var e;let t=(0,ec.useFieldSchema)(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),{dn:l}=eY();return{key:"align",title:n("Align"),options:[{label:n("Left"),value:"left"},{label:n("Center"),value:"center"},{label:n("Right"),value:"right"}],value:(null==(e=t["x-component-props"])?void 0:e.align)||"left",onChange:e=>{let n=t["x-component-props"]||{};n.align=e;let r={"x-uid":t["x-uid"]};r["x-component-props"]=n,t["x-component-props"]=n,o.componentProps.align=e,l.emit("patch",{schema:r}),l.refresh()}}}},{name:"sortable",type:"switch",useVisible(){tS();let{collectionField:e}=sb(),{getInterface:t}=sO(),n=t(null==e?void 0:e.interface),{currentMode:o}=lx();return(null==n?void 0:n.sortable)===!0&&!o},useComponentProps(){let e=(0,ec.useField)(),{t}=(0,eT.useTranslation)(),n=(0,ec.useFieldSchema)(),{dn:o}=eY();return{title:t("Sortable"),checked:e.componentProps.sorter,onChange:t=>{let l={"x-uid":n["x-uid"]};n["x-component-props"]={...n["x-component-props"],sorter:t},l["x-component-props"]=n["x-component-props"],e.componentProps.sorter=t,o.emit("patch",{schema:l}),o.refresh()}}}},{name:"setDefaultValue",useVisible(){let{fieldSchema:e}=sb();return!!e&&!(null==e?void 0:e["x-read-pretty"])},Component:sq,useComponentProps(){let{fieldSchema:e}=sb();return{fieldSchema:e}}},{name:"required",type:"switch",useVisible(){let{uiSchema:e,fieldSchema:t}=sb(),n=(0,ec.useField)();return!!t&&["QuickEdit","FormItem"].includes(t["x-decorator"])&&!n.readPretty&&!(null==e?void 0:e["x-read-pretty"])},useComponentProps(){let{fieldSchema:e}=sb(),t=(0,ec.useField)(),{t:n}=(0,eT.useTranslation)(),{dn:o}=eY();return{key:"required",title:n("Required"),checked:e.required,onChange:n=>{var l,r;if(!e)return console.error("fieldSchema is required");let i={"x-uid":e["x-uid"]};e.required=n,i.required=n;let a=null==(r=t.path)?void 0:r.splice((null==(l=t.path)?void 0:l.length)-1,1);t.form.query("".concat(a.concat("*."+e.name))).forEach(e=>{e.required=n}),o.emit("patch",{schema:i}),o.refresh()}}}},{name:"pattern",type:"select",useVisible(){let{fieldSchema:e,collectionField:t}=sb(),n=(0,ec.useField)();return!!e&&["QuickEdit","FormItem"].includes(e["x-decorator"])&&!(null==n?void 0:n.readPretty)&&(null==t?void 0:t.interface)!=="o2m"&&!sB(e)},useComponentProps(){let{fieldSchema:e}=sb(),t=(0,ec.useField)(),{t:n}=(0,eT.useTranslation)(),{dn:o}=eY(),l="editable";return e?(!0===e["x-disabled"]&&(l="readonly"),!0===e["x-read-pretty"]&&(l="read-pretty"),{key:"pattern",title:n("Pattern"),options:[{label:n("Editable"),value:"editable"},{label:n("Readonly"),value:"readonly"},{label:n("Easy-reading"),value:"read-pretty"}],value:l,onChange:n=>{var l,r;let i={"x-uid":e["x-uid"]},a=null==(r=t.path)?void 0:r.splice((null==(l=t.path)?void 0:l.length)-1,1);switch(n){case"readonly":e["x-read-pretty"]=!1,e["x-disabled"]=!0,i["x-read-pretty"]=!1,i["x-disabled"]=!0,t.form.query("".concat(a.concat("*."+e.name))).forEach(e=>{e.readonly=!0,e.disabled=!0});break;case"read-pretty":e["x-read-pretty"]=!0,e["x-disabled"]=!1,i["x-read-pretty"]=!0,i["x-disabled"]=!1,t.form.query("".concat(a.concat("*."+e.name))).forEach(e=>{e.readPretty=!0});break;default:e["x-read-pretty"]=!1,e["x-disabled"]=!1,i["x-read-pretty"]=!1,i["x-disabled"]=!1,t.form.query("".concat(a.concat("*."+e.name))).forEach(e=>{e.readPretty=!1,e.disabled})}o.emit("patch",{schema:i}),o.refresh()}}):console.error("fieldSchema is required")}}]},{name:"componentOptions",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Specific properties")}},useChildren(){let e=os(),t=function(){var e,t,n;let{fieldSchema:o,collectionField:l}=sb(),r=(0,ec.useField)(),i=uc(),a=(0,ec.useFieldSchema)(),s=o||a,c=(null==s||null==(e=s["x-component-props"])?void 0:e.mode)||(null==r||null==(t=r.componentProps)?void 0:t.mode)||(i?"FileManager":"")||(null==l||null==(n=l.uiSchema)?void 0:n["x-component"]);return({AssociationField:"Select"})[c]||c}(),n=e.schemaSettingsManager.get("fieldSettings:component:".concat(t));return(null==n?void 0:n.items)||[]}},{name:"divider",type:"divider"},{name:"delete",type:"remove",sort:100,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{removeParentsIfNoChildren:!0,confirm:{title:e("Delete field")},breakRemoveOn:{"x-component":"Grid"}}}}]}),bq=new mL({name:"table:configureColumns",insertPosition:"beforeEnd",icon:"SettingOutlined",title:'{{t("Configure columns")}}',wrap:(e,t)=>{let{isInSubTable:n}=t;return e["x-action-column"]?e:{type:"void","x-decorator":"TableV2.Column.Decorator","x-toolbar":"TableColumnSchemaToolbar","x-settings":"fieldSettings:TableColumn","x-component":"TableV2.Column",properties:{[e.name]:{...e}}}},items:[{name:"displayFields",type:"itemGroup",title:'{{t("Display fields")}}',useChildren:pG},{name:"parentCollectionFields",Component:()=>{let e=p$(),{t}=(0,eT.useTranslation)(),n=eB();if(!(null==e?void 0:e.length))return null;let o=[];return e.forEach(e=>{Object.values(e)[0].length&&o.push({type:"itemGroup",divider:!0,title:t("Parent collection fields")+"("+n("".concat(Object.keys(e)[0]))+")",children:Object.values(e)[0].filter(e=>{var t;return!(null==e||null==(t=e.field)?void 0:t.isForeignKey)})})}),(0,A.jsx)(mb,{children:o})}},{name:"associationFields",Component:()=>{let e=pK(),t=(0,ec.useFieldSchema)(),{t:n}=(0,eT.useTranslation)(),o=(0,es.useMemo)(()=>[{type:"itemGroup",title:n("Display association fields"),children:e}],[e,n]);return(null==e?void 0:e.length)&&"AssociationField.SubTable"!==t["x-component"]?(0,A.jsx)(mb,{children:o}):null}},{name:"divider",type:"divider",useVisible:()=>"AssociationField.SubTable"!==(0,ec.useFieldSchema)()["x-component"]},{type:"item",name:"add",title:'{{t("Action column")}}',Component:"TableActionColumnInitializer",useVisible:()=>"AssociationField.SubTable"!==(0,ec.useFieldSchema)()["x-component"]}]}),b_=()=>{let{onCreateBlockSchema:e,componentType:t,createBlockSchema:n,...o}=mn(),{insert:l}=me(),r=tJ();return(0,A.jsx)(mf,{icon:(0,A.jsx)(vL.A,{}),...o,onClick:async()=>{l((e=>{let{collectionName:t,dataSource:n,rowKey:o}=e;if(!t||!n||!o)throw Error("collectionName, dataSource, rowKey is required");return{type:"void","x-acl-action":"".concat(t,":list"),"x-decorator":"TableSelectorProvider","x-use-decorator-props":"useTableSelectorDecoratorProps","x-decorator-props":{collection:t,dataSource:n,action:"list",params:{pageSize:20},rowKey:o},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:tableSelector","x-component":"CardItem",properties:{[(0,ec.uid)()]:{type:"void","x-initializer":"table:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}}},value:{type:"array","x-initializer":"table:configureColumns","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowSelection:{type:"checkbox"}}}}}})({rowKey:r.filterTargetKey,collectionName:r.name,dataSource:r.dataSource}))}})},bO=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideChildrenIfSingleCollection:o}=e,l=mn(),{insert:r}=me();return(0,A.jsx)(vB,{...l,onlyCurrentDataSource:n,icon:(0,A.jsx)(vR.A,{}),componentType:"FilterCollapse",onCreateBlockSchema:async e=>{let{item:t}=e;r((e=>{let{collectionName:t,dataSource:n,blockType:o}=e;return{type:"void","x-decorator":"AssociationFilter.Provider","x-use-decorator-props":"useCollapseBlockDecoratorProps","x-decorator-props":{collection:t,dataSource:n,blockType:o,associationFilterStyle:{width:"100%"},name:"filter-collapse"},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:filterCollapse","x-component":"CardItem","x-filter-targets":[],properties:{[(0,ec.uid)()]:{type:"void","x-action":"associateFilter","x-initializer":"filterCollapse:configureFields","x-component":"AssociationFilter"}}}})({dataSource:t.dataSource,collectionName:t.collectionName||t.name,blockType:"filter"}))},filter:t,hideChildrenIfSingleCollection:o})},bB=new mL({name:"filterForm:configureActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",title:'{{t("Enable actions")}}',name:"enableActions",children:[{name:"filter",title:'{{t("Filter")}}',Component:"CreateFilterActionInitializer",schema:{"x-action-settings":{}}},{name:"reset",title:'{{t("Reset")}}',Component:"CreateResetActionInitializer",schema:{"x-action-settings":{}}}]}]}),bE=e=>{let{collectionName:t,dataSource:n,templateSchema:o}=e;if(!t||!n)throw Error("collectionName and dataSource are required");return{type:"void","x-decorator":"FilterFormBlockProvider","x-use-decorator-props":"useFilterFormBlockDecoratorProps","x-decorator-props":{dataSource:n,collection:t},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:filterForm","x-component":"CardItem","x-filter-targets":[],"x-filter-operators":{},properties:{[(0,ec.uid)()]:{type:"void","x-component":"FormV2","x-use-component-props":"useFilterFormBlockProps",properties:{grid:o||{type:"void","x-component":"Grid","x-initializer":"filterForm:configureFields"},[(0,ec.uid)()]:{type:"void","x-initializer":"filterForm:configureActions","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{float:"right"}}}}}}}},bV=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideChildrenIfSingleCollection:o}=e,l=mn(),{insert:r}=me();return(0,A.jsx)(vB,{...l,icon:(0,A.jsx)(vL.A,{}),onlyCurrentDataSource:n,componentType:"FilterFormItem",templateWrap:(e,t)=>{let{item:n}=t,o=bE({templateSchema:e,dataSource:n.dataSource,collectionName:n.name||n.collectionName});return n.template&&"reference"===n.mode&&(o["x-template-key"]=n.template.key),o},onCreateBlockSchema:e=>{let{item:t}=e;return r(bE({collectionName:t.collectionName||t.name,dataSource:t.dataSource}))},filter:t,hideChildrenIfSingleCollection:o})},bz=new mL({name:"filterForm:configureFields",wrap:pO,icon:"SettingOutlined",title:'{{t("Configure fields")}}',items:[{type:"subMenu",name:"displayFields",title:'{{t("Display fields")}}',useChildren:e=>{var t;let{name:n,currentFields:o}=tJ(),{getInterface:l,getCollection:r}=sO(),i=(0,ec.useForm)(),{readPretty:a=i.readPretty,block:s="FilterForm"}=e||{},{snapshot:c,fieldSchema:d}=co(),u=null==d?void 0:d["x-action"];return null==o||null==(t=o.filter(e=>{var t;return(null==e?void 0:e.interface)&&!(null==e?void 0:e.isForeignKey)&&(null==(t=l(e.interface))?void 0:t.filterable)}))?void 0:t.map(e=>{var t,o,i;let c=l(e.interface),d=r(e.target),p={type:"string",name:e.name,required:!1,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FilterFormItem","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"".concat(n,".").concat(e.name),"x-component-props":{}};return pM(e)&&(p={type:"string",name:"".concat(e.name),required:!1,"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FilterFormItem","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"".concat(n,".").concat(e.name),"x-component-props":null==(i=e.uiSchema)?void 0:i["x-component-props"]}),{name:(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name,type:"item",title:(null==e||null==(o=e.uiSchema)?void 0:o.title)||e.name,Component:"CollectionFieldInitializer",remove:pE,schemaInitialize:t=>{var n;null==c||null==(n=c.schemaInitialize)||n.call(c,t,{field:e,block:s,readPretty:a,action:u,targetCollection:d})},schema:p}})}},{name:"parentCollectionFields",Component:vM},{name:"associationFields",Component:vD},{name:"divider",type:"divider"},{title:'{{t("Add text")}}',Component:"MarkdownFormItemInitializer",name:"addText"},{title:'{{t("Custom filter field")}}',name:"custom",type:"item",Component:"FilterFormItemCustom"}]}),bL=new mL({name:"filterTree:configureActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",title:'{{t("Enable actions")}}',name:"enableActions",children:[{name:"filter",title:'{{t("Filter")}}',Component:"CreateFilterActionInitializer",schema:{"x-action-settings":{}}},{name:"reset",title:'{{t("Reset")}}',Component:"CreateResetActionInitializer",schema:{"x-action-settings":{}}}]}]}),bG=e=>{let{filterCollections:t,onlyCurrentDataSource:n,hideChildrenIfSingleCollection:o}=e,l=mn(),{insert:r}=me(),i=tg();return(0,A.jsx)(vB,{...l,onlyCurrentDataSource:n,icon:(0,A.jsx)(i6,{type:"TableOutlined"}),componentType:"FilterTree",onCreateBlockSchema:async e=>{let{item:t}=e,n=i.getCollection(t.name);r((e=>{let{actionInitializers:t="TreeActionInitializers",collection:n,association:o,resource:l,...r}=e,i=l||o||n;return{type:"void","x-acl-action":"".concat(i,":list"),"x-decorator":"TreeBlockProvider","x-decorator-props":{resource:i,collection:n,association:o,readPretty:!0,action:"list",runWhenParamsChanged:!0,...r},"x-filter-targets":[],"x-filter-operators":{},"x-settings":"blockSettings:filterTree","x-component":"CardItem",properties:{actionBar:{type:"void","x-initializer":"filterTree:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{}},tree:{type:"array","x-component":"Tree","x-use-component-props":"useTreeBlockProps"}}}})({collection:t.name,rowKey:n.filterTargetKey||"id"}))},filter:t,hideChildrenIfSingleCollection:o})};var bK=n(26387);let b$=()=>{let{insert:e}=me(),{t}=(0,eT.useTranslation)(),n=mn();return(0,A.jsx)(mf,{...n,icon:(0,A.jsx)(bK.A,{}),onClick:()=>{e({type:"void","x-settings":"blockSettings:markdown","x-decorator":"CardItem","x-decorator-props":{name:"markdown"},"x-component":"Markdown.Void","x-editable":!1,"x-component-props":{content:t("This is a demo text, **supports Markdown syntax**.")}})}})},bU=()=>{let{insert:e}=me(),t=mn();return(0,A.jsx)(mf,{...t,icon:(0,A.jsx)(vL.A,{}),onClick:()=>{e({type:"void","x-editable":!1,"x-decorator":"FormItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:markdown","x-component":"Markdown.Void","x-component-props":{content:'{{t("This is a demo text, **supports Markdown syntax**.")}}'}})}})},bW=new mL({name:"popup:tableSelector:addBlock",...{wrap:pO,title:'{{t("Add block")}}',icon:"PlusOutlined",items:[{type:"itemGroup",title:'{{t("Selector")}}',name:"selector",children:[{name:"title",title:"Table",Component:"TableSelectorInitializer"}]},{type:"itemGroup",title:'{{t("Filter blocks")}}',name:"filterBlocks",useChildren(){let{name:e,dataSource:t}=tS();return[{name:"filterFormBlockInTableSelector",title:'{{t("Form")}}',Component:"FilterFormBlockInitializer",componentProps:{filterCollections:()=>!1,onlyCurrentDataSource:!0},collectionName:e,dataSource:t},{name:"filterCollapseBlockInTableSelector",title:'{{t("Collapse")}}',Component:"FilterCollapseBlockInitializer",componentProps:{filterCollections:()=>!1,onlyCurrentDataSource:!0},collectionName:e,dataSource:t}]}},{type:"itemGroup",title:'{{t("Other blocks")}}',name:"otherBlocks",children:[{title:'{{t("Add text")}}',Component:"BlockItemInitializer",name:"addText",schema:{type:"void","x-editable":!1,"x-decorator":"BlockItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:markdown","x-component":"Markdown.Void","x-component-props":{content:'{{t("This is a demo text, **supports Markdown syntax**.")}}'}}}]}]}}),bH=()=>{let e=mn();return(0,A.jsx)(gQ,{...e,item:e,schema:{},type:"x-collection-field"})},bY=()=>{let e=mn();return(0,A.jsx)(gQ,{...e,schema:{},item:e,type:"x-collection-field"})},bX=(0,nu.rU)(e=>{let{token:t}=e;return{menuItem:{paddingLeft:"".concat(t.padding,"px !important"),paddingRight:"".concat(t.padding,"px !important")}}}),bJ=()=>{let{insert:e}=me(),{t}=(0,eT.useTranslation)(),n=(0,es.useContext)(ec.SchemaOptionsContext),{theme:o}=yS(),{styles:l}=bX(),r=(0,es.useCallback)(async()=>{let{title:l,icon:r}=await AE(t("Add submenu"),()=>(0,A.jsx)(i8,{scope:n.scope,components:{...n.components},children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(al,{schema:{properties:{title:{title:t("Menu item title"),"x-component":"Input","x-decorator":"FormItem",required:!0},icon:{title:t("Icon"),"x-component":"IconPicker","x-decorator":"FormItem"}}}})})}),o).open({initialValues:{}});e({type:"void",title:l,"x-component":"Menu.SubMenu","x-decorator":"ACLMenuItemProvider","x-component-props":{icon:r},"x-server-hooks":[{type:"onSelfCreate",method:"bindMenuToRole"},{type:"onSelfSave",method:"extractTextToLocale"}]})},[e,n.components,n.scope,t,o]);return(0,A.jsx)(mf,{icon:(0,A.jsx)(i6,{type:"FolderAddOutlined"}),title:t("Create group"),onClick:r,className:l.menuItem})},bQ=()=>{let{insert:e}=me(),{t}=(0,eT.useTranslation)(),n=(0,es.useContext)(ec.SchemaOptionsContext),{theme:o}=yS(),{styles:l}=bX(),r=(0,es.useCallback)(async()=>{let{title:l,href:r,icon:i}=await AE(t("Add link"),()=>(0,A.jsx)(i8,{scope:n.scope,components:{...n.components},children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(al,{schema:{properties:{title:{title:t("Menu item title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:t("Icon"),"x-component":"IconPicker","x-decorator":"FormItem"},href:{title:t("Link"),"x-component":"Input","x-decorator":"FormItem"}}}})})}),o).open({initialValues:{}});e({type:"void",title:l,"x-component":"Menu.URL","x-decorator":"ACLMenuItemProvider","x-component-props":{icon:i,href:r},"x-server-hooks":[{type:"onSelfCreate",method:"bindMenuToRole"},{type:"onSelfSave",method:"extractTextToLocale"}]})},[e,n.components,n.scope,t,o]);return(0,A.jsx)(mf,{className:l.menuItem,icon:(0,A.jsx)(i6,{type:"GlobalOutlined"}),title:t("Create link"),onClick:r})},bZ=()=>{let{insert:e}=me(),{t}=(0,eT.useTranslation)(),n=(0,es.useContext)(ec.SchemaOptionsContext),{theme:o}=yS(),{styles:l}=bX(),r=(0,es.useCallback)(async()=>{let{title:l,icon:r}=await AE(t("Add page"),()=>(0,A.jsx)(i8,{scope:n.scope,components:{...n.components},children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(al,{schema:{properties:{title:{title:t("Menu item title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:t("Icon"),"x-component":"IconPicker","x-decorator":"FormItem"}}}})})}),o).open({initialValues:{}});e({type:"void",title:l,"x-component":"Menu.Item","x-decorator":"ACLMenuItemProvider","x-component-props":{icon:r},"x-server-hooks":[{type:"onSelfCreate",method:"bindMenuToRole"},{type:"onSelfSave",method:"extractTextToLocale"}],properties:{page:{type:"void","x-component":"Page","x-async":!0,properties:{[(0,ec.uid)()]:{type:"void","x-component":"Grid","x-initializer":"page:addBlock",properties:{}}}}}})},[e,n.components,n.scope,t,o]);return(0,A.jsx)(mf,{icon:(0,A.jsx)(i6,{type:"FileOutlined"}),title:t("Create page"),onClick:r,className:l.menuItem})},b0=new mL({name:"menuInitializers:menuItem",insertPosition:"beforeEnd",icon:"PlusOutlined",title:'{{t("Add menu item")}}',style:{width:"100%"},items:[{name:"submenu",Component:bJ},{name:"page",Component:bZ},{name:"link",Component:bQ}]}),b1=new mL({name:"page:addBlock",title:'{{t("Add block")}}',icon:"PlusOutlined",wrap:pO,items:[{name:"dataBlocks",title:'{{t("Data blocks")}}',type:"itemGroup",children:[{name:"table",title:'{{t("Table")}}',Component:"TableBlockInitializer"},{name:"form",title:'{{t("Form")}}',Component:"FormBlockInitializer"},{name:"details",title:'{{t("Details")}}',Component:"DetailsBlockInitializer"},{name:"list",title:'{{t("List")}}',Component:"ListBlockInitializer"},{name:"gridCard",title:'{{t("Grid Card")}}',Component:"GridCardBlockInitializer"}]},{name:"filterBlocks",title:'{{t("Filter blocks")}}',type:"itemGroup",children:[{name:"filterForm",title:'{{t("Form")}}',Component:"FilterFormBlockInitializer"},{name:"filterCollapse",title:'{{t("Collapse")}}',Component:"FilterCollapseBlockInitializer"},{name:"filterTree",title:'{{t("Tree")}}',Component:"FilterTreeBlockInitializer"}]},{name:"otherBlocks",type:"itemGroup",title:'{{t("Other blocks")}}',children:[{name:"markdown",title:'{{t("Demonstration text")}}',Component:"MarkdownBlockInitializer"}]}]}),b2=e=>{let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{uiSchema:o}=hY(),l=eE(null==o?void 0:o["x-component"]),r=eB(),i=(e,n)=>{t[e]=void 0===t[e]?n:t[e]},a=Tp();return((0,es.useEffect)(()=>{(null==a?void 0:a.field)&&(a.field.added=a.field.added||new Set,a.field.added.add(n.name))}),(0,es.useEffect)(()=>{if(!o)return;i("content",o["x-content"]),i("title",o.title),i("description",o.description),i("initialValue",o.default),!0===n["x-disabled"]&&(t.disabled=!0),!0===n["x-read-pretty"]&&(t.readPretty=!0),void 0===n.required&&(t.required=!!o.required),t.dataSource=o.enum;let e=r(o["x-component-props"])||{},l=(0,ec.merge)(e,t.componentProps||{});t.componentProps=l},[JSON.stringify(o)]),o)?es.createElement(l,e,e.children):null},b6=e=>{let t=(0,ec.useFieldSchema)();return(0,A.jsx)(tj,{name:t.name,children:(0,A.jsx)(b2,{...e})})};var b3=((c={}).ConstantValue="constantValue",c.DynamicValue="dynamicValue",c);let b5=e=>{let{value:t,onChange:n}=e,{getCollectionFields:o,getAllCollectionsInheritChain:l}=sO(),r=tJ(),{form:i}=Tp(),a=(0,ec.useFieldSchema)(),s=m3(),c=lN(),d=lT(),u=hm(r),{name:p,getField:m}=r,h=m(a.name),x=(0,es.useMemo)(()=>rH({collectionField:h,variables:c,localVariables:d,getAllCollectionsInheritChain:l}),[h,l,d,c]),f=(0,es.useCallback)(e=>{let t=e.find(e=>"$nForm"===e.value),n=o(p);return(null==n?void 0:n.length)||!t||(t.children=rX(u)),e},[u,p]),v=(0,es.useCallback)(t=>{let{value:n,onChange:o}=t;return(0,A.jsx)(b6,{...e,value:n,onChange:o})},[JSON.stringify(eu().omit(e,"value"))]);return(0,A.jsx)(rW,{form:i,record:s,value:t,onChange:n,renderSchemaComponent:v,collectionField:h,shouldChange:x,returnScope:f,targetFieldSchema:a})};var b4=n(59259);function b8(){let e=(0,ns._)(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return b8=function(){return e},e}function b7(){let e=(0,ns._)(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return b7=function(){return e},e}let b9=(0,nu.rU)(e=>{let{css:t}=e;return{designer:t(b8()),actionDesigner:t(b7())}});function Ce(e){return Ct()(e)}function Ct(){let{data:e,inResources:t,getResourceActionParams:n,getStrategyActionParams:o}=NF(),l=NP(),r=tJ();return function(i){let a=r.resource;return!i&&a&&(i="".concat(a,":create}")),(null==i?void 0:i.includes(":"))||(i="".concat(a,":").concat(i)),!i||!!function(l){arguments.length>1&&void 0!==arguments[1]&&arguments[1];let[r]=l.split(":");return(null==e?void 0:e.allowAll)?{}:t(r)?n(l):o(l)}(i,{recordPkValue:l})}}let Cn=(0,ec.observer)(e=>{var t;let{onClick:n}=e,o=tJ(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),i=(0,ec.useForm)(),a=lN(),s=Ct(),c=l["x-enable-children"]||[],d=null==l?void 0:l["x-allow-add-to-current"],u=null==l||null==(t=l["x-component-props"])?void 0:t.linkageFromForm,p="danger"===r.componentProps.type?void 0:r.componentProps.type||"primary",{getChildrenCollections:m}=sO(),h=m(o.name),x=(0,es.useMemo)(()=>c.map(e=>{if(!e)return;let t=h.find(t=>t.name===e.collection);if(t)return{...t.getOptions(),title:e.title||t.title}}).filter(e=>e&&s("".concat(e.name,":create"))),[c,h]),f=(null==l?void 0:l["x-linkage-rules"])||[],v=lT({currentForm:{values:m3()}}),g=eB(),{designable:y}=eY(),{styles:b}=b9(),C=e.icon||null,S=(0,es.useMemo)(()=>x.map(e=>({key:e.name,label:g(e.title),onClick:()=>null==n?void 0:n(e)})),[x,n]),w=(0,es.useMemo)(()=>({items:S}),[S]);return(0,es.useEffect)(()=>{r.stateOfLinkageRules={},f.filter(e=>!e.disabled).forEach(e=>{var t;null==(t=e.actions)||t.forEach(t=>{ds({operator:t.operator,field:r,condition:e.condition,variables:a,localVariables:v})})})},[r,f,v,a]),(0,A.jsx)("div",{className:b.actionDesigner,children:(0,A.jsx)(Co,{inheritsCollections:x,linkageFromForm:u,allowAddToCurrent:d,props:e,componentType:p,menu:w,onClick:n,collection:o,icon:C,field:r,form:i,designable:y})})},{displayName:"CreateAction"});function Co(e){var t,n,o,l;let{inheritsCollections:r,linkageFromForm:i,allowAddToCurrent:a,props:s,componentType:c,menu:d,onClick:u,collection:p,icon:m,field:h,form:x,designable:f}=e,{getCollection:v}=sO();return(null==r?void 0:r.length)>0?i?(0,A.jsx)(e3.Ay,{"aria-label":s["aria-label"],type:c,disabled:h.disabled,danger:s.danger,icon:m,onClick:e=>{let t=function(e,t,n){let o={$form:t.values,$iteration:t.values};if(!e.includes("$iteration"))return c5(e,{$form:t.values});{let t=n.path.segments.concat([]);return t.splice(-2),c5(e=e.replace("$iteration.","$iteration.".concat(t.join("."),".")),o)}}(i,x,h),n=v(r.find(e=>e.name===t)?t:p.name);null==u||u(n)},style:{display:!f&&(null==h||null==(o=h.data)?void 0:o.hidden)&&"none",opacity:f&&(null==h||null==(l=h.data)?void 0:l.hidden)&&.1},children:s.children}):void 0===a||a?(0,A.jsxs)(nX.A.Button,{"aria-label":s["aria-label"],danger:s.danger,type:c,icon:(0,A.jsx)(xm.A,{}),buttonsRender:e=>{let[t,n]=e;return[es.cloneElement(t,{style:null==s?void 0:s.style}),es.cloneElement(n,{loading:!1,style:null==s?void 0:s.style})]},menu:d,onClick:e=>{null==u||u(p)},children:[m,s.children]}):(0,A.jsx)(nX.A,{menu:d,children:(0,A.jsxs)(e3.Ay,{"aria-label":s["aria-label"],icon:m,type:c,danger:s.danger,style:null==s?void 0:s.style,children:[s.children," ",(0,A.jsx)(xm.A,{})]})}):(0,A.jsx)(e3.Ay,{...s,"aria-label":s["aria-label"],type:c,disabled:h.disabled,danger:s.danger,icon:m,onClick:e=>{null==u||u(p)},style:{...null==s?void 0:s.style,display:!f&&(null==h||null==(t=h.data)?void 0:t.hidden)&&"none",opacity:f&&(null==h||null==(n=h.data)?void 0:n.hidden)&&.1},children:s.children})}let Cl=(0,es.forwardRef)((e,t)=>{let[n,o]=(0,es.useState)(!1),l=tJ(),r=(0,ec.useFieldSchema)(),i=(0,ec.useField)(),[a,s]=(0,es.useState)(l.name),[c,d]=(0,es.useState)(l.dataSource),u=(null==r?void 0:r["x-linkage-rules"])||[],p=m3(),m=co(),h=lN(),{styles:x}=b9(),f=lT({currentForm:{values:p}});(0,es.useEffect)(()=>{i.stateOfLinkageRules={},u.filter(e=>!e.disabled).forEach(e=>{var t;null==(t=e.actions)||t.forEach(t=>{ds({operator:t.operator,field:i,condition:e.condition,variables:h,localVariables:f})})})},[i,u,f,h]);let v=(0,es.createRef)(),g=(0,b4.composeRef)(t,v);return(0,A.jsx)("div",{className:x.actionDesignerCss,ref:g,children:(0,A.jsxs)(ct,{value:{...m,visible:n,setVisible:o},children:[(0,A.jsx)(Cn,{...e,onClick:e=>{o(!0),s(e.name),d(e.dataSource)}}),(0,A.jsx)(hH,{name:a,dataSource:c,children:(0,A.jsx)(ec.RecursionField,{schema:r,basePath:i.address,onlyRenderProperties:!0})})]})})});class Cr extends eR{async load(){this.app.addComponents({...C,...b,DestroyActionInitializer:yL,CreateFormBlockInitializer:y5,FormBlockInitializer:be,RecordFormBlockInitializer:bl,TableBlockInitializer:bC,TableSelectorInitializer:b_,RecordReadPrettyFormBlockInitializer:vK,DetailsBlockInitializer:vV,ListBlockInitializer:vJ,GridCardBlockInitializer:vH,FilterFormBlockInitializer:bV,FilterTreeBlockInitializer:bG,FilterCollapseBlockInitializer:bO,MarkdownBlockInitializer:b$,MarkdownFormItemInitializer:bU,TableCollectionFieldInitializer:bY,CollectionFieldInitializer:bH,CreateActionInitializer:yR,CustomizeAddRecordActionInitializer:y_,CreateChildInitializer:yD,ViewActionInitializer:y0,UpdateActionInitializer:yZ,PopupActionInitializer:yJ,SaveRecordActionInitializer:yW,UpdateRecordActionInitializer:yX,CreateSubmitActionInitializer:yH,UpdateSubmitActionInitializer:yY,BulkDestroyActionInitializer:yz,ExpandableActionInitializer:yK,DisassociateActionInitializer:yG,FilterActionInitializer:y$,RefreshActionInitializer:yU,FilterFormItemCustom:yP,AssociateActionInitializer:yB,AssociateActionProvider:yV}),this.app.schemaInitializerManager.add(b1),this.app.schemaInitializerManager.add(bb),this.app.schemaInitializerManager.add(bq),this.app.schemaInitializerManager.add(by),this.app.schemaInitializerManager.add(bp),this.app.schemaInitializerManager.add(bu),this.app.schemaInitializerManager.add(y1),this.app.schemaInitializerManager.add(y3),this.app.schemaInitializerManager.add(y6),this.app.schemaInitializerManager.add(yq),this.app.schemaInitializerManager.add(yO),this.app.schemaInitializerManager.add(vI),this.app.schemaInitializerManager.add(bB),this.app.schemaInitializerManager.add(bL),this.app.schemaInitializerManager.add(bi),this.app.schemaInitializerManager.add(bm),this.app.schemaInitializerManager.add(bz),this.app.schemaInitializerManager.add(bh),this.app.schemaInitializerManager.add(bx),this.app.schemaInitializerManager.add(bf),this.app.schemaInitializerManager.add(bv),this.app.schemaInitializerManager.add(v0),this.app.schemaInitializerManager.add(yQ),this.app.schemaInitializerManager.add(v1),this.app.schemaInitializerManager.add(bW),this.app.schemaInitializerManager.add(v5),this.app.schemaInitializerManager.add(v8),this.app.schemaInitializerManager.add(v7),this.app.schemaInitializerManager.add(b0),this.app.schemaInitializerManager.add(v4)}}function Ci(){let e=(0,ec.useFieldSchema)(),t=(0,ec.useField)(),n=["Radio.Group","Checkbox.Group"],o=e["x-component"],l=yk().options.map(e=>n.includes(o)?n.includes(e.value)?e:null:n.includes(e.value)||"DatePicker"===e.value||"AssociationCascader"===e.value?null:e).filter(Boolean),{dn:r}=eY();return(0,A.jsx)(aW,{title:"Field Component",options:l,value:e["x-component"],onChange:n=>{t.component=n,e["x-component"]=n,t.componentProps=e["x-component-props"],r.emit("patch",{schema:{"x-uid":e["x-uid"],"x-component":e["x-component"]}}),r.refresh()}},"component-field")}var Ca=n(40568);let Cs=()=>{let{t:e}=(0,eT.useTranslation)(),{dn:t}=eY(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)();o.collectionName;let l=o.title;return(0,A.jsx)(aQ,{title:e("Set default value"),schema:{type:"void",title:e("Set default value"),properties:{default:{title:l,"x-decorator":"FormItem","x-component":Cc,"x-component-props":{fieldSchema:o}}}},onSubmit:e=>{let{default:{value:l=null}}=e;n.setValue(l),o.default=l,o["x-component-props"]={...o["x-component-props"],defaultValue:l},t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"],default:o.default}}),t.refresh()}},"set field default value")},Cc=e=>{var t;let{value:n,onChange:o,fieldSchema:l}=e,{currentUserSettings:r}=rF({collectionField:{uiSchema:l},uiSchema:l}),{datetimeSettings:i}=la({operator:null==(t=l["x-component-props"])?void 0:t["filter-operator"],schema:l,noDisabled:!0}),a=(0,es.useMemo)(()=>[r,i].filter(Boolean),[i,r]),s={...l,"x-component":l["x-component"]||"Input","x-decorator":"",title:"",name:"value"},c=l["x-component-props"]||{},d=(0,Ca.A)(o);return(0,es.useEffect)(()=>{l.default&&d({value:l.default})},[l.default,d]),(0,A.jsx)(P4,{scope:a,children:(0,A.jsx)(rW,{...c,renderSchemaComponent:()=>(0,A.jsx)(al,{schema:s}),fieldNames:{},value:null==n?void 0:n.value,scope:a,onChange:e=>{o({value:e})},shouldChange:rH({})})})},Cd=["$user","$date","$nDate","$nRole"],Cu=function(){let{exclude:e=Cd}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=lT(),n=lN(),o=(0,es.useCallback)(e=>{let o=null==n?void 0:n.getVariable(e);return o||(o=t.find(t=>t.name===e)),o},[t,n]);return{parseFilter:(0,es.useCallback)(async o=>{let l=(0,eh.flatten)(o,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue:o=>!oY(o)||e.includes(lp(o))?o:null==n?void 0:n.parseVariable(o,t)});return await Promise.all(Object.keys(l).map(async e=>(l[e]=await l[e],void 0===l[e]&&(l[e]=null),l[e]))),(0,eh.unflatten)(l)},[e,t,null==n?void 0:n.parseVariable]),findVariable:o}},Cp=new or({name:"actionSettings:addChild",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"openMode",Component:c6,componentProps:{openMode:!0,openSize:!0}},{name:"enableChildCollections",Component:a3,useVisible(){let{name:e}=tJ(),{getChildrenCollections:t}=sO();return(0,es.useMemo)(()=>t(e).length>0,[t,e])},useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"delete",type:"remove"}]}),Cm=new or({name:"actionSettings:addNew",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"openMode",Component:c6,componentProps:{openMode:!0,openSize:!0}},{name:"enableChildCollections",Component:a3,useComponentProps(){let{name:e}=tJ();return{collectionName:e}},useVisible(){let{name:e}=tJ(),{getChildrenCollections:t}=sO();return(0,es.useMemo)(()=>t(e).length>0,[t,e])}},{name:"delete",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Ch=new or({name:"actionSettings:addRecord",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"openMode",Component:c6,componentProps:{openMode:!0,openSize:!0}},{name:"delete",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Cx=new or({name:"actionSettings:associate",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"openMode",Component:c6,componentProps:{openMode:!0,openSize:!0}},{name:"enableChildCollections",Component:a3,useComponentProps(){let{name:e}=tJ();return{collectionName:e}},useVisible(){let{name:e}=tJ(),{getChildrenCollections:t}=sO();return(0,es.useMemo)(()=>t(e).length>0,[t,e])}},{name:"delete",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Cf=new or({name:"actionSettings:bulkDelete",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"secondConFirm",Component:dC},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Cv=new or({name:"actionSettings:delete",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"secondConFirm",Component:dC},{name:"workflowConfig",Component:dv,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.triggerWorkflows)}},{name:"delete",type:"remove"}]}),Cg=new or({name:"actionSettings:disassociate",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"secondConFirm",Component:dC},{name:"delete",type:"remove"}]}),Cy=new or({name:"actionSettings:expendable",items:[{name:"editButton",Component:function(){var e,t;let n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY(),{t:r}=(0,eT.useTranslation)(),{titleExpand:i,titleCollapse:a,iconExpand:s,iconCollapse:c}=o["x-component-props"]||{};return(0,A.jsx)(aQ,{title:r("Edit button"),schema:{type:"object",title:r("Edit button"),properties:{titleExpand:{"x-decorator":"FormItem","x-component":"Input",title:"".concat(r("Button title")," - ").concat(r("Expand all")),default:i},titleCollapse:{"x-decorator":"FormItem","x-component":"Input",title:"".concat(r("Button title")," - ").concat(r("Collapse all")),default:a},iconExpand:{"x-decorator":"FormItem","x-component":"IconPicker",title:"".concat(r("Button icon")," - ").concat(r("Expand all")),default:s},iconCollapse:{"x-decorator":"FormItem","x-component":"IconPicker",title:"".concat(r("Button icon")," - ").concat(r("Collapse all")),default:c},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:r("Button background color"),default:(null==o||null==(e=o["x-component-props"])?void 0:e.danger)?"danger":(null==o||null==(t=o["x-component-props"])?void 0:t.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}]}}},onSubmit:e=>{let{titleExpand:t,titleCollapse:i,iconExpand:a,iconCollapse:s,type:c}=e;o.title=r("Expand/Collapse"),n.title=r("Expand/Collapse"),n.componentProps.icon=a,n.componentProps.danger="danger"===c,n.componentProps.type=c,o["x-component-props"]={...o["x-component-props"]||{},titleExpand:t,titleCollapse:i,iconExpand:a,iconCollapse:s,type:c,danger:"danger"===c},l.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"],title:o.title}}),l.refresh()}})},useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Cb=new or({name:"actionSettings:filter",items:[{name:"FilterableFields",Component:s5},{name:"divider",type:"divider"},{name:"EditButton",type:"modal",useComponentProps(){var e;let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o}=eY(),{t:l}=(0,eT.useTranslation)();return{title:l("Edit button"),schema:{type:"object",title:l("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:l("Button title"),default:n.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:l("Button icon"),default:null==n||null==(e=n["x-component-props"])?void 0:e.icon,"x-component-props":{}}}},onSubmit:e=>{let{title:l,icon:r}=e;n.title=l,t.title=l,t.componentProps.icon=r,n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].icon=r,o.emit("patch",{schema:{"x-uid":n["x-uid"],title:l,"x-component-props":{...n["x-component-props"]}}}),o.refresh()}}}},{name:"divider2",type:"divider"},{name:"delete",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:e=>"Space"===e["x-component"]||"ActionBar"===e["x-component"]}}]}),CC=new or({name:"actionSettings:refresh",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"secondConFirm",Component:dC},{name:"delete",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),CS=new or({name:"actionSettings:saveRecord",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"secondConfirmation",Component:dC},{name:"assignFieldValues",Component:dd},{name:"skipRequiredValidation",Component:dp},{name:"afterSuccessfulSubmission",Component:dh,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.onSuccess)}},{name:"bindWorkflow",Component:dv},{name:"delete",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Cw=new or({name:"actionSettings:updateSubmit",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"secondConfirmation",Component:dC},{name:"afterSuccessfulSubmission",Component:dh},{name:"workflowConfig",Component:dv,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.triggerWorkflows)}},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),CF=new or({name:"actionSettings:submit",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"secondConfirmation",Component:dC},{name:"workflowConfig",Component:dv,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.triggerWorkflows)}},{name:"saveMode",Component:c0,useVisible(){var e;let t=(0,ec.useFieldSchema)();return"submit"===t["x-action"]&&(null==(e=t.parent)?void 0:e["x-initializer"])==="createForm:configureActions"}},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Cj=new or({name:"actionSettings:updateRecord",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"secondConFirm",Component:dC},{name:"assignFieldValues",Component:dd},{name:"afterSuccessfulSubmission",Component:dh},{name:"workflowConfig",Component:dv,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.triggerWorkflows)}},{name:"delete",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),CA=new or({name:"actionSettings:popup",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"openMode",Component:c6,componentProps:{openMode:!0,openSize:!0}},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Ck=new or({name:"actionSettings:edit",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"openMode",Component:c6,componentProps:{openMode:!0,openSize:!0}},{name:"delete",type:"remove"}]}),CI=new or({name:"actionSettings:view",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"openMode",Component:c6,componentProps:{openMode:!0,openSize:!0}},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),CP=[{name:"title",Component:aZ},{name:"dataScope",Component:il,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)(),{form:l}=Tp(),r=(0,ec.useField)(),{service:i}=oF(),{dn:a}=eY(),s=tZ();return{collectionName:n,defaultFilter:(null==o||null==(t=o["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:l,onSubmit:e=>{let{filter:t}=e;t=d5(t);let n=r.decoratorProps.params||{};if(n.filter=t,r.decoratorProps.params=n,o["x-decorator-props"].params=n,"auto"===s){var l;i.run({...null==(l=i.params)?void 0:l[0],filter:t})}a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"sortingRules",type:"modal",useComponentProps(){var e,t;let{name:n}=tJ(),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),{service:i}=oF(),{dn:a}=eY(),s=hd(n),c=(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],d=null==c?void 0:c.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return{title:o("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:o("Set default sorting rules"),properties:{sort:{type:"array",default:d,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:s,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:o("ASC"),value:"asc"},{label:o("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:o("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit(e){var t;let{sort:n}=e,o=n.map(e=>"desc"===e.direction?"-".concat(e.field):e.field),s=r.decoratorProps.params||{};s.sort=o,r.decoratorProps.params=s,l["x-decorator-props"].params=s,a.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}}),i.run({...null==(t=i.params)?void 0:t[0],sort:o})}}}},{name:"setDataLoadingMode",Component:t0},{name:"template",Component:aB,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"Details",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}],CT=new or({name:"blockSettings:multiDataDetails",items:CP}),CN=new or({name:"blockSettings:detailsWithPagination",items:CP}),CM=[{name:"title",Component:aZ},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{insertAdjacentPosition:"beforeEnd",componentName:"ReadPrettyFormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}],CD=new or({name:"blockSettings:singleDataDetails",items:CM}),CR=new or({name:"blockSettings:details",items:CM}),Cq=[5,6,10,12,24,60,96,120],C_=["xs","md","lg","xxl"],CO={xs:"Phone device",md:"Tablet device",lg:"Desktop device",xxl:"Large screen device"},CB={xs:"< 768",md:"≥ 768",lg:"≥ 992",xxl:"≥ 1600"},CE={xs:1,md:2,lg:3,xxl:4},CV=[1,2,3,4,6,8,12,24].reduce((e,t)=>(e[t]=t,e),{}),Cz=new or({name:"blockSettings:gridCard",items:[{name:"SetTheCountOfColumnsDisplayedInARow",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useFieldSchema)(),n=(0,ec.useField)(),{dn:o}=eY(),l=n.decoratorProps.columnCount||CE,r=(0,es.useMemo)(()=>({"x-component":"Slider","x-decorator":"FormItem","x-component-props":{min:1,max:24,marks:CV,tooltip:{formatter:t=>"".concat(t).concat(e("Column"))},step:null}}),[e]),i=(0,es.useMemo)(()=>C_.reduce((t,n)=>(t[n]={...r,title:e(CO[n]),description:"".concat(e("Screen size")," ").concat(CB[n]," ").concat(e("pixels"))},t),{}),[r,e]);return{title:e("Set the count of columns displayed in a row"),initialValues:l,schema:{type:"object",title:e("Set the count of columns displayed in a row"),properties:i},onSubmit:e=>{eu().set(t,"x-decorator-props.columnCount",e),n.decoratorProps.columnCount=e,o.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":t["x-decorator-props"]}})}}}},{name:"SetTheDataScope",Component:il,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)(),{form:l}=Tp(),r=(0,ec.useField)(),{dn:i}=eY();return{collectionName:n,defaultFilter:(null==o||null==(t=o["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:l,onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(o,"x-decorator-props.params.filter",t),r.decoratorProps.params={...o["x-decorator-props"].params},i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"SetDefaultSortingRules",type:"modal",useComponentProps(){var e,t;let{name:n}=tJ(),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),{dn:i}=eY(),a=hd(n),s=(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],c=null==s?void 0:s.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return{title:o("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:o("Set default sorting rules"),properties:{sort:{type:"array",default:c,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:a,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:o("ASC"),value:"asc"},{label:o("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:o("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{let{sort:t}=e,n=t.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);eu().set(l,"x-decorator-props.params.sort",n),r.decoratorProps.params={...l["x-decorator-props"].params},i.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}})}}}},{name:"setDataLoadingMode",Component:t0},{name:"RecordsPerPage",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),l=(0,ec.useField)(),{dn:r}=eY();return{title:n("Records per page"),value:(null==(t=l.decoratorProps)||null==(e=t.params)?void 0:e.pageSize)||20,options:Cq.map(e=>({value:e})),onChange:e=>{eu().set(o,"x-decorator-props.params.pageSize",e),l.decoratorProps.params={...o["x-decorator-props"].params,page:1},r.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"LayoutDirection",type:"select",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useFieldSchema)(),o=(0,ec.useField)(),{dn:l}=eY();return{title:t("Layout Direction"),value:(null==(e=o.decoratorProps)?void 0:e.layoutDirection)||"column",options:[{value:"row"},{value:"column"}],onChange:e=>{eu().set(n,"x-decorator-props.layoutDirection",e),eu().set(o,"decoratorProps.layoutDirection",e),l.emit("patch",{schema:{"x-uid":n["x-uid"],"x-decorator-props":n["x-decorator-props"]}})}}}},{name:"setLinkable",type:"switch",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),l=(0,ec.useField)(),{dn:r}=eY();return{title:n("Set Linkable"),checked:null!=(t=null==(e=o["x-decorator-props"])?void 0:e.isLinkable)&&t,onChange:e=>{eu().set(o,"x-decorator-props.isLinkable",e),l.decoratorProps.isLinkable=e,r.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}},useVisible(){var e,t;return null==(t=(0,ec.useFieldSchema)()["x-decorator-props"])||null==(e=t.linkConfig)?void 0:e.link}},{name:"setInfiniteScroll",type:"switch",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useFieldSchema)(),o=(0,ec.useField)(),{dn:l}=eY();return{title:t("Set InfiniteScroll"),checked:null==(e=n["x-decorator-props"])?void 0:e.needInfiniteScroll,onChange:e=>{eu().set(n,"x-decorator-props.needInfiniteScroll",e),o.decoratorProps.needInfiniteScroll=e,l.emit("patch",{schema:{"x-uid":n["x-uid"],"x-decorator-props":n["x-decorator-props"]}})}}}},{name:"setLinkConfig",type:"modal",useComponentProps(){var e,t,n,o,l;let{t:r}=(0,eT.useTranslation)(),i=tS(),a=(0,ec.useFieldSchema)(),s=hd((null==(e=a["x-decorator-props"])?void 0:e.collection)||i.name),{dn:c}=eY(),d=ts();return{title:r("Set LinkConfig"),schema:{type:"object",title:"Set LinkConfig",properties:{link:{type:"string",title:r("Link"),required:!0,"x-decorator":"FormItem","x-component":"Input",default:(null==(n=a["x-decorator-props"])||null==(t=n.linkConfig)?void 0:t.link)||""},fields:{type:"object",title:r("Field"),"x-decorator":"FormItem","x-component":"Select",enum:s,default:(null==(l=a["x-decorator-props"])||null==(o=l.linkConfig)?void 0:o.fields)||null,"x-component-props":{multiple:!0}}}},onSubmit:e=>{var t;a["x-decorator-props"].linkConfig={...null==(t=a["x-decorator-props"])?void 0:t.linkConfig,link:e.link,fields:e.fields,linkDataSource:d.key,linkCollection:i.name},c.emit("patch",{schema:{"x-uid":a["x-uid"],"x-decorator-props":a["x-decorator-props"]}})}}}},{name:"ConvertReferenceToDuplicate",Component:aB,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"GridCard",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:()=>({removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}]}),CL=new or({name:"blockSettings:list",items:[{name:"EditBlockTitle",Component:aZ},{name:"SetTheDataScope",Component:il,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)(),{form:l}=Tp(),r=(0,ec.useField)(),{dn:i}=eY();return{collectionName:n,defaultFilter:(null==o||null==(t=o["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:l,onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(o,"x-decorator-props.params.filter",t),r.decoratorProps.params={...o["x-decorator-props"].params,page:1},i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"SetDefaultSortingRules",type:"modal",useComponentProps(){var e,t;let{name:n}=tJ(),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),{dn:i}=eY(),a=hd(n),s=(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],c=null==s?void 0:s.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return{title:o("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:o("Set default sorting rules"),properties:{sort:{type:"array",default:c,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:a,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:o("ASC"),value:"asc"},{label:o("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:o("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{let{sort:t}=e,n=t.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);eu().set(l,"x-decorator-props.params.sort",n),r.decoratorProps.params={...l["x-decorator-props"].params,page:1},i.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}})}}}},{name:"setDataLoadingMode",Component:t0},{name:"RecordsPerPage",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),l=(0,ec.useField)(),{dn:r}=eY();return{title:n("Records per page"),value:(null==(t=l.decoratorProps)||null==(e=t.params)?void 0:e.pageSize)||20,options:[{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"80",value:80},{label:"100",value:100}],onChange:e=>{eu().set(o,"x-decorator-props.params.pageSize",e),l.decoratorProps.params={...o["x-decorator-props"].params,page:1},r.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConvertReferenceToDuplicate",Component:aB,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"List",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:()=>({removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}]}),CG=new or({name:"blockSettings:tableSelector",items:[{name:"SetTheDataScope",Component:il,useComponentProps:()=>{var e,t;let{name:n}=tJ(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{form:r}=Tp(),{service:i,extraFilter:a}=l2(),{dn:s}=eY(),c=tZ(),d=(0,es.useCallback)(e=>{let{filter:t}=e;t=d5(t);let n=o.decoratorProps.params||{};n.filter=t,o.decoratorProps.params=n,l["x-decorator-props"].params=n;let r=(0,ed.cloneDeep)(t);if(a&&(r=r?{$and:[a,r]}:a),"auto"===c){var d;i.run({...null==(d=i.params)?void 0:d[0],filter:r,page:1})}s.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}})},[o.decoratorProps,l,a,c,s,i]);return{collectionName:n,defaultFilter:(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:r,onSubmit:d}}},{name:"treeTable",type:"switch",useComponentProps:()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{service:n}=l2(),{t:o}=(0,eT.useTranslation)(),{dn:l}=eY();return{title:o("Tree table"),defaultChecked:!0,checked:!1!==e.decoratorProps.treeTable,onChange:o=>{var r;e.form.clearFormGraph("".concat(e.address,".*")),e.decoratorProps.treeTable=o,t["x-decorator-props"].treeTable=o;let i={...null==(r=n.params)?void 0:r[0],tree:!!o||null};l.emit("patch",{schema:t}),l.refresh(),n.run(i)}}},useVisible:()=>{let{getCollectionJoinField:e}=sO(),t=(0,ec.useFieldSchema)(),n=tJ(),o=l0(t,"CollectionField"),l=e(null==o?void 0:o["x-collection-field"]);return(null==n?void 0:n.tree)&&(null==l?void 0:l.target)===(null==l?void 0:l.collectionName)}},{name:"SetDefaultSortingRules",type:"modal",useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),r=hd(n),{service:i}=l2(),{t:a}=(0,eT.useTranslation)(),{dn:s}=eY(),c=(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],d=null==c?void 0:c.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return{title:a("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:a("Set default sorting rules"),properties:{sort:{type:"array",default:d,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:r,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:a("ASC"),value:"asc"},{label:a("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:a("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{var t;let{sort:n}=e,r=n.map(e=>"desc"===e.direction?"-".concat(e.field):e.field),a=o.decoratorProps.params||{};a.sort=r,o.decoratorProps.params=a,l["x-decorator-props"].params=a,s.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}}),i.run({...null==(t=i.params)?void 0:t[0],sort:r})}}},useVisible(){let{dragSort:e}=(0,ec.useField)().decoratorProps;return!e}},{name:"setDataLoadingMode",Component:t0},{name:"RecordsPerPage",type:"select",useComponentProps(){var e,t;let n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{service:l}=l2(),{t:r}=(0,eT.useTranslation)(),{dn:i}=eY();return{title:r("Records per page"),value:(null==(t=n.decoratorProps)||null==(e=t.params)?void 0:e.pageSize)||20,options:[{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:e=>{var t;let r=n.decoratorProps.params||{};r.pageSize=e,n.decoratorProps.params=r,o["x-decorator-props"].params=r,l.run({...null==(t=l.params)?void 0:t[0],pageSize:e,page:1}),i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:()=>({removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}]}),CK=new or({name:"blockSettings:filterCollapse",items:[{name:"EditBlockTitle",Component:aZ},{name:"ConvertReferenceToDuplicate",Component:aB,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"FilterCollapse",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"ConnectDataBlocks",Component:aU,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{type:pj.COLLAPSE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:()=>({removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}]}),C$=new or({name:"fieldSettings:FilterCollapseItem",items:[{name:"decoratorOptions",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Generic properties")}},useChildren:()=>[{name:"customTitle",type:"modal",useComponentProps(){var e;let t=(0,ec.useFieldSchema)(),{t:n}=(0,eT.useTranslation)(),{getCollectionJoinField:o}=sO(),{getField:l}=tJ(),r=l(t.name)||o(t["x-collection-field"]),{dn:i}=eY();return{title:n("Custom title"),schema:{type:"object",title:n("Custom title"),properties:{title:{default:null==t?void 0:t.title,description:"".concat(n("Original title: ")).concat((null==r||null==(e=r.uiSchema)?void 0:e.title)||(null==t?void 0:t.title)),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:e=>{let{title:n}=e;n&&(t.title=n,i.emit("patch",{schema:{"x-uid":t["x-uid"],title:t.title}})),i.refresh()}}}},{name:"defaultCollapse",type:"switch",useComponentProps(){let e=(0,ec.useFieldSchema)(),t=(0,ec.useField)(),{t:n}=(0,eT.useTranslation)(),{dn:o}=eY();return{title:n("Default collapse"),checked:t.componentProps.defaultCollapse,onChange:n=>{t.componentProps.defaultCollapse=n,eu().set(e,"x-component-props.defaultCollapse",n),o.emit("patch",{schema:{"x-uid":e["x-uid"],"x-component-props":e["x-component-props"]}}),o.refresh()}}}},{name:"setTheDataScope",Component:il,useComponentProps(){var e,t;let n=(0,ec.useFieldSchema)(),{form:o}=Tp(),l=(0,ec.useField)(),{getCollectionJoinField:r}=sO(),{getField:i}=tJ(),a=i(n.name)||r(n["x-collection-field"]),{dn:s}=eY();return{collectionName:null==a?void 0:a.target,defaultFilter:(null==n||null==(t=n["x-component-props"])||null==(e=t.params)?void 0:e.filter)||{},form:o,onSubmit:e=>{var t;let{filter:o}=e;eu().set(l.componentProps,"params",{...null==(t=l.componentProps)?void 0:t.params,filter:o}),n["x-component-props"].params=l.componentProps.params,s.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":n["x-component-props"]}})}}}},{name:"setDefaultSortingRules",Component:a0,useComponentProps(){let e=(0,ec.useFieldSchema)(),{getCollectionJoinField:t}=sO(),{getField:n}=tJ(),o=n(e.name)||t(e["x-collection-field"]);return{name:null==o?void 0:o.target}}},{name:"titleField",type:"select",useComponentProps(){var e,t;let n=(0,ec.useFieldSchema)(),{t:o}=(0,eT.useTranslation)(),{getCollectionJoinField:l}=sO(),{getField:r}=tJ(),i=r(n.name)||l(n["x-collection-field"]),{getCollectionFields:a}=sO(),s=eB(),{dn:c}=eY(),d=((null==i?void 0:i.target)?a(null==i?void 0:i.target):[]).filter(e=>!(null==e?void 0:e.target)&&"boolean"!==e.type).map(e=>{var t;return{value:null==e?void 0:e.name,label:s(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return{key:"title-field",title:o("Title field"),options:d,value:null==(t=n["x-component-props"])||null==(e=t.fieldNames)?void 0:e.label,onChange:e=>{var t,o,l;let r={"x-uid":n["x-uid"]},a={...null==i||null==(o=i.uiSchema)||null==(t=o["x-component-props"])?void 0:t.fieldNames,...null==(l=n["x-component-props"])?void 0:l.fieldNames,label:e};n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].fieldNames=a,r["x-component-props"]=n["x-component-props"],c.emit("patch",{schema:r}),c.refresh()}}}}]},{name:"divider",type:"divider"},{name:"delete",type:"remove",sort:100,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{removeParentsIfNoChildren:!0,confirm:{title:e("Delete field")},breakRemoveOn:{"x-component":"Grid"}}}}]}),CU=new or({name:"blockSettings:filterForm",items:[{name:"title",Component:aZ},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"FilterFormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"connectDataBlocks",Component:aU,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{type:pj.FORM,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),CW=new or({name:"fieldSettings:FilterFormItem",items:[{name:"decoratorOptions",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Generic properties")}},useChildren:()=>[{name:"editFieldTitle",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{getCollectionJoinField:r}=sO(),{getField:i}=tJ(),a=i(l.name)||r(l["x-collection-field"]);return{title:t("Edit field title"),schema:{type:"object",title:t("Edit field title"),properties:{title:{title:t("Field title"),default:null==o?void 0:o.title,description:"".concat(t("Original field title: ")).concat(null==a||null==(e=a.uiSchema)?void 0:e.title),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit(e){let{title:t}=e;t&&(o.title=t,l.title=t,n.emit("patch",{schema:{"x-uid":l["x-uid"],title:l.title}})),n.refresh()}}}},{name:"displayTitle",type:"switch",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),{dn:o}=eY(),l=(0,ec.useField)(),r=(0,ec.useFieldSchema)();return{title:n("Display title"),checked:null==(t=null==(e=r["x-decorator-props"])?void 0:e.showTitle)||t,onChange(e){r["x-decorator-props"]=r["x-decorator-props"]||{},r["x-decorator-props"].showTitle=e,l.decoratorProps.showTitle=e,o.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":{...r["x-decorator-props"],showTitle:e}}}),o.refresh()}}}},{name:"editDescription",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{dn:t}=eY(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)();return{title:e("Edit description"),schema:{type:"object",title:e("Edit description"),properties:{description:{default:null==n?void 0:n.description,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit(e){let{description:l}=e;n.description=l,o.description=l,t.emit("patch",{schema:{"x-uid":o["x-uid"],description:o.description}}),t.refresh()}}}},{name:"editTooltip",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{dn:n}=eY(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)();return{title:t("Edit tooltip"),schema:{type:"object",title:t("Edit tooltip"),properties:{tooltip:{default:null==l||null==(e=l["x-decorator-props"])?void 0:e.tooltip,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}}}},onSubmit(e){let{tooltip:t}=e;o.decoratorProps.tooltip=t,l["x-decorator-props"]=l["x-decorator-props"]||{},l["x-decorator-props"].tooltip=t,n.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}}),n.refresh()}}}},{name:"setValidationRules",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o,refresh:l}=eY(),r=up(),{getCollectionJoinField:i}=sO(),{getField:a}=tJ(),s=a(n.name)||i(n["x-collection-field"]);return{title:e("Set validation rules"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:e("Set validation rules"),properties:{rules:{type:"array",default:null==n?void 0:n["x-validator"],"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},maxItems:3,items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{header:'{{ t("Validation rule") }}'},properties:{index:{type:"void","x-component":"ArrayCollapse.Index"},layout:{type:"void","x-component":"FormLayout","x-component-props":{labelStyle:{marginTop:"6px"},labelCol:8,wrapperCol:16},properties:{...r,message:{type:"string",title:'{{ t("Error message") }}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:2,maxRows:2}}}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"}}},properties:{add:{type:"void",title:'{{ t("Add validation rule") }}',"x-component":"ArrayCollapse.Addition","x-reactions":{dependencies:["rules"],fulfill:{state:{disabled:"{{$deps[0].length >= 3}}"}}}}}}}},onSubmit(e){var r;let i=[];for(let t of e.rules)i.push(eu().pickBy(t,eu().identity));let a={"x-uid":n["x-uid"]};if(["percent"].includes(null==s?void 0:s.interface))for(let e of i)(e.maxValue||e.minValue)&&(e.percentMode=!0),e.percentFormat&&(e.percentFormats=!0);t.validator=eu().concat([],(null==s||null==(r=s.uiSchema)?void 0:r["x-validator"])||[],i),n["x-validator"]=i,a["x-validator"]=i,o.emit("patch",{schema:a}),l()}}},useVisible:()=>!!up()},{name:"operator",Component:pw},{name:"editDefaultValue",Component:sq}]},{name:"componentOptions",type:"itemGroup",hideIfNoChildren:!0,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{title:e("Specific properties")}},useChildren(){let e=os(),t=ux(),n=e.schemaSettingsManager.get("fieldSettings:component:".concat(t));return(null==n?void 0:n.items)||[]}},{name:"divider",type:"divider"},{name:"delete",type:"remove",sort:100,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{removeParentsIfNoChildren:!0,confirm:{title:e("Delete field")},breakRemoveOn:{"x-component":"Grid"}}}}]}),CH=new or({name:"blockSettings:filterTree",items:[{name:"title",Component:aZ},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tS(),o=(0,ec.useFieldSchema)();return{componentName:"FilterFormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tS();return{collectionName:e}}},{name:"connectDataBlocks",Component:aU,useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{type:pj.TREE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),CY=new or({name:"blockSettings:markdown",items:[{name:"EditMarkdown",type:"item",useComponentProps(){let e=(0,ec.useField)(),{t}=(0,eT.useTranslation)();return{title:t("Edit markdown"),onClick:()=>{e.editable=!0}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:()=>({removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}]}),CX=new or({name:"fieldSettings:component:Cascader",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),{fieldSchema:n,collectionField:o}=sb(),l=(0,ec.useFieldSchema)(),r=n||l,i=SN({fieldSchema:n,collectionField:o}),a=un(),s=ux(),{dn:c}=eY();return{title:e("Field component"),options:i,value:s,onChange(e){let n={"x-uid":r["x-uid"]};if(r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].mode=e,n["x-component-props"]=r["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(r)&&a){var o,l;n.default=null,r.default=null,null==t||null==(o=t.setInitialValue)||o.call(t,null),null==t||null==(l=t.setValue)||l.call(t,null)}c.emit("patch",{schema:n}),c.refresh()}}},useVisible:ui},{name:"setTheDataScope",Component:il,useComponentProps(){var e,t,n;let{getCollectionJoinField:o,getAllCollectionsInheritChain:l}=sO(),{getField:r}=tJ(),{form:i}=Tp(),a=m3(),s=(0,ec.useField)(),{fieldSchema:c,collectionField:d}=sb(),u=(0,ec.useFieldSchema)(),p=c||u,m=d||r(p.name)||o(p["x-collection-field"]),h=lN(),x=lT(),{dn:f}=eY();return{collectionName:null==m?void 0:m.target,defaultFilter:(null==p||null==(n=p["x-component-props"])||null==(t=n.service)||null==(e=t.params)?void 0:e.filter)||{},form:i,dynamicComponent:e=>(0,A.jsx)(rW,{...e,form:i,collectionField:e.collectionField,record:a,shouldChange:rH({collectionField:e.collectionField,variables:h,localVariables:x,getAllCollectionsInheritChain:l})}),onSubmit:e=>{var t,n,o;let{filter:l}=e;l=d5(l),eu().set(s.componentProps,"service.params.filter",l);let r=null==(t=p["x-component-props"])?void 0:t.service;r?r.params.filter=l:p["x-component-props"].service={params:{filter:{...l}}};let i=p["x-component-props"],a=null==(o=s.path)?void 0:o.splice((null==(n=s.path)?void 0:n.length)-1,1);s.form.query("".concat(a.concat("*."+p.name))).forEach(e=>{e.componentProps=i}),f.emit("patch",{schema:{"x-uid":p["x-uid"],"x-component-props":i}}),f.refresh()}}},useVisible:()=>!ul()},{name:"setDefaultSortingRules",Component:function(e){var t,n,o,l;let r=(0,ec.useField)(),{dn:i}=eY(),{t:a}=(0,eT.useTranslation)(),s=(0,ec.useFieldSchema)(),{getField:c}=tJ(),{getCollectionJoinField:d}=sO(),u=null!=(l=null==e?void 0:e.fieldSchema)?l:s,p=c(u.name)||d(u["x-collection-field"]),m=hd(null==p?void 0:p.target),h=(null==(o=u["x-component-props"])||null==(n=o.service)||null==(t=n.params)?void 0:t.sort)||[],x=null==h?void 0:h.map(e=>(null==e?void 0:e.startsWith("-"))?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return(0,A.jsx)(aQ,{title:a("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:a("Set default sorting rules"),properties:{sort:{type:"array",default:x,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:m,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:a("ASC"),value:"asc"},{label:a("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:a("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:t=>{var n,o,l,a,s,c,d,p;let{sort:m}=t,h=m.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);eu().set(r.componentProps,"service.params.sort",h),null==e||null==(n=e.onSubmitCallBack)||n.call(e,h);let x=null==(o=u["x-component-props"])?void 0:o.service;x?x.params.sort=null==(c=r.componentProps)||null==(s=c.service.params)?void 0:s.sort:u["x-component-props"].service={params:{sort:null==(p=r.componentProps)||null==(d=p.service.params)?void 0:d.sort}};let f=u["x-component-props"],v=null==(a=r.path)?void 0:a.splice((null==(l=r.path)?void 0:l.length)-1,1);r.form.query("".concat(v.concat("*."+u.name))).forEach(e=>{e.componentProps=f}),i.emit("patch",{schema:{"x-uid":u["x-uid"],"x-component-props":f}})}})},useComponentProps(){let{fieldSchema:e}=sb();return{fieldSchema:e}},useVisible:()=>!ul()},{name:"titleField",type:"select",useComponentProps(){var e,t,n,o;let{t:l}=(0,eT.useTranslation)(),r=(0,ec.useField)(),{dn:i}=eY(),a=uh(),{uiSchema:s,fieldSchema:c,collectionField:d}=sb(),u=(0,ec.useFieldSchema)(),p=c||u,m=tA(),h=d||m,{getCollectionFields:x}=sO(),f={...null==h||null==(t=h.uiSchema)||null==(e=t["x-component-props"])?void 0:e.fieldNames,...null==r||null==(n=r.componentProps)?void 0:n.fieldNames,...null==p||null==(o=p["x-component-props"])?void 0:o.fieldNames};return{title:l("Title field"),options:a,value:null==f?void 0:f.label,onChange(e){var t,n,o,l,a;let s={"x-uid":p["x-uid"]},c={...null==h||null==(n=h.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...null==(o=p["x-component-props"])?void 0:o.fieldNames,label:e};p["x-component-props"]=p["x-component-props"]||{},p["x-component-props"].fieldNames=c;let d=x(h.target).find(t=>t.name===e);"m2o"===d.interface?p["x-component-props"]["x-next-title"]={label:e,collection:d.collectionName}:p["x-component-props"]["x-next-title"]=null,s["x-component-props"]=p["x-component-props"],r.componentProps.fieldNames=p["x-component-props"].fieldNames;let u=null==(a=r.path)?void 0:a.splice((null==(l=r.path)?void 0:l.length)-1,1);r.form.query("".concat(u.concat("*."+p.name))).forEach(e=>{e.componentProps.fieldNames=c}),i.emit("patch",{schema:s}),i.refresh()}}},useVisible:ui},{name:"changOnSelect",Component:function(e){var t;let{dn:n}=eY(),{t:o}=(0,eT.useTranslation)(),{fieldSchema:l,collectionField:r}=sb();(0,ec.useField)();let i=(0,ec.useFieldSchema)(),a=l||i;return(0,A.jsx)(aY,{title:o("Chang on Parent"),checked:!!(null==a||null==(t=a["x-component-props"])?void 0:t.changOnSelect),onChange:e=>{a["x-component-props"].changOnSelect=e,n.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":{...a["x-component-props"]}}}),n.refresh()}})},useVisible:ui}]}),CJ=new or({name:"fieldSettings:component:CascadeSelect",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),o=SN(),l=un(),r=ux(),{dn:i}=eY();return{title:e("Field component"),options:o,value:r,onChange(e){let o={"x-uid":n["x-uid"]};n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].mode=e,o["x-component-props"]=n["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(n)&&l&&(o.default=null,n.default=null,t.setInitialValue(null),t.setValue(null)),i.emit("patch",{schema:o}),i.refresh()}}}},{name:"titleField",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{dn:r}=eY(),i=uh(),a=tA();return{title:n("Title field"),options:i,value:null==o||null==(t=o.componentProps)||null==(e=t.fieldNames)?void 0:e.label,onChange(e){var t,n;let i={"x-uid":l["x-uid"]},s={...null==a||null==(n=a.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...o.componentProps.fieldNames,label:e};l["x-component-props"]=l["x-component-props"]||{},l["x-component-props"].fieldNames=s,i["x-component-props"]=l["x-component-props"],o.componentProps.fieldNames=l["x-component-props"].fieldNames,r.emit("patch",{schema:i}),r.refresh()}}}}]}),CQ=new or({name:"fieldSettings:component:Checkbox",items:[{name:"fieldComponent",type:"select",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),{fieldSchema:o}=sb(),l=(0,ec.useFieldSchema)(),r=o||l,i=[{label:t("Checkbox"),value:"Checkbox"},{label:t("Radio group"),value:"Radio group"}],{dn:a}=eY();return{title:t("Field component"),options:i,value:(null==(e=r["x-component-props"])?void 0:e.mode)||"Checkbox",onChange(e){let t={"x-uid":r["x-uid"]};r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].mode=e,t["x-component-props"]=r["x-component-props"],n.componentProps=n.componentProps||{},n.componentProps.mode=e,a.emit("patch",{schema:t}),a.refresh()}}}}]}),CZ={name:"enableLink",type:"switch",useVisible:()=>(0,ec.useField)().readPretty,useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),{fieldSchema:o}=sb(),l=(0,ec.useFieldSchema)(),r=o||l,{dn:i}=eY();return{title:t("Enable link"),checked:(null==(e=r["x-component-props"])?void 0:e.enableLink)!==!1,onChange(e){r["x-component-props"]={...null==r?void 0:r["x-component-props"],enableLink:e},n.componentProps.enableLink=e,i.emit("patch",{schema:{"x-uid":r["x-uid"],"x-component-props":{...null==r?void 0:r["x-component-props"]}}}),i.refresh()}}}},C0={name:"allowMultiple",type:"switch",useVisible(){let e=ul(),t=tA();return!e&&["hasMany","belongsToMany"].includes(null==t?void 0:t.type)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),{fieldSchema:o}=sb(),l=(0,ec.useFieldSchema)(),r=o||l,{dn:i,refresh:a}=eY();return{title:t("Allow multiple"),checked:(null==(e=r["x-component-props"])?void 0:e.multiple)===void 0||r["x-component-props"].multiple,onChange(e){let t={"x-uid":r["x-uid"]};r["x-component-props"]=r["x-component-props"]||{},n.componentProps=n.componentProps||{},r["x-component-props"].multiple=e,n.componentProps.multiple=e,t["x-component-props"]=r["x-component-props"],i.emit("patch",{schema:t}),a()}}}},C1={name:"quickCreate",type:"select",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,insertAdjacent:r}=eY();return{title:t("Quick create"),options:[{label:t("None"),value:"none"},{label:t("Dropdown"),value:"quickAdd"},{label:t("Pop-up"),value:"modalAdd"}],value:(null==(e=n.componentProps)?void 0:e.addMode)||"none",onChange(e){"modalAdd"===e&&(o.reduceProperties((e,t)=>"Action"===t["x-component"]?t:e,null)||r("afterBegin",{"x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:addNew","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"default",component:"CreateRecordAction"}}));let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].addMode=e,t["x-component-props"]=o["x-component-props"],n.componentProps=n.componentProps||{},n.componentProps.addMode=e,l.emit("patch",{schema:t}),l.refresh()}}}},C2={name:"setDefaultSortingRules",Component:s3},C6={name:"setTheDataScope",Component:il,useComponentProps(){var e,t,n;let{getCollectionJoinField:o,getAllCollectionsInheritChain:l}=sO(),{getField:r}=tJ(),{form:i}=Tp(),a=m3();(0,ec.useField)();let{fieldSchema:s,collectionField:c}=sb(),d=(0,ec.useFieldSchema)(),u=s||d,p=c||r(u.name)||o(u["x-collection-field"]),m=lN(),h=lT(),{dn:x}=eY();return{collectionName:null==p?void 0:p.target,defaultFilter:(null==u||null==(n=u["x-component-props"])||null==(t=n.service)||null==(e=t.params)?void 0:e.filter)||{},form:i,dynamicComponent:e=>(0,A.jsx)(rW,{...e,form:i,collectionField:e.collectionField,record:a,shouldChange:rH({collectionField:e.collectionField,variables:m,localVariables:h,getAllCollectionsInheritChain:l})}),onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(u["x-component-props"],"service.params.filter",t),x.emit("patch",{schema:{"x-uid":u["x-uid"],"x-component-props":u["x-component-props"]}})}}}},C3=new or({name:"fieldSettings:component:Select",items:[{name:"fieldComponent",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=tA(),{fieldSchema:r,collectionField:i}=sb(),a=(0,ec.useFieldSchema)(),s=r||a,c=SN({fieldSchema:r,collectionField:i}),d=un(),u=ux(),{dn:p}=eY(),m=["select","multipleSelect"].includes(null==l?void 0:l.interface),h=[{label:n("Select"),value:"Select"},{label:n("Radio group"),value:"Radio group"}];if((null==l?void 0:l.interface)==="multipleSelect"){let e=h.findIndex(e=>"Radio group"===e.value);h.splice(e,1)}let x=tr().collectionFieldInterfaceManager.getFieldInterface(null==l?void 0:l.interface),f=eB();if(s["x-component-props"].multiple){let e=c.findIndex(e=>"Radio group"===e.value);c.splice(e,1)}let v=m?h:c;return null==x||null==(t=x.componentOptions)||null==(e=t.filter(e=>!e.useVisible||e.useVisible()))||e.forEach(e=>{(null==v?void 0:v.find(t=>t.value===e.value))||null==v||v.push({label:f(e.label),value:e.value})}),{title:n("Field component"),options:v,value:u,onChange(e){let t={"x-uid":s["x-uid"]};if(s["x-component-props"]=s["x-component-props"]||{},s["x-component-props"].mode=e,t["x-component-props"]=s["x-component-props"],o.componentProps=o.componentProps||{},o.componentProps.mode=e,nW(s)&&d){var n,l;t.default=null,s.default=null,null==o||null==(n=o.setInitialValue)||n.call(o,null),null==o||null==(l=o.setValue)||l.call(o,null)}p.emit("patch",{schema:t}),p.refresh()}}}},{...C6,useVisible(){let e=uu(),t=ul();return e&&!t}},{...C2,useComponentProps(){let{fieldSchema:e}=sb();return{fieldSchema:e}},useVisible(){let e=uu(),t=ul();return e&&!t}},{...C1,useVisible(){let e=ui(),t=ul(),{fieldSchema:n}=sb();return e&&!n&&!t}},{...C0,useVisible(){let e=ui(),t=sK();return e&&t()}},{name:"titleField",type:"select",useComponentProps(){var e,t,n,o;let{t:l}=(0,eT.useTranslation)(),r=(0,ec.useField)(),{dn:i}=eY(),a=uh(),{uiSchema:s,fieldSchema:c,collectionField:d}=sb(),u=(0,ec.useFieldSchema)(),p=c||u,m=tA(),h=d||m,{getCollectionFields:x}=sO(),f={...null==h||null==(t=h.uiSchema)||null==(e=t["x-component-props"])?void 0:e.fieldNames,...null==r||null==(n=r.componentProps)?void 0:n.fieldNames,...null==p||null==(o=p["x-component-props"])?void 0:o.fieldNames};return{title:l("Title field"),options:a,value:null==f?void 0:f.label,onChange(e){var t,n,o,l,a;let s={"x-uid":p["x-uid"]},c={...null==h||null==(n=h.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...null==(o=p["x-component-props"])?void 0:o.fieldNames,label:e};p["x-component-props"]=p["x-component-props"]||{},p["x-component-props"].fieldNames=c;let d=x(h.target).find(t=>t.name===e);"m2o"===d.interface?p["x-component-props"]["x-next-title"]={label:e,collection:d.collectionName}:p["x-component-props"]["x-next-title"]=null,s["x-component-props"]=p["x-component-props"],r.componentProps.fieldNames=p["x-component-props"].fieldNames;let u=null==(a=r.path)?void 0:a.splice((null==(l=r.path)?void 0:l.length)-1,1);r.form.query("".concat(u.concat("*."+p.name))).forEach(e=>{e.componentProps.fieldNames=f}),i.emit("patch",{schema:s}),i.refresh()}}},useVisible:ui},{...CZ,useVisible(){let e=ul();return ui()&&e}}]}),C5=new or({name:"fieldSettings:component:CustomTitle",items:[{name:"fieldComponent",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=tA(),{fieldSchema:r,collectionField:i}=sb(),a=(0,ec.useFieldSchema)(),s=r||a,c=SN({fieldSchema:r,collectionField:i}),d=un(),u=ux(),{dn:p}=eY(),m=["select","multipleSelect"].includes(null==l?void 0:l.interface),h=[{label:n("Select"),value:"Select"},{label:n("Radio group"),value:"Radio group"},{label:n("Custom Title"),value:"CustomTitle"}];if((null==l?void 0:l.interface)==="multipleSelect"){let e=h.findIndex(e=>("Select"===e.value&&(e.value="multiple"),"Radio group"===e.value));h.splice(e,1)}let x=tr().collectionFieldInterfaceManager.getFieldInterface(null==i?void 0:i.interface),f=eB(),v=m?h:c;return null==x||null==(t=x.componentOptions)||null==(e=t.filter(e=>!e.useVisible||e.useVisible()))||e.forEach(e=>{(null==v?void 0:v.find(t=>t.value===e.value))||null==v||v.push({label:f(e.label),value:e.value})}),{title:n("Field component"),options:v,value:u,onChange(e){let t={"x-uid":s["x-uid"]};if(s["x-component-props"]=s["x-component-props"]||{},s["x-component-props"].mode=e,t["x-component-props"]=s["x-component-props"],o.componentProps=o.componentProps||{},o.componentProps.mode=e,nW(s)&&d){var n,l;t.default=null,s.default=null,null==o||null==(n=o.setInitialValue)||n.call(o,null),null==o||null==(l=o.setValue)||l.call(o,null)}p.emit("patch",{schema:t}),p.refresh()}}},useVisible:()=>"CustomTitle"===ux()},{name:"customTitle",type:"modal",useComponentProps(){var e,t;let n=(0,ec.useFieldSchema)(),{fieldSchema:o}=sb(),l=o||n,{t:r}=(0,eT.useTranslation)(),{dn:i}=eY(),a=y4(),s=null==(t=l["x-component-props"])||null==(e=t.fieldNames)?void 0:e.formula,c=(0,ec.useField)();return{title:r("Custom option label"),schema:{type:"object",title:r("Custom option label"),properties:{formula:{required:!0,"x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:a},default:s}}},onSubmit:e=>{let{formula:t}=e;if(t){var n,o;let e={...l["x-component-props"],fieldNames:{...null==(n=l["x-component-props"])?void 0:n.fieldNames,formula:t}};c.componentProps={...c.componentProps,fieldNames:{...null==(o=c.componentProps)?void 0:o.fieldNames,formula:t}},l["x-component-props"]=e,i.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":e}})}i.refresh()}}},useVisible:()=>"CustomTitle"===ux()},{...C6,useVisible(){let e=uu(),t=ul();return e&&!t}},{...C2,useComponentProps(){let{fieldSchema:e}=sb();return{fieldSchema:e}},useVisible(){let e=uu(),t=ul();return e&&!t}},{...C1,useVisible(){let e=ui(),t=ul(),{fieldSchema:n}=sb();return e&&!n&&!t}},{...C0,useVisible(){let e=ui(),t=sK();return e&&t()}},{...CZ,useVisible(){let e=ul();return ui()&&e}}]}),C4=new or({name:"fieldSettings:component:DatePicker",items:[{name:"dateDisplayFormat",Component:s6,useComponentProps(){let e=(0,ec.useFieldSchema)(),{fieldSchema:t}=sb();return{fieldSchema:t||e}}}]}),C8={name:"titleField",type:"select",useComponentProps(){var e,t,n;let{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),{uiSchema:r,fieldSchema:i,collectionField:a}=sb(),s=uh(),c=(0,ec.useFieldSchema)(),d=i||c,u=tA(),p=a||u,{dn:m}=eY(),h=(null==l||null==(e=l.componentProps)?void 0:e.fieldNames)||(null==d||null==(t=d["x-component-props"])?void 0:t.fieldNames)||(null==r||null==(n=r["x-component-props"])?void 0:n.fieldNames);return{title:o("Title field"),options:s,value:null==h?void 0:h.label,onChange(e){var t,n;let o={"x-uid":d["x-uid"]},r={...null==p||null==(n=p.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...l.componentProps.fieldNames,label:e};d["x-component-props"]=d["x-component-props"]||{},d["x-component-props"].fieldNames=r,o["x-component-props"]=d["x-component-props"],l.componentProps.fieldNames=d["x-component-props"].fieldNames,m.emit("patch",{schema:o}),m.refresh()}}}},C7=new or({name:"fieldSettings:component:Picker",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=un(),o=ux(),{fieldSchema:l,collectionField:r}=sb(),i=(0,ec.useFieldSchema)(),a=l||i,s=SN({fieldSchema:l,collectionField:r}),{dn:c}=eY();return{title:e("Field component"),options:s,value:o,onChange(e){let o={"x-uid":a["x-uid"]};if(a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].mode=e,o["x-component-props"]=a["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(a)&&n){var l,r;o.default=null,a.default=null,null==t||null==(l=t.setInitialValue)||l.call(t,null),null==t||null==(r=t.setValue)||r.call(t,null)}c.emit("patch",{schema:o}),c.refresh()}}}},{name:"popupSize",type:"select",useVisible:()=>!ul(),useComponentProps(){var e,t,n;let{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),{fieldSchema:r}=sb(),i=(0,ec.useFieldSchema)(),a=r||i,{dn:s}=eY();return{title:o("Popup size"),options:[{label:o("Small"),value:"small"},{label:o("Middle"),value:"middle"},{label:o("Large"),value:"large"}],value:null!=(n=null==a||null==(e=a["x-component-props"])?void 0:e.openSize)?n:(null==a||null==(t=a["x-component-props"])?void 0:t.openMode)=="modal"?"large":"middle",onChange:e=>{l.componentProps.openSize=e,a["x-component-props"]={...a["x-component-props"],openSize:e},s.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":a["x-component-props"]}}),s.refresh()}}}},{name:"allowMultiple",type:"switch",useVisible(){let e=ul(),t=tA();return!e&&["hasMany","belongsToMany"].includes(null==t?void 0:t.type)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow multiple"),checked:(null==(e=o["x-component-props"])?void 0:e.multiple)===void 0||o["x-component-props"].multiple,onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},n.componentProps=n.componentProps||{},o["x-component-props"].multiple=e,n.componentProps.multiple=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},C8]}),C9=new or({name:"fieldSettings:component:DrawerSubTable",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),{fieldSchema:n,collectionField:o}=sb(),l=(0,ec.useFieldSchema)(),r=n||l,i=SN({fieldSchema:n,collectionField:o}),{dn:a}=eY(),s=un(),c=ux();return{title:e("Field component"),options:i,value:c,onChange(e){let n={"x-uid":r["x-uid"]};r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].mode=e,n["x-component-props"]=r["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(r)&&s&&(n.default=null,r.default=null,t.setInitialValue(null),t.setValue(null)),a.emit("patch",{schema:n}),a.refresh()}}}},{name:"allowMultiple",type:"switch",useVisible(){let e=ul(),t=tA();return!e&&["hasMany","belongsToMany"].includes(null==t?void 0:t.type)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow multiple"),checked:(null==(e=o["x-component-props"])?void 0:e.multiple)===void 0||o["x-component-props"].multiple,onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},n.componentProps=n.componentProps||{},o["x-component-props"].multiple=e,n.componentProps.multiple=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},C8,{name:"popupSize",type:"select",useVisible:()=>!ul(),useComponentProps(){var e,t,n;let{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),{fieldSchema:r}=sb(),i=(0,ec.useFieldSchema)(),a=r||i,{dn:s}=eY();return{title:o("Popup size"),options:[{label:o("Small"),value:"small"},{label:o("Middle"),value:"middle"},{label:o("Large"),value:"large"}],value:null!=(n=null==a||null==(e=a["x-component-props"])?void 0:e.openSize)?n:(null==a||null==(t=a["x-component-props"])?void 0:t.openMode)=="modal"?"large":"middle",onChange:e=>{l.componentProps.openSize=e,a["x-component-props"]={...a["x-component-props"],openSize:e},s.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":a["x-component-props"]}}),s.refresh()}}}}]}),Se=new or({name:"fieldSettings:component:FileManager",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=un(),o=ux(),{fieldSchema:l,collectionField:r}=sb(),i=(0,ec.useFieldSchema)(),a=l||i,s=SN({fieldSchema:l,collectionField:r}),{dn:c}=eY();return{title:e("Field component"),options:s,value:o,onChange(e){let o={"x-uid":a["x-uid"]};a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].mode=e,o["x-component-props"]=a["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(a)&&n&&(o.default=null,a.default=null,t.setInitialValue(null),t.setValue(null)),c.emit("patch",{schema:o}),c.refresh()}}}},{name:"quickUpload",type:"switch",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),{fieldSchema:o}=sb(),l=(0,ec.useFieldSchema)(),r=o||l,{dn:i,refresh:a}=eY();return{title:t("Quick upload"),checked:(null==(e=r["x-component-props"])?void 0:e.quickUpload)!==!1,onChange(e){let t={"x-uid":r["x-uid"]};n.componentProps.quickUpload=e,r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].quickUpload=e,t["x-component-props"]=r["x-component-props"],i.emit("patch",{schema:t}),a()}}},useVisible(){let{fieldSchema:e}=sb(),t=(0,ec.useField)(),n=(0,ec.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||n.readPretty)}},{name:"selectFile",type:"switch",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),{fieldSchema:o}=sb(),l=(0,ec.useFieldSchema)(),r=o||l,{dn:i,refresh:a}=eY();return{title:t("Select file"),checked:(null==(e=r["x-component-props"])?void 0:e.selectFile)!==!1,onChange(e){let t={"x-uid":r["x-uid"]};n.componentProps.selectFile=e,r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].selectFile=e,t["x-component-props"]=r["x-component-props"],i.emit("patch",{schema:t}),a()}}},useVisible(){let{fieldSchema:e}=sb(),t=(0,ec.useField)(),n=(0,ec.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||n.readPretty)}},{name:"size",type:"select",useVisible(){let e=ul(),{fieldSchema:t}=sb();return e&&!t},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY();return{title:t("Size"),options:[{label:t("Large"),value:"large"},{label:t("Default"),value:"default"},{label:t("Small"),value:"small"}],value:(null==n||null==(e=n.componentProps)?void 0:e.size)||"default",onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].size=e,t["x-component-props"]=o["x-component-props"],n.componentProps=n.componentProps||{},n.componentProps.size=e,l.emit("patch",{schema:t}),l.refresh()}}}},{...C0,useVisible(){let e=ui(),t=sK();return e&&t()}}]}),St=new or({name:"fieldSettings:component:Upload.Attachment",items:[{name:"size",type:"select",useVisible:()=>ul(),useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY();return{title:t("Size"),options:[{label:t("Large"),value:"large"},{label:t("Default"),value:"default"},{label:t("Small"),value:"small"}],value:(null==n||null==(e=n.componentProps)?void 0:e.size)||"default",onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].size=e,t["x-component-props"]=o["x-component-props"],n.componentProps=n.componentProps||{},n.componentProps.size=e,l.emit("patch",{schema:t}),l.refresh()}}}},{name:"showCount",type:"modal",useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),{fieldSchema:n}=sb(),o=(0,ec.useFieldSchema)(),l=n||o,{dn:r}=eY();return{title:t("Show Count"),schema:{type:"object",title:t("Show Count"),properties:{showCount:{default:(null==l||null==(e=l["x-component-props"])?void 0:e.showCount)||1,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:0,max:5}}}},onSubmit:e=>{let{showCount:t}=e,n=l["x-component-props"]||{};n.showCount=t;let o={"x-uid":l["x-uid"],"x-component-props":n};r.emit("patch",{schema:o}),r.refresh()}}}}]}),Sn=new or({name:"fieldSettings:component:Input",items:[]}),So=e=>{let{unitConversionType:t}=e,n=(0,ec.useForm)(),{t:o}=(0,eT.useTranslation)();return(0,A.jsxs)(oo.A,{defaultValue:t||"*",style:{width:160},onChange:e=>{n.setValuesIn("unitConversionType",e)},children:[(0,A.jsx)(oo.A.Option,{value:"*",children:o("Multiply by")}),(0,A.jsx)(oo.A.Option,{value:"/",children:o("Divide by")})]})},Sl=new or({name:"fieldSettings:component:InputNumber",items:[{name:"setSliderMAXNumber",type:"modal",useVisible(){var e;let t=(0,ec.useFieldSchema)();return"Slider"===t["x-component"]||(null==(e=t["x-component-props"])?void 0:e.component)==="Slider"},useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{dn:r}=eY();return{title:n("MAX"),value:null==(e=l["x-component-props"])?void 0:e.max,schema:{type:"object",title:n("Edit Slider Max"),properties:{maxNumber:{default:(null==(t=l["x-component-props"])?void 0:t.max)||100,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit(e){Number(e.maxNumber)>(o.componentProps.min||0)?(l["x-component-props"].max=Number(e.maxNumber),o.componentProps.max=Number(e.maxNumber),r.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":l["x-component-props"]}})):cg.Ay.warning(n("Cannot be less than or equal to the minimum value"))}}}},{name:"setSliderMinNumber",type:"modal",useVisible(){var e;let t=(0,ec.useFieldSchema)();return"Slider"===t["x-component"]||(null==(e=t["x-component-props"])?void 0:e.component)==="Slider"},useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{dn:r}=eY();return{title:n("MIN"),value:null==(e=l["x-component-props"])?void 0:e.min,schema:{type:"object",title:n("Edit Slider Min"),properties:{minNumber:{default:(null==(t=l["x-component-props"])?void 0:t.min)||0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit(e){Number(e.minNumber)<(o.componentProps.max||0)?(l["x-component-props"].min=Number(e.minNumber),o.componentProps.min=Number(e.minNumber),r.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":l["x-component-props"]}})):cg.Ay.warning(n("Cannot be greater than or equal to the maximum value"))}}}},{name:"displayFormat",Component:function(e){let{fieldSchema:t}=e,n=(0,ec.useField)(),{dn:o}=eY(),{t:l}=(0,eT.useTranslation)(),{getCollectionJoinField:r}=sO(),i=r(null==t?void 0:t["x-collection-field"])||{},{formatStyle:a,unitConversion:s,unitConversionType:c,separator:d,step:u,addonBefore:p,addonAfter:m}=t["x-component-props"]||{},{step:h}=(null==i?void 0:i.uiSchema["x-component-props"])||{};return(0,A.jsx)(aQ,{title:l("Format"),schema:{type:"object",properties:{formatStyle:{type:"string",default:a||"normal",enum:[{value:"normal",label:l("Normal")},{value:"scientifix",label:l("Scientifix notation")}],"x-decorator":"FormItem","x-component":"Select",title:"{{t('Style')}}"},unitConversion:{type:"number","x-decorator":"FormItem","x-component":"InputNumber",title:"{{t('Unit conversion')}}",default:s,"x-component-props":{style:{width:"100%"},addonBefore:(0,A.jsx)(So,{unitConversionType:c})}},separator:{type:"string",default:d||"0,0.00",enum:[{value:"0,0.00",label:l("100,000.00")},{value:"0.0,00",label:l("100.000,00")},{value:"0 0,00",label:l("100 000.00")},{value:"0.00",label:l("100000.00")}],"x-decorator":"FormItem","x-component":"Select",title:"{{t('Separator')}}"},step:{type:"string",title:'{{t("Precision")}}',"x-component":"Select","x-decorator":"FormItem",default:u||h||"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"}]},addonBefore:{type:"string",title:'{{t("Prefix")}}',"x-component":"Input","x-decorator":"FormItem",default:p},addonAfter:{type:"string",title:'{{t("Suffix")}}',"x-component":"Input","x-decorator":"FormItem",default:m}}},onSubmit:e=>{let l={"x-uid":t["x-uid"]};l["x-component-props"]=t["x-component-props"]||{},t["x-component-props"]={...t["x-component-props"]||{},...e},l["x-component-props"]=t["x-component-props"],n.componentProps=t["x-component-props"];let r=n.path.entire.split(".");r.pop();let i=r.join(".");n.query("".concat(i,".*[0:].").concat(t.name)).forEach(n=>{n.props.name===t.name&&n.setComponentProps({...e})}),o.emit("patch",{schema:l}),o.refresh()}})},useComponentProps(){let e=(0,ec.useFieldSchema)(),{fieldSchema:t}=sb();return{fieldSchema:t||e}},useVisible:()=>ul()}]}),Sr=e=>({name:e.name,type:"select",useComponentProps(){var t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{fieldSchema:r}=sb(),i=r||l,{dn:a}=eY();return{title:n(e.title),options:e.options(n),value:(null==(t=i["x-component-props"])?void 0:t[e.name])||e.defaultValue,onChange(t){let n={"x-uid":i["x-uid"]};i["x-component-props"]=i["x-component-props"]||{},i["x-component-props"][e.name]=t,n["x-component-props"]=i["x-component-props"],o.componentProps=o.componentProps||{},o.componentProps[e.name]=t,a.emit("patch",{schema:n})}}}}),Si=new or({name:"fieldSettings:component:Input.Preview",items:[Sr({name:"size",title:"Size",options:e=>[{value:"small",label:e("Small")},{value:"middle",label:e("Middle")},{value:"large",label:e("Large")},{value:"oversized",label:e("Oversized")},{value:"auto",label:e("Auto")}],defaultValue:"small"}),Sr({name:"objectFit",title:"Object Fit",options:e=>[{value:"cover",label:e("Cover")},{value:"fill",label:e("Fill")},{value:"contain",label:e("Contain")},{value:"scale-down",label:e("Scale Down")},{value:"none",label:e("None")}],defaultValue:"cover"})]}),Sa=new or({name:"fieldSettings:component:multiple",items:[{name:"fieldComponent",type:"select",useComponentProps(){var e,t,n;let{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),{fieldSchema:r}=sb(),{getCollectionJoinField:i}=sO(),a=tr(),s=(0,ec.useFieldSchema)(),c=r||s,d=i(c["x-collection-field"]),u=a.collectionFieldInterfaceManager.getFieldInterface(null==d?void 0:d.interface),p=eB(),m=[{label:o("Select"),value:"multiple"}];null==u||null==(t=u.componentOptions)||null==(e=t.filter(e=>!e.useVisible||e.useVisible()))||e.forEach(e=>{(null==m?void 0:m.find(t=>t.value===e.value))||null==m||m.push({label:p(e.label),value:e.value})});let{dn:h}=eY();return{title:o("Field component"),options:m,value:(null==(n=c["x-component-props"])?void 0:n.mode)||"multiple",onChange(e){let t={"x-uid":c["x-uid"]};c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].mode=e,c["x-component-props"].multiple=!0,t["x-component-props"]=c["x-component-props"],l.componentProps=l.componentProps||{},l.componentProps.mode=e,l.componentProps.multiple=!0,h.emit("patch",{schema:t}),h.refresh()}}}}]}),Ss=new or({name:"fieldSettings:component:Nester",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),o=SN(),l=un(),r=ux(),{dn:i}=eY();return{title:e("Field component"),options:o,value:r,onChange(e){let o={"x-uid":n["x-uid"]};n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].mode=e,o["x-component-props"]=n["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(n)&&l&&(o.default=null,n.default=null,t.setInitialValue(null),t.setValue(null)),i.emit("patch",{schema:o}),i.refresh()}}}},{name:"allowMultiple",type:"switch",useVisible(){let e=ul(),t=tA();return!e&&["hasMany","belongsToMany"].includes(null==t?void 0:t.type)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow multiple"),checked:(null==(e=o["x-component-props"])?void 0:e.multiple)===void 0||o["x-component-props"].multiple,onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},n.componentProps=n.componentProps||{},o["x-component-props"].multiple=e,n.componentProps.multiple=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"allowDissociate",type:"switch",useVisible(){let{type:e}=Tc();return!uo()&&"update"===e},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow dissociate"),checked:(null==(e=o["x-component-props"])?void 0:e.allowDissociate)!==!1,onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},n.componentProps=n.componentProps||{},o["x-component-props"].allowDissociate=e,n.componentProps.allowDissociate=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}}]}),Sc=new or({name:"fieldSettings:component:PopoverNester",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),{fieldSchema:n,collectionField:o}=sb(),l=(0,ec.useFieldSchema)(),r=n||l,i=SN({fieldSchema:n,collectionField:o}),{dn:a}=eY(),s=un(),c=ux();return{title:e("Field component"),options:i,value:c,onChange(e){let n={"x-uid":r["x-uid"]};r["x-component-props"]=r["x-component-props"]||{},r["x-component-props"].mode=e,n["x-component-props"]=r["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(r)&&s&&(n.default=null,r.default=null,t.setInitialValue(null),t.setValue(null)),a.emit("patch",{schema:n}),a.refresh()}}}},{name:"allowMultiple",type:"switch",useVisible(){let e=ul(),t=tA();return!e&&["hasMany","belongsToMany"].includes(null==t?void 0:t.type)},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow multiple"),checked:(null==(e=o["x-component-props"])?void 0:e.multiple)===void 0||o["x-component-props"].multiple,onChange(e){let t={"x-uid":o["x-uid"]};o["x-component-props"]=o["x-component-props"]||{},n.componentProps=n.componentProps||{},o["x-component-props"].multiple=e,n.componentProps.multiple=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},C8]}),Sd=new or({name:"fieldSettings:component:Radio group",items:[{name:"fieldComponent",type:"select",useComponentProps(){var e,t,n;let{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),{fieldSchema:r}=sb(),i=(0,ec.useFieldSchema)(),a=r||i,s=[{label:o("Checkbox"),value:"Checkbox"},{label:o("Radio group"),value:"Radio group"}],c=tr(),{getCollectionJoinField:d}=sO(),u=d(a["x-collection-field"]),p=c.collectionFieldInterfaceManager.getFieldInterface(null==u?void 0:u.interface),m=eB(),{dn:h}=eY();return null==p||null==(t=p.componentOptions)||null==(e=t.filter(e=>!e.useVisible||e.useVisible()))||e.forEach(e=>{(null==s?void 0:s.find(t=>t.value===e.value))||null==s||s.push({label:m(e.label),value:e.value})}),{title:o("Field component"),options:s,value:(null==(n=a["x-component-props"])?void 0:n.mode)||"Radio group",onChange(e){let t={"x-uid":a["x-uid"]};a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].mode=e,t["x-component-props"]=a["x-component-props"],l.componentProps=l.componentProps||{},l.componentProps.mode=e,h.emit("patch",{schema:t}),h.refresh()}}}}]}),Su=new or({name:"FilterFormItemSettings",items:[{name:"editFieldTitle",Component:ph},{name:"editDescription",Component:px},{name:"editTooltip",Component:pf},{name:"validationRules",Component:pg},{name:"setDataScope",Component:il,useVisible(){let e=uu(),t=uo();return e&&!t},useComponentProps(){var e,t,n;let{getCollectionJoinField:o,getAllCollectionsInheritChain:l}=sO(),{getField:r}=tJ(),{form:i}=Tp(),a=m3(),s=(0,ec.useField)(),c=(0,ec.useFieldSchema)(),d=r(c.name)||o(c["x-collection-field"]),u=lN(),p=lT(),{dn:m}=eY();return{collectionName:null==d?void 0:d.target,defaultFilter:(null==c||null==(n=c["x-component-props"])||null==(t=n.service)||null==(e=t.params)?void 0:e.filter)||{},form:i,dynamicComponent:e=>(0,A.jsx)(rW,{...e,form:i,collectionField:e.collectionField,record:a,shouldChange:rH({collectionField:e.collectionField,variables:u,localVariables:p,getAllCollectionsInheritChain:l})}),onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(s.componentProps,"service.params.filter",t),c["x-component-props"]=s.componentProps,m.emit("patch",{schema:{"x-uid":c["x-uid"],"x-component-props":s.componentProps}})}}}},{name:"fieldMode",Component:pb},{name:"operator",Component:pw},{name:"titleField",Component:pF},{name:"divider",type:"divider",useVisible(){let{getCollectionJoinField:e}=sO(),{getField:t}=tJ(),n=(0,ec.useFieldSchema)();return!!(t(n.name)||e(n["x-collection-field"]))}},{name:"remove",type:"remove",useComponentProps(){let{t:e}=(0,eT.useTranslation)();return{removeParentsIfNoChildren:!0,confirm:{title:e("Delete field")},breakRemoveOn:{"x-component":"Grid"}}}}]});var Sp=n(9122);let Sm={label:"label",value:"value",color:"color",options:"children"};function Sh(e,t,n){let o=function e(t,n){let o=[];if(!Array.isArray(t))return o;for(let l=0;l<t.length;l++){let r=t[l][n.options];Array.isArray(r)&&o.push(...e(r,n)),o.push({...t[l]})}return o}(t,n),l=(0,ed.castArray)(e).filter(e=>null!=e).map(e=>(0,eh.isPlainObject)(e)?e[n.value]:e);if(!o)return[];let r=[];for(let e of l){let t=o.find(t=>t[n.value]===e)||{value:e,label:e?e.toString():e};r.push(t)}return r}let Sx=(0,ec.observer)(e=>{var t,n,o;let l={...Sm,...e.fieldNames},r=(0,ec.useField)();if(!(0,ec.isValid)(e.value)||(0,ec.isArrayField)(r)&&(null==r||null==(t=r.value)?void 0:t.length)===0)return(0,A.jsx)("div",{});let i=tA(),a=(0,ec.useFieldSchema)(),s=r.dataSource||e.options||(null==i?void 0:i.uiSchema.enum)||[],c=Sh(r.value,s,l),d=Sf(null==(o=a["x-component-props"])||null==(n=o.fieldNames)?void 0:n.formula,c,a);return(0,A.jsx)("div",{children:(0,A.jsx)(gi,{ellipsis:e.ellipsis,children:d.map((e,t)=>(0,A.jsx)(nz.A,{color:e[l.color],icon:e.icon,children:e[l.label]},t))})})},{displayName:"ReadPretty"}),Sf=(e,t,n)=>e?t.map(t=>{let o=t.label,l=e.replace(RegExp("{{".concat(n.name,"}}"),"g"),o);return{...t,label:l}}):t,Sv=(e,t)=>{var n;return(null!=(n=null==t?void 0:t.label)?n:"").toLowerCase().includes((e||"").toLowerCase())},Sg=(0,ec.connect)(e=>{let{objectValue:t,loading:n,value:o,rawOptions:l,defaultValue:r,firstLevelValue:i,collectionField:a,...s}=e,{t:c}=(0,eT.useTranslation)(),d=eB(),u=tg(),p=e.multiple?"multiple":e.mode;p&&!["multiple","tags"].includes(p)&&(p=void 0);let m=t=>["tags","multiple"].includes(e.mode)||e.multiple?t?(0,ec.toArr)(t):void 0:t,h=u.getCollectionFields("".concat(a,".").concat(i)).map(e=>{if("m2o"===e.interface)return{...e,label:d(e.uiSchema.title),value:e.name}}).filter(Boolean);h.unshift({label:c("none"),value:"none"});let x=h.find(e=>e.value===o),f=x?o:"none";return(0,es.useEffect)(()=>{if(!x){var t;null==(t=e.onChange)||t.call(e,"none")}},[o,h]),(0,A.jsx)(oo.A,{role:"button","data-testid":"select-".concat(p||"single"),showSearch:!0,filterOption:Sv,allowClear:{clearIcon:(0,A.jsx)(Sp.A,{role:"button","aria-label":"icon-close-select"})},popupMatchSelectWidth:!1,notFoundContent:n?(0,A.jsx)(eD.A,{}):(0,A.jsx)(op.A,{image:op.A.PRESENTED_IMAGE_SIMPLE}),value:m(f),defaultValue:m(r),tagRender:e=>(0,A.jsx)(nz.A,{role:"button","aria-label":e.label,closeIcon:(0,A.jsx)(cp.A,{role:"button","aria-label":"icon-close-tag"}),...e,children:e.label}),options:h,...s,onChange:t=>{var n;null==(n=e.onChange)||n.call(e,void 0===t?null:t)},mode:p})},(0,ec.mapProps)({dataSource:"options"},(e,t)=>({...e,fieldNames:{...Sm,...e.fieldNames},suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon})),(0,ec.mapReadPretty)(Sx)),Sy=new or({name:"fieldSettings:component:SubTable",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),o=SN(),l=un(),r=ux(),{dn:i}=eY();return{title:e("Field component"),options:o,value:r,onChange(e){let o={"x-uid":n["x-uid"]};n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].mode=e,o["x-component-props"]=n["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(n)&&l&&(o.default=null,n.default=null,t.setInitialValue(null),t.setValue(null)),i.emit("patch",{schema:o}),i.refresh()}}}},{name:"allowAddNewData",type:"switch",useVisible(){let e=ul(),t=ui();return!e&&t},useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow add new"),checked:(null==(e=o["x-component-props"])?void 0:e.allowAddnew)!==!1,onChange(e){let t={"x-uid":o["x-uid"]};n.componentProps.allowAddnew=e,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].allowAddnew=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"allowSelectExistingRecord",type:"switch",useVisible:()=>!ul(),useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l,refresh:r}=eY();return{title:t("Allow selection of existing records"),checked:null==(e=o["x-component-props"])?void 0:e.allowSelectExistingRecord,onChange(e){let t={"x-uid":o["x-uid"]};n.componentProps.allowSelectExistingRecord=e,o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].allowSelectExistingRecord=e,t["x-component-props"]=o["x-component-props"],l.emit("patch",{schema:t}),r()}}}},{name:"SetDefaultSortingRules",type:"modal",useComponentProps(){let{getCollectionJoinField:e}=sO(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{target:o}=e(n["x-collection-field"])||{},l=hd(o),{t:r}=(0,eT.useTranslation)(),{dn:i}=eY(),a=t.componentProps.sortArr||[],s=null==a?void 0:a.map(e=>(null==e?void 0:e.startsWith("-"))?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return{title:r("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:r("Set default sorting rules"),properties:{sort:{type:"array",default:s,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:l,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:r("ASC"),value:"asc"},{label:r("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:r("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{let{sort:o}=e,l=o.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);t.componentProps.sortArr=l,n["x-component-props"].sortArr=l,i.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":n["x-component-props"]}})}}},useVisible(){let{getCollectionJoinField:e}=sO(),{interface:t}=e((0,ec.useFieldSchema)()["x-collection-field"])||{};return ul()&&["m2m","o2m"].includes(t)}},{name:"clicktoselect",type:"modal",useVisible(){let e=ul(),t=ui();return!e&&t},useComponentProps(){var e,t,n,o;let{t:l}=(0,eT.useTranslation)(),r=(0,ec.useField)(),i=(0,ec.useFieldSchema)(),{dn:a,refresh:s}=eY(),c=eB(),d=tg(),[u,p]=(0,es.useState)((null==(e=i["x-component-props"].quickAddField)?void 0:e.value)||"none"),m=d.getCollection(i["x-collection-field"]),h=un(),x=m.fields.map(e=>{if("m2o"===e.interface||"select"===e.interface){var t;return{...e,label:c(null==(t=e.uiSchema)?void 0:t.title),value:e.name}}}).filter(Boolean);x.unshift({label:"none",value:"none"}),d.getCollectionFields("".concat(i["x-collection-field"],".").concat(u)).map(e=>{if("m2o"===e.interface)return{...e,label:c(e.uiSchema.title),value:e.name}}).filter(Boolean).unshift({label:l("none"),value:"none"});let f=(null==(n=i["x-component-props"])||null==(t=n.quickAddParentCollection)?void 0:t.value)||"none",v={type:"object",title:l("Click to select"),properties:{isquickaddtabs:{title:l("Enable quick create"),type:"boolean",default:(null==(o=i["x-component-props"])?void 0:o.isQuickAdd)||!1,"x-decorator":"FormItem","x-component":"Switch","x-component-props":{}},firstLevelselection:{title:l("Set Quick Add Tabs"),default:u,"x-decorator":"FormItem","x-component":"Select",enum:x,"x-reactions":[{dependencies:["isquickaddtabs"],fulfill:{state:{visible:"{{$deps[0] === true}}"}}}],"x-component-props":{onChange(e){p(e)}}},secondLevelselection:{title:l("Set Quick Add Parent Tabs"),default:f,"x-decorator":"FormItem","x-component":"SecondLevelSelect","x-reactions":[{dependencies:["firstLevelselection","isquickaddtabs"],fulfill:{state:{visible:'{{$deps[0] !== "none" && $deps[1] === true}}'},schema:{"x-component-props":{firstLevelValue:"{{$deps[0]}}",collectionField:i["x-collection-field"]}}}}]}}};return{components:{Switch:eh.Switch,SecondLevelSelect:Sg},title:l("Quick create"),schema:v,onSubmit:async e=>{var t;let{isquickaddtabs:n,firstLevelselection:o,secondLevelselection:l}=e,c={"x-uid":i["x-uid"]};r.componentProps.isQuickAdd=n,i["x-component-props"]=i["x-component-props"]||{},i["x-component-props"].isQuickAdd=n,c["x-component-props"]=i["x-component-props"],i["x-component-props"]=i["x-component-props"]||{},i["x-component-props"].quickAddField={fieldInterface:(null==(t=x.find(e=>e.value===o))?void 0:t.interface)||"none",value:o},c["x-component-props"]=i["x-component-props"],r.componentProps=r.componentProps||{},r.componentProps.quickAddField=i["x-component-props"].quickAddField,i["x-component-props"]=i["x-component-props"]||{},i["x-component-props"].quickAddParentCollection={collectionField:"".concat(i["x-collection-field"],".").concat(o,".").concat(l),value:l},c["x-component-props"]=i["x-component-props"],r.componentProps=r.componentProps||{},r.componentProps.quickAddParentCollection={collectionField:"".concat(i["x-collection-field"],".").concat(o,".").concat(l),value:l},nW(i)&&h&&(c.default=null,i.default=null,r.setInitialValue(null),r.setValue(null)),a.emit("patch",{schema:c}),s(),a.refresh()}}}},{name:"tablePagination",type:"switch",useComponentProps(){var e;let{dn:t}=eY(),n=(0,ec.useFieldSchema)(),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)();return{title:o("Pagination"),checked:(null==(e=n["x-component-props"])?void 0:e.pagination)||!1,onChange(e){n["x-component-props"].pagination||(n["x-component-props"]={...n["x-component-props"],pagination:!1}),n["x-component-props"].pagination=e,l.componentProps.pagination=e,t.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":{...null==n?void 0:n["x-component-props"]}}}),t.refresh()}}}}]}),Sb=new or({name:"fieldSettings:component:Tag",items:[{name:"fieldComponent",type:"select",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),t=(0,ec.useField)(),n=un(),{fieldSchema:o,collectionField:l}=sb(),r=SN({fieldSchema:o,collectionField:l}),i=(0,ec.useFieldSchema)(),a=o||i,s=ux(),{dn:c}=eY();return{title:e("Field component"),options:r,value:s,onChange(e){let o={"x-uid":a["x-uid"]};a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].mode=e,o["x-component-props"]=a["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.mode=e,nW(a)&&n&&(o.default=null,a.default=null,t.setInitialValue(null),t.setValue(null)),c.emit("patch",{schema:o}),c.refresh()}}}},{name:"tagColorField",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),r=tA(),{fieldSchema:i,collectionField:a}=sb(),s=i||l,c=a||r,{dn:d}=eY(),u=d9(null!=(t=null==c?void 0:c.target)?t:null==c?void 0:c.targetCollection);return{title:n("Tag color field"),options:u,value:null==o||null==(e=o.componentProps)?void 0:e.tagColorField,onChange(e){let t={"x-uid":s["x-uid"]};s["x-component-props"]=s["x-component-props"]||{},s["x-component-props"].tagColorField=e,t["x-component-props"]=s["x-component-props"],o.componentProps.tagColorField=e,d.emit("patch",{schema:t}),d.refresh()}}}},{name:"titleField",type:"select",useComponentProps(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useField)(),{fieldSchema:l,collectionField:r}=sb(),i=(0,ec.useFieldSchema)(),a=l||i,s=uh(),c=tA(),d=r||c,{dn:u}=eY();return{title:n("Title field"),options:s,value:null==o||null==(t=o.componentProps)||null==(e=t.fieldNames)?void 0:e.label,onChange(e){var t,n;let l={"x-uid":a["x-uid"]},r={...null==d||null==(n=d.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...o.componentProps.fieldNames,label:e};a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].fieldNames=r,l["x-component-props"]=a["x-component-props"],o.componentProps.fieldNames=a["x-component-props"].fieldNames,u.emit("patch",{schema:l}),u.refresh()}}}},{name:"enableLink",type:"switch",useVisible:()=>(0,ec.useField)().readPretty,useComponentProps(){var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{dn:l}=eY();return{title:t("Enable link"),checked:(null==(e=o["x-component-props"])?void 0:e.enableLink)!==!1,onChange(e){o["x-component-props"]={...null==o?void 0:o["x-component-props"],enableLink:e},n.componentProps.enableLink=e,l.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":{...null==o?void 0:o["x-component-props"]}}}),l.refresh()}}}}]}),SC=new or({name:"fieldSettings:component:UnixTimestamp",items:[{name:"dateDisplayFormat",Component:s6,useComponentProps(){let e=(0,ec.useFieldSchema)(),{fieldSchema:t}=sb();return{fieldSchema:t||e}}}]});class SS extends eR{async load(){this.schemaSettingsManager.add(bD),this.schemaSettingsManager.add(ba),this.schemaSettingsManager.add(bs),this.schemaSettingsManager.add(bc),this.schemaSettingsManager.add(CU),this.schemaSettingsManager.add(CW),this.schemaSettingsManager.add(CH),this.schemaSettingsManager.add(CT),this.schemaSettingsManager.add(CN),this.schemaSettingsManager.add(CD),this.schemaSettingsManager.add(CR),this.schemaSettingsManager.add(CG),this.schemaSettingsManager.add(CL),this.schemaSettingsManager.add(Cz),this.schemaSettingsManager.add(CK),this.schemaSettingsManager.add(CY),this.schemaSettingsManager.add(Cm),this.schemaSettingsManager.add(Cb),this.schemaSettingsManager.add(CC),this.schemaSettingsManager.add(CI),this.schemaSettingsManager.add(Ck),this.schemaSettingsManager.add(Cv),this.schemaSettingsManager.add(Cg),this.schemaSettingsManager.add(Cf),this.schemaSettingsManager.add(Ch),this.schemaSettingsManager.add(CA),this.schemaSettingsManager.add(Cj),this.schemaSettingsManager.add(c1),this.schemaSettingsManager.add(Cw),this.schemaSettingsManager.add(CF),this.schemaSettingsManager.add(CS),this.schemaSettingsManager.add(Cp),this.schemaSettingsManager.add(Cy),this.schemaSettingsManager.add(Cx),this.schemaSettingsManager.add(bd),this.schemaSettingsManager.add(y9),this.schemaSettingsManager.add(bR),this.schemaSettingsManager.add(C$),this.schemaSettingsManager.add(C3),this.schemaSettingsManager.add(C7),this.schemaSettingsManager.add(Ss),this.schemaSettingsManager.add(Sc),this.schemaSettingsManager.add(C9),this.schemaSettingsManager.add(Sy),this.schemaSettingsManager.add(C4),this.schemaSettingsManager.add(SC),this.schemaSettingsManager.add(Sn),this.schemaSettingsManager.add(Si),this.schemaSettingsManager.add(Sl),this.schemaSettingsManager.add(CQ),this.schemaSettingsManager.add(Sd),this.schemaSettingsManager.add(C5),this.schemaSettingsManager.add(Se),this.schemaSettingsManager.add(Sb),this.schemaSettingsManager.add(CJ),this.schemaSettingsManager.add(St),this.schemaSettingsManager.add(CX),this.schemaSettingsManager.add(Sa)}}let Sw=()=>null,SF=()=>{let{designable:e}=eY(),t=(0,ec.useFieldSchema)(),n=eE((0,es.useMemo)(()=>t["x-designer"]||t["x-toolbar"]?t["x-designer"]||t["x-toolbar"]:t["x-settings"]?sN:Sw,[t]));return e&&n||Sw},Sj=e=>{let t=(0,es.useContext)(ec.SchemaOptionsContext),n=(0,es.useContext)(ec.SchemaExpressionScopeContext),o=(0,es.useRef)();return o.current=n,e.toFieldProps({...t,get scope(){return{...t.scope,...o.current}}})};function SA(){return(0,es.useContext)(eV)}let Sk=()=>{var e;let{getCollectionJoinField:t,getCollection:n}=sO(),o=(0,ec.useFieldSchema)(),{getField:l}=tJ(),r=l(o.name)||t(o["x-collection-field"]),{t:i}=(0,eT.useTranslation)(),{label:a}=(null==(e=o["x-component-props"])?void 0:e.fieldNames)||{};return(0,es.useMemo)(()=>{if(!r||!(null==r?void 0:r.interface)||!["o2o","oho","obo","o2m","linkTo","m2o","m2m"].includes(r.interface))return;let e=n(r.target);if((null==e?void 0:e.template)==="file")return[{label:i("Record picker"),value:"CollectionField"},{label:i("Select"),value:"AssociationSelect"}];switch(r.interface){case"o2m":return[{label:i("Record picker"),value:"CollectionField"},{label:i("Subtable"),value:"TableField"},{label:i("Select"),value:"AssociationSelect"}];case"m2o":case"m2m":case"linkTo":return[{label:i("Record picker"),value:"CollectionField"},{label:i("Select"),value:"AssociationSelect"}];default:return[{label:i("Record picker"),value:"CollectionField"},{label:i("Subform"),value:"FormField"},{label:i("Select"),value:"AssociationSelect"}]}},[i,null==r?void 0:r.interface,a])},SI=()=>{var e;let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{getField:o}=tJ(),{getCollectionJoinField:l}=sO(),r=o(n.name)||l(n["x-collection-field"]),i=eB();(0,es.useEffect)(()=>{if(!(null==t?void 0:t.title)){var e;t.title=i(null==r||null==(e=r.uiSchema)?void 0:e.title)}},[null==r||null==(e=r.uiSchema)?void 0:e.title])};var SP=n(30572);let ST=()=>{let[e,t]=(0,es.useState)(0),[n,o]=(0,es.useState)(0),l=(0,es.useRef)(null),r=(0,es.useCallback)(()=>{var e,n,r;if(!l.current)return;let i=l.current.getBoundingClientRect(),a=Math.ceil((null==i?void 0:i.height)||0),s=(null==(e=l.current.querySelector(".ant-table-header"))?void 0:e.getBoundingClientRect().height)||0,c=null==(n=l.current.querySelector(".ant-table"))?void 0:n.getBoundingClientRect();if(!c)return;let d=null==(r=l.current.querySelector(".ant-table-pagination"))?void 0:r.getBoundingClientRect(),u=d?d.y-c.height-c.y+d.height:0;o(i.width),t(a-s-u)},[]);return(0,SP.A)("resize",r),{height:e,width:n,tableSizeRefCallback:e=>{l.current=e&&e.children?e.children[0]:null,r()}}},SN=e=>{var t,n,o;let{t:l}=(0,eT.useTranslation)(),{getCollectionJoinField:r,getCollection:i}=sO(),a=(0,ec.useFieldSchema)(),s=(null==e?void 0:e.fieldSchema)||a,c=(0,ec.useField)(),d=(0,ec.useForm)(),u=(null==s?void 0:s["x-read-pretty"])||c.readPretty||d.readPretty,p=tr(),m=null==e?void 0:e.fieldSchema,{getField:h}=tJ(),x=(null==e?void 0:e.collectionField)||h(s.name)||r(s["x-collection-field"]),f=p.collectionFieldInterfaceManager.getFieldInterface(null==x?void 0:x.interface),{label:v}=(null==(t=s["x-component-props"])?void 0:t.fieldNames)||{},g=eB(),y=(0,es.useMemo)(()=>{if(!x||!(null==x?void 0:x.interface))return[];if(!["o2o","oho","obo","o2m","linkTo","m2o","m2m","updatedBy","createdBy"].includes(x.interface))return;let e=i(x.target);if((null==e?void 0:e.template)==="file")return u?[{label:l("Title"),value:"Select"},{label:l("File manager"),value:"FileManager"},{label:l("Tag"),value:"Tag"}]:[{label:l("Select"),value:"Select"},{label:l("Record picker"),value:"Picker"},{label:l("File manager"),value:"FileManager"}];if((null==e?void 0:e.template)==="tree"&&["m2m","o2m","m2o"].includes(x.interface))return u?[{label:l("Title"),value:"Select"},{label:l("Tag"),value:"Tag"}]:[{label:l("Select"),value:"Select"},{label:l("Record picker"),value:"Picker"},["m2m","o2m"].includes(x.interface)&&{label:l("Sub-table"),value:"SubTable"},{label:l("Cascade Select"),value:"CascadeSelect"},!m&&{label:l("Sub-form"),value:"Nester"},{label:l("Subform: Popover"),value:"PopoverNester"},{label:l("Subtable: Drawer"),value:"DrawerSubTable"},{label:l("Cascader"),value:"Cascader"}];switch(x.interface){case"o2m":return u?[{label:l("Title"),value:"Select"},{label:l("Tag"),value:"Tag"},!m&&{label:l("Sub-table"),value:"SubTable"},!m&&{label:l("Sub-details"),value:"Nester"}]:[{label:l("Select"),value:"Select"},{label:l("Record picker"),value:"Picker"},!m&&{label:l("Sub-form"),value:"Nester"},{label:l("Subform: Popover"),value:"PopoverNester"},{label:l("Subtable: Drawer"),value:"DrawerSubTable"},!m&&{label:l("Sub-table"),value:"SubTable"}];case"m2m":return u?[{label:l("Title"),value:"Select"},{label:l("Tag"),value:"Tag"},!m&&{label:l("Sub-details"),value:"Nester"},!m&&{label:l("Sub-table"),value:"SubTable"}]:[{label:l("Select"),value:"Select"},{label:l("Record picker"),value:"Picker"},!m&&{label:l("Sub-table"),value:"SubTable"},!m&&{label:l("Sub-form"),value:"Nester"},{label:l("Subform: Popover"),value:"PopoverNester"},{label:l("Subtable: Drawer"),value:"DrawerSubTable"}];case"m2o":case"linkTo":return u?[{label:l("Title"),value:"Select"},{label:l("Tag"),value:"Tag"},!m&&{label:l("Sub-details"),value:"Nester"}]:[{label:l("Select"),value:"Select"},{label:l("Record picker"),value:"Picker"},!m&&{label:l("Sub-form"),value:"Nester"},{label:l("Subform: Popover"),value:"PopoverNester"},{label:l("Subtable: Drawer"),value:"DrawerSubTable"},{label:l("Cascader"),value:"Cascader"}];default:return u?[{label:l("Title"),value:"Select"},{label:l("Tag"),value:"Tag"},!m&&{label:l("Sub-details"),value:"Nester"}]:[{label:l("Select"),value:"Select"},{label:l("Record picker"),value:"Picker"},!m&&{label:l("Sub-form"),value:"Nester"},{label:l("Subform: Popover"),value:"PopoverNester"},{label:l("Subtable: Drawer"),value:"DrawerSubTable"}]}},[l,null==x?void 0:x.interface,v]);return null==f||null==(o=f.componentOptions)||null==(n=o.filter(e=>!e.useVisible||e.useVisible()))||n.forEach(e=>{(null==y?void 0:y.find(t=>t.value===e.value))||null==y||y.push({label:g(e.label),value:e.value})}),(y||[]).filter(Boolean)},SM=(0,ec.observer)(e=>{let{t}=(0,eT.useTranslation)(),[n,o]=(0,es.useState)(!0);return(0,A.jsxs)(eq.DndContext,{collisionDetection:eq.rectIntersection,...e,onDragStart:t=>{var n,l,r;let{active:i}=t;o(!!(null==i||null==(l=i.data)||null==(n=l.current)?void 0:n.schema)),(null==e?void 0:e.onDragStart)&&(null==e||null==(r=e.onDragStart)||r.call(e,t))},onDragEnd:(e=>{let{refresh:t}=eY(),n=eC(),{t:o}=(0,eT.useTranslation)();return l=>{var r,i,a,s,c,d,u,p,m,h,x,f,v,g,y,b,C,S,w,F;let{active:j,over:A}=l,k=null==j||null==(i=j.data)||null==(r=i.current)?void 0:r.schema,I=null==A||null==(s=A.data)||null==(a=s.current)?void 0:a.schema,P=null==A||null==(d=A.data)||null==(c=d.current)?void 0:c.insertAdjacent,T=null==A||null==(p=A.data)||null==(u=p.current)?void 0:u.breakRemoveOn,N=null==A||null==(h=A.data)||null==(m=h.current)?void 0:m.wrapSchema,M=null==A||null==(f=A.data)||null==(x=f.current)?void 0:x.onSuccess,D=null==(y=null==A||null==(g=A.data)||null==(v=g.current)?void 0:v.removeParentsIfNoChildren)||y;if(!k||!I){null==e||null==(b=e.onDragEnd)||b.call(e,l);return}if(k===I){null==e||null==(C=e.onDragEnd)||C.call(e,l);return}if(k.parent===I&&"beforeEnd"===P){null==e||null==(S=e.onDragEnd)||S.call(e,l);return}let R=ez({t:o,api:n,refresh:t,current:I});if(R.loadAPIClientEvents(),k.parent===I.parent){R.insertBeforeBeginOrAfterEnd(k),null==e||null==(w=e.onDragEnd)||w.call(e,l);return}if(P){R.insertAdjacent(P,k,{wrap:N,breakRemoveOn:T,removeParentsIfNoChildren:D,onSuccess:M}),null==e||null==(F=e.onDragEnd)||F.call(e,l);return}}})(e),children:[(0,A.jsx)(eq.DragOverlay,{dropAnimation:{duration:10,easing:"cubic-bezier(0.18, 0.67, 0.6, 1.22)"}}),e.children]})},{displayName:"DndContext"});var SD=n(61146),SR=n(17074);let Sq=(0,es.createContext)(null);Sq.displayName="DraggableContext";let S_=(0,es.createContext)(null);S_.displayName="SortableContext";let SO=e=>{let{id:t,data:n,children:o}=e,l=(0,eq.useDraggable)({id:t,data:n}),r=(0,eq.useDroppable)({id:t,data:n});return(0,A.jsx)(S_.Provider,{value:{draggable:l,droppable:r},children:o})},SB=(0,es.forwardRef)((e,t)=>{var n,o;let{component:l,overStyle:r,style:i,children:a,openMode:s,...c}=e,{token:d}=iw.A.useToken(),{draggable:u,droppable:p}=(0,es.useContext)(S_),{isOver:m,setNodeRef:h}=p,x=(0,SR.useMergeRefs)([h,t]),f={...i};return m&&(null==u||null==(n=u.active)?void 0:n.id)!==(null==p||null==(o=p.over)?void 0:o.id)&&(f["a"===l?"color":"background"]=new SD.q(d.colorSettings).setAlpha(.15).toHex8String(),Object.assign(f,r)),es.createElement(l||"div",{role:"none",...c,className:r6()("tb-sortable-designer",e.className),ref:x,style:f},a)}),SE=(0,ec.observer)(e=>{var t;let n,o,l,{schema:r,id:i,eid:a,removeParentsIfNoChildren:s,...c}=(t=e,n=(0,ec.useField)(),o=t.id?t.id:n.address.toString(),l=(0,ec.useFieldSchema)(),e.schema?{...e,id:o}:{...e,id:o,schema:l}),d=(0,es.useMemo)(()=>({insertAdjacent:"afterEnd",schema:r,removeParentsIfNoChildren:null==s||s}),[r,s]);return(0,A.jsx)(SO,{id:i,data:d,children:(0,A.jsx)(SB,{id:a,...c,ref:e.ref,children:e.children})})},{displayName:"SortableItem",forwardRef:!0}),SV=e=>{let{draggable:t}=(0,es.useContext)(S_),{attributes:n,listeners:o,setNodeRef:l}=t;return(0,A.jsx)("div",{style:{display:"inline-block",width:14,height:14,lineHeight:"14px",textAlign:"left"},children:(0,A.jsx)("div",{ref:l,style:{position:"relative",zIndex:1,lineHeight:0,fontSize:0,display:"inline-block"},...o,...n,role:"none",children:(0,A.jsx)("span",{style:{cursor:"move",fontSize:14},children:e.children})})})},Sz=e=>{let{form:t,children:n,...o}=e,l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),i=e_(t.createVoidField({...l.props,basePath:""}));return(0,A.jsx)(ec.FieldContext.Provider,{value:void 0,children:(0,A.jsx)(ec.FormContext.Provider,{value:t,children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",...o,children:(0,A.jsx)(ec.RecursionField,{basePath:i.address,schema:r,onlyRenderProperties:!0})})})})},SL=e=>e.children,SG=e=>{let{form:t,children:n,disabled:o,...l}=e,r=(0,ec.useField)(),i=(0,ec.useFieldSchema)(),a=e_(t.createVoidField({...r.props,basePath:""})),s=eE(i["x-component"],SL);return(0,es.useEffect)(()=>{t.disabled=o||r.disabled},[o,r.disabled]),(0,A.jsx)(og.Ay,{componentDisabled:o,children:(0,A.jsx)(ec.FieldContext.Provider,{value:void 0,children:(0,A.jsx)(ec.FormContext.Provider,{value:t,children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",...l,children:(0,A.jsx)(ec.FieldContext.Provider,{value:a,children:(0,A.jsx)(s,{...r.componentProps,children:(0,A.jsx)(ec.RecursionField,{basePath:a.address,schema:i,onlyRenderProperties:!0})})})})})})})},SK=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ek((e=>{let{request:t,initialValue:n}=e;return t||(()=>Promise.resolve({data:n}))})(t),e)},S$=(0,es.createContext)(null);S$.displayName="FormBlockContext";let SU=(0,ec.observer)(e=>{let{request:t,effects:n,initialValue:o,useValues:l=SK,...r}=e,i=(0,ec.useFieldSchema)(),a=(0,ec.useField)(),s=(0,es.useMemo)(()=>(0,ec.createForm)({effects:n}),[]),c=l({uid:i["x-uid"],async onSuccess(e){await s.reset(),s.setValues(null==e?void 0:e.data),s.setInitialValues(null==e?void 0:e.data)}},e),d=(0,es.useContext)(S$);return(0,A.jsx)(S$.Provider,{value:{parent:d,form:s,result:c,field:a,fieldSchema:i},children:(0,A.jsx)(eD.A,{spinning:(null==c?void 0:c.loading)||!1,children:"Form"===i["x-decorator"]?(0,A.jsx)(SG,{form:s,...r}):(0,A.jsx)(Sz,{form:s,...r})})})},{displayName:"Form"});SU.Designer=function(){let{name:e,title:t}=tJ(),n=rh();return(0,A.jsxs)(sP,{template:n,title:t||e,children:[(0,A.jsx)(aB,{componentName:"Form",collectionName:e}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})};let SW=new or({name:"FormV1Settings",items:[{name:"template",Component:aB,useComponentProps(){let{name:e}=tJ();return{componentName:"Form",collectionName:e}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});function SH(){let e=(0,ns._)(["\n .ant-formily-item-feedback-layout-loose {\n margin-bottom: 12px;\n }\n "]);return SH=function(){return e},e}let SY=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(SH())}}),SX=e=>{let{form:t,children:n,...o}=e,l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),i=e_(t.createVoidField({...l.props,basePath:""}));return(0,A.jsx)(ec.FieldContext.Provider,{value:void 0,children:(0,A.jsx)(ec.FormContext.Provider,{value:t,children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",...o,children:(0,A.jsx)(ec.RecursionField,{basePath:i.address,schema:r,onlyRenderProperties:!0})})})})},SJ=e=>e.children,SQ=e=>{let{form:t,children:n,disabled:o,...l}=e,r=(0,ec.useField)(),i=(0,ec.useFieldSchema)(),a=e_(t.createVoidField({...r.props,basePath:""})),s=eE(i["x-component"],SJ);return(0,A.jsx)(ec.FieldContext.Provider,{value:void 0,children:(0,A.jsx)(ec.FormContext.Provider,{value:t,children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",...l,children:(0,A.jsx)(ec.FieldContext.Provider,{value:a,children:(0,A.jsx)(s,{...r.componentProps,children:(0,A.jsx)(ec.RecursionField,{basePath:a.address,schema:i,onlyRenderProperties:!0})})})})})})},SZ=e=>{var t,n;let o,{form:l}=e,r=(0,ec.useFieldSchema)(),{setFormValueChanged:i}=co(),a=lN(),s=lT({currentForm:l}),c=(null==(o=null,r.mapProperties(e=>{e["x-linkage-rules"]&&(o=e["x-linkage-rules"])}),t=o||(null==(n=r.parent)?void 0:n["x-linkage-rules"]))?void 0:t.filter(e=>!e.disabled))||[];return(0,es.useEffect)(()=>{let t=(0,ec.uid)();return l.addEffects(t,()=>{(0,ec.onFormInputChange)(()=>{null==i||i(!0)})}),e.disabled&&(l.disabled=e.disabled),()=>{l.removeEffects(t)}},[l,e.disabled,i]),(0,es.useEffect)(()=>{let e=(0,ec.uid)(),t=[];return l.addEffects(e,()=>{c.forEach(e=>{var n;null==(n=e.actions)||n.forEach(n=>{var o;if(null==(o=n.targetFields)?void 0:o.length){let o=n.targetFields.join(",");(0,ec.onFieldInit)("*(".concat(o,")"),(o,l)=>{var r,i,d,u,p,m,h,x,f;o.initStateOfLinkageRules={display:(null==(r=o.initStateOfLinkageRules)?void 0:r.display)||c9(!0,o.display),required:(null==(i=o.initStateOfLinkageRules)?void 0:i.required)||c9(!0,o.required||!1),pattern:(null==(d=o.initStateOfLinkageRules)?void 0:d.pattern)||c9(!0,o.pattern),value:(null==(u=o.initStateOfLinkageRules)?void 0:u.value)||c9(!0,o.value||o.initialValue)},t.push((0,ec.reaction)(()=>[function(e){let{linkageRules:t,formValues:n}=e;return t.map(e=>{let t=e=>{let o=Object.keys(e)[0]||"$and";return e[o].map(e=>{if("$and"in e||"$or"in e)return t(e);let o=c8(e).join(".");return(0,eh.getValuesByPath)(n,o)}).filter(Boolean)};return t(e.condition)})}({linkageRules:c,formValues:l.values}),function(e){let{linkageRules:t,localVariables:n}=e;return t.map(e=>{let t=Object.keys(e.condition)[0]||"$and";return e.condition[t].map(e=>{let t=c4(e);return t?oY(t.value)?S2(t.value,n):t.value:null}).filter(Boolean)})}({linkageRules:c,localVariables:s}),function(e){var t;let{action:n,localVariables:o}=e,l=n.value,r=null==l?void 0:l.mode,i=(null==l?void 0:l.value)||(null==l?void 0:l.result);if("express"===r&&null!=i)return null==(t=i.match(oH))?void 0:t.map(e=>S2(e,o)).filter(Boolean)}({action:n,localVariables:s})].map(e=>JSON.stringify(e)).join(","),(p=n,m=o,h=e,x=a,f=s,()=>{de({operator:p.operator,value:p.value,field:m,condition:h.condition,variables:x,localVariables:f}),setTimeout(async()=>{var e;let t=function(e){switch(e){case am.Required:case am.InRequired:return"required";case am.Visible:case am.None:case am.Hidden:return"display";case am.Editable:case am.ReadOnly:case am.ReadPretty:return"pattern";case am.Value:return"value";default:return null}}(p.operator);if(!(null==(e=m.stateOfLinkageRules)?void 0:e[t]))return;let n=m.stateOfLinkageRules[t],o=(n=(n=await Promise.all(n)).filter(e=>e.condition))[n.length-1];"value"===t?n.length>1&&(m.value=o.value):(m[t]=null==o?void 0:o.value,"display"===t&&(null==o?void 0:o.value)==="none"&&(m.value=void 0)),m.stateOfLinkageRules[t]=null})}),{fireImmediately:!0}))})}})})}),()=>{l.removeEffects(e),t.forEach(e=>{e()})}},[c]),"FormV2"===r["x-decorator"]?(0,A.jsx)(SQ,{...e}):(0,A.jsx)(SX,{...e})},S0=e=>{let t=(0,ec.useFieldSchema)(),{setFormValueChanged:n}=co(),o=(0,es.useMemo)(()=>(0,ec.createForm)({disabled:e.disabled,effects(){(0,ec.onFormInputChange)(e=>{null==n||n(!0)})}}),[]);return"FormV2"===t["x-decorator"]?(0,A.jsx)(SQ,{form:o,...e}):(0,A.jsx)(SX,{form:o,...e})},S1=Tr((0,ec.observer)(e=>{let t=(0,ec.useField)(),{styles:n}=SY(),{form:o,disabled:l,...r}=iq(e),i=l||t.disabled;return(0,A.jsx)(og.Ay,{componentDisabled:i,children:(0,A.jsx)("form",{onSubmit:e=>e.preventDefault(),className:n.container,children:(0,A.jsx)(eD.A,{spinning:t.loading||!1,children:o?(0,A.jsx)(SZ,{form:o,...r,disabled:i}):(0,A.jsx)(S0,{...r,disabled:i})})})})}),{displayName:"Form"});function S2(e,t){var n;if(!oY(e))return;let o=lp(e),l={[o]:null==(n=t.find(e=>e.name===o))?void 0:n.ctx};return(0,eh.getValuesByPath)(l,oX(e))}let S6=()=>{let{name:e,title:t}=tJ(),n=rh();return(0,A.jsx)(sP,{schemaSettings:"FormDetailsSettings",template:n,title:t||e})},S3=e=>{let{value:t,options:n,onChange:o,mode:l,fieldNames:r,loading:i,rawOptions:a,defaultValue:s,...c}=e,d=(0,ec.useFieldSchema)(),u=d.collectionName,p=(0,ec.useForm)();(0,es.useEffect)(()=>{if(u&&d.name.toString().includes("__custom")&&s){let e=d.name.toString().split(".")[1];p.values.__custom[e]=null==s?void 0:s[r.value]}},[]);let m=t=>{var o;if(!(0,ec.isValid)(t)||"object"==typeof t&&0===Object.keys(t).length)return;let i=null==(o=Sh((0,ec.toArr)(t).filter(e=>e).map(e=>(0,eh.isPlainObject)(e)?e[r.value]:e),n,r))?void 0:o.map(e=>({label:e[r.label],value:e[r.value]}));return["tags","multiple"].includes(l)||e.multiple?i:i.shift()};return r.formula&&(delete c.onSearch,delete c.filterOption),(0,A.jsx)(oo.A,{role:"button","data-testid":"select-object-".concat(l||"single"),value:m(t),defaultValue:m(s),allowClear:{clearIcon:(0,A.jsx)(Sp.A,{role:"button","aria-label":"icon-close-select"})},labelInValue:!0,notFoundContent:i?(0,A.jsx)(eD.A,{}):(0,A.jsx)(op.A,{image:op.A.PRESENTED_IMAGE_SIMPLE}),options:n,fieldNames:r,showSearch:!0,popupMatchSelectWidth:!1,filterOption:(e,t)=>{var n;return(null!=(n=null==t?void 0:t[r.label||"label"])?n:"").includes(e)},filterSort:(e,t)=>{if("number"==typeof e[r.label])return e[r.label]-t[r.label];if("string"==typeof e[r.label]){var n,o;return(null!=(n=null==e?void 0:e[r.label||"label"])?n:"").toLowerCase().localeCompare((null!=(o=null==t?void 0:t[r.label||"label"])?o:"").toLowerCase())}},onChange:t=>{let i=Sh((0,ec.toArr)(t).map(e=>e.value),a||n,r);if(["tags","multiple"].includes(l)||e.multiple?null==o||o(i):null==o||o(i.shift()||null),u&&d.name.toString().includes("__custom")){let e=d.name.toString().split(".")[1];p.values.__custom[e]=null==t?void 0:t.value}},mode:l,tagRender:e=>(0,A.jsx)(nz.A,{role:"button","aria-label":e.label,closeIcon:(0,A.jsx)(cp.A,{role:"button","aria-label":"icon-close-tag"}),...e,children:e.label}),...c})},S5=e=>{let{objectValue:t,loading:n,value:o,rawOptions:l,defaultValue:r,...i}=e,a=e.multiple?"multiple":e.mode,s=null==i?void 0:i.params,[c,d]=(0,es.useState)([]),[u,p]=(0,es.useState)(""),m=(0,ec.useFieldSchema)(),h=eC();a&&!["multiple","tags","CustomTitle"].includes(a)&&(a=void 0);let x={...i};(null==i?void 0:i.collection)&&i.collection!==u?(h.request({url:i.collection+":list",params:{paginate:!1,filter:s?{...s.filter}:{}}}).then(e=>{d(null==e?void 0:e.data.data),x.options=null==e?void 0:e.data.data}).catch(()=>{}),p(i.collection)):(null==i?void 0:i.collection)===u?x.options=c.map(e=>({...e})):x.options=S4(e.fieldNames.formula,(null==e?void 0:e.options)||[],m);let f=(e=>{let t,n=(0,ec.useFieldSchema)(),{getField:o}=tJ(),l=(0,es.useMemo)(()=>o(n["x-collection-field"]),[n["x-collection-field"]]);if(!(null==l?void 0:l.target)&&!n.collectionName)return e;let r={resource:(null==l?void 0:l.target)||n.collectionName,action:"list",params:{paginate:!1}},i=/{{(.*?)}}/g,a=[];for(;null!==(t=i.exec(e.fieldNames.formula));)a.push(t[1]);let s=a.filter(e=>e.includes("."));s.length&&(r.params.appends=s.map(e=>e.split(".")[0]));let c=e.fieldNames.formula,[d,u]=(0,es.useState)([]),{run:p}=ek(r,{manual:!0,onSuccess:e=>{u(e.data)}});if((0,es.useEffect)(()=>{c?p():u(e.options)},[c]),c){var m;null==(m=e.options)||m.forEach(t=>{let n,o={},l="";null==d||d.forEach(e=>{if(t.id===e.id){for(;n=i.exec(c);)if(n[1].includes(".")){let t=e[n[1].split(".")[0]]?e[n[1].split(".")[0]][n[1].split(".")[1]]:"";o[n[1]]=null!=t?t:""}else o[n[1]]=e[n[1]]||"";l=c.replace(/{{(.*?)}}/g,function(e,t){return Object.prototype.hasOwnProperty.call(o,t)?o[t]:e})}}),t[e.fieldNames.label]=l})}return e})(x);return(0,A.jsx)(S3,{rawOptions:l,...f,defaultValue:r,value:o,mode:a,loading:n})},S4=(e,t,n)=>t.map(t=>{let o=t.label,l=e.replace(RegExp("{{".concat(n.name,"}}"),"g"),o);return{...t,label:l}}),S8=e=>{let{value:t,options:n,onChange:o,fieldNames:l,mode:r,loading:i,rawOptions:a,defaultValue:s,...c}=e,d=t=>{var o;if(!(0,ec.isValid)(t)||"object"==typeof t&&0===Object.keys(t).length)return;let i=null==(o=Sh((0,ec.toArr)(t).filter(e=>e).map(e=>(0,eh.isPlainObject)(e)?e[l.value]:e),n,l))?void 0:o.map(e=>({label:e[l.label],value:e[l.value]}));return["tags","multiple"].includes(r)||e.multiple?i:i.shift()};return(0,A.jsx)(oo.A,{role:"button","data-testid":"select-object-".concat(r||"single"),value:d(t),defaultValue:d(s),allowClear:{clearIcon:(0,A.jsx)(Sp.A,{role:"button","aria-label":"icon-close-select"})},labelInValue:!0,notFoundContent:i?(0,A.jsx)(eD.A,{}):(0,A.jsx)(op.A,{image:op.A.PRESENTED_IMAGE_SIMPLE}),options:n,fieldNames:l,showSearch:!0,popupMatchSelectWidth:!1,filterOption:(e,t)=>{var n;return(null!=(n=null==t?void 0:t[l.label||"label"])?n:"").includes(e)},filterSort:(e,t)=>{var n,o;return(null!=(n=null==e?void 0:e[l.label||"label"])?n:"").toLowerCase().localeCompare((null!=(o=null==t?void 0:t[l.label||"label"])?o:"").toLowerCase())},onChange:t=>{let i=Sh((0,ec.toArr)(t).map(e=>e.value),a||n,l);["tags","multiple"].includes(r)||e.multiple?null==o||o(i):null==o||o(i.shift()||null)},mode:r,tagRender:e=>(0,A.jsx)(nz.A,{role:"button","aria-label":e.label,closeIcon:(0,A.jsx)(cp.A,{role:"button","aria-label":"icon-close-tag"}),...e,children:e.label}),...c})},S7=(e,t)=>{var n;return(null!=(n=null==t?void 0:t.label)?n:"").toLowerCase().includes((e||"").toLowerCase())},S9=(0,ec.connect)(e=>{let{objectValue:t,loading:n,value:o,rawOptions:l,defaultValue:r,...i}=e,a=e.multiple?"multiple":e.mode;a&&!["multiple","tags","CustomTitle"].includes(a)&&(a=void 0);let s=e.options?[...e.options]:[];if(["CustomTitle"].includes(e.mode)&&("formula"in i.fieldNames||"collection"in e))return(0,A.jsx)(S5,{...e});if(t)return(0,A.jsx)(S8,{rawOptions:l,...i,defaultValue:r,value:o,mode:a,loading:n});let c=t=>["tags","multiple"].includes(e.mode)||e.multiple?t?(0,ec.toArr)(t):void 0:t;return(0,A.jsx)(oo.A,{role:"button","data-testid":"select-".concat(a||"single"),showSearch:!0,filterOption:S7,allowClear:{clearIcon:(0,A.jsx)(Sp.A,{role:"button","aria-label":"icon-close-select"})},options:s,popupMatchSelectWidth:!1,notFoundContent:n?(0,A.jsx)(eD.A,{}):(0,A.jsx)(op.A,{image:op.A.PRESENTED_IMAGE_SIMPLE}),value:c(o),defaultValue:c(r),tagRender:e=>(0,A.jsx)(nz.A,{role:"button","aria-label":e.label,closeIcon:(0,A.jsx)(cp.A,{role:"button","aria-label":"icon-close-tag"}),...e,children:e.label}),...i,onChange:t=>{var n;null==(n=e.onChange)||n.call(e,void 0===t?null:t)},mode:a})},(0,ec.mapProps)({dataSource:"options"},(e,t)=>({...e,fieldNames:{...Sm,...e.fieldNames},suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon})),(0,ec.mapReadPretty)(Sx)),we=(0,ec.connect)(e=>{let{options:t,value:n,onChange:o}=e;return(0,A.jsx)("div",{onClick:e=>{e.stopPropagation();let t=e.target.value;"radio"===e.target.type&&t===n&&(null==o||o(""))},children:(0,A.jsx)(sU.Ay.Group,{...e,value:n,options:t})})},(0,ec.mapProps)({dataSource:"options",onInput:"onChange",value:"value"}),(0,ec.mapReadPretty)(Sx)),wt=e=>"Radio group"===e.mode?(0,A.jsx)(we,{...e}):(0,A.jsx)(S9,{...e});wt.ReadPretty=Sx;let wn=(0,ec.observer)(e=>{let t,n={...Sm,...e.fieldNames},o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),r=m3(),{snapshot:i}=co(),{data:a}=ek(i?async()=>({data:r[l.name]}):{action:"list",...e.service,params:{paginate:!1,filter:{[n.value]:{$in:(t=o.value,(0,ed.castArray)(t).filter(e=>null!=e).map(e=>"object"==typeof e?e[n.value]:e))}}}},{refreshDeps:[e.service,o.value]});return(0,A.jsx)(wt.ReadPretty,{...e,options:null==a?void 0:a.data})},{displayName:"ReadPretty"}),wo=(0,ec.connect)(e=>{var t,n;let{fieldNames:o={},service:l={},wait:r=300,value:i,defaultValue:a,objectValue:s,manual:c=!0,mapOptions:d,targetField:u,CustomDropdownRender:p,optionFilter:m,...h}=e,x=t$(tc()),[f,v]=(0,es.useState)(!1),g=(0,es.useRef)(!1),y=(0,ec.useFieldSchema)(),b=(null==(t=y["x-component-props"])?void 0:t.addMode)==="quickAdd",{getField:C}=tJ(),S=(0,es.useRef)(null),{getCollectionJoinField:w,getInterface:F}=sO(),j=y["x-collection-field"]||y.name,k=C(j)||w(j),I=u||(null==k?void 0:k.target)&&(null==o?void 0:o.label)&&w("".concat(k.target,".").concat(o.label)),T=(0,es.useMemo)(()=>{if(null==I?void 0:I.interface){var e,t,n,o;return(null==(o=F(I.interface))||null==(n=o.filterable)||null==(t=n.operators)||null==(e=t[0])?void 0:e.value)||"$includes"}return"$includes"},[I]),N=eB(),M=(0,es.useCallback)(e=>{try{return e.filter(e=>["number","string"].includes(typeof e[o.value])).map(e=>{var t;let n=N(e[o.label]);if(null==I||null==(t=I.uiSchema)?void 0:t.enum)if(Array.isArray(n))n=n.map((e,t)=>{let n=I.uiSchema.enum.find(t=>t.value===e);return n?(0,A.jsx)(nz.A,{role:"button",color:n.color,style:{marginRight:3},children:(null==n?void 0:n.label)||e},t):(0,A.jsx)(nz.A,{role:"button",children:e},e)}).reverse();else{let e=I.uiSchema.enum.find(e=>e.value===n);e&&(n=(0,A.jsx)(nz.A,{role:"button",color:e.color,children:e.label}))}return((null==I?void 0:I.type)==="date"&&(n=P()(n).format("YYYY-MM-DD")),d)?d({[o.label]:n||"N/A",[o.value]:e[o.value]}):{...e,[o.label]:n||"N/A",[o.value]:e[o.value]}}).filter(Boolean)}catch(t){return console.error(t),e}},[null==I?void 0:I.uiSchema,o]),D={...null==l?void 0:l.params,filter:null==l||null==(n=l.params)?void 0:n.filter};o.formula?D.paginate=!1:D.pageSize=200;let{data:R,run:q,loading:_}=ek({action:"list",...l,headers:x,params:D},{manual:c,debounceWait:r}),O=(0,es.useMemo)(()=>JSON.stringify({service:l,fieldNames:o}),[l,o]),B=(0,es.useCallback)(()=>S.current&&p?(0,A.jsx)(p,{search:S.current,callBack:()=>{S.current=null,v(!1)}}):null,[S.current]);(0,es.useEffect)(()=>{g.current&&q()},[O]);let E=async e=>{var t;q({filter:pA([e?{[o.label]:{[T]:e}}:{},null==l||null==(t=l.params)?void 0:t.filter])}),S.current=e},V=(0,es.useMemo)(()=>{var e;let t=i||a;if(!(null==R||null==(e=R.data)?void 0:e.length))return null!=t?Array.isArray(t)?t:[t]:[];let n=null!=t&&(Array.isArray(t)?t:[{...t,[o.value]:t[o.value]||t}])||[],l="function"==typeof m?R.data.filter(m):R.data;return(0,ed.uniqBy)(l.concat(null!=n?n:[]),o.value)},[i,a,null==R?void 0:R.data,o.value,m]);return(0,A.jsx)(wt,{open:f,popupMatchSelectWidth:!1,autoClearSearchValue:!0,filterOption:!1,filterSort:null,fieldNames:o,onSearch:E,onDropdownVisibleChange:e=>{v(e),S.current=null,e&&q(),g.current=!0},objectValue:s,value:i,defaultValue:a,...h,loading:!R||_,options:M(V),rawOptions:V,dropdownRender:e=>{let t=V.some(e=>e[o.label]===S.current);return(0,A.jsx)(A.Fragment,{children:b?(0,A.jsxs)(A.Fragment,{children:[!((null==R?void 0:R.data.length)===0&&(null==S?void 0:S.current))&&e,(null==R?void 0:R.data.length)>0&&(null==S?void 0:S.current)&&!t&&(0,A.jsx)(mA.A,{style:{margin:0}}),!t&&(0,A.jsx)(B,{})]}):e})}})},(0,ec.mapProps)({dataSource:"options"},(e,t)=>{var n;let o=(0,ec.useFieldSchema)();return{...e,fieldNames:{...Sm,...e.fieldNames,...t.componentProps.fieldNames,...null==(n=o["x-component-props"])?void 0:n.fieldNames},suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon}}),(0,ec.mapReadPretty)(wn));wo.ReadPretty=wn;let wl=e=>{let{style:t={},form:n}=e,{token:o}=iw.A.useToken(),{templates:l,display:r,enabled:i,defaultTemplate:a}=(()=>{let e,t=(0,ec.useFieldSchema)(),{t:n}=(0,eT.useTranslation)(),{duplicateData:o}=Tp(),{getCollectionJoinField:l}=sO();if(o)return o;let{items:r=[],display:i=!0}=(e=Tx(t))&&eu().cloneDeep(e["x-data-templates"])||{};return r.forEach(e=>{try{var t;e.fields=null==(t=e.fields)?void 0:t.map(t=>l("".concat(e.collection,".").concat(t))?t:"").filter(Boolean)}catch(t){(0,eh.error)(t),e.fields=[]}}),{templates:[{key:"none",title:n("None")}].concat(r.map((e,t)=>({key:t,...e,isLeaf:null!==e.dataId&&void 0!==e.dataId,titleCollectionField:(null==e?void 0:e.titleField)&&l("".concat(e.collection,".").concat(e.titleField))}))),display:i,defaultTemplate:r.find(e=>e.default),enabled:r.length>0&&r.every(e=>e.dataId||e.dataScope)}})(),{getCollectionJoinField:s}=sO(),c=ip(l),[d,u]=(0,es.useState)((null==a?void 0:a.key)||"none"),[p,m]=(0,es.useState)(null),h=eC(),{t:x}=(0,eT.useTranslation)();(0,es.useEffect)(()=>{i&&a&&(n.__template=!0,"duplicate"===a.key&&y(a.dataId,a))},[]),(0,es.useEffect)(()=>{(null==c?void 0:c.some(e=>e.key===d))||g("none")},[c]);let f=(0,es.useMemo)(()=>({display:"flex",alignItems:"center",backgroundColor:o.colorFillAlter,padding:"1em",...t}),[t,o.colorFillAlter]),v=(0,es.useMemo)(()=>({fontSize:o.fontSize,fontWeight:"bold",whiteSpace:"nowrap",marginRight:o.marginXS}),[o.fontSize,o.marginXS]),g=(0,es.useCallback)(async e=>{u(e),m(null),null==n||n.reset()},[]),y=(0,es.useCallback)(async(e,t)=>{let o={...t,dataId:e};m(t),wr(h,o,x).then(e=>(n&&e&&(n.reset(),n.__template=!0,(0,eh.forEach)(e,(e,t)=>{if(e){var o;n.values[t]=e,null==n||null==(o=n.setInitialValuesIn)||o.call(n,t,e)}})),e)).catch(e=>{console.error(e)})},[]);if(!i||!r)return null;let b=null==c?void 0:c.find(e=>e.key===d);return(0,A.jsx)("div",{style:f,children:(0,A.jsxs)(of.A,{wrap:!0,children:[(0,A.jsxs)("label",{style:v,children:[x("Data template"),": "]}),(0,A.jsx)(oo.A,{"data-testid":"select-form-data-template",popupMatchSelectWidth:!1,options:c,fieldNames:{label:"title",value:"key"},value:d,onChange:g}),"none"!==d&&b&&(0,A.jsx)(wo,{style:{width:220},fieldNames:{label:null==b?void 0:b.titleField,value:"id"},target:null==b?void 0:b.collection,value:p,objectValue:!0,service:{resource:null==b?void 0:b.collection,params:{filter:null==b?void 0:b.dataScope}},onChange:e=>y(null==e?void 0:e.id,{...e,...b}),targetField:s("".concat(null==b?void 0:b.collection,".").concat(b.titleField))})]})})};async function wr(e,t,n){if(0!==t.fields.length&&t.dataId)return e.resource(t.collection).get({filterByTk:t.dataId,fields:t.fields,isTemplate:!0}).then(e=>{var t;return null==(t=e.data)?void 0:t.data})}let wi=new or({name:"FormSettings",items:[{name:"title",Component:aZ},{name:"linkageRules",Component:a1,useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"dataTemplates",Component:a6,useVisible(){let{action:e}=Tp();return!e},useComponentProps(){let{name:e}=tJ();return{collectionName:e}}},{name:"divider",type:"divider"},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"FormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),wa=new or({name:"ReadPrettyFormSettings",items:[{name:"title",Component:aZ},{name:"formItemTemplate",Component:aV,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{insertAdjacentPosition:"beforeEnd",componentName:"ReadPrettyFormItem",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),ws=new or({name:"FormDetailsSettings",items:[{name:"title",Component:aZ},{name:"dataScope",Component:il,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)(),{form:l}=Tp(),r=(0,ec.useField)(),{service:i}=oF(),{dn:a}=eY();return{collectionName:n,defaultFilter:(null==o||null==(t=o["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:l,onSubmit:e=>{var t;let{filter:n}=e;n=d5(n);let l=r.decoratorProps.params||{};l.filter=n,r.decoratorProps.params=l,o["x-decorator-props"].params=l,i.run({...null==(t=i.params)?void 0:t[0],filter:n}),a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"setDataLoadingMode",Component:t0},{name:"sortingRules",type:"modal",useComponentProps(){var e,t;let{name:n}=tJ(),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),{service:i}=oF(),{dn:a}=eY(),s=hd(n),c=(null==l||null==(t=l["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],d=null==c?void 0:c.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return{title:o("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:o("Set default sorting rules"),properties:{sort:{type:"array",default:d,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:s,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:o("ASC"),value:"asc"},{label:o("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:o("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit(e){var t;let{sort:n}=e,o=n.map(e=>"desc"===e.direction?"-".concat(e.field):e.field),s=r.decoratorProps.params||{};s.sort=o,r.decoratorProps.params=s,l["x-decorator-props"].params=s,a.emit("patch",{schema:{"x-uid":l["x-uid"],"x-decorator-props":l["x-decorator-props"]}}),i.run({...null==(t=i.params)?void 0:t[0],sort:o})}}}},{name:"template",Component:aB,useComponentProps(){var e,t;let{name:n}=tJ(),o=(0,ec.useFieldSchema)();return{componentName:"Details",collectionName:n,resourceName:(null==o||null==(e=o["x-decorator-props"])?void 0:e.resource)||(null==o||null==(t=o["x-decorator-props"])?void 0:t.association)}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),wc=(0,ec.observer)(e=>{let t=(0,ec.useFieldSchema)(),{getField:n}=tJ(),o=(0,ec.useField)(),l=n(t.name),r=eB(),i=Tp();return(0,es.useEffect)(()=>{if(!o.title){var e;o.title=r(null==l||null==(e=l.uiSchema)?void 0:e.title)}(null==i?void 0:i.field)&&(i.field.added=i.field.added||new Set,i.field.added.add(t.name))},[]),(0,A.jsx)("div",{children:e.children})},{displayName:"FormField"});S1.Designer=()=>{let{name:e,title:t}=tJ(),n=rh();return(0,A.jsx)(sP,{schemaSettings:"FormSettings",template:n,title:t||e})},S1.FilterDesigner=()=>{let{name:e,title:t}=tJ(),n=rh();return(0,A.jsx)(sP,{schemaSettings:"blockSettings:filterForm",template:n,title:t||e})},S1.ReadPrettyDesigner=()=>{let{name:e,title:t}=tJ(),n=rh();return(0,A.jsx)(sP,{schemaSettings:"ReadPrettyFormSettings",template:n,title:t||e})},S1.Templates=wl;var wd=n(13133),wu=n(79622);function wp(){let e=(0,ns._)(["\n .ant-table-cell {\n > .ant-space-horizontal {\n .ant-space-item-split:has(+ .ant-space-item:empty) {\n display: none;\n }\n }\n }\n "]);return wp=function(){return e},e}let wm=(0,nu.rU)(e=>{let{css:t}=e;return t(wp())}),wh=(0,es.createContext)({}),wx=()=>(0,es.useContext)(wh);var wf=n(31952);let wv=(0,es.createContext)(null);wv.displayName="SystemSettingsContext";let wg=()=>(0,es.useContext)(wv),wy=e=>{let t=ek({url:"systemSettings:get"});return(0,A.jsx)(wv.Provider,{value:{...t},children:e.children})},wb=Object.keys(on).map(e=>({label:"".concat(on[e].label," (").concat(e,")"),value:e})),wC=()=>{let{setVisible:e}=co();return{async run(){e(!1)}}},wS=e=>{let{visible:t}=co(),n=wg();return ek(()=>Promise.resolve(null==n?void 0:n.data),{...e,refreshDeps:[t,null==n?void 0:n.data]})},ww=()=>{let{setVisible:e}=co(),t=(0,ec.useForm)(),{mutate:n,data:o}=wg()||{},l=eC(),{t:r}=(0,eT.useTranslation)();return{async run(){var i;await t.submit();let a=(0,ed.cloneDeep)(t.values);n({data:{...null==o?void 0:o.data,...a}}),await l.request({url:"systemSettings:put",method:"post",data:a}),cg.Ay.success(r("Saved successfully"));let s=(null==(i=a.enabledLanguages)?void 0:i[0])||"en-US";a.enabledLanguages.length<2&&l.auth.getLocale()!==s?(l.auth.setLocale(""),window.location.reload()):e(!1)}}},wF={type:"object",properties:{[(0,ec.uid)()]:{"x-decorator":"Form","x-decorator-props":{useValues:"{{ useSystemSettingsValues }}"},"x-component":"div",type:"void",title:'{{t("System settings")}}',properties:{raw_title:{type:"string",title:"{{t('System title')}}","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{supportsLineBreak:!0},required:!0},logo:{type:"string",title:"{{t('Logo')}}","x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{action:"attachments:create",multiple:!1}},enabledLanguages:{type:"array",title:'{{t("Enabled languages")}}',"x-component":"Select","x-component-props":{mode:"multiple"},"x-decorator":"FormItem",enum:wb,"x-reactions":e=>{e.dataSource=wb.map(t=>{var n;let o=t.label;return(null==(n=e.value)?void 0:n[0])===t.value&&(o+="(".concat(fG.t("Default"),")")),{label:o,value:t.value}})}},footer1:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column"},properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit",useAction:"{{ useSaveSystemSettingsValues }}"}}}}}}}},wj=()=>(0,A.jsx)(rZ.A,{bordered:!1,children:(0,A.jsx)(al,{scope:{useSaveSystemSettingsValues:ww,useSystemSettingsValues:wS,useCloseAction:wC},schema:wF})});class wA extends eR{async load(){this.app.use(wy,this.options)}}let wk=(0,es.createContext)({title:null,setTitle(){}});wk.displayName="DocumentTitleContext";let wI=e=>{let t=eB(),{addonBefore:n,addonAfter:o}=e,{t:l}=(0,eT.useTranslation)(),[r,i]=(0,es.useState)(""),a="".concat(n?" - ".concat(l(n)):"").concat(l(t(r)||"")).concat(o?" - ".concat(l(o)):"");return(0,A.jsxs)(wk.Provider,{value:{title:r,setTitle:i},children:[(0,A.jsx)(wf.m,{children:(0,A.jsx)("title",{children:a})}),e.children]})},wP=e=>{var t,n;let o=wg();return(0,A.jsx)(wI,{addonAfter:null==o||null==(n=o.data)||null==(t=n.data)?void 0:t.title,children:e.children})},wT=()=>(0,es.useContext)(wk),wN=e=>{let{setTitle:t}=wT();(0,es.useEffect)(()=>{t(e)},[])};class wM extends eR{async load(){this.app.use(wP,this.options)}}var wD=n(46626);function wR(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n height: 100%;\n border-radius: 8px 8px 0 0;\n &.draggable {\n cursor: move;\n padding: 0 10px;\n border-radius: 5px;\n background: #f0f0f0;\n }\n "]);return wR=function(){return e},e}let wq=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{dragHandleMenu:t(wR())}}),w_=e=>{let{isSubMenu:t,children:n,className:o,isAdminMenu:l}=e,{draggable:r}=(0,es.useContext)(S_),{designable:i}=eY(),{attributes:a,listeners:s,setNodeRef:c,isDragging:d,transform:u,transition:p}=r,{styles:m}=wq();return i?({...e.style,transform:wD.CSS.Translate.toString(u),transition:p,cursor:"move",zIndex:d?999:"auto"},(0,A.jsx)("div",{ref:c,className:(0,nu.cx)(m.dragHandleMenu,{draggable:d,leftBorder:t&&d,adminMenu:l&&d},o),...s,...a,role:"none",children:n})):n},{Paragraph:wO,Text:wB,Link:wE}=e2.A,wV=e=>{let{error:t}=e,{resetBoundary:n}=(0,wu.Md)(),{t:o}=(0,eT.useTranslation)(),l=(0,A.jsxs)(eT.Trans,{children:["This is likely a Tachybase internals bug. Please open an issue at ",(0,A.jsx)(wE,{href:"https://github.com/tegojs/tego-standard/issues",target:"_blank",children:"here"})]});return(0,A.jsx)("div",{style:{backgroundColor:"white"},children:(0,A.jsx)(e6.Ay,{style:{maxWidth:"60vw",margin:"auto"},status:"error",title:o("Render Failed"),subTitle:l,extra:[(0,A.jsx)(e3.Ay,{type:"primary",href:"https://github.com/tegojs/tego-standard/issues",target:"_blank",children:o("Feedback")},"feedback"),(0,A.jsx)(e3.Ay,{onClick:n,children:o("Try again")},"try")],children:(0,A.jsx)(wO,{copyable:!0,children:(0,A.jsx)(wB,{type:"danger",style:{whiteSpace:"pre-line",textAlign:"center"},children:t.stack})})})})};function wz(){let e=(0,ns._)(["\n .ant-tabs-nav-wrap.ant-tabs-nav-wrap {\n flex: none;\n }\n .ant-tabs-tab.ant-tabs-tab.ant-tabs-tab {\n border: none;\n background-color: #ffffff;\n }\n\n .ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active {\n border-radius: 8px 8px 0 0;\n box-shadow: none;\n text-shadow: none;\n background-color: var(--tb-box-bg);\n }\n .ant-tabs-extra-content {\n flex: 1;\n }\n "]);return wz=function(){return e},e}function wL(){let e=(0,ns._)(["\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n &.designable {\n justify-content: space-between;\n }\n .add-tab-btn {\n border-radius: 8px 8px 0 0;\n }\n\n .scroll-area-extra-content {\n align-self: flex-end;\n }\n "]);return wL=function(){return e},e}function wG(){let e=(0,ns._)(["\n position: relative;\n border-radius: 8px 8px 0 0;\n &:hover {\n .tab-designer-wrapper {\n display: block;\n }\n }\n .tab-designer-wrapper {\n display: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 0 2px;\n border-radius: 3px;\n color: #000000;\n background-color: #ffffff;\n\n &:hover {\n color: #ffffff;\n background-color: var(--colorSettings);\n }\n }\n "]);return wG=function(){return e},e}let wK=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{tabComponentClass:t(wz()),tabWrapper:t(wL()),tabItemClass:t(wG())}}),w$=e=>{let{title:t}=e,{designable:n}=eY(),o=(0,ec.useFieldSchema)(),{render:l}=sx(o["x-settings"]||"PageSettings",o["x-settings-props"]);return n?(0,A.jsx)(sS,{title:t,children:(0,A.jsx)("div",{className:"general-schema-designer",children:(0,A.jsx)("div",{className:"general-schema-designer-icons",children:(0,A.jsx)(of.A,{size:2,align:"center",children:l()})})})}):null},wU=e=>{let{schema:t}=e,{designable:n}=eY(),o=(0,ec.useFieldSchema)(),{render:l}=sx(o["x-settings"]||"PageTabSettings",o["x-settings-props"]);return n?(0,A.jsx)(sS,{schema:t,children:l()}):null},wW=cP("tb-page",e=>{let{componentCls:t}=e;return{[t]:{position:"relative",zIndex:20,flex:1,display:"flex",flexDirection:"column",height:"calc(100vh - var(--tb-header-height))",overflow:"hidden","&:hover":{"> .general-schema-designer":{display:"block"}},".ant-page-header":{zIndex:1,position:"relative"},"> .general-schema-designer":{position:"absolute",zIndex:999,top:"0",bottom:"0",left:"0",right:"0",display:"none",border:"0",pointerEvents:"none","> .general-schema-designer-icons":{zIndex:9999,position:"absolute",right:"2px",top:"2px",lineHeight:"16px",pointerEvents:"all",".ant-space-item":{backgroundColor:"var(--colorSettings)",color:"#fff",lineHeight:"16px",width:"16px",paddingLeft:"1px"}}},".tb-page-header-wrapper":{zIndex:10,".ant-page-header-heading":{justifyContent:"start",".ant-btn":{border:"none",boxShadow:"none"}}},".pageHeaderCss":{backgroundColor:e.colorBgContainer,paddingInline:e.paddingLG,"&.ant-page-header-has-footer":{paddingTop:e.paddingSM,paddingBottom:"0",".ant-page-header-heading-left":{},".ant-page-header-footer":{marginBlockStart:"0"}},".ant-tabs-nav":{marginBottom:"0"},".ant-page-header-heading-title":{color:e.colorText}},".height0":{fontSize:0,height:0},".designerCss":{position:"relative","&:hover":{"> .general-schema-designer":{display:"block"}},"&.tb-action-link":{"> .general-schema-designer":{top:"-10px",bottom:"-10px",left:"-10px",right:"-10px"}},"> .general-schema-designer":{position:"absolute",zIndex:999,top:"0",bottom:"0",left:"0",right:"0",display:"none",background:"var(--colorBgSettingsHover)",border:"0",pointerEvents:"none","> .general-schema-designer-icons":{position:"absolute",right:"2px",top:"2px",lineHeight:"16px",pointerEvents:"all",".ant-space-item":{backgroundColor:"var(--colorSettings)",color:"#fff",lineHeight:"16px",width:"16px",paddingLeft:"1px"}}}},".pageWithFixedBlockCss":{height:"100%","> .tb-grid:not(:last-child)":{"> .tb-schema-initializer-button":{display:"none"}}},".tb-page-wrapper":{flex:1,padding:e.paddingMD,paddingBottom:0,overflowX:"hidden",overflowY:"scroll"},".tb-page-header-button":{flex:1,paddingTop:e.paddingMD,paddingLeft:e.paddingMD,border:"none"}}}}),wH=e=>{var t,n,o;let{children:l,...r}=e,{t:i}=(0,eT.useTranslation)(),{title:a,setTitle:s}=wT(),c=(0,ec.useFieldSchema)(),d=null==(t=c["x-component-props"])?void 0:t.disablePageHeader,u=null==(n=c["x-component-props"])?void 0:n.enablePageTabs,p=null==(o=c["x-component-props"])?void 0:o.enableSharePage,[m,h]=(0,eN.useSearchParams)(),[x,f]=(0,es.useState)(!1),v=(0,es.useMemo)(()=>m.get("tab")||Object.keys(c.properties||{}).shift(),[c.properties,m]),[g,y]=(0,es.useState)(0),b=wm(),{wrapSSR:C,hashId:S,componentCls:w}=wW();return(0,es.useEffect)(()=>{a||s(i(c.title))},[c.title,a]),C((0,A.jsx)(nB,{children:(0,A.jsxs)("div",{className:"".concat(w," ").concat(S," ").concat(b.styles),children:[(0,A.jsx)(w$,{title:c.title||a}),(0,A.jsx)(wY,{disablePageHeader:d,enablePageTabs:u,activeKey:v,title:a,fieldSchema:c,parentProps:r,setHeight:y,setLoading:f,enableSharePage:p,setSearchParams:h}),(0,A.jsx)(w0,{loading:x,disablePageHeader:d,enablePageTabs:u,fieldSchema:c,activeKey:v,height:g,children:l})]})}))},wY=e=>{var t,n,o;let{disablePageHeader:l,enablePageTabs:r,setHeight:i,activeKey:a,setLoading:s,setSearchParams:c,fieldSchema:d,title:u,parentProps:p,enableSharePage:m}=e,{theme:h}=yS(),x=(0,es.useContext)(ec.SchemaOptionsContext),f=eB(),{showScrollArea:v}=wx(),g=null==(t=d["x-component-props"])?void 0:t.hidePageTitle,y=d["x-extend-components"]||{},b=g?void 0:d.title||f(u),C=d.mapProperties(e=>({key:e.name,label:(0,A.jsx)(wJ,{schema:e})}));return(0,A.jsxs)("div",{ref:e=>{i(Math.floor((null==e?void 0:e.getBoundingClientRect().height)||0)+1)},className:"tb-page-header-wrapper",children:[!l&&(0,A.jsx)(rl.z,{className:r6()("pageHeaderCss",b||m?"":"height0"),ghost:!1,title:b||" ",...p,extra:(0,A.jsxs)(A.Fragment,{children:[null==(n=Object.values(y))?void 0:n.map((t,n)=>{let o={type:"void",name:t.name,"x-component":t.component,"x-component-props":{}},l={...e,isExtra:!0,fieldSchema:d};return(0,A.jsx)(w4,{...l,children:(0,A.jsx)(al,{schema:o})})}),!r&&v&&(0,A.jsx)(IO,{})]}),footer:r&&(0,A.jsx)(wX,{activeKey:a,setLoading:s,setSearchParams:c,showScrollArea:v,options:x,theme:h,items:C})}),null==(o=Object.values(y))?void 0:o.map((t,n)=>{let o={type:"void",name:"icon"+t.name,"x-component":t.component,"x-component-props":{}},l={...e,fieldSchema:d};return(0,A.jsx)(w4,{...l,children:(0,A.jsx)(al,{schema:o})})})]})},wX=e=>{let{activeKey:t,setLoading:n,setSearchParams:o,showScrollArea:l,options:r,theme:i,items:a}=e,{styles:s}=wK(),[c,d]=(0,es.useState)(!1),u=(0,eq.useSensors)((0,eq.useSensor)(eq.PointerSensor,{activationConstraint:{distance:5}}));return(0,es.useEffect)(()=>{setTimeout(()=>{d(!0)})},[]),(0,A.jsx)(SM,{sensors:u,children:(0,A.jsx)(wd.A,{className:s.tabComponentClass,type:"card",size:"small",animated:c,activeKey:t,items:a,onTabClick:e=>{n(!0),o([["tab",e]]),setTimeout(()=>{n(!1)},50)},tabBarExtraContent:(0,A.jsx)(wQ,{theme:i,showScrollArea:l,options:r})})})},wJ=e=>{let{schema:t}=e,{t:n}=(0,eT.useTranslation)(),{styles:o}=wK();return(0,A.jsx)(SE,{id:t.name,schema:t,className:r6()("tb-action-link","designerCss",e.className,o.tabItemClass),children:(0,A.jsxs)(w_,{children:[t["x-icon"]&&(0,A.jsx)(i6,{style:{marginRight:8},type:t["x-icon"]}),(0,A.jsx)("span",{style:{padding:"6px 16px"},children:t.title||n("Unnamed")}),(0,A.jsx)("div",{className:"tab-designer-wrapper",children:(0,A.jsx)(wU,{schema:t})})]})})},wQ=e=>{let{showScrollArea:t,options:n,theme:o}=e,l=eY(),{t:r}=(0,eT.useTranslation)(),{getAriaLabel:i}=mq(),{styles:a}=wK(),s=async()=>{let{title:e,icon:t}=await AE(r("Add tab"),()=>(0,A.jsx)(wZ,{options:n}),o).open({initialValues:{}});l.insertBeforeEnd({type:"void",title:e,"x-icon":t,"x-component":"Grid","x-initializer":"page:addBlock",properties:{}})};return(0,A.jsxs)("div",{className:(0,nu.cx)(a.tabWrapper,{designable:l.designable}),children:[l.designable&&(0,A.jsx)(e3.Ay,{className:"add-tab-btn",type:"text","aria-label":i("tabs"),icon:(0,A.jsx)(sF.A,{}),onClick:s}),t&&(0,A.jsx)(IO,{className:"scroll-area-extra-content"})]})},wZ=e=>{let{options:t}=e,{t:n}=(0,eT.useTranslation)();return(0,A.jsx)(i8,{scope:t.scope,components:{...t.components},children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(al,{schema:{properties:{title:{title:n("Tab name"),"x-component":"Input","x-decorator":"FormItem",required:!0},icon:{title:n("Icon"),"x-component":"IconPicker","x-decorator":"FormItem"}}}})})})},w0=e=>(0,A.jsx)("div",{className:"tb-page-wrapper",children:(0,A.jsx)(wu.tH,{FallbackComponent:wV,onError:e=>{var t,n;null==(n=window)||null==(t=n.Sentry)||t.captureException(e),console.error(e)},children:(0,A.jsx)(w1,{...e})})}),w1=e=>{let{loading:t,disablePageHeader:n,enablePageTabs:o,fieldSchema:l,activeKey:r,height:i,children:a}=e,{token:s}=iw.A.useToken();if(!t)return!n&&o?l.mapProperties(e=>e.name!==r?null:(0,A.jsx)(bT,{height:"calc(".concat(i,"px + 46px + ").concat(s.marginLG,"px * 2)"),children:(0,A.jsx)(al,{schema:new ec.Schema({properties:{[e.name]:e}})})},e.name)):(0,A.jsx)(bT,{height:"calc(".concat(i,"px + 46px + ").concat(s.marginLG,"px * 2)"),children:(0,A.jsx)("div",{className:"pageWithFixedBlockCss tb-page-content",children:a})})},w2=new or({name:"PageTabSettings",items:[{name:"edit",type:"modal",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{schema:t}=sw(),{dn:n}=eY();return{title:e("Edit"),schema:{type:"object",title:e("Edit tab"),properties:{title:{title:e("Tab name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}},icon:{title:e("Icon"),"x-decorator":"FormItem","x-component":"IconPicker","x-component-props":{}}}},initialValues:{title:t.title,icon:t["x-icon"]},onSubmit:e=>{let{title:o,icon:l}=e;t.title=o,t["x-icon"]=l,n.emit("patch",{schema:{"x-uid":t["x-uid"],title:o,"x-icon":l}}),n.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"item",useComponentProps(){let{modal:e}=eX.A.useApp(),{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),{schema:o}=sw();return{title:n("Delete"),eventKey:"remove",onClick(){e.confirm({title:n("Delete block"),content:n("Are you sure you want to delete it?"),...confirm,onOk(){t.remove(o)}})},children:n("Delete")}}}]});function w6(){var e;return!(null==(e=(0,ec.useFieldSchema)()["x-component-props"])?void 0:e.disablePageHeader)}let w3=new or({name:"PageSettings",items:[{name:"enablePageHeader",type:"switch",useComponentProps(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)();return{title:n("Enable page header"),checked:!(null==(e=o["x-component-props"])?void 0:e.disablePageHeader),onChange(e){o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].disablePageHeader=!e,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"]}}),t.refresh()}}}},{name:"divider",type:"divider",useVisible:w6},{name:"displayPageTitle",type:"switch",useVisible:w6,useComponentProps(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)();return{title:n("Display page title"),checked:!(null==(e=o["x-component-props"])?void 0:e.hidePageTitle),onChange(e){o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].hidePageTitle=!e,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"]}}),t.refresh()}}}},{name:"editPageTitle",type:"modal",useVisible(){var e;let t=w6(),n=!(null==(e=(0,ec.useFieldSchema)()["x-component-props"])?void 0:e.hidePageTitle);return t&&n},useComponentProps(){let{dn:e}=eY(),{t}=(0,eT.useTranslation)(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{title:l}=sw();return{hide:!0,title:t("Edit page title"),schema:{type:"object",title:t("Edit page title"),properties:{title:{title:t("Title"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},initialValues:{title:l},onSubmit(t){let{title:l}=t;n.title=l,o.title=l,e.emit("patch",{schema:{"x-uid":o["x-uid"],title:l}})}}}},{name:"enablePageTabs",type:"switch",useVisible:w6,useComponentProps(){var e;let{dn:t}=eY(),{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)();return{title:n("Enable page tabs"),checked:null==(e=o["x-component-props"])?void 0:e.enablePageTabs,onChange(e){o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].enablePageTabs=e,t.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"]}}),t.refresh()}}}}]}),w5=(0,es.createContext)({}),w4=e=>(0,A.jsx)(w5.Provider,{value:e,children:e.children}),w8=()=>(0,es.useContext)(w5);class w7 extends eR{async load(){this.addComponents(),this.addScopes(),this.addSchemaSettings()}addComponents(){this.app.addComponents({...w,...S,CodeMirror:eh.CodeMirror})}addScopes(){this.app.addScopes({useFilterActionProps:d4})}addSchemaSettings(){this.app.schemaSettingsManager.add(w3),this.app.schemaSettingsManager.add(w2),this.app.schemaSettingsManager.add(ut),this.app.schemaSettingsManager.add(Su),this.app.schemaSettingsManager.add(SW),this.app.schemaSettingsManager.add(wi),this.app.schemaSettingsManager.add(wa),this.app.schemaSettingsManager.add(ws),this.app.schemaSettingsManager.add(dj)}}var w9=n(64372);function Fe(e){let{collection:t}=e;return t}function Ft(e){let t=Fl.call(this,e.field.target,e);return t.length&&t.some(e=>Fn(e.field))||(e.isLeaf=!0),t}function Fn(e){return e.target&&e.interface}function Fo(e){return!0}function Fl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{needLeaf:!1},{needLeaf:o}=n,[l,r]=vS(e),i=this.getCollectionFields(r,l),a=o?i:i.filter(Fn),s=Ft.bind(this);return a.filter(this.filter).map(e=>{var n,o,l;let r=t?"".concat(t.value?"".concat(t.value,"."):"").concat(e.name):e.name,i=null!=(o=this.compile(null==(n=e.uiSchema)?void 0:n.title))?o:e.name,a=!this.getCollectionFields(e.target).filter(Fn).filter(this.filter).length;return{pId:null!=(l=null==t?void 0:t.key)?l:null,id:r,key:r,value:r,title:i,isLeaf:a,loadChildren:a?null:s,field:e,fullTitle:t?[...t.fullTitle,i]:[i]}})}let Fr=e=>{let{title:t,value:n,onChange:o,collection:l,useCollection:r=Fe,filter:i=Fo,rootOption:a,loadData:s,needLeaf:c=!1,...d}=e,u=eB(),{t:p}=(0,eT.useTranslation)(),[m,h]=(0,es.useState)({}),x=r({collection:l}),[f,v]=vS(x),{getCollectionFields:g}=sO(f),y=Object.values(m),b=(0,es.useMemo)(()=>e.multiple?(n||[]).map(e=>m[e]).filter(Boolean):n,[n,e.multiple,m]),C=(0,es.useCallback)(async e=>{if(null!=s)return s(e);if(!e.isLeaf&&e.loadChildren){let t=e.loadChildren(e);h(e=>t.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{...e}))}},[s]);(0,es.useEffect)(()=>{let e=a?{...a,id:a.value,key:a.value,title:a.label,fullTitle:a.label,isLeaf:!1}:null,t=(null===s?[]:Fl.call({compile:u,getCollectionFields:g,filter:i},x,e,{needLeaf:c})).reduce((e,t)=>Object.assign(e,{[t.value]:t}),{});e&&(t[e.value]=e),h(t)},[x,a,i,s]),(0,es.useEffect)(()=>{let t=e.multiple?n:n?[n]:[];if(!(null==t?void 0:t.length)||t.every(e=>!!m[e]))return;let o=[];t.forEach(e=>{let t=e.split("."),n=m[t[0]];for(let e=1;e<t.length&&n;e++){let l=t.slice(0,e+1).join(".");if(m[l]){n=m[l];break}if(!n.isLeaf&&n.loadChildren){let l=n.loadChildren(n);(null==l?void 0:l.length)&&(o.push(...l),n=l.find(n=>n.value===t.slice(0,e+1).join(".")))}}}),h(e=>o.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{...e}))},[n,y.length,e.multiple]);let S=(0,es.useCallback)(t=>{if(!e.multiple)return void o(t);let n=t.map(e=>e.value).filter(Boolean),l=new Set(n),r=b.find(e=>!l.has(e.value));if(r){let e="".concat(r.value,".");Object.keys(m).forEach(t=>{t.startsWith(e)&&l.delete(t)})}else n.forEach(e=>{let t=e.split(".");if(t.length)for(let e=1;e<=t.length;e++)l.add(t.slice(0,e).join("."))});o(Array.from(l))},[e.multiple,b,o,m]),w=(0,es.useCallback)(e=>{var t;let{value:n,onClose:o,disabled:l,closable:r}=e;if(!n)return null;let{fullTitle:i}=null!=(t=m[n])?t:{};return(0,A.jsx)(nz.A,{closable:r&&!l,onClose:o,children:null==i?void 0:i.join(" / ")})},[m]),F=Array.isArray(b)?b.filter(e=>e.value in m):b,j=e.multiple?n:null!=n?[n]:[];return(0,A.jsx)(w9.A,{role:"button","data-testid":"select-field".concat(t?"-".concat(t):""),value:F,placeholder:p("Select field"),showCheckedStrategy:w9.A.SHOW_ALL,treeDefaultExpandedKeys:j,allowClear:{clearIcon:(0,A.jsx)(Sp.A,{role:"button","aria-label":"icon-close"})},treeCheckStrictly:e.multiple,treeCheckable:e.multiple,tagRender:w,onChange:S,treeDataSimpleMode:!0,treeData:y,loadData:C,...d})};function Fi(e){let{collection:t}=e;return t}function Fa(e){var t;let n=null!=(t=this.needLeaf)&&t,o=Fd.call(this,e.field.target,e,{needLeaf:n});return o.length&&o.some(e=>Fs(e.field))||(e.isLeaf=!0),o}function Fs(e){return e.target&&e.interface}function Fc(e){return!0}function Fd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{needLeaf:!1},{needLeaf:o}=n,[l,r]=vS(e),i=this.getCollectionFields(r,l),a=o?i:i.filter(Fs),s=Fa.bind({...this,needLeaf:o});return a.filter(this.filter).map(e=>{var n,l,r;let i=t?"".concat(t.value?"".concat(t.value,"."):"").concat(e.name):e.name,a=null!=(l=this.compile(null==(n=e.uiSchema)?void 0:n.title))?l:e.name,c=e.target?this.getCollectionFields(e.target):[],d=!(o?c:c.filter(Fs)).filter(this.filter).length;return{pId:null!=(r=null==t?void 0:t.key)?r:null,id:i,key:i,value:i,title:a,isLeaf:d,loadChildren:d?null:s,field:e,fullTitle:t?[...t.fullTitle,a]:[a]}})}let Fu=e=>{let{title:t,value:n,onChange:o,collection:l,useCollection:r=Fi,filter:i=Fc,rootOption:a,loadData:s,needLeaf:c=!1,...d}=e,u=eB(),{t:p}=(0,eT.useTranslation)(),[m,h]=(0,es.useState)({}),x=r({collection:l}),[f,v]=vS(x),{getCollectionFields:g}=sO(f),y=Object.values(m),b=(0,es.useMemo)(()=>e.multiple?(n||[]).map(e=>m[e]).filter(Boolean):n,[n,e.multiple,m]),C=(0,es.useCallback)(async e=>{if(null!=s)return s(e);if(!e.isLeaf&&e.loadChildren){let t=e.loadChildren(e);h(e=>t.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{...e}))}},[s]);(0,es.useEffect)(()=>{let e=a?{...a,id:a.value,key:a.value,title:a.label,fullTitle:a.label,isLeaf:!1}:null,t=(null===s?[]:Fd.call({compile:u,getCollectionFields:g,filter:i,needLeaf:c},x,e,{needLeaf:c})).reduce((e,t)=>Object.assign(e,{[t.value]:t}),{});e&&(t[e.value]=e),h(t)},[x,a,i,s]),(0,es.useEffect)(()=>{let t=e.multiple?n:n?[n]:[];if(!(null==t?void 0:t.length)||t.every(e=>!!m[e]))return;let o=[];t.forEach(e=>{let t=e.split("."),n=m[t[0]];for(let e=1;e<t.length&&n;e++){let l=t.slice(0,e+1).join(".");if(m[l]){n=m[l];break}if(!n.isLeaf&&n.loadChildren){let l=n.loadChildren(n);(null==l?void 0:l.length)&&(o.push(...l),n=l.find(n=>n.value===t.slice(0,e+1).join(".")))}}}),h(e=>o.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{...e}))},[n,y.length,e.multiple]);let S=(0,es.useCallback)(t=>{if(!e.multiple)return void o(t);let n=t.map(e=>e.value).filter(Boolean),l=new Set(n),r=b.find(e=>!l.has(e.value));if(r){let e="".concat(r.value,".");Object.keys(m).forEach(t=>{t.startsWith(e)&&l.delete(t)})}else n.forEach(e=>{let t=e.split(".");if(t.length)for(let e=1;e<=t.length;e++)l.add(t.slice(0,e).join("."))});o(Array.from(l))},[e.multiple,b,o,m]),w=(0,es.useCallback)(e=>{var t;let{value:n,onClose:o,disabled:l,closable:r}=e;if(!n)return null;let{fullTitle:i}=null!=(t=m[n])?t:{};return(0,A.jsx)(nz.A,{closable:r&&!l,onClose:o,children:null==i?void 0:i.join(" / ")})},[m]),F=Array.isArray(b)?b.filter(e=>e.value in m):b,j=e.multiple?n:null!=n?[n]:[];return(0,A.jsx)(w9.A,{"data-testid":"select-field".concat(t?"-".concat(t):""),value:F,placeholder:p("Select field"),showCheckedStrategy:w9.A.SHOW_ALL,treeDefaultExpandedKeys:j,allowClear:{clearIcon:(0,A.jsx)(Sp.A,{role:"button","aria-label":"icon-close"})},treeCheckStrictly:e.multiple,treeCheckable:e.multiple,tagRender:w,onChange:S,treeDataSimpleMode:!0,treeData:y,loadData:C,...d})},Fp=(0,ec.connect)(e=>{var t,n;let{fieldNames:o,collection:l,associationField:r}=e,i=tg(),a=i.getCollection(l).titleField,s=i.getCollection(l+"."+r).titleField,{data:c}=ek({resource:l,action:"list",params:{appends:[r],fields:[a],paginate:!1,filter:(null==e||null==(t=e.params)?void 0:t.filter)?{...null==e||null==(n=e.params)?void 0:n.filter}:{}}}),d=(0,es.useMemo)(()=>{if(!e.chartCascader)return Object.entries((null==c?void 0:c.data.reduce((e,t)=>{if(t[r]){let n=t[r][s];null!=e[n]||(e[n]=[]),e[n].push(t[a])}return e},{}))||{}).map(e=>{let[t,n]=e;return{[o.label]:t,[o.value]:t,children:n.map(e=>({[o.label]:e,[o.value]:e}))}});{let e={},t=[];for(let n in null==c||c.data.forEach(t=>{if(null==t?void 0:t[r]){let n=[];Array.isArray(t[r])&&t[r].length?n.push(...t[r]):n.push({...t[r]}),n.forEach(n=>{Object.keys(n).length&&(e[n[s]]?e[n[s]].push({label:t[a],value:t[a]}):e[n[s]]=[{label:t[a],value:t[a]}])})}}),e)t.push({label:n,value:n,children:[...e[n]]});return t}},[r,s,a,null==c?void 0:c.data]);return(0,A.jsx)(Fm,{options:d,...e,showSearch:!0,titleField:a,joinTitleField:s})},(0,ec.mapProps)(e=>({...e}))),Fm=e=>{let{value:t,options:n,onChange:o,fieldNames:l,chartCascader:r,titleField:i,joinTitleField:a}=e,s=l?l.value:i,c=l?l.value:"value",d=t&&n?[]:void 0;if(d)for(let e of n){if(e[s]===t){d.push(e[s]);break}for(let n of e.children)if(n[c]===t){d.push(e[c]),d.push(n[c]);break}}let u={...e,value:d,onChange:e=>{e?o(e[e.length-1]):o(e)}};return(0,A.jsx)(om.A,{...u})};Fm.displayName="SingleValueCascader",Fp.displayName="AssociationCascader";let Fh=(0,ec.observer)(e=>{var t,n,o;let l=(0,ec.useField)(),{getCollectionJoinField:r,getCollection:i}=sO(),a=(0,ec.useFieldSchema)(),s=(null==(t=a["x-component-props"])?void 0:t.multiple)!==!1,c=(null==(n=a["x-component-props"])?void 0:n.allowDissociate)!==!1,d=(0,es.useMemo)(()=>r(a["x-collection-field"]),[a["x-collection-field"],a.name]),u=(0,es.useMemo)(()=>{var e;return(null==(e=i(null==d?void 0:d.target))?void 0:e.template)==="file"},[a["x-collection-field"]]),p=(0,es.useMemo)(()=>{var e;return(null==(e=i(null==d?void 0:d.target))?void 0:e.template)==="tree"},[a["x-collection-field"]]),m=(0,es.useMemo)(()=>{var e;return(null==(e=a["x-component-props"])?void 0:e.mode)||(u?"FileManager":p?"Cascader":"Select")},[null==(o=a["x-component-props"])?void 0:o.mode]),h=(0,es.useMemo)(()=>JSON.stringify(l.value),[l.value]),[x,f]=(0,es.useState)(!0);return((0,es.useEffect)(()=>{if(f(!0),!d)return void f(!1);if(l.value&&l.form.__template&&["Nester","SubTable","PopoverNester"].includes(m))if(["belongsTo","hasOne"].includes(d.type)){var e;(null==(e=l.value)?void 0:e[d.targetKey])&&delete l.value[d.targetKey],l.value={...l.initialValue,...l.value}}else["belongsToMany","hasMany"].includes(d.type)&&Array.isArray(l.value)&&(l.value=l.value.map(e=>{var t;return delete e[d.targetKey],{...null==(t=l.initialValue)?void 0:t[0],...e}}));if(null!==l.value&&void 0!==l.value){["Nester","PopoverNester"].includes(m)&&Array.isArray(l.value)&&0===l.value.length&&["belongsToMany","hasMany"].includes(d.type)&&(l.value=[oO({})]),f(!1);return}["Nester"].includes(m)&&(["belongsTo","hasOne"].includes(d.type)?l.value={}:["belongsToMany","hasMany"].includes(d.type)&&(l.value=[oO({})])),"SubTable"===m&&(l.value=[]),f(!1)},[m,d,h]),x)?null:d?(0,A.jsx)(lm.Provider,{value:{options:d,field:l,allowMultiple:s,allowDissociate:c,currentMode:m},children:e.children}):null},{displayName:"AssociationFieldProvider"});var Fx=n(54424);let Ff=(0,ec.observer)(e=>{var t,n,o,l;let{objectValue:r=!0}=e,{message:i}=eX.A.useApp(),a=(0,ec.useField)(),s=(0,ec.useFieldSchema)(),c=lf(e),{options:d}=lx(),u=oY(e.value)?void 0:e.value,p=Array.isArray(u)?u.filter(Boolean):u,[m,h]=(0,es.useState)(p),x=null==(t=s["x-component-props"])?void 0:t.addMode,f=s["x-add-new"],{t:v}=(0,eT.useTranslation)(),{multiple:g}=e,y=(0,ec.useForm)(),b=eC().resource(d.target),C=(e=>{if(!e)return;let t=Object.keys(e)[0]||"$and",n=e[t],o=[];return null==n||n.map(e=>{var t,n,l;let r=c4(e);if(!(null==r?void 0:r.key))return!0;let i=null==r||null==(l=r.value)||null==(n=l.match)||null==(t=n.call(l,/\{\{\$(?:[a-zA-Z_]\w*)\.([a-zA-Z_]\w*)(?:\.id)?\}\}/))?void 0:t[1];i&&o.push(i)}),o})(null==(l=a.componentProps)||null==(o=l.service)||null==(n=o.params)?void 0:n.filter),S=tz();(0,es.useEffect)(()=>{let e=oY(a.value)?void 0:a.value;h(Array.isArray(e)?e.filter(Boolean):e)},[a.value]),(0,es.useEffect)(()=>{let t=(0,ec.uid)();return y.addEffects(t,()=>{(null==C?void 0:C.length)>0&&(0,ec.onFieldInputValueChange)("*",t=>{C.includes(t.props.name)&&a.value&&(e.onChange(a.initialValue),h(a.initialValue))})}),()=>{y.removeEffects(t)}},[]);let w=async e=>{var t,n;let{search:o,callBack:l}=e,{data:{data:r}}=await b.create({values:{[(null==a||null==(n=a.componentProps)||null==(t=n.fieldNames)?void 0:t.label)||"id"]:o}});if(r){if(["m2m","o2m"].includes(null==d?void 0:d.interface)&&!1!==g){let e=y.getValuesIn(a.path)||[];e.push(r),y.setValuesIn(a.path,e),a.onInput(e)}else y.setValuesIn(a.path,r),a.onInput(r);(0,Fx.Tn)(l)&&(null==l||l()),i.success(v("Saved successfully"))}};return(0,A.jsx)("div",{children:(0,A.jsxs)(of.A.Compact,{style:{display:"flex",lineHeight:"32px"},children:[(0,A.jsx)(wo,{style:{width:"100%"},...e,size:"middle",objectValue:r,value:p||m,service:c,onChange:t=>{var n;let o=(null==t?void 0:t.length)!==0?t:null;null==(n=e.onChange)||n.call(e,o)},CustomDropdownRender:"quickAdd"===x&&(e=>(0,A.jsxs)("div",{onClick:()=>w(e),style:{cursor:"pointer",padding:"5px 12px",color:"#0d0c0c"},children:[(0,A.jsx)(sF.A,{}),(0,A.jsx)("span",{style:{paddingLeft:5},children:v("Add")+" “".concat(e.search,"” ")})]}))}),("modalAdd"===x||f)&&(0,A.jsx)(m1,{isNew:!0,record:null,parent:S,children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:a.address,schema:s,filterProperties:e=>"Action"===e["x-component"]})})]})},s.name)},{displayName:"AssociationSelect"});(0,ec.connect)(e=>{let t=lf(e);return(os(),e.fieldNames)?(0,A.jsx)(wo.ReadPretty,{...e,service:t}):null},(0,ec.mapProps)({dataSource:"options",loading:!0},(e,t)=>({...e,fieldNames:e.fieldNames&&{...e.fieldNames,...t.componentProps.fieldNames},suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon})));let Fv={type:"void","x-component":"AssociationField.Nester",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"form:configureFields"}}},Fg={type:"void","x-component":"AssociationField.AddNewer","x-action":"create",title:'{{ t("Add record") }}',"x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializersForCreateFormBlock",properties:{tab1:{type:"void",title:'{{t("Add new")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addNew:addBlock",properties:{}}}}}}}},Fy={type:"void","x-component":"AssociationField.Selector",title:'{{ t("Select record") }}',"x-component-props":{className:"tb-record-picker-selector"},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:tableSelector:addBlock",properties:{}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:submit","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}},Fb={type:"void",title:'{{ t("View record") }}',"x-component":"AssociationField.Viewer","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}},FC={type:"void","x-component":"AssociationField.SubTable","x-initializer":"table:configureColumns","x-initializer-props":{action:!1},properties:{}},FS=(0,ec.observer)(e=>{let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),o=co(),{getCollection:l}=sO(),r=lh("AddNewer"),{options:i}=lx(),[a,s]=(0,es.useState)(!1),c=l(null==i?void 0:i.target),[d,u]=(0,es.useState)(null==c?void 0:c.name),[p,m]=(0,es.useState)(null==c?void 0:c.dataSource);return(0,A.jsxs)(hH,{name:null==i?void 0:i.target,children:[(0,A.jsx)(Cn,{...e,onClick:e=>{r(Fg),s(!0),u(e.name),m(e.dataSource)}}),(0,A.jsx)(ct,{value:{...o,visible:a,setVisible:s},children:(0,A.jsx)(hH,{name:d,dataSource:p,children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:t.address,schema:n,filterProperties:e=>"AssociationField.AddNewer"===e["x-component"]})})})]})},{displayName:"CreateRecordAction"}),Fw=()=>{let e=(0,ec.useField)(),{multiple:t,options:n=[],setSelectedRows:o,selectedRows:l=[],onChange:r}=(0,es.useContext)(g_),{onRowSelectionChange:i,rowKey:a="id",...s}=l6(),{setVisible:c}=co();return{...s,rowKey:a,rowSelection:{type:t?"checkbox":"radio",selectedRowKeys:null==l?void 0:l.filter(e=>n.every(t=>t[a]!==e[a])).map(e=>e[a])},onRowSelectionChange(n,s){if(t){let t=nU(e.value)||[],n=l||[],r=(0,ed.differenceBy)(n,t,a),c=(0,ed.unionBy)(r,s,a),d=c.map(e=>e[a]);null==o||o(c),null==i||i(d,c)}else null==o||o(s),null==i||i(n,s),r((null==s?void 0:s[0])||null),c(!1)}}},FF=e=>{var t,n;let o,l,{value:r,multiple:i,onChange:a,...s}=e,c=(0,ec.useFieldSchema)(),[d,u]=(0,es.useState)(!1),[p,m]=(0,es.useState)([]),h=lh("Selector"),x=lv(e),f=(0,ec.useField)(),[v,g]=(0,es.useState)([]),{getField:y}=tJ(),b=y(f.props.name),C=nL(null==b?void 0:b.target,(null==x?void 0:x.label)||"label"),S=eB(),{modalProps:w}=co();(0,es.useEffect)(()=>{r&&Object.keys(r).length>0?g((Array.isArray(r)?r:r?[r]:[]).filter(Boolean).map(e=>{let t=e[x.label];return{...e,[x.label]:n$(S(C),S(t))}})):g([])},[r,null==x?void 0:x.label]);let F={size:"small",fieldNames:x,multiple:["o2m","m2m"].includes(null==b?void 0:b.interface)&&i,association:{target:null==b?void 0:b.target},options:v,onChange:null==e?void 0:e.onChange,selectedRows:p,setSelectedRows:m,collectionField:b};return(0,A.jsxs)("div",{style:{width:"100%",overflow:"auto"},children:[(0,A.jsx)(gN,{value:v,multiple:i,quickUpload:(null==(t=c["x-component-props"])?void 0:t.quickUpload)!==!1,selectFile:(null==(n=c["x-component-props"])?void 0:n.selectFile)!==!1,action:"".concat(null==b?void 0:b.target,":create"),onSelect:()=>{h(Fy),u(!0),m([])},onRemove:e=>{let t=v.filter(t=>t.id!==e.id);if(g(t),0===t.length)return a(null);a(t)},onChange:e=>{e.every(e=>"uploading"!==e.status)&&(e=e.filter(e=>"done"===e.status).map(e=>e.response.data),i?a([...v,...e]):a(e[0]))}}),(0,A.jsx)(ct,{value:{openMode:"drawer",visible:d,setVisible:u,modalProps:{getContainer:(null==s?void 0:s.getContainer)||(null==w?void 0:w.getContainer)},formValueChanged:!1},children:(0,A.jsx)(gV,{...F,children:(0,A.jsx)(hH,{name:null==b?void 0:b.target,children:(0,A.jsx)(ae,{children:(0,A.jsx)(lQ,{params:{filter:(o=(null==b?void 0:b.targetKey)||"id",(l=v.map(e=>e[o]).filter(Boolean)).length?{$and:[{["".concat(o,".$ne")]:l}]}:{})},children:(0,A.jsx)(i8,{scope:{usePickActionProps:()=>{let{setVisible:e}=co(),{multiple:t,selectedRows:n,onChange:o,options:l,collectionField:r}=(0,es.useContext)(g_);return{onClick(){t?o((0,ed.unionBy)(n,l,(null==r?void 0:r.targetKey)||"id")):o((null==n?void 0:n[0])||null),e(!1)}}},useTableSelectorProps:Fw},children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:f.address,schema:c,filterProperties:e=>"AssociationField.Selector"===e["x-component"]})})})})})})})]})},Fj=(0,ec.connect)(e=>{let t=(0,ec.useFieldSchema)(),{getField:n}=tJ(),{getCollectionJoinField:o}=sO(),l=n(t.name)||o(t["x-collection-field"]);return(0,A.jsx)(gi,{ellipsis:!0,children:l?(0,A.jsx)(gT,{...e}):null})});function FA(){let e=(0,ns._)(["\n display: flex;\n > .ant-space-item {\n width: 100%;\n }\n "]);return FA=function(){return e},e}let Fk=(0,nu.rU)(e=>{let{css:t}=e;return{space:t(FA())}}),FI=(0,ec.createSchemaField)({components:{Space:of.A,Input:nJ.A,ArrayItems:eh.ArrayItems,FormItem:eh.FormItem}}),FP=(0,ec.connect)(e=>{var t,n,o,l,r,i,a,s,c,d;let{data:u,mapOptions:p,onChange:m}=e,[h,x]=(0,es.useState)(u),f=(0,ec.useFieldSchema)(),[v,g]=(0,es.useState)(!1),y=eC(),{options:b,field:C}=lx(),S=y.resource(b.target),w=null==C||null==(t=C.componentProps)?void 0:t.fieldNames,F=null==(l=f["x-component-props"])||null==(o=l.service)||null==(n=o.params)?void 0:n.filter,j=null==(a=f["x-component-props"])||null==(i=a.service)||null==(r=i.params)?void 0:r.sort,k=(null==(s=f["x-component-props"])?void 0:s.changOnSelect)||!1,I=(0,ec.useField)(),[P,T]=(0,es.useState)([]),[N,M]=(0,es.useState)(!1),[D,R]=(0,es.useState)({}),{styles:q}=Fk();(0,es.useEffect)(()=>{let t=e.value||f["x-component-props"].value;if(!N&&t)if(t.parent||Object.keys(D).length){var n,o;let e=[];if(!t.parent&&Object.keys(D).length){let n=FD(D,[],t.id);e.push(...n)}else{let n,l=Array.isArray(t)?FM(null==t?void 0:t.filter(e=>e.value),!0):(n=[],(o=t)&&function e(t){if(null==t?void 0:t.parent){let{parent:n}=t;e(n)}let{parent:o,...l}=t;n.push(l)}(o),n);e.push(...l)}let l=null==e||null==(n=e.map)?void 0:n.call(e,e=>e.id);E(!0),T(l)}else S.list({paginate:!1,filter:t.id?{id:{$eq:t.id}}:{},sort:j,tree:!0}).then(e=>{var t;R(null==(t=e.data)?void 0:t.data[0])}).catch(()=>{})},[f["x-component-props"].value,null==(c=f["x-component-props"])?void 0:c.changOnSelect,D]),(0,es.useEffect)(()=>{E(!0)},[F]);let _=async()=>{var e;let t=await S.list({paginate:!1,filter:pA([F,V]),sort:j,tree:!0});return null==t||null==(e=t.data)?void 0:e.data},O=async e=>{if(M(!0),e){if(["o2m","m2m"].includes(b.interface)){let t=Array.isArray(C.fieldValue)?C.fieldValue:[];t[I.index]=e[e.length-1],C.fieldValue=t}else C.value=e[e.length-1];let t=[];t.push({key:void 0,children:[],value:e[0]}),e.forEach((n,o)=>{o===e.length-1?t.push({key:n.id,children:n.children||null}):t.push({key:n.id,children:n.children,value:e[o+1]})}),null==m||m(t)}else null==m||m({})},B=e=>(e.forEach(e=>{e.value=e[w.value],e.label=e[w.label],e.children&&(e.children=B(e.children))}),e),E=async e=>{if(e){g(!0);let e=await _();e=B(e),g(!1),x(e)}},V=(e,t)=>(0,eh.fuzzysearch)(e,t.map(e=>e.label||"").join(""));return(0,A.jsx)(of.A,{wrap:!0,className:q.space,children:(0,A.jsx)(Aj,{style:{width:"100%"},showSearch:{filter:V},fieldNames:w,defaultValue:P,options:h,onChange:(e,t)=>O(t),onDropdownVisibleChange:e=>{E(e)},changeOnSelect:k,placeholder:"Please select"},null!=(d=P[0])?d:[])})}),FT=(0,ec.connect)(e=>(0,A.jsx)("div",{style:{width:"100%"},children:(0,A.jsx)(FP,{...e})})),FN=(0,ec.observer)(e=>{let{options:t}=lx(),n=(0,es.useMemo)(()=>(0,ec.createForm)(),[]),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),i=lf(e);(0,es.useEffect)(()=>{let o=(0,ec.uid)();return n.addEffects(o,()=>{(0,ec.onFormValuesChange)(n=>{var o,i;if("m2o"===t.interface){let t=FM(null==(o=n.values)?void 0:o[r.name]);setTimeout(()=>{n.setValuesIn(r.name,t),e.onChange(t),l.value=t})}else{let t=FM(null==(i=n.values)?void 0:i.select_array).filter(e=>e&&Object.keys(e).length>0);setTimeout(()=>{l.value=t,e.onChange(t)})}})}),()=>{n.removeEffects(o)}},[]);let a=Array.isArray(l.value)&&l.value.length>0?l.value:[{}];(0,es.useEffect)(()=>{var o,l;let r=null==(l=n.values)||null==(o=l.select_array)?void 0:o.filter(e=>e&&Object.keys(e).length);"m2o"!==t.interface&&e.value&&!r.length&&n.setInitialValues({select_array:a})},[e.value]);let s={type:"object",properties:{select_array:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",default:a,items:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},select:{type:"string","x-decorator":"FormItem","x-component":FT,"x-component-props":{...e,style:{width:"100%"}},"x-read-pretty":!1},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:o("Add new"),"x-component":"ArrayItems.Addition"}}}}};return(0,A.jsx)(ec.FormProvider,{form:n,children:"m2o"===t.interface?(0,A.jsx)(al,{components:{FormItem:eh.FormItem},schema:{...r,default:l.value,title:"","x-component":FT,"x-component-props":{...e,service:i,style:{width:"100%"}},"x-read-pretty":!1}}):(0,A.jsx)(FI,{schema:s})})},{displayName:"InternalCascader"});function FM(e,t){let n=[];if(!Array.isArray(e))return e;for(let r of e){let e=null;if(Array.isArray(r)){for(let t=(null==r?void 0:r.length)-1;t>=0;t--)if(r[t].value){e=r[t].value;break}e&&n.push(e)}else{var o,l;(e=(null==r?void 0:r.value)?r.value:null)?t?null==n||null==(o=n.push)||o.call(n,e):n=e:null==n||null==(l=n.push)||l.call(n,r)}}return n}let FD=(e,t,n)=>{let{children:o,...l}=e;if(t.push(l),!o||(null==e?void 0:e.id)===n||!o.length)return t;{let{children:o}=e;return FD(o[0],t,n)}},FR=(0,ec.createSchemaField)({components:{Space:of.A,Input:nJ.A,ArrayItems:eh.ArrayItems,FormItem:eh.FormItem}}),Fq=(0,ec.connect)(e=>{var t;let{data:n,mapOptions:o,onChange:l,value:r}=e,[i,a]=(0,es.useState)([{key:void 0,children:[],value:null}]),[s,c]=(0,es.useState)(n),[d,u]=(0,es.useState)(!1),p=eB(),m=eC(),h=lf(e),{options:x,field:f}=lx(),v=m.resource(x.target),{getCollectionJoinField:g,getInterface:y}=sO(),b=null==f||null==(t=f.componentProps)?void 0:t.fieldNames,[C,S]=(0,es.useState)(!1),w=(null==x?void 0:x.target)&&(null==b?void 0:b.label)&&g("".concat(x.target,".").concat(b.label)),F=(0,es.useMemo)(()=>{if(null==w?void 0:w.interface){var e,t;return(null==(t=y(w.interface))||null==(e=t.filterable)?void 0:e.operators[0].value)||"$includes"}return"$includes"},[w]),j=(0,ec.useField)();(0,es.useEffect)(()=>{if(r&&!C){var e;let t=Array.isArray(r)?FB(null==r?void 0:r.filter(e=>e.value),!0):FE(r);a(null==t||null==(e=t.map)?void 0:e.call(t,e=>({key:e.parentId,children:[],value:e})))}},[r]);let k=(0,es.useCallback)(e=>{try{return null==e?void 0:e.filter(e=>["number","string"].includes(typeof e[b.value])).map(e=>{var t,n,l;let r=p(e[b.label]);if(null==w||null==(t=w.uiSchema)?void 0:t.enum)if(Array.isArray(r))r=r.map((e,t)=>{var n,o;let l=null==(n=(o=w.uiSchema.enum).find)?void 0:n.call(o,t=>t.value===e);return l?(0,A.jsx)(nz.A,{color:l.color,style:{marginRight:3},children:(null==l?void 0:l.label)||e},t):(0,A.jsx)(nz.A,{children:e},e)}).reverse();else{let e=null==(n=(l=w.uiSchema.enum).find)?void 0:n.call(l,e=>e.value===r);e&&(r=(0,A.jsx)(nz.A,{color:e.color,children:e.label}))}return((null==w?void 0:w.type)==="date"&&(r=P()(r).format("YYYY-MM-DD")),o)?o({[b.label]:r||"N/A",[b.value]:e[b.value]}):{...e,[b.label]:r||"N/A",[b.value]:e[b.value]}}).filter(Boolean)}catch(t){return console.error(t),e}},[null==w?void 0:w.uiSchema,b]),I=async e=>{var t,n;let o=await v.list({pageSize:200,params:null==h?void 0:h.params,filter:pA([null==h||null==(t=h.params)?void 0:t.filter,e]),tree:!e.parentId||void 0});return null==o||null==(n=o.data)?void 0:n.data},T=async(e,t,n)=>{S(!0);let o=await I({parentId:null==t?void 0:t.id}),r=[...i];if(r.splice(n+1),r[n]={...r[n],value:t},(null==t?void 0:t.id)&&(r[n+1]={key:null==t?void 0:t.id,children:(null==o?void 0:o.length)>0?o:null}),a(r),["o2m","m2m"].includes(x.interface)){let e=Array.isArray(f.fieldValue)?f.fieldValue:[];e[j.index]=t,f.fieldValue=e}else f.value=t;null==l||l(r)},N=async(e,t,n)=>{if(e){var o,r,s;u(!0);let e=await I({parentId:null==t?void 0:t.key});if(u(!1),c(e),n===(null==i?void 0:i.length)-1&&(null==t||null==(o=t.value)?void 0:o.id)){let e=await I({parentId:null==t||null==(r=t.value)?void 0:r.id}),o=[...i];o.splice(n+1),o[n]={...o[n],value:null==t?void 0:t.value},o[n+1]={key:null==t||null==(s=t.value)?void 0:s.id,children:(null==e?void 0:e.length)>0?e:null},a(o),null==l||l(o)}}},M=async(e,t)=>{let n=e?{[b.label]:{[F]:e}}:{};u(!0);let o=await I({...n,parentId:null==t?void 0:t.key});u(!1),c(o)};return(0,A.jsx)(of.A,{wrap:!0,children:i.map((e,t)=>{var n,o,l;return e.children&&(0,A.jsx)(oo.A,{disabled:f.disabled,allowClear:!0,showSearch:!0,autoClearSearchValue:!0,filterOption:!1,filterSort:null,defaultValue:{label:null==e||null==(n=e.value)?void 0:n[b.label],value:null==e||null==(o=e.value)?void 0:o[b.value]},labelInValue:!0,onSearch:t=>M(t,e),fieldNames:b,style:{minWidth:150},onChange:(e,n)=>T(e,n,t),options:d?[]:k(s),onDropdownVisibleChange:n=>N(n,e,t),notFoundContent:d?(0,A.jsx)(eD.A,{size:"small"}):null},"".concat(null==(l=e.value)?void 0:l.id,"+ ").concat(e.key," + ").concat(b.label))})})}),F_=(0,ec.connect)(e=>(0,A.jsx)("div",{children:(0,A.jsx)(Fq,{...e})})),FO=(0,ec.observer)(e=>{let{options:t}=lx(),n=(0,es.useMemo)(()=>(0,ec.createForm)(),[]),{t:o}=(0,eT.useTranslation)(),l=(0,ec.useField)(),r=(0,ec.useFieldSchema)();(0,es.useEffect)(()=>{let o=(0,ec.uid)();return n.addEffects(o,()=>{(0,ec.onFormValuesChange)(n=>{var o,i;if("m2o"===t.interface){let t=FB(null==(o=n.values)?void 0:o[r.name]);setTimeout(()=>{n.setValuesIn(r.name,t),e.onChange(t),l.value=t})}else{let t=FB(null==(i=n.values)?void 0:i.select_array).filter(e=>e&&Object.keys(e).length>0);setTimeout(()=>{l.value=t,e.onChange(t)})}})}),()=>{n.removeEffects(o)}},[]);let i=Array.isArray(l.value)&&l.value.length>0?l.value:[{}];(0,es.useEffect)(()=>{var o,l;let r=null==(l=n.values)||null==(o=l.select_array)?void 0:o.filter(e=>e&&Object.keys(e).length);if("m2o"!==t.interface&&e.value&&!r.length){let e=FB(i).filter(e=>e&&Object.keys(e).length>0);n.setValues({select_array:e})}},[e.value]);let a={type:"object",properties:{select_array:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",default:i,items:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},select:{type:"string","x-decorator":"FormItem","x-component":F_,"x-component-props":{...e}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:o("Add new"),"x-component":"ArrayItems.Addition"}}}}};return(0,A.jsx)(ec.FormProvider,{form:n,children:"m2o"===t.interface?(0,A.jsx)(al,{components:{FormItem:eh.FormItem},schema:{...r,default:l.value,title:"","x-component":F_,"x-component-props":{...e}}}):(0,A.jsx)(FR,{schema:a})})},{displayName:"InternalCascadeSelect"});function FB(e,t){let n=[];if(!Array.isArray(e))return e;for(let r of e){let e=null;if(Array.isArray(r)){for(let t=(null==r?void 0:r.length)-1;t>=0;t--)if(r[t].value){e=r[t].value;break}e&&n.push(e)}else{var o,l;(e=(null==r?void 0:r.value)?r.value:null)?t?null==n||null==(o=n.push)||o.call(n,e):n=e:null==n||null==(l=n.push)||l.call(n,r)}}return n}function FE(e){let t=[];return e&&function e(n){if(null==n?void 0:n.parent){let{parent:t}=n;e(t)}let{parent:o,...l}=n;t.push(l)}(e),t}function FV(){let e=(0,ns._)(["\n .ant-formily-item-bordered-none {\n .ant-input-number-group-addon {\n border: none !important;\n background: none;\n }\n .ant-checkbox-wrapper {\n margin-left: 8px;\n }\n .ant-table {\n margin: 0px !important;\n }\n }\n "]);return FV=function(){return e},e}let Fz=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(FV())}}),FL=(0,ec.observer)(()=>{var e;let{styles:t}=Fz(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),l=lh("SubTable"),r=lh("Selector"),{options:i}=lx(),{params:a,actionName:s}=NI();(0,es.useEffect)(()=>{l(FC),n.required=o.required},[]),(0,es.useEffect)(()=>{var e;(null==(e=n.componentProps)?void 0:e.allowSelectExistingRecord)&&r(Fy)},[null==(e=n.componentProps)?void 0:e.allowSelectExistingRecord]);let c=i4(),d={...c.components,FormItem:pu,"Radio.Group":wt,"Checkbox.Group":e=>(0,A.jsx)(wt,{multiple:!0,mode:"multiple",...e})};return(0,A.jsx)(hH,{name:i.target,children:(0,A.jsx)(Nk,{actionPath:"".concat(i.target,":").concat(s||(null==a?void 0:a.actionName)||"view"),children:(0,A.jsx)(eh.FormLayout,{className:t.container,layout:"vertical",bordered:!1,children:(0,A.jsx)(ec.SchemaOptionsContext.Provider,{value:{scope:c.scope,components:d},children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:n.address,schema:o,filterProperties:e=>"AssociationField.SubTable"===e["x-component"]})})})})})},{displayName:"InternalSubTable"});function FG(e){return"object"==typeof e&&null!==e}let FK=(0,ec.observer)(e=>{var t,n,o,l,r;let i,{t:a}=(0,eT.useTranslation)(),s=(0,ec.useFieldSchema)(),c=m3(),{getCollection:d}=sO(),{enableLink:u}=s["x-component-props"]||{},p=(0,ec.useField)(),m=lv(e),[h,x]=(0,es.useState)(!1),f=lh("Viewer"),{options:v}=lx(),[g,y]=(0,es.useState)({}),b=eB(),{designable:C}=eY(),{snapshot:S}=co(),w=d(null==v?void 0:v.target),F=(null==w?void 0:w.template)==="tree",j=(0,es.useRef)(),k=(()=>{let{getCollectionJoinField:e}=sO();return(t,n)=>{if(!t)return;let o=e("".concat(t,".").concat(n));return null==o?void 0:o.uiSchema}})(),{formulaRecord:I,fieldNames:P}=s?{formulaRecord:{},fieldNames:m}:(null==(n=s["x-component-props"])?void 0:n.mode)==="CustomTitle"&&(null==(l=s["x-component-props"])||null==(o=l.fieldNames)?void 0:o.formula)?(Array.isArray(c[null==s?void 0:s.name])?c[null==s?void 0:s.name].forEach(e=>{e.customLabel=lC(e,s)}):c[null==s?void 0:s.name].customLabel=lC(c[null==s?void 0:s.name],s),{formulaRecord:c,fieldNames:{...m,label:"customLabel"}}):{formulaRecord:c,fieldNames:m},T=()=>(0,A.jsx)(lA,{name:"$nPopupRecord",title:a("Current popup record"),value:g,collection:w,children:(0,A.jsx)(l$.Provider,{value:!0,children:(0,A.jsx)(ae,{children:(0,A.jsx)(ec.RecursionField,{schema:s,onlyRenderProperties:!0,basePath:p.address,filterProperties:e=>"AssociationField.Viewer"===e["x-component"]})})})});return(0,A.jsx)("div",{children:(0,A.jsx)(nb.Provider,{value:"".concat(null==v?void 0:v.collectionName,".").concat(null==v?void 0:v.name),children:(0,A.jsxs)(hH,{name:null!=(t=null==v?void 0:v.target)?t:null==v?void 0:v.targetCollection,children:[(0,A.jsx)(gi,{ellipsis:!0,ref:j,children:(0,ec.toArr)(I[s.name]||e.value).map((e,t,n)=>{var o,l,r,i,a,s,c,p,m;let h=null==e?void 0:e[(null==P?void 0:P.label)||"label"],g=null==(m=b(F?FE(e).map(e=>null==e?void 0:e[(null==P?void 0:P.label)||"label"]).join(" / "):FG(h)?(null==(l=d(null==w||null==(i=w.fieldsMap)||null==(r=i[(null==P?void 0:P.label)||"label"])?void 0:r.target))||null==(o=l.options)?void 0:o.titleField)?h[null==(s=d(null==w||null==(p=w.fieldsMap)||null==(c=p[(null==P?void 0:P.label)||"label"])?void 0:c.target))||null==(a=s.options)?void 0:a.titleField]:JSON.stringify(h):h))?"N/A":m,I=n$(b(k((null==e?void 0:e.__collection)||(null==v?void 0:v.target),(null==P?void 0:P.label)||"label")),g,!0);return(0,A.jsxs)(es.Fragment,{children:[(0,A.jsx)("span",{children:S?I:!1!==u?(0,A.jsx)("a",{onClick:t=>{var n;t.stopPropagation(),t.preventDefault(),C&&f(Fb),x(!0),y(e),null==j||null==(n=j.current)||n.setPopoverVisible(!1)},children:I}):I}),t<n.length-1?(0,A.jsx)("span",{style:{marginRight:4,color:"#aaa"},children:","}):null]},"".concat(null==e?void 0:e.id,"_").concat(t))})}),(0,A.jsx)(ct,{value:{visible:h,setVisible:x,openMode:"drawer",snapshot:(null==v?void 0:v.interface)==="snapshot",fieldSchema:s},children:(i=null==s||null==(r=s["x-collection-field"])?void 0:r.split("."))&&i.length>2?(0,A.jsx)(m1,{record:g,parent:I[i[1]],children:T()}):(0,A.jsx)(m1,{record:g,parent:I,children:T()})})]})})})},{displayName:"ReadPrettyInternalViewer"}),F$=(0,ec.observer)(e=>{var t;let{options:n}=lx(),[o,l]=(0,es.useState)(!1),{t:r}=(0,eT.useTranslation)(),i={...e,shouldMountElement:!0},a={...e,enableLink:!0},s=(0,ec.useField)(),c=(0,ec.useFieldSchema)(),d=tg(),u=(0,es.useContext)(ce);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("span",{style:{cursor:"pointer",display:"flex"},onClick:()=>{l(!0)},children:[(0,A.jsx)("div",{style:{maxWidth:"95%"},children:(0,A.jsx)(FK,{...a})}),(0,A.jsx)(x0.A,{style:{display:"inline-flex",marginLeft:"5px"}})]}),(0,A.jsx)(ct,{value:{...u,visible:o,setVisible:l,openMode:"drawer"},children:(0,A.jsx)(cx.A,{title:r(null==n||null==(t=n.uiSchema)?void 0:t.rawTitle),open:o,onClose:()=>{l(!1)},style:{backgroundColor:"#f3f3f3"},width:"70%",destroyOnClose:!0,extra:(0,A.jsx)(e3.Ay,{type:"primary",onClick:()=>l(!1),children:"确认"}),children:(0,A.jsx)(ld,{isInSubForm:!0,children:(0,A.jsx)(ly,{value:{value:s.value,collection:d.getCollection(c["x-collection-field"])},children:(0,A.jsx)(FL,{...i})})})})})]})},{displayName:"InternaDrawerSubTable"});function FU(){let e=(0,ns._)(["\n & .ant-formily-item-layout-vertical {\n margin-bottom: 10px;\n }\n .ant-card-body {\n padding: 15px 20px 5px;\n }\n .ant-divider-horizontal {\n margin: 10px 0;\n }\n "]);return FU=function(){return e},e}function FW(){let e=(0,ns._)(["\n .ant-card-body {\n padding: 0px 20px 20px 0px;\n }\n > .ant-card-bordered {\n border: none;\n }\n "]);return FW=function(){return e},e}let FH=(0,nu.rU)(e=>{let{css:t}=e;return{body:t(FU()),showTitle:t(FW())}}),FY=(0,ec.observer)(()=>{var e,t;let n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),l=lh("Nester"),{options:r}=lx(),i=null==(t=null==(e=o["x-decorator-props"])?void 0:e.showTitle)||t,{params:a}=NI(),{styles:s}=FH();return(0,es.useEffect)(()=>{l(Fv)},[]),(0,A.jsx)(hH,{name:r.target,children:(0,A.jsx)(Nk,{actionPath:"".concat(r.target,":").concat(null==a?void 0:a.actionName),children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)("div",{className:r6()(s.body,{[s.showTitle]:!1===i}),children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:n.address,schema:o,filterProperties:e=>"AssociationField.Nester"===e["x-component"]})})})})})},{displayName:"InternalNester"}),FX=()=>{let e=(0,ec.useField)(),{multiple:t,options:n=[],setSelectedRows:o,selectedRows:l=[],onChange:r}=(0,es.useContext)(g_),{onRowSelectionChange:i,rowKey:a="id",...s}=l6(),{setVisible:c}=co();return{...s,rowKey:a,rowSelection:{type:t?"checkbox":"radio",selectedRowKeys:null==l?void 0:l.filter(e=>n.every(t=>t[a]!==e[a])).map(e=>e[a])},onRowSelectionChange(n,s){if(t){let t=nU(e.value)||[],n=l||[],r=(0,ed.differenceBy)(n,t,a),c=(0,ed.unionBy)(r,s,a),d=c.map(e=>e[a]);null==o||o(c),null==i||i(d,c)}else null==o||o(s),null==i||i(n,s),r((null==s?void 0:s[0])||null),c(!1)}}},FJ=(0,ec.observer)(e=>{var t,n;let o,l,{value:r,multiple:i,openSize:a,onChange:s,quickUpload:c,selectFile:d,shouldMountElement:u,...p}=e,m=(0,ec.useField)(),h=lv(e),[x,f]=(0,es.useState)(!1),v=(0,ec.useFieldSchema)(),g=lh("Selector"),{options:y}=lx(),{collectionName:b}=Tp(),C=eB(),S=nL(y,(null==h?void 0:h.label)||"label"),w=v["x-add-new"],[F,j]=(0,es.useState)([]),k=tz(),I=(0,es.useMemo)(()=>r&&Object.keys(r).length>0?(Array.isArray(r)?r:r?[r]:[]).filter(Boolean).map(e=>{let t=null==e?void 0:e[h.label];return{...e,[h.label]:n$(C(S),C(t))}}):[],[r,null==h?void 0:h.label]),P={size:"small",fieldNames:h,multiple:!1!==i&&["o2m","m2m"].includes(null==y?void 0:y.interface),association:{target:null==y?void 0:y.target},options:I,onChange:null==e?void 0:e.onChange,selectedRows:F,setSelectedRows:j,collectionField:y,currentFormCollection:b};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(of.A.Compact,{style:{display:"flex",lineHeight:"32px"},children:[(0,A.jsx)("div",{style:{width:"100%"},children:(0,A.jsx)(oo.A,{role:"button","data-testid":"select-data-picker",style:{width:"100%"},popupMatchSelectWidth:!1,...p,mode:i?"multiple":e.mode,fieldNames:h,onDropdownVisibleChange:e=>{g(Fy),f(!0)},allowClear:!0,onChange:e=>{if(e){if(Array.isArray(e)){if(!e.length){s([]),j([]);return}let t=null==I?void 0:I.filter(t=>e.includes(t[h.value]));s(t),j(t)}}else{let e=i?[]:null;s(e),j(e)}},options:I,value:null==i?null:Array.isArray(r)?null==(n=r.filter(Boolean))?void 0:n.map(e=>null==e?void 0:e[h.value]):null==r?void 0:r[h.value],open:!1})}),w&&(0,A.jsx)(m1,{isNew:!0,record:null,parent:k,children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:m.address,schema:v,filterProperties:e=>"Action"===e["x-component"]})})]}),(0,A.jsx)(ct,{value:{openSize:(null==(t=v["x-component-props"])?void 0:t.openSize)||a,openMode:"drawer",visible:x,setVisible:f},children:(0,A.jsx)(gV,{...P,children:(0,A.jsx)(hH,{name:null==y?void 0:y.target,children:(0,A.jsx)(ae,{children:(0,A.jsx)(lQ,{params:{filter:(o=(null==y?void 0:y.targetKey)||"id",(l=I.map(e=>e[o]).filter(Boolean)).length?{$and:[{["".concat(o,".$ne")]:l}]}:{})},children:(0,A.jsx)(i8,{scope:{usePickActionProps:()=>{let{setVisible:e}=co(),{multiple:t,selectedRows:n,onChange:o,options:l,collectionField:r}=(0,es.useContext)(g_);return{onClick(){t?o((0,ed.unionBy)(n,l,(null==r?void 0:r.targetKey)||"id")):o((null==n?void 0:n[0])||null),e(!1)},style:{display:!1!==t&&["o2m","m2m"].includes(null==r?void 0:r.interface)?"block":"none"}}},useTableSelectorProps:FX},children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:m.address,schema:v,filterProperties:e=>"AssociationField.Selector"===e["x-component"]})})})})})})})]})},{displayName:"InternalPicker"});function FQ(){let e=(0,ns._)(["\n max-width: 95%;\n "]);return FQ=function(){return e},e}function FZ(){let e=(0,ns._)(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: transparent;\n z-index: 9999;\n "]);return FZ=function(){return e},e}function F0(){let e=(0,ns._)(["\n min-width: 600px;\n max-width: 800px;\n max-height: 440px;\n overflow: auto;\n .ant-card {\n border: 0px;\n }\n "]);return F0=function(){return e},e}let F1=(0,nu.rU)(e=>{let{css:t}=e;return{pretty:t(FQ()),mask:t(FZ()),container:t(F0())}}),F2=(0,ec.observer)(e=>{var t;let{styles:n}=F1(),{options:o}=lx(),[l,r]=(0,es.useState)(!1),{t:i}=(0,eT.useTranslation)();(0,ec.useFieldSchema)()["x-component-props"].enableLink=!1;let a=(0,es.useRef)(),s={...e,shouldMountElement:!0},c=(0,A.jsx)("div",{ref:a,className:n.container,children:(0,A.jsx)(FY,{...s})}),d=(0,es.useContext)(ce),{getAriaLabel:u}=dO();return(0,A.jsxs)(ct,{value:{...d,modalProps:{getContainer:()=>a.current}},children:[(0,A.jsx)(dE,{overlayStyle:{padding:"0px"},content:c,trigger:"click",placement:"topLeft",open:l,onOpenChange:e=>r(e),title:i(null==o||null==(t=o.uiSchema)?void 0:t.rawTitle),children:(0,A.jsxs)("span",{style:{cursor:"pointer",display:"flex"},children:[(0,A.jsx)("div",{className:n.pretty,children:(0,A.jsx)(FK,{...e})}),(0,A.jsx)(x0.A,{style:{display:"inline-flex",margin:"5px"}})]})}),l&&(0,A.jsx)("div",{role:"button","aria-label":u("mask"),onClick:()=>r(!1),className:n.mask})]})},{displayName:"InternaPopoverNester"}),F6=(0,ec.observer)(e=>{let{multiple:t}=e,n=(0,ec.useField)(),o=(0,ec.useForm)(),{options:l,currentMode:r}=lx(),{components:i}=(0,es.useContext)(ec.SchemaOptionsContext),a=eu().get(i,"AlternativeAssociationSelect")||Ff;return(0,A.jsxs)(i8,{scope:{useCreateActionProps:()=>{let{onClick:e}=uK(),r=(0,ec.useField)(),{getPrimaryKey:i}=tJ(),a=i();return{async onClick(){var i,s;await e();let{data:c}=(null==(s=r.data)||null==(i=s.data)?void 0:i.data)||{};if(c)if(["m2m","o2m"].includes(null==l?void 0:l.interface)&&!1!==t){let e=o.getValuesIn(n.path)||[];e.find(e=>e[a]===c[a])||(e.push(c),o.setValuesIn(n.path,e),n.onInput(e))}else o.setValuesIn(n.path,c),n.onInput(c)}}}},components:{CreateRecordAction:FS},children:["Picker"===r&&(0,A.jsx)(FJ,{...e}),"Nester"===r&&(0,A.jsx)(FY,{...e}),"PopoverNester"===r&&(0,A.jsx)(F2,{...e}),("Select"===r||"CustomTitle"===r)&&(0,A.jsx)(a,{...e}),"SubTable"===r&&(0,A.jsx)(FL,{...e}),"FileManager"===r&&(0,A.jsx)(FF,{...e}),"CascadeSelect"===r&&(0,A.jsx)(FO,{...e}),"DrawerSubTable"===r&&(0,A.jsx)(F$,{...e}),"Cascader"===r&&(0,A.jsx)(FN,{...e})]})},{displayName:"EditableAssociationField"}),F3=(0,ec.observer)(e=>(0,A.jsx)(Fh,{children:(0,A.jsx)(F6,{...e})}),{displayName:"Editable"});function F5(){let e=(0,ns._)(["\n position: relative;\n .ant-input {\n width: 100%;\n }\n "]);return F5=function(){return e},e}function F4(){let e=(0,ns._)(["\n > .ant-card-body > .ant-divider:last-child {\n display: none;\n }\n "]);return F4=function(){return e},e}function F8(){let e=(0,ns._)(["\n border: 1px solid #f0f0f0 !important;\n box-shadow: none;\n "]);return F8=function(){return e},e}let F7=(0,nu.rU)(e=>{let{css:t}=e;return{input:t(F5()),card:t(F4()),button:t(F8())}}),F9=e=>{let{field:t}=lx(),n=tV(),o=tS(),l=(0,es.useCallback)(e=>{var t;let{form:n,fieldSchema:o,collectionField:l,getInterface:r,formBlockType:i}=e;return!!l&&(!l.target||null==(t=o["x-component-props"])||!t.mode||!!["Picker","Select"].includes(o["x-component-props"].mode))&&"update"!==i&&!(null==n?void 0:n.readPretty)&&!sB(o)&&!sL.includes(null==l?void 0:l.interface)&&!a8(l,r)},[]);return(0,A.jsx)(uN,{name:"nester",children:(0,A.jsx)(ly,{value:{value:t.value,collection:o},children:(0,A.jsx)(m1,{isNew:null==n?void 0:n.isNew,record:t.value,parent:null==n?void 0:n.data,children:(0,A.jsx)(sV,{isAllowToSetDefaultValue:l,children:(0,A.jsx)(rZ.A,{bordered:!0,children:e.children})})})})})},je=(0,ec.observer)(e=>{let t=(0,ec.useFieldSchema)(),{options:n,field:o,allowMultiple:l,allowDissociate:r}=lx(),{t:i}=(0,eT.useTranslation)(),a=tz(),s=tS();Array.isArray(o.value)||(o.value=[]);let c=(0,es.useCallback)(e=>{var t;let{form:n,fieldSchema:o,collectionField:l,getInterface:r}=e;return!!l&&(!l.target||null==(t=o["x-component-props"])||!t.mode||!!["Picker","Select"].includes(o["x-component-props"].mode))&&!(null==n?void 0:n.readPretty)&&!sB(o)&&!sL.includes(null==l?void 0:l.interface)&&!a8(l,r)},[]),{styles:d}=F7();return o.value.length>0?(0,A.jsx)(rZ.A,{bordered:!0,style:{position:"relative"},className:d.card,children:o.value.map((e,d)=>{let u=r;return r||(u=!(null==e?void 0:e[n.targetKey])),(0,A.jsxs)(es.Fragment,{children:[(0,A.jsxs)("div",{style:{textAlign:"right"},children:[o.editable&&l&&(0,A.jsx)(iV.A,{title:i("Add new"),children:(0,A.jsx)(sF.A,{style:{zIndex:1e3,marginRight:"10px",color:"#a8a3a3"},onClick:()=>{(0,ec.action)(()=>(Array.isArray(o.value)||(o.value=[]),(0,ec.spliceArrayState)(o,{startIndex:d+1,insertCount:1}),o.value.splice(d+1,0,oO({})),(0,ec.each)(o.form.fields,(e,t)=>{e||delete o.form.fields[t]}),o.onInput(o.value)))}})},"add"),!o.readPretty&&u&&(0,A.jsx)(iV.A,{title:i("Remove"),children:(0,A.jsx)(cp.A,{style:{zIndex:1e3,color:"#a8a3a3"},onClick:()=>{(0,ec.action)(()=>((0,ec.spliceArrayState)(o,{startIndex:d,deleteCount:1}),o.value.splice(d,1),o.onInput(o.value)))}})},"remove")]}),(0,A.jsx)(uN,{name:"nester",children:(0,A.jsx)(ly,{value:{value:e,collection:s},children:(0,A.jsx)(m1,{isNew:o_(e),record:e,parent:a,children:(0,A.jsx)(m6,{index:d,children:(0,A.jsx)(sV,{isAllowToSetDefaultValue:c,children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:o.address.concat(d),schema:t})})})})})}),(0,A.jsx)(mA.A,{})]},d)})}):(0,A.jsx)(A.Fragment,{children:o.editable&&l&&(0,A.jsx)(iV.A,{title:i("Add new"),children:(0,A.jsx)(e3.Ay,{type:"default",className:d.button,block:!0,icon:(0,A.jsx)(sF.A,{}),onClick:()=>{let e=o.value;e.push({}),o.value=e}})},"add")})},{displayName:"ToManyNester"}),jt=(0,ec.observer)(e=>{var t,n;let o,l=(0,ec.useFieldSchema)(),r=m3(),{enableLink:i,tagColorField:a}=l["x-component-props"],s=(0,ec.useField)(),c=lv(e),[d,u]=(0,es.useState)(!1),p=lh("Viewer"),{options:m}=lx(),[h,x]=(0,es.useState)({}),f=eB(),{designable:v}=eY(),g=nL(m,(null==c?void 0:c.label)||"label"),{snapshot:y}=co(),b=(0,es.useRef)(),{getCollection:C}=sO(),S=C(null==m?void 0:m.target),w=(null==S?void 0:S.template)==="tree",F=()=>(0,A.jsx)(l$.Provider,{value:!0,children:(0,A.jsx)(ae,{children:(0,A.jsx)(ec.RecursionField,{schema:l,onlyRenderProperties:!0,basePath:s.address,filterProperties:e=>"AssociationField.Viewer"===e["x-component"]})})});return(0,A.jsx)("div",{children:(0,A.jsx)(nb.Provider,{value:"".concat(null==m?void 0:m.collectionName,".").concat(null==m?void 0:m.name),children:(0,A.jsxs)(hH,{name:null!=(t=null==m?void 0:m.target)?t:null==m?void 0:m.targetCollection,children:[(0,A.jsx)(gi,{ellipsis:!0,ref:b,children:(0,ec.toArr)(e.value).map((e,t,n)=>{var o,l,r;let s,d=null==e?void 0:e[(null==c?void 0:c.label)||"label"],m=null==(o=f(w?FE(e).map(e=>null==e?void 0:e[(null==c?void 0:c.label)||"label"]).join(" / "):FG(d)?JSON.stringify(d):d))?"N/A":o,h=(l=f(g),r=e[a],Array.isArray(s=null==l?void 0:l.enum)&&m?nK(m).map(e=>{let t=s.find(t=>t.value===e);return es.createElement(nz.A,{color:r||(null==t?void 0:t.color)},null==t?void 0:t.label)}):(null==l?void 0:l["x-component"])==="DatePicker"?es.createElement(nz.A,{color:r},nG({...null==l?void 0:l["x-component-props"],value:m})):es.createElement(nz.A,{color:r},m));return(0,A.jsxs)(es.Fragment,{children:[(0,A.jsx)("span",{children:y?h:!1!==i?(0,A.jsx)("a",{onClick:t=>{var n;t.stopPropagation(),t.preventDefault(),v&&p(Fb),u(!0),x(e),null==b||null==(n=b.current)||n.setPopoverVisible(!1)},children:h}):h}),t<n.length-1?(0,A.jsx)("span",{style:{marginRight:4,color:"#aaa"},children:","}):null]},"".concat(null==e?void 0:e[c.value],"_").concat(t))})}),(0,A.jsx)(ct,{value:{visible:d,setVisible:u,openMode:"drawer",snapshot:(null==m?void 0:m.interface)==="snapshot"},children:(o=null==l||null==(n=l["x-collection-field"])?void 0:n.split("."))&&o.length>2?(0,A.jsx)(m1,{record:h,parent:r[o[1]],children:F()}):(0,A.jsx)(m1,{record:h,parent:r,children:F()})})]})})})},{displayName:"ReadPrettyInternalTag"}),jn=(0,ec.observer)(e=>{let{currentMode:t}=lx();return(0,A.jsxs)(A.Fragment,{children:[["Select","Picker","CascadeSelect","Cascader","CustomTitle"].includes(t)&&(0,A.jsx)(FK,{...e}),"Tag"===t&&(0,A.jsx)(jt,{...e}),"Nester"===t&&(0,A.jsx)(FY,{...e}),"SubTable"===t&&(0,A.jsx)(FL,{...e}),"FileManager"===t&&(0,A.jsx)(Fj,{...e})]})},{displayName:"ReadPrettyAssociationField"}),jo=(0,ec.observer)(e=>(0,A.jsx)(Fh,{children:(0,A.jsx)(jn,{...e})}),{displayName:"ReadPretty"});var jl=n(6219);let jr=(0,ec.observer)(e=>{let{schema:t,basePath:n}=e,o=m3(),{getCollectionJoinField:l}=sO(),r=t.reduceProperties((e,t)=>"CollectionField"===t["x-component"]?t:e,null),i=r&&l(r["x-collection-field"]);if(r&&(null==o?void 0:o.__collection)&&i&&["select","multipleSelect"].includes(i.interface)){let e="".concat(o.__collection,".").concat(r.name),l={...t.toJSON(),properties:{[r.name]:{...r.toJSON(),"x-collection-field":e}}};return(0,A.jsx)(ec.RecursionField,{basePath:n,schema:l,onlyRenderProperties:!0})}return e.children},{displayName:"ColumnFieldProvider"});function ji(){let e=(0,ns._)(["\n height: 100%;\n overflow: hidden;\n .ant-table-thead {\n .ant-table-cell {\n text-align: center;\n }\n }\n .ant-table-wrapper {\n height: 100%;\n .ant-spin-nested-loading {\n height: 100%;\n .ant-spin-container {\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n }\n }\n .ant-table {\n overflow-x: auto;\n overflow-y: hidden;\n }\n "]);return ji=function(){return e},e}function ja(){let e=(0,ns._)(["\n // 扩大 SchemaToolbar 的面积\n .tb-action-link {\n margin: -","px -","px;\n padding: ","px ","px;\n }\n "]);return ja=function(){return e},e}function js(){let e=(0,ns._)(["\n & > td {\n border-top: 2px solid "," !important;\n }\n "]);return js=function(){return e},e}function jc(){let e=(0,ns._)(["\n & > td {\n border-bottom: 2px solid "," !important;\n }\n "]);return jc=function(){return e},e}function jd(){let e=(0,ns._)(["\n & > td {\n background-color: "," !important;\n }\n &:hover > td {\n background-color: "," !important;\n }\n "]);return jd=function(){return e},e}function ju(){let e=(0,ns._)(["\n max-width: 300px;\n white-space: nowrap;\n &:hover .general-schema-designer {\n display: block;\n }\n "]);return ju=function(){return e},e}function jp(){let e=(0,ns._)(["\n max-width: 300px;\n white-space: nowrap;\n .ant-color-picker-trigger {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n }\n "]);return jp=function(){return e},e}function jm(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n float: left;\n align-items: center;\n justify-content: space-evenly;\n padding-right: 8px;\n .tb-table-index {\n opacity: 0;\n }\n &:not(.checked) {\n .tb-table-index {\n opacity: 1;\n }\n }\n "]);return jm=function(){return e},e}function jh(){let e=(0,ns._)(["\n &:hover {\n .tb-table-index {\n opacity: 0;\n }\n .tb-origin-node {\n display: block;\n }\n }\n "]);return jh=function(){return e},e}function jx(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n "]);return jx=function(){return e},e}function jf(){let e=(0,ns._)(["\n position: absolute;\n right: 50%;\n transform: translateX(50%);\n &:not(.checked) {\n display: none;\n }\n "]);return jf=function(){return e},e}let jv=(0,nu.rU)(e=>{let{css:t,token:n}=e,o=new SD.q(n.colorSettings).setAlpha(.6).toHex8String();return{container:t(ji()),toolbar:t(ja(),n.paddingContentVerticalLG,n.marginSM,n.paddingContentVerticalLG,n.marginSM),topActive:t(js(),o),bottomActive:t(jc(),o),highlightRow:t(jd(),n.controlItemBgActiveHover,n.controlItemBgActiveHover),headerCellDesigner:t(ju()),bodyCell:t(jp()),rowSelect:t(jm()),rowSelectHover:t(jh()),cellChecked:t(jx()),cellCheckedNode:t(jf())}}),jg=e=>{let t=(0,ec.useField)();return e.field||t},jy=e=>{var t,n,o,l,r,i;let{styles:a}=jv(),s=null==(t=e["data-row-key"])?void 0:t.toString(),{setNodeRef:c,isOver:d,active:u,over:p}=(0,jl.useSortable)({id:s}),m=(null!=(r=null==u||null==(n=u.data.current)?void 0:n.sortable.index)?r:-1)>(null!=(i=null==p||null==(l=p.data.current)||null==(o=l.sortable)?void 0:o.index)?i:-1)?a.topActive:a.bottomActive;return(0,A.jsx)("tr",{ref:(null==u?void 0:u.id)!==s?c:null,...e,className:r6()(e.className,{[m]:u&&d})})},jb=e=>{let{id:t,...n}=e,{listeners:o}=(0,jl.useSortable)({id:t});return(0,A.jsx)(ss.A,{...n,...o,style:{cursor:"grab"}})},jC=e=>{let{index:t,...n}=e;return(0,A.jsx)("div",{className:r6()("tb-table-index"),style:{padding:"0 8px 0 16px"},...n,children:t})},jS=[5,10,20,50,100,200],jw=Tr((0,ec.observer)(e=>{var t,n,o,l,r,i,a,s;let{token:c}=iw.A.useToken(),{styles:d}=jv(),{pagination:u,useProps:p,...m}=e,{pagination:h,...x}=(null==p?void 0:p())||{},{dragSort:f,showIndex:v=!0,onRowSelectionChange:g,onChange:y,rowSelection:b,rowKey:C,required:S,onExpand:w,onClickRow:F,...j}={...m,...x},k=jg(j),I=(e=>{var t,n,o,l,r;let{t:i}=(0,eT.useTranslation)(),{styles:a}=jv(),s=jg(e),c=(0,ec.useFieldSchema)(),{schemaInWhitelist:d}=NN(),{designable:u}=eY(),{exists:p,render:m}=mz(c["x-initializer"],c["x-initializer-props"]),h=tG(),x=tS(),f=(null==s||null==(l=s.value)||null==(o=l.slice)||null==(n=o.call(l))||null==(t=n.filter)?void 0:t.call(n,Boolean))||[],v=null==(r=c.reduceProperties((e,t)=>{var n;return(null==(n=t["x-component"])?void 0:n.endsWith(".Column"))>-1&&d(Object.values(t.properties||{}).pop())?e.concat([t]):e},[]))?void 0:r.map(e=>{var t;let n=e.reduceProperties((e,t)=>{if(sy(t))return e.concat([t])},[]),o=(null==n?void 0:n.length)>0?n[0].name:e.name;return{title:(0,A.jsx)(ec.RecursionField,{name:e.name,schema:e,onlyRenderSelf:!0}),dataIndex:o,key:e.name,sorter:null==(t=e["x-component-props"])?void 0:t.sorter,width:200,...e["x-component-props"],render:(t,n)=>{var o;let l=null==(o=s.value)?void 0:o.indexOf(n);return(0,A.jsx)(lA,{name:"$nPopupRecord",title:i("Current popup record"),value:n,collection:x,children:(0,A.jsx)(ly,{value:{value:n,collection:x},children:(0,A.jsx)(m6,{index:n.__index||l,children:(0,A.jsx)(m1,{isNew:o_(n),record:n,parent:h,children:(0,A.jsx)(jr,{schema:e,basePath:s.address.concat(n.__index||l),children:(0,A.jsx)("span",{role:"button",className:a.toolbar,children:(0,A.jsx)(ec.RecursionField,{basePath:s.address.concat(n.__index||l),schema:e,onlyRenderProperties:!0})})})})})})})}}});if(!p)return v;let g=v.concat({title:m(),fixed:"right",dataIndex:"TABLE_COLUMN_INITIALIZER",key:"TABLE_COLUMN_INITIALIZER",render:u?()=>(0,A.jsx)("span",{}):null});return e.showDel&&g.push({title:"",key:"delete",width:60,align:"center",fixed:"right",render:(t,n,o)=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(rQ.A,{style:{cursor:"pointer",marginRight:"10px"},onClick:()=>{(0,ec.action)(()=>(Array.isArray(s.value)||(s.value=[]),(0,ec.spliceArrayState)(s,{startIndex:o+1,insertCount:1}),s.value.splice(o+1,0,oO(eu().cloneDeep(n))),(0,ed.each)(s.form.fields,(e,t)=>{e||delete s.form.fields[t]}),s.onInput(s.value)))}}),(0,A.jsx)(x7.A,{style:{cursor:"pointer"},onClick:()=>{(0,ec.action)(()=>{var t;let o=f.indexOf(n);return(0,ec.spliceArrayState)(s,{startIndex:o,deleteCount:1}),s.value.splice(o,1),null==(t=s.initialValue)||t.splice(o,1),e.setFieldValue([...s.value]),s.onInput(s.value)})}})]})}),[...g.filter(e=>"left"===e.fixed),...g.filter(e=>!e.fixed||"left"!==e.fixed&&"right"!==e.fixed),...g.filter(e=>"right"===e.fixed)]})(j),P=(0,ec.useFieldSchema)(),T=tJ(),{expandFlag:N,allIncludesChildren:M}=(null==P||null==(t=P.parent)?void 0:t["x-decorator"])==="TableSelectorProvider"?l2():lz(),D=(0,Ca.A)(j.onRowDragEnd||(()=>{})),R=((e,t)=>{let{t:n}=(0,eT.useTranslation)(),o=(0,es.useCallback)(e=>n("Total {{count}} items",{count:e}),[n]);if(!1===t||!t&&!1===e)return!1;let l={showTotal:o,showSizeChanger:!0,pageSizeOptions:jS,...e,...t};return!!l.total&&l})(u,h),[q,_]=(0,es.useState)([]),[O,B]=(0,es.useState)((null==k||null==(n=k.data)?void 0:n.selectedRowKeys)||[]),[E,V]=(0,es.useState)([]),z=(null==k||null==(i=k.value)||null==(r=i.slice)||null==(l=r.call(i))||null==(o=l.filter)?void 0:o.call(l,Boolean))||[],L=(null==b?void 0:b.type)!=="none",G=f||k.componentProps.dragSort||!1,K=(0,es.useRef)(new Map),$=null,U="";F&&($=e=>({onClick:t=>{(0,eh.isPortalInBody)(t.target)||F(e,V,E)}}),U=d.highlightRow),(0,es.useEffect)(()=>{N?_(M):_([])},[N,M]);let W=(0,es.useMemo)(()=>({header:{wrapper:e=>(0,A.jsx)(SM,{children:(0,A.jsx)("thead",{...e})}),cell:e=>(0,A.jsx)("th",{...e,className:r6()(e.className,d.headerCellDesigner)})},body:{wrapper:e=>(0,A.jsx)(SM,{onDragEnd:e=>{var t,n,o,l,r,i;if(!e.active||!e.over)return void console.warn("move cancel");let a=null==(o=e.active)||null==(n=o.data.current)||null==(t=n.sortable)?void 0:t.index,s=null==(i=e.over)||null==(r=i.data.current)||null==(l=r.sortable)?void 0:l.index,c=k.value[a]||e.active,d=k.value[s]||e.over;k.move(a,s),D({from:c,to:d})},children:(0,A.jsx)("tbody",{...e})}),row:e=>(0,A.jsx)(jy,{...e}),cell:e=>(0,A.jsx)("td",{...e,className:r6()(e.className,d.bodyCell)})}}),[k,D,G]),H=e=>{if(e.key)return e.key;if(K.current.has(e))return K.current.get(e);let t=(0,ec.uid)();return K.current.set(e,t),t},Y=e=>{var t,n;return"string"==typeof C?null==(t=e[C])?void 0:t.toString():null==(n=(null!=C?C:H)(e))?void 0:n.toString()},X={rowSelection:b?{type:"checkbox",selectedRowKeys:O,onChange(e,t){k.data=k.data||{},k.data.selectedRowKeys=e,B(e),null==g||g(e,t)},getCheckboxProps:e=>({"aria-label":"checkbox"}),renderCell:(t,n,o,l)=>{var r,i,a;let s;if(!G&&!v)return l;let c=null==e||null==(r=e.pagination)?void 0:r.current,u=(null==e||null==(i=e.pagination)?void 0:i.pageSize)||20;return c?o=o+(c-1)*u+1:o+=1,n.__index&&(a=n.__index,s=[],null==a||a.split(".").forEach(function(e){isNaN(e)||s.push(String(Number(e)+1))}),o=s.join(".")),(0,A.jsxs)("div",{role:"button","aria-label":"table-index-".concat(o),className:r6()(t?"checked":null,d.rowSelect,{[d.rowSelectHover]:L}),children:[(0,A.jsxs)("div",{className:r6()(t?"checked":null,d.cellChecked),children:[G&&(0,A.jsx)(jb,{id:Y(n)}),v&&(0,A.jsx)(jC,{index:o})]}),L&&(0,A.jsx)("div",{className:r6()("tb-origin-node",t?"checked":null,d.cellCheckedNode),children:l})]})},...b}:void 0},J=(0,es.useCallback)(e=>{var t,n;let{children:o}=e;return G?es.createElement(jl.SortableContext,{items:(null==(n=k.value)||null==(t=n.map)?void 0:t.call(n,Y))||[]},o):es.createElement(es.Fragment,{},o)},[k,G]),Q=(0,ec.useFieldSchema)(),Z=null==Q||null==(s=Q.parent)||null==(a=s["x-decorator-props"])?void 0:a.fixedBlock,{height:ee,tableSizeRefCallback:et}=ST(),en=(0,es.useMemo)(()=>Z?{x:"max-content",y:ee}:{x:"max-content"},[Z,ee]);return(0,A.jsxs)("div",{className:d.container,children:[(0,A.jsx)(J,{children:(0,A.jsx)(xF.A,{ref:et,rowKey:null!=C?C:H,dataSource:z,tableLayout:"auto",...j,...X,pagination:R,components:W,onChange:(e,t,n,o)=>{null==y||y(e,t,n,o)},onRow:$,rowClassName:e=>E.includes(e[C])?U:"",scroll:en,columns:I,expandable:{onExpand:(e,t)=>{_(e?[...q,t[T.getPrimaryKey()]]:q.filter(e=>t[T.getPrimaryKey()]!==e)),null==w||w(e,t)},expandedRowKeys:q}})}),k.errors.length>0&&(0,A.jsx)("div",{className:"ant-formily-item-error-help ant-formily-item-help ant-formily-item-help-enter ant-formily-item-help-enter-active",children:k.errors.map(e=>e.messages.map(e=>(0,A.jsx)("div",{children:e},e)))})]})}),{displayName:"Table"});var jF=n(37976),jj=n(98961),jA=n(2836);let jk=(e,t)=>{let[n,o]=(0,es.useState)(null),{parseFilter:l,findVariable:r}=Cu();return(0,es.useEffect)(()=>{let n=async()=>{o(await l(pA([e||t])))},i=eu().debounce(n,300);return n(),(0,ec.reaction)(()=>(0,eh.flatten)(e,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if(!oY(e))return e;let t=lp(e),n=r(t);return(0,eh.getValuesByPath)({[t]:(null==n?void 0:n.ctx)||{}},oX(e))}}),i)},[e,r,t,l]),[n,o]};function jI(){let e=(0,ns._)(["\n display: flex;\n flex-direction: row;\n max-height: 30vh;\n .left-pane {\n padding: 2px;\n display: flex;\n font-weight: 500;\n flex-direction: column;\n width: 100px;\n overflow-y: auto;\n /* 隐藏滚动条 微软/火狐 */\n -ms-overflow-style: none;\n scrollbar-width: none;\n border-right: 2px solid #d4d4d4;\n padding: 2px;\n margin-right: 5px;\n div {\n background-color: #ffffff;\n white-space: normal;\n cursor: pointer;\n margin: 5px 0 5px;\n }\n div:last-of-type {\n margin-bottom: 0;\n }\n }\n /* 隐藏滚动条 谷歌浏览器 */\n .left-pane::-webkit-scrollbar {\n display: none;\n }\n\n .right-pane {\n padding: 2px;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n flex: 1;\n div {\n margin-bottom: 1em;\n .ant-btn {\n margin-right: 2px;\n }\n }\n div:last-of-type {\n margin-bottom: 0;\n }\n }\n "]);return jI=function(){return e},e}let jP=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(jI())}}),jT=e=>{var t;let{item:n,onChange:o,leftRef:l}=e,{ref:r}=(0,jA.Wx)({threshold:.1,onChange:e=>{if(e&&l.current){let e="#parent-item-"+n.id;l.current.querySelector(e).scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}}});return(0,A.jsx)("div",{id:"item-"+n.id,ref:r,children:null==n||null==(t=n.childrenItems)?void 0:t.sort((e,t)=>null!=e.sort?e.sort-t.sort:e.id-t.id).map((e,t)=>(0,A.jsx)(e3.Ay,{onClick:()=>{o(e)},icon:e.checked?(0,A.jsx)(jF.A,{}):null,children:e.label},t))},n.id)},jN=(0,ec.observer)(e=>{var t,n,o,l;let r=(0,es.useRef)(),{styles:i}=jP(),{fieldValue:a,setFieldValue:s}=e,c=(0,ec.useFieldSchema)(),d=tg(),u=eC(),[p,m]=(0,es.useState)(""),h=c.parent["x-component-props"].isQuickAdd,{value:x,fieldInterface:f}=(null==(t=c.parent["x-component-props"])?void 0:t.quickAddField)||{},v=c.parent["x-component-props"].quickAddParentCollection,[g,y]=(0,es.useState)([]),{field:b}=lx(),{t:C}=(0,eT.useTranslation)(),[S,w]=(0,es.useState)(),F=c.reduceProperties((e,t)=>{let n=t.reduceProperties((e,t)=>t.name===x?t:e);return n||e},new ec.Schema({})),j=null==(o=F["x-component-props"])||null==(n=o.service)?void 0:n.params,[k]=jk(null==j?void 0:j.filter),I=null==(l=Object.values(no()((null==j?void 0:j.filter)||{})))?void 0:l.map(e=>{let t=e.match(/^{{\$nForm\.(.*?)\./);if(t)return t[1]}).filter(Boolean);(0,jj.A)(async()=>{let e={},t=[];if((null==j||!j.filter||k)&&(x||"none"!==x||!h)&&c.properties){var n,o,l,r,i;let a={paginate:!1,filter:JSON.stringify(k)};if(v&&(null==v?void 0:v.value)!=="none"){a.appends=[v.value];let t=d.getCollection(v.collectionField),o=await u.request({url:t.name+":list",params:{paginate:!1}});e.parentTitleField=t.titleField,e.parentOptions=null==o||null==(n=o.data)?void 0:n.data}if(F&&"m2o"===f){e.service=F["x-component-props"].service,e.collectionName=d.getCollection(F["x-collection-field"]).name;let n=await u.request({url:e.collectionName+":list",params:a});e.childrenTitleField=d.getCollection(e.collectionName).titleField,e.childrenOptions=null==n||null==(o=n.data)?void 0:o.data,(null==(l=e.parentOptions)?void 0:l.length)&&(null==(r=e.childrenOptions)?void 0:r.length)&&(null==v?void 0:v.value)!=="none"?e.parentOptions.forEach(n=>{let o=e.childrenOptions.map(t=>{var o;if((null==(o=t[null==v?void 0:v.value])?void 0:o.id)===n.id)return{...t,label:t[e.childrenTitleField],keys:t.id,value:t.id,checked:!1}}).filter(Boolean);o.length&&t.push({...n,value:null==n?void 0:n.id,label:n[e.parentTitleField],key:n.id,childrenItems:o})}):(null==(i=e.childrenOptions)?void 0:i.length)&&(!v||(null==v?void 0:v.value)==="none")&&e.childrenOptions.forEach(n=>{t.push({...n,label:n[e.childrenTitleField],value:null==n?void 0:n.id,key:null==n?void 0:n.id,checked:!1})}),y(t)}else if(F){let e=d.getCollectionField(F["x-collection-field"]);if(!(null==e?void 0:e.uiSchema)||!(null==e?void 0:e.uiSchema.enum))return;e.uiSchema.enum.forEach(e=>{t.push(e)}),y(t)}}},[k,null==j?void 0:j.filter,S,h,x,v]),(0,eM.A)(()=>{if(!g.length)return;let e=b.value;e&&(v&&(null==v?void 0:v.value)!=="none"?y(jM(g,e,x)):y(jD(g,e,x)))},[x,a]),(0,ec.useFormEffects)(()=>{(0,ec.onFieldChange)(I,e=>{w(e)})});let P=g;P=v&&"none"!==v.value?null==g?void 0:g.map(e=>{var t;let n=null==e||null==(t=e.childrenItems)?void 0:t.filter(e=>(0,eh.fuzzysearch)(p,null==e?void 0:e.label));if((0,eh.fuzzysearch)(p,null==e?void 0:e.label)||(null==n?void 0:n.length))return{...e,childrenItems:(null==n?void 0:n.length)?n:e.childrenItems}}).filter(Boolean):g.filter(e=>(0,eh.fuzzysearch)(p,null==e?void 0:e.label));let T=e=>{b.value=b.value||[];let t={};t[x]=e,b.value.push(oO(t)),s([...b.value])};return(0,A.jsxs)("div",{children:[(0,A.jsx)(nJ.A,{placeholder:C("Please enter search content"),prefix:(0,A.jsx)(gn.A,{}),value:p,onChange:e=>{m(e.target.value)}}),v&&(null==v?void 0:v.value)!=="none"?(0,A.jsxs)("div",{className:i.container,ref:r,children:[(0,A.jsx)("div",{className:"left-pane",children:P.sort((e,t)=>null!=e.sort?e.sort-t.sort:e.id-t.id).map(e=>(0,A.jsx)("div",{id:"parent-item-"+e.id,onClick:()=>{var t;null==(t=r.current)||t.querySelector("#item-"+e.id).scrollIntoView({behavior:"auto",block:"nearest",inline:"start"});let n="#parent-item-"+e.id;r.current.querySelector(n).scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}),r.current.querySelector(n).style.color="#166cff";let o=r.current.querySelectorAll("div:not("+n+")");null==o||o.forEach(function(e){e.style.color="#1e1e1e"})},children:e.label||null},e.id))}),(0,A.jsx)("div",{className:"right-pane",children:P.sort((e,t)=>null!=e.sort?e.sort-t.sort:e.id-t.id).map(e=>(0,A.jsx)(jT,{item:e,onChange:T,leftRef:r},e.id))})]}):(0,A.jsx)(of.A,{style:{maxHeight:"30vh",overflow:"auto",padding:"10px"},children:P.map((e,t)=>(0,A.jsx)(e3.Ay,{onClick:()=>{T(e)},icon:e.checked?(0,A.jsx)(jF.A,{}):null,children:e.label},t))})]})}),jM=(e,t,n)=>null==e?void 0:e.map(e=>{let o=e.childrenItems.map(e=>{let o=t.find(t=>{var o;return(null==(o=t[n])?void 0:o.value)===e.value});return{...e,checked:!!o}});return{...e,childrenItems:o}}),jD=(e,t,n)=>e.map(e=>{let o=t.find(t=>{var o;return(null==(o=t[n])?void 0:o.value)===e.value});return{...e,checked:!!o}}),jR=(0,ec.observer)(e=>{var t;let{t:n}=(0,eT.useTranslation)(),o=(0,ec.useFieldSchema)(),l=o.parent["x-component-props"].isQuickAdd,{value:r}=(null==(t=o.parent["x-component-props"])?void 0:t.quickAddField)||{},i=[{key:"1",label:n("Quick create"),children:(0,A.jsx)(jN,{...e})}];return l&&r&&"none"!==r?(0,A.jsx)(r0.A,{items:i,defaultActiveKey:["1"]}):null});function jq(){let e=(0,ns._)(["\n display: block;\n border-radius: 0px;\n border-right: 1px solid rgba(0, 0, 0, 0.06);\n "]);return jq=function(){return e},e}function j_(){let e=(0,ns._)(["\n display: block;\n border-radius: 0px;\n "]);return j_=function(){return e},e}function jO(){let e=(0,ns._)(["\n .ant-formily-item.ant-formily-item-feedback-layout-loose {\n margin-bottom: 0px !important;\n }\n .ant-formily-editable {\n vertical-align: sub;\n }\n .ant-table-footer {\n display: flex;\n }\n "]);return jO=function(){return e},e}function jB(){let e=(0,ns._)(["\n .ant-table-footer {\n padding: 0 !important;\n }\n .ant-formily-item-error-help {\n display: none;\n }\n .ant-description-textarea {\n line-height: 34px;\n }\n .ant-table-cell .ant-formily-item-error-help {\n display: block;\n position: absolute;\n font-size: 12px;\n top: 100%;\n background: #fff;\n width: 100%;\n margin-top: -15px;\n padding: 3px;\n z-index: 1;\n border-radius: 3px;\n box-shadow: 0 0 10px #eee;\n animation: none;\n transform: translateY(0);\n opacity: 1;\n }\n "]);return jB=function(){return e},e}function jE(){let e=(0,ns._)(["\n position: relative;\n .ant-input {\n width: 100%;\n }\n "]);return jE=function(){return e},e}let jV=(0,nu.rU)(e=>{let{css:t}=e;return{addNew:t(jq()),select:t(j_()),table:t(jO()),container:t(jB()),input:t(jE())}}),jz=(0,ec.observer)(e=>{var t,n,o,l,r;let i,a,{openSize:s}=e,{styles:c}=jV(),{field:d,options:u}=lx(),p=(0,ec.useField)(),{t:m}=(0,eT.useTranslation)(),[h,x]=(0,es.useState)(!1),[f,v]=(0,es.useState)([]),g=lv(e),y=(0,ec.useFieldSchema)(),b=eB(),C=nL(u,(null==g?void 0:g.label)||"label"),S=tV(),[w,F]=(0,es.useState)([]),{dn:j}=eY();d.move=(e,t)=>{if(void 0!==t&&(0,ec.isArr)(d.value)&&e!==t)return(0,ec.action)(()=>{let n=d.value[e];return d.value.splice(e,1),d.value.splice(t,0,n),(0,ec.exchangeArrayState)(d,{fromIndex:e,toIndex:t}),d.onInput(d.value)})};let k=(0,es.useMemo)(()=>d.value&&Object.keys(d.value).length>0?(Array.isArray(d.value)?d.value:d.value?[d.value]:[]).filter(Boolean).map(e=>{let t=null==e?void 0:e[g.label];return{...e,[g.label]:n$(b(C),b(t))}}):[],[d.value,null==g?void 0:g.label]),I={size:"small",fieldNames:d.componentProps.fieldNames,multiple:!0,association:{target:null==u?void 0:u.target},options:k,onChange:null==e?void 0:e.onChange,selectedRows:f,setSelectedRows:v,collectionField:u},P={...e,fieldValue:w,setFieldValue:F},T={pageSize:(null==(n=p.componentProps)||null==(t=n.pagination)?void 0:t.pageSize)||5,current:(null==(l=p.componentProps)||null==(o=l.pagination)?void 0:o.current)||1,total:(null==(r=d.value)?void 0:r.length)||0};return(0,A.jsxs)("div",{className:c.container,children:[(0,A.jsx)(ld,{isInSubTable:!0,children:(0,A.jsx)(tE,{record:null,parentRecord:S,children:(0,A.jsxs)(uN,{name:"nester",children:[(0,A.jsx)(jR,{...P}),(0,A.jsx)(jw,{className:c.table,bordered:!0,onChange:e=>{p&&y&&(p.componentProps={...p.componentProps,pagination:e},y["x-component-props"]={...y["x-component-props"],pagination:e})},size:"small",field:d,showIndex:!0,dragSort:d.editable,showDel:d.editable,setFieldValue:F,pagination:!!d.componentProps.pagination&&T,rowSelection:{type:"none",hideSelectAll:!0},footer:()=>{var e,t;return d.editable&&(0,A.jsxs)(A.Fragment,{children:[(null==(e=d.componentProps)?void 0:e.allowAddnew)!==!1&&(0,A.jsx)(e3.Ay,{type:"text",block:!0,className:c.addNew,onClick:()=>{d.value=d.value||[],d.value.push(oO({})),F([...d.value])},children:m("Add new")}),(null==(t=d.componentProps)?void 0:t.allowSelectExistingRecord)&&(0,A.jsx)(e3.Ay,{type:"text",block:!0,className:c.select,onClick:()=>{x(!0)},children:m("Select")})]})},isSubTable:!0})]})})}),(0,A.jsx)(ct,{value:{openSize:s,openMode:"drawer",visible:h,setVisible:x},children:(0,A.jsx)(gV,{...I,children:(0,A.jsx)(hH,{name:null==u?void 0:u.target,children:(0,A.jsx)(ae,{children:(0,A.jsx)(lQ,{params:{filter:(i=(null==u?void 0:u.targetKey)||"id",(a=k.map(e=>e[i]).filter(Boolean)).length?{$and:[{["".concat(i,".$ne")]:a}]}:{})},children:(0,A.jsx)(i8,{scope:{usePickActionProps:()=>{let{setVisible:e}=co(),{selectedRows:t,options:n,collectionField:o}=(0,es.useContext)(g_);return{onClick(){let l=(0,ed.unionBy)(t,n,(null==o?void 0:o.targetKey)||"id"),r=d.value||[];d.value=(0,ed.uniqBy)(r.concat(l),(null==o?void 0:o.targetKey)||"id"),d.onInput(d.value),e(!1)}}},useTableSelectorProps:FX,useCreateActionProps:uG},children:(0,A.jsx)(ec.RecursionField,{onlyRenderProperties:!0,basePath:d.address,schema:y.parent,filterProperties:e=>"AssociationField.Selector"===e["x-component"]})})})})})})})]})},{displayName:"SubTable"}),jL=(0,ec.connect)(F3,(0,ec.mapReadPretty)(jo));function jG(e){let{action:t="list",service:n,fieldNames:o}=e,l=(null==n?void 0:n.params)||{},r=(0,ec.useFieldSchema)(),{getField:i}=tJ(),{getCollectionFields:a}=sO(),s=m3(),c=(0,es.useCallback)(e=>e&&"object"==typeof e?e[o.value]:e,[o.value]),d=(0,es.useMemo)(()=>{if(void 0!==e.value&&null!==e.value)if(Array.isArray(e.value))return e.value.map(c);else return[c(e.value)]},[e.value,c]),u=(0,es.useMemo)(()=>i(r.name),[r.name]),p=null==s?void 0:s[null==u?void 0:u.sourceKey],m=(0,es.useMemo)(()=>{let e=["oho","o2m"].includes(null==u?void 0:u.interface);return pA([pA([e&&!pq(r)&&(null==u?void 0:u.foreignKey)?{[u.foreignKey]:{$is:null}}:null,null==l?void 0:l.filter]),e&&null!=p&&!pq(r)&&(null==u?void 0:u.foreignKey)?{[u.foreignKey]:{$eq:p}}:null,(null==l?void 0:l.filter)&&d?{[o.value]:{$in:d}}:null],"$or")},[null==l?void 0:l.filter,a,u,p,d,o.value]);return(0,es.useMemo)(()=>({resource:null==u?void 0:u.target,action:t,...n,params:{...null==n?void 0:n.params,filter:m}}),[null==u?void 0:u.target,t,m,n])}jL.SubTable=jz,jL.Nester=e=>{let{options:t}=(0,es.useContext)(lm);return["hasOne","belongsTo"].includes(t.type)?(0,A.jsx)(ld,{isInSubForm:!0,children:(0,A.jsx)(F9,{...e})}):["hasMany","belongsToMany"].includes(t.type)?(0,A.jsx)(ld,{isInSubForm:!0,children:(0,A.jsx)(je,{...e})}):null},jL.AddNewer=dT.Container,jL.Selector=dT.Container,jL.Viewer=dT.Container,jL.InternalSelect=FJ,jL.ReadPretty=jo;let jK=(0,ec.observer)(e=>{let t=jG(e);return SI(),(0,A.jsx)(wo.ReadPretty,{...e,service:t})},{displayName:"ReadPretty"}),j$=(0,ec.connect)(e=>{let{fieldNames:t,objectValue:n=!0}=e,o=jG(e);SI();let l=(0,es.useCallback)(e=>n||"object"!=typeof e?e:e[t.value],[n,t.value]),r=(0,es.useMemo)(()=>{if(void 0!==e.value&&null!==e.value)if(Array.isArray(e.value))return e.value.map(l);else return l(e.value)},[e.value,l]);return(0,A.jsx)(wo,{...e,objectValue:n,value:r,service:o})},(0,ec.mapProps)({dataSource:"options",loading:!0},(e,t)=>({...e,fieldNames:{...Sm,...e.fieldNames,...t.componentProps.fieldNames},suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon})),(0,ec.mapReadPretty)(jK));j$.Designer=function(){var e,t,n,o,l,r,i,a,s,c,d;let{getCollectionFields:u,getInterface:p,getCollectionJoinField:m,getCollection:h,isTitleField:x}=sO(),{getField:f}=tJ(),{form:v}=Tp(),g=(0,ec.useField)(),y=(0,ec.useFieldSchema)(),{t:b}=(0,eT.useTranslation)(),C=nM(),{dn:S,refresh:w,insertAdjacent:F}=eY(),j=eB(),k=sK(),{isAllowToSetDefaultValue:I}=sz(),P=f(y.name)||m(y["x-collection-field"]),T=Sk(),N=g.address.segments.includes("__form_grid"),M=p(null==P?void 0:P.interface),D=null==M||null==(e=M.validateSchema)?void 0:e.call(M,y),R=null==P||null==(t=P.uiSchema)?void 0:t.title,q=(null==P?void 0:P.target)?u(null==P?void 0:P.target):[],_={title:g.title===R?void 0:g.title},O=hd(null==P?void 0:P.target),B=(null==(l=g.componentProps)||null==(o=l.service)||null==(n=o.params)?void 0:n.sort)||[];(0,es.useEffect)(()=>{g.readPretty!==y["x-read-pretty"]&&(g.readPretty=!!y["x-read-pretty"])},[y["x-read-pretty"]]);let E=null==B?void 0:B.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});g.readPretty||(_.required=g.required);let V=q.filter(e=>x(e)).map(e=>{var t;return{value:null==e?void 0:e.name,label:j(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}}),z="editable";!0===y["x-disabled"]&&(z="readonly"),!0===y["x-read-pretty"]&&(z="read-pretty");let L=eu().omit(y,"required");return(0,A.jsxs)(sP,{children:[(0,A.jsx)(dn,{}),v&&!(null==v?void 0:v.readPretty)&&D&&(0,A.jsx)(aQ,{title:b("Set validation rules"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:b("Set validation rules"),properties:{rules:{type:"array",default:null==y?void 0:y["x-validator"],"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},maxItems:3,items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{header:'{{ t("Validation rule") }}'},properties:{index:{type:"void","x-component":"ArrayCollapse.Index"},layout:{type:"void","x-component":"FormLayout","x-component-props":{labelStyle:{marginTop:"6px"},labelCol:8,wrapperCol:16},properties:{...D,message:{type:"string",title:'{{ t("Error message") }}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:2,maxRows:2}}}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"}}},properties:{add:{type:"void",title:'{{ t("Add validation rule") }}',"x-component":"ArrayCollapse.Addition","x-reactions":{dependencies:["rules"],fulfill:{state:{disabled:"{{$deps[0].length >= 3}}"}}}}}}}},onSubmit:e=>{var t;let n=[];for(let t of e.rules)n.push(eu().pickBy(t,eu().identity));let o={"x-uid":y["x-uid"]};if(["percent"].includes(null==P?void 0:P.interface))for(let e of n)(e.maxValue||e.minValue)&&(e.percentMode=!0),e.percentFormat&&(e.percentFormats=!0);g.validator=eu().concat([],(null==P||null==(t=P.uiSchema)?void 0:t["x-validator"])||[],n),y["x-validator"]=n,o["x-validator"]=n,S.emit("patch",{schema:o}),w()}}),I()&&(0,A.jsx)(aQ,{title:b("Set default value"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},width:800,schema:{type:"object",title:b("Set default value"),properties:{default:{...L,"x-decorator":"FormItem","x-component-props":{...L["x-component-props"],component:(null==P?void 0:P.target)?"AssociationSelect":void 0,service:{resource:null==P?void 0:P.target}},name:"default",title:b("Default value"),default:y.default||(null==P?void 0:P.defaultValue),"x-read-pretty":!1,"x-disabled":!1}}},onSubmit:e=>{let t={"x-uid":y["x-uid"]};g.value!==e.default&&(g.value=e.default),y.default=e.default,t.default=e.default,S.emit("patch",{schema:t}),w()}}),v&&!N&&T&&(0,A.jsx)(aW,{title:b("Field component"),options:T,value:y["x-component"],onChange:e=>{var t,n;let o={name:null==P?void 0:P.name,type:"void",required:y.required,description:y.description,default:y.default,"x-decorator":"FormItem","x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem","x-component":e,"x-validator":y["x-validator"],"x-collection-field":y["x-collection-field"],"x-decorator-props":y["x-decorator-props"],"x-component-props":{...null==P||null==(t=P.uiSchema)?void 0:t["x-component-props"],...y["x-component-props"]}};null==M||null==(n=M.schemaInitialize)||n.call(M,o,{field:P,block:"Form",readPretty:g.readPretty,action:C?"get":null,targetCollection:h(null==P?void 0:P.target)}),"CollectionField"===e&&(o.type="string"),F("beforeBegin",{type:"void","x-component":"div",properties:{[o.name||(0,ec.uid)()]:o}},{onSuccess:()=>{S.remove(null,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})}})}}),k()?(0,A.jsx)(aY,{title:b("Allow multiple"),checked:(null==(r=y["x-component-props"])?void 0:r.multiple)===void 0||y["x-component-props"].multiple,onChange:e=>{let t={"x-uid":y["x-uid"]};y["x-component-props"]=y["x-component-props"]||{},g.componentProps=g.componentProps||{},y["x-component-props"].multiple=e,g.componentProps.multiple=e,t["x-component-props"]=y["x-component-props"],S.emit("patch",{schema:t}),w()}},"multiple"):null,(0,A.jsx)(il,{collectionName:null==P?void 0:P.target,defaultFilter:(null==(s=g.componentProps)||null==(a=s.service)||null==(i=a.params)?void 0:i.filter)||{},form:v,onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(g.componentProps,"service.params.filter",t),y["x-component-props"]=g.componentProps,S.emit("patch",{schema:{"x-uid":y["x-uid"],"x-component-props":g.componentProps}})}}),(0,A.jsx)(aQ,{title:b("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:b("Set default sorting rules"),properties:{sort:{type:"array",default:E,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:O,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:b("ASC"),value:"asc"},{label:b("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:b("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{let{sort:t}=e,n=t.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);eu().set(g.componentProps,"service.params.sort",n),y["x-component-props"]=g.componentProps,S.emit("patch",{schema:{"x-uid":y["x-uid"],"x-component-props":g.componentProps}})}}),v&&!(null==v?void 0:v.readPretty)&&!sB(y)&&(0,A.jsx)(aW,{title:b("Pattern"),options:[{label:b("Editable"),value:"editable"},{label:b("Readonly"),value:"readonly"},{label:b("Easy-reading"),value:"read-pretty"}],value:z,onChange:e=>{let t={"x-uid":y["x-uid"]};switch(e){case"readonly":y["x-read-pretty"]=!1,y["x-disabled"]=!0,t["x-read-pretty"]=!1,t["x-disabled"]=!0,g.readPretty=!1,g.disabled=!0;break;case"read-pretty":y["x-read-pretty"]=!0,y["x-disabled"]=!1,t["x-read-pretty"]=!0,t["x-disabled"]=!1,g.readPretty=!0;break;default:y["x-read-pretty"]=!1,y["x-disabled"]=!1,t["x-read-pretty"]=!1,t["x-disabled"]=!1,g.readPretty=!1,g.disabled=!1}S.emit("patch",{schema:t}),S.refresh()}},"pattern"),(null==P?void 0:P.target)&&["CollectionField","AssociationSelect"].includes(y["x-component"])&&(0,A.jsx)(aW,{title:b("Title field"),options:V,value:null==g||null==(d=g.componentProps)||null==(c=d.fieldNames)?void 0:c.label,onChange:e=>{var t,n;let o={"x-uid":y["x-uid"]},l={...null==P||null==(n=P.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...g.componentProps.fieldNames,label:e};g.componentProps.fieldNames=l,y["x-component-props"]=y["x-component-props"]||{},y["x-component-props"].fieldNames=l,o["x-component-props"]=y["x-component-props"],S.emit("patch",{schema:o}),S.refresh()}},"title-field"),P&&(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,confirm:{title:b("Delete field")},breakRemoveOn:{"x-component":"Grid"}},"remove")]})},j$.FilterDesigner=function(){var e,t,n,o,l,r,i,a,s,c,d;let{getCollectionFields:u,getInterface:p,getCollectionJoinField:m}=sO(),{getField:h}=tJ(),{form:x}=Tp(),f=(0,ec.useField)(),v=(0,ec.useFieldSchema)(),{t:g}=(0,eT.useTranslation)(),{dn:y,refresh:b}=eY(),C=eB(),S=h(v.name)||m(v["x-collection-field"]),w=p(null==S?void 0:S.interface),F=null==w||null==(e=w.validateSchema)?void 0:e.call(w,v),j=null==S||null==(t=S.uiSchema)?void 0:t.title,k=(null==S?void 0:S.target)?u(null==S?void 0:S.target):[],I={title:f.title===j?void 0:f.title},P=hd(null==S?void 0:S.target),T=(null==(l=f.componentProps)||null==(o=l.service)||null==(n=o.params)?void 0:n.sort)||[],N=null==T?void 0:T.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});f.readPretty||(I.required=f.required);let M=k.filter(e=>!(null==e?void 0:e.target)&&"boolean"!==e.type).map(e=>{var t;return{value:null==e?void 0:e.name,label:C(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return v["x-disabled"],v["x-read-pretty"],(0,A.jsxs)(sP,{children:[(0,A.jsx)(dn,{required:!1}),x&&!(null==x?void 0:x.readPretty)&&F&&(0,A.jsx)(aQ,{title:g("Set validation rules"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:g("Set validation rules"),properties:{rules:{type:"array",default:null==v?void 0:v["x-validator"],"x-component":"ArrayCollapse","x-decorator":"FormItem","x-component-props":{accordion:!0},maxItems:3,items:{type:"object","x-component":"ArrayCollapse.CollapsePanel","x-component-props":{header:'{{ t("Validation rule") }}'},properties:{index:{type:"void","x-component":"ArrayCollapse.Index"},layout:{type:"void","x-component":"FormLayout","x-component-props":{labelStyle:{marginTop:"6px"},labelCol:8,wrapperCol:16},properties:{...F,message:{type:"string",title:'{{ t("Error message") }}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:2,maxRows:2}}}}},remove:{type:"void","x-component":"ArrayCollapse.Remove"},moveUp:{type:"void","x-component":"ArrayCollapse.MoveUp"},moveDown:{type:"void","x-component":"ArrayCollapse.MoveDown"}}},properties:{add:{type:"void",title:'{{ t("Add validation rule") }}',"x-component":"ArrayCollapse.Addition","x-reactions":{dependencies:["rules"],fulfill:{state:{disabled:"{{$deps[0].length >= 3}}"}}}}}}}},onSubmit:e=>{var t;let n=[];for(let t of e.rules)n.push(eu().pickBy(t,eu().identity));let o={"x-uid":v["x-uid"]};if(["percent"].includes(null==S?void 0:S.interface))for(let e of n)(e.maxValue||e.minValue)&&(e.percentMode=!0),e.percentFormat&&(e.percentFormats=!0);f.validator=eu().concat([],(null==S||null==(t=S.uiSchema)?void 0:t["x-validator"])||[],n),v["x-validator"]=n,o["x-validator"]=n,y.emit("patch",{schema:o}),b()}}),x&&!(null==x?void 0:x.readPretty)&&(null==S||null==(r=S.uiSchema)?void 0:r.type)&&(0,A.jsx)(aQ,{title:g("Set default value"),components:{ArrayCollapse:eh.ArrayCollapse,FormLayout:eh.FormLayout},schema:{type:"object",title:g("Set default value"),properties:{default:{...eu().omit(null==S?void 0:S.uiSchema,"required"),name:"default",title:g("Default value"),"x-decorator":"FormItem",default:v.default||(null==S?void 0:S.defaultValue)}}},onSubmit:e=>{let t={"x-uid":v["x-uid"]};f.value!==e.default&&(f.value=e.default),v.default=e.default,t.default=e.default,y.emit("patch",{schema:t}),b()}}),(0,A.jsx)(il,{collectionName:null==S?void 0:S.target,defaultFilter:(null==(s=f.componentProps)||null==(a=s.service)||null==(i=a.params)?void 0:i.filter)||{},form:x,onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(f.componentProps,"service.params.filter",t),v["x-component-props"]=f.componentProps,y.emit("patch",{schema:{"x-uid":v["x-uid"],"x-component-props":f.componentProps}})}}),(0,A.jsx)(aQ,{title:g("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:g("Set default sorting rules"),properties:{sort:{type:"array",default:N,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:P,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:g("ASC"),value:"asc"},{label:g("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:g("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{let{sort:t}=e,n=t.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);eu().set(f.componentProps,"service.params.sort",n),v["x-component-props"]=f.componentProps,y.emit("patch",{schema:{"x-uid":v["x-uid"],"x-component-props":f.componentProps}})}}),(null==S?void 0:S.target)&&["CollectionField","AssociationSelect"].includes(v["x-component"])&&(0,A.jsx)(aW,{title:g("Title field"),options:M,value:null==f||null==(d=f.componentProps)||null==(c=d.fieldNames)?void 0:c.label,onChange:e=>{var t,n;let o={"x-uid":v["x-uid"]},l={...null==S||null==(n=S.uiSchema)||null==(t=n["x-component-props"])?void 0:t.fieldNames,...f.componentProps.fieldNames,label:e};f.componentProps.fieldNames=l,v["x-component-props"]=v["x-component-props"]||{},v["x-component-props"].fieldNames=l,o["x-component-props"]=v["x-component-props"],y.emit("patch",{schema:o}),y.refresh()}},"title-field"),S&&(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,confirm:{title:g("Delete field")},breakRemoveOn:{"x-component":"Grid"}},"remove")]})};let jU=(0,ec.connect)(e=>{let{fieldNames:t,params:n}=e,o=(0,ec.useFieldSchema)(),l=null==t?void 0:t.value,r=eC(),[i,a]=(0,es.useState)([]),[s,c]=(0,es.useState)([]);return(0,jj.A)(async()=>{let{data:{data:e}}=await r.request({url:o.collectionName+":list",params:{paginate:!1,filter:n?{...n.filter}:{}}}),t=e.filter((e,t,n)=>n.findIndex(t=>t[l]===e[l])===t);a(t),c(t)},[null==n?void 0:n.filter,o.collectionName]),(0,A.jsx)(hQ.A,{...e,options:s,filterOption:(e,t)=>{var n;return(0,eh.fuzzysearch)(e||"",(null==(n=t[l])?void 0:n.toString())||"")},allowClear:!0,onSearch:e=>{e?c([{[l]:e},...i]):c(i)}})},(0,ec.mapProps)({dataSource:"options"}),(0,ec.mapReadPretty)(gs.Input));function jW(){let e=(0,ns._)(["\n .card {\n margin-bottom: ","px;\n }\n "]);return jW=function(){return e},e}let jH=(0,nu.rU)(e=>{let{css:t,token:n}=e;return t(jW(),n.marginLG)}),jY=e=>{let{children:t,name:n,...o}=e,l=rh(),r=(0,ec.useFieldSchema)(),i=null==r?void 0:r["x-template-key"],{styles:a}=jH();return i&&!l?null:(0,A.jsx)(pr,{name:n,className:"".concat(a," tb-card-item"),children:(0,A.jsx)(rZ.A,{className:"card",bordered:!1,...o,children:e.children})})},jX={label:"label",value:"value",children:"children"},jJ=e=>{let t=(0,ec.useField)();return ek(()=>Promise.resolve({data:t.dataSource||[]}),e)},jQ=e=>null==e?void 0:e.loadData,jZ=(0,ec.connect)(e=>{let t=(0,ec.useField)(),{value:n,onChange:o,labelInValue:l,useDataSource:r=jJ,useLoadData:i=jQ,changeOnSelectLast:a,changeOnSelect:s,maxLevel:c,...d}=e,u={...jX,...e.fieldNames},p=i(e),{loading:m,run:h}=r({onSuccess(e){t.dataSource=(null==e?void 0:e.data)||[]}});return(0,A.jsx)(om.A,{loading:m,...d,options:t.dataSource,loadData:p,changeOnSelect:(0,ed.isBoolean)(a)?!a:s,value:(0,ec.toArr)(n).map(e=>"object"==typeof e?e[u.value]:e),fieldNames:u,displayRender:(e,t)=>(0,A.jsx)(of.A,{split:"/",children:e.map((e,o)=>{if(t[o])return(0,A.jsx)("span",{children:e},o);let l=(0,ec.toArr)(n).filter(Boolean).find(t=>t[u.value]===e);return(0,A.jsx)("span",{children:(null==l?void 0:l[u.label])||e},o)})}),onDropdownVisibleChange:e=>{var n;!e||(null==(n=t.dataSource)?void 0:n.length)||h()},onChange:(e,t)=>{e&&l?o(t.map(e=>(0,ed.omit)(e,[u.children]))):o(e)}})},(0,ec.mapProps)({dataSource:"options"},(e,t)=>({...e,suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon})),(0,ec.mapReadPretty)(e=>{let{fieldNames:t=jX}=e,n=(0,ec.toArr)(e.value),o=n.length,l=(0,ec.useField)().dataSource,r=[];for(let e of n)if("object"==typeof e)r.push(e);else{let n=null==l?void 0:l.find(n=>n[t.value]===e);l=(null==n?void 0:n[t.children])||[],r.push(n||{label:e,value:e})}return(0,A.jsx)("div",{children:r.map((e,n)=>(0,A.jsxs)("span",{children:["object"==typeof e?e[t.label]:e,o>n+1&&" / "]},n))})}));var j0=n(75873),j1=n(84058),j2=n.n(j1);let j6=e=>e.value?(0,A.jsx)(jF.A,{style:{color:"#52c41a"}}):e.showUnchecked?(0,A.jsx)(cp.A,{style:{color:"#ff4d4f"}}):null,j3=(0,ec.connect)(e=>(0,A.jsx)(j0.A,{...e,onChange:t=>{null==e||e.onChange(t)}}),(0,ec.mapProps)({value:"checked",onInput:"onChange"}),(0,ec.mapReadPretty)(j6)),j5=(0,ec.connect)(e=>{let{t}=(0,eT.useTranslation)(),[n,o]=(0,es.useState)();return(0,A.jsx)(sU.Ay.Group,{...e,onChange:t=>{"null"!==t.target.value?e.onChange(t.target.value):e.onChange(null),o(t.target.value)},value:e.value||n,options:[{label:t("?"),value:"null"},{label:t("Yes"),value:"true"},{label:t("No"),value:"false"}],optionType:"button"})},(0,ec.mapReadPretty)(j6)),j4=e=>"Radio group"===e.mode?(0,A.jsx)(j5,{...e}):(0,A.jsx)(j3,{...e});function j8(e){var t;let{filter:n,isTableOid:o}=e,l=eB(),r=(0,ec.useField)(),i=(0,es.useContext)(rV),a=tJ(),s=hp(o&&((null==i||null==(t=i.field)?void 0:t.collectionName)||(null==i?void 0:i.collectionName)||a.name)),{collections:c=[]}=sO(),d=(null==r?void 0:r.dataSource)?c.filter(e=>(null==r?void 0:r.dataSource.find(t=>t.value===e.name))||(null==r?void 0:r.dataSource.includes(e.name))):c,u="function"==typeof n?(s||d).filter(n):s||d;return(0,es.useMemo)(()=>u.filter(e=>!e.hidden).map(e=>{var t;return{label:l(e.title||e.label),value:e.name||e.value,color:null==(t=e.category)?void 0:t.color}}),[u])}j4.ReadPretty=j6,j4.__ANT_CHECKBOX=!0,j4.Group=(0,ec.connect)(j0.A.Group,(0,ec.mapProps)({dataSource:"options"}),(0,ec.mapReadPretty)(e=>{if(!(0,ec.isValid)(e.value))return null;let t=(0,ec.useField)(),n=tA(),o=t.dataSource||(null==n?void 0:n.uiSchema.enum)||[],l=j2()(t.value?t.value:[]);return(0,A.jsx)(gi,{ellipsis:e.ellipsis,children:o.filter(e=>l.includes(e.value)).map((e,t)=>(0,A.jsx)(nz.A,{color:e.color,icon:e.icon,children:e.label},t))})}));let j7=(0,ec.connect)(e=>{let{filter:t,...n}=e,o=j8(e),{t:l}=(0,eT.useTranslation)(),r=(0,es.useCallback)((e,t)=>{var n,o;return(null!=(n=null==t?void 0:t.label.toLowerCase())?n:"").includes(e.toLocaleLowerCase())||(null!=(o=null==t?void 0:t.value.toString().toLowerCase())?o:"").includes(e.toLocaleLowerCase())},[]);return(0,A.jsx)(oo.A,{role:"button","data-testid":"select-collection",placeholder:l("Select collection"),popupMatchSelectWidth:!1,...n,showSearch:!0,filterOption:r,options:o})},(0,ec.mapReadPretty)((0,ec.observer)(e=>{let{mode:t}=e,n=eB(),o=j8(e).filter(n=>{if("multiple"===t){var o;return(null!=(o=e.value)?o:[]).includes(n.value)}return e.value===n.value});return(0,A.jsx)("div",{children:o.map(e=>(0,A.jsx)(nz.A,{color:e.color,children:n(e.label)},e.value))})},{displayName:"CollectionSelectObserver"}))),j9=(0,ec.connect)(e=>{let{filter:t,...n}=e,o=function(e){let{filter:t}=e,n=eB(),o=tr().getDataSources();return(0,es.useMemo)(()=>[{label:n("Main"),value:"main"},...("function"==typeof t?o.filter(t):o).map(e=>({label:e.displayName,value:e.key}))],[o,t])}(e),{t:l}=(0,eT.useTranslation)(),r=(0,es.useCallback)((e,t)=>{var n,o;return(null!=(n=null==t?void 0:t.label.toLowerCase())?n:"").includes(e.toLocaleLowerCase())||(null!=(o=null==t?void 0:t.value.toString().toLowerCase())?o:"").includes(e.toLocaleLowerCase())},[]);return(0,A.jsx)(oo.A,{role:"button","data-testid":"select-datasource",placeholder:l("Select data source"),popupMatchSelectWidth:!1,...n,showSearch:!0,filterOption:r,options:o})}),Ae=(0,ec.connect)(e=>{let t=tr(),n=eB(),{value:o,onChange:l,dataSourceFilter:r,collectionFilter:i,...a}=e,[s,c]=vS(o),d=[s,c].filter(Boolean),u=t.getDataSources(),p=(0,es.useMemo)(()=>(r?u.filter(r):u).map(e=>({label:n(e.displayName),value:e.key,children:e.collectionManager.collectionInstancesArr.filter(null!=i?i:e=>!e.hidden).map(e=>({label:n(e.title),value:e.name}))})),[u,r,i]),m=(0,es.useCallback)(e=>{if(!e)return l(e);l("main"===e[0]?e[1]:e.join(":"))},[l]);return(0,A.jsx)(om.A,{showSearch:!0,...a,options:p,value:d,onChange:m})});var At=n(11970);function An(){let e=(0,ns._)(["\n display: inline-flex;\n .ant-color-picker-trigger-disabled {\n cursor: default;\n }\n "]);return An=function(){return e},e}let Ao=(0,nu.rU)(e=>{let{css:t}=e;return{color:t(An())}}),Al=(0,ec.connect)(e=>{let{value:t,onChange:n,...o}=e;return(0,A.jsx)("div",{role:"button","aria-label":"color-picker-normal",style:{display:"inline-block"},children:(0,A.jsx)(At.A,{value:t,trigger:"hover",...o,destroyTooltipOnHide:!0,getPopupContainer:e=>e,presets:[{label:"Recommended",colors:["#8BBB11","#52C41A","#13A8A8","#1677FF","#F5222D","#FADB14","#FA8C164D","#FADB144D","#52C41A4D","#1677FF4D","#2F54EB4D","#722ED14D","#EB2F964D"]}],onChange:e=>n(e.toHexString())})})},(0,ec.mapProps)((e,t)=>({...e})),(0,ec.mapReadPretty)(e=>{let t=(0,eh.usePrefixCls)("description-color-picker",e),{styles:n}=Ao();return(0,A.jsx)("div",{role:"button","aria-label":"color-picker-read-pretty",className:r6()(t,n.color,e.className),children:(0,A.jsx)(At.A,{disabled:!0,value:e.value,size:"small",...e})})})),Ar={red:'{{t("Red")}}',magenta:'{{t("Magenta")}}',volcano:'{{t("Volcano")}}',orange:'{{t("Orange")}}',gold:'{{t("Gold")}}',lime:'{{t("Lime")}}',green:'{{t("Green")}}',cyan:'{{t("Cyan")}}',blue:'{{t("Blue")}}',geekblue:'{{t("Geek blue")}}',purple:'{{t("Purple")}}',default:'{{t("Default")}}'},Ai=(0,ec.connect)(e=>{let t=eB();return(0,A.jsx)(oo.A,{...e,children:Object.keys(Ar).map(e=>(0,A.jsx)(oo.A.Option,{value:e,children:(0,A.jsx)(nz.A,{color:e,children:t(Ar[e]||Ar.default)})},e))})},(0,ec.mapProps)((e,t)=>({...e,suffix:(0,A.jsx)("span",{children:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffix})})),(0,ec.mapReadPretty)(e=>{let t=eB(),{value:n}=e;return Ar[n]?(0,A.jsx)(nz.A,{color:n,children:t(Ar[n]||Ar.default)}):null}));var Aa=n(67187),As=n.n(Aa),Ac=n(70058);function Ad(){let e=(0,ns._)(["\n .react-js-cron {\n padding: 0.5em 0.5em 0 0.5em;\n border: 1px dashed #ccc;\n .react-js-cron-field {\n flex-shrink: 0;\n margin-bottom: 0.5em;\n\n > span {\n flex-shrink: 0;\n margin: 0 0.5em 0 0;\n }\n\n > .react-js-cron-select {\n margin: 0 0.5em 0 0;\n }\n }\n }\n "]);return Ad=function(){return e},e}n(73820);let Au=(0,nu.rU)(e=>{let{css:t}=e;return{input:t(Ad())}}),Ap=e=>{let t=eC().auth.getLocale(),n=(0,es.useMemo)(()=>{try{return As().toString(e.value,{locale:t,use24HourTimeFormat:!0})}catch{return(0,eh.error)("The '".concat(e.value,"' is not a valid cron expression")),e.value}},[e.value]);return e.value?(0,A.jsx)("span",{children:n}):null},Am=(0,ec.connect)(e=>{let{onChange:t,...n}=e,{styles:o}=Au();return(0,A.jsx)("fieldset",{className:o.input,children:(0,A.jsx)(Ac.l4,{setValue:t,locale:window.cronLocale,...n})})},(0,ec.mapReadPretty)(Ap));Am.ReadPretty=Ap;let Ah=(0,ec.connect)(e=>{var t;let{onChange:n,value:o}=e,{getField:l}=tJ(),r=(0,ec.useFieldSchema)(),i=null==(t=l(null==r?void 0:r.name))?void 0:t.uiSchema.enum,a=eB(),[s,c]=(0,es.useState)({label:"{{t('Custom')}}",value:"@daily"}),d=(0,es.useMemo)(()=>(e.options||[]).concat(i||[]).concat([s]).map(e=>({...e,label:a(e.label)})),[e.options,s]);(0,es.useEffect)(()=>{null==o||d.find(e=>e.value===o)||c({...s,value:o})},[d,o]);let u=(0,es.useMemo)(()=>o===s.value,[o,s]),p=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t&&c({...s,value:e}),n(e)};return(0,A.jsxs)("fieldset",{children:[(0,A.jsx)(oo.A,{popupMatchSelectWidth:!1,allowClear:!0,...e,value:o,options:d,onChange:e=>p(e)}),u?(0,A.jsx)(Am,{value:o,onChange:e=>p(e,!0),allowedDropdowns:["period","week-days","months","month-days"],allowedPeriods:["year","month","week","day"]}):null]})},(0,ec.mapReadPretty)(e=>{var t;let{value:n}=e,o=eB(),l=(0,ec.useFieldSchema)(),{getField:r}=tJ(),i=null==(t=r(null==l?void 0:l.name))?void 0:t.uiSchema.enum,a=(0,es.useMemo)(()=>(e.options||[]).concat(i||[]),[e.options]),s=(0,es.useMemo)(()=>{var e;return n&&(null==a||null==(e=a.find(e=>e.value===n))?void 0:e.label)},[a,n]);return(0,A.jsx)(gi,{ellipsis:!0,children:n&&(s?o(s):(0,A.jsx)(Am.ReadPretty,{...e}))})}));var Ax=n(92488),Af=n(18155),Av=n(78652);function Ag(e){let t=Number(e);if(!Number.isFinite(t))return 0;let n=String(t).split(".")[1];return n?n.length:0}let Ay={"0,0.00":{thousands:",",decimal:"."},"0.0,00":{thousands:".",decimal:","},"0 0,00":{thousands:" ",decimal:"."},"0.00":{thousands:"",decimal:"."}},Ab=e=>{let{step:t,formatStyle:n,value:o,addonBefore:l,addonAfter:r,unitConversion:i,unitConversionType:a,separator:s}=e,c=(0,es.useMemo)(()=>(function(e){let t,{step:n,formatStyle:o,value:l,unitConversion:r,unitConversionType:i,separator:a="0.00"}=e;if(!(0,ec.isValid)(l))return null;let s=function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",o=arguments.length>2?arguments[2]:void 0;if(!o)return e;if("*"===n)t=e*o;else{if("/"!==n)return console.error("Error: Invalid operator. Use '*' for multiplication or '/' for division."),null;if(0===o)return console.error("Error: Division by zero."),null;t=e/o}return Av.LIG(t,9)}(l,i,r);if(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0.00",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o="";if(Ay[t]){let{thousands:l,decimal:r}=Ay[t];o=e.toLocaleString("en-US",{style:"decimal",minimumFractionDigits:n,maximumFractionDigits:n}).replace(/,/g,"comma_placeholder").replace(/\./g,"dot_placeholder").replace(/comma_placeholder/g,l).replace(/dot_placeholder/g,r)}else o=e.toString();return o}(Number((0,eh.toFixedByStep)(s,n)),a,Ag(n)),"scientifix"===o){var c;t=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";return(0,Af.GP)(".".concat(t,"e"))(e).replace(".",n).replace(/e([+-]?\d+)/,(e,t)=>t.startsWith("+")?"\xd710<sup>".concat(t.slice(1),"</sup>"):"\xd710<sup>-".concat(t.slice(1),"</sup>"))}(Number(s),Ag(n),null==Ay||null==(c=Ay[a])?void 0:c.decimal)}return t})({step:t,formatStyle:n,value:o,unitConversion:i,unitConversionType:a,separator:s}),[t,n,o,i,a,s]);return(0,ec.isValid)(c)?(0,A.jsxs)("div",{className:"tb-read-pretty-input-number",children:[l,(0,A.jsx)("span",{dangerouslySetInnerHTML:{__html:c}}),r]}):null},AC=(0,ec.connect)(e=>(0,A.jsx)(Ax.A,{...e}),(0,ec.mapProps)(e=>({...e})),(0,ec.mapReadPretty)(Ab)),AS={label:"label",value:"value",children:"children"},Aw=e=>{let t=(0,ec.useField)();return ek(()=>Promise.resolve({data:t.dataSource||[]}),e)},AF=e=>null==e?void 0:e.loadData,Aj=(0,ec.connect)(e=>{(0,ec.useField)();let{value:t,onChange:n,labelInValue:o,useDataSource:l=Aw,useLoadData:r=AF,changeOnSelect:i,maxLevel:a,defaultValue:s,...c}=e;return(0,A.jsx)(om.A,{...c,onChange:n,style:{width:"100%"},defaultValue:s,changeOnSelect:i})},(0,ec.mapProps)({dataSource:"options"},(e,t)=>({...e,suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon})),(0,ec.mapReadPretty)(e=>{let{fieldNames:t=AS}=e,n=(0,ec.toArr)(e.value),o=n.length,l=(0,ec.useField)().dataSource,r=[];for(let e of n)if("object"==typeof e)r.push(e);else{let n=null==l?void 0:l.find(n=>n[t.value]===e);l=(null==n?void 0:n[t.children])||[],r.push(n||{label:e,value:e})}return(0,A.jsx)("div",{children:r.map((e,n)=>(0,A.jsxs)("span",{children:["object"==typeof e?e[t.label]:e,o>n+1&&" / "]},n))})}));var AA=n(80205);let Ak=()=>null;Ak.DatePicker=function(e){let t,n,o,l=cv("description-date-picker",e);return e.value?(0,A.jsx)("div",{className:r6()(l,e.className),children:(t=(0,eh.getDefaultFormat)(e),n=(0,eh.str2moment)(e.value,e),o=P().isDayjs(n)?n.format(t):"",(0,ec.isArr)(o)?o.join("~"):o)}):(0,A.jsx)("div",{})},Ak.DateRangePicker=function(e){let t=cv("description-text",e),n=(0,eh.getDefaultFormat)(e);return(0,A.jsx)("div",{className:r6()(t,e.className),style:e.style,children:(()=>{let t=(0,eh.str2moment)(e.value,e);if(!t)return"";let o=t.map(e=>e.format(n));return(0,ec.isArr)(o)?o.join("~"):o})()})};let AI=es.createContext({utc:!0}),AP=()=>es.useContext(AI),AT=AI.Provider,AN=(0,ec.connect)(AA.A,(0,ec.mapProps)(e=>{let t=(0,eh.getDefaultFormat)(e),n=e.onChange;return{...e,format:t,value:(0,eh.str2moment)(e.value,e),onChange:t=>{n&&(!e.showTime&&t&&(t=t.startOf("day")),n(lo(t,e)))}}}),(0,ec.mapReadPretty)(Ak.DatePicker)),AM=(0,ec.connect)(AA.A.RangePicker,(0,ec.mapProps)(e=>{let t=(0,eh.getDefaultFormat)(e),n=e.onChange;return{...e,format:t,value:(0,eh.str2moment)(e.value,e),onChange:t=>{n&&n(t?[lo(function(e,t){let{showTime:n}=t;return n?e:e.startOf("day")}(t[0],e),e),lo(function(e,t){let{showTime:n}=t;return n?e:e.endOf("day")}(t[1],e),e)]:[])}}}),(0,ec.mapReadPretty)(Ak.DateRangePicker)),AD=e=>{let{utc:t=!0}=AP(),n=Array.isArray(e.value)?e.value[0]:e.value;return e={utc:t,...e},(0,A.jsx)(AN,{...e,value:n})};AD.ReadPretty=Ak.DatePicker,AD.RangePicker=function(e){let{t}=(0,eT.useTranslation)(),{utc:n=!0}=AP();if("range"===e.valueType){let t=e.onChange,n=e.value;e={...e},n&&(e.value=[n[0].value,P()(n[1].value).add(-1,"d").toISOString()]),e.onChange=e=>{e&&e.length?t([{value:P()(e[0]).toISOString(),inclusive:!0},{value:P()(e[1]).add(1,"d").toISOString(),inclusive:!1}]):t(null)}}let o=li();return e={utc:n,presets:[{label:t("Today"),value:o.today},{label:t("Last week"),value:o.lastWeek},{label:t("This week"),value:o.thisWeek},{label:t("Next week"),value:o.nextWeek},{label:t("Last month"),value:o.lastMonth},{label:t("This month"),value:o.thisMonth},{label:t("Next month"),value:o.nextMonth},{label:t("Last quarter"),value:o.lastQuarter},{label:t("This quarter"),value:o.thisQuarter},{label:t("Next quarter"),value:o.nextQuarter},{label:t("Last year"),value:o.lastYear},{label:t("This year"),value:o.thisYear},{label:t("Next year"),value:o.nextYear},{label:t("Last 7 days"),value:o.last7Days},{label:t("Next 7 days"),value:o.next7Days},{label:t("Last 30 days"),value:o.last30Days},{label:t("Next 30 days"),value:o.next30Days},{label:t("Last 90 days"),value:o.last90Days},{label:t("Next 90 days"),value:o.next90Days}],...e},(0,A.jsx)(AM,{...e})};let AR=Tr(e=>{var t;let n=t6();return!(null==n?void 0:n.loading)&&eu().isEmpty(null==n||null==(t=n.data)?void 0:t.data)?(0,A.jsx)(op.A,{image:op.A.PRESENTED_IMAGE_SIMPLE}):(0,A.jsx)(S1,{...e})});function Aq(){let e=(0,ns._)(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return Aq=function(){return e},e}let A_=(0,nu.rU)(e=>{let{css:t}=e;return{designer:t(Aq())}}),AO=(0,es.forwardRef)((e,t)=>{var n,o,l;let r=(0,ec.useFieldSchema)(),{styles:i}=A_(),a=l2(),s=lz(),c=(null==(o=r.parent)||null==(n=o.parent)?void 0:n["x-decorator"])==="TableSelectorProvider"?a:s,{titleExpand:d,titleCollapse:u,iconExpand:p,iconCollapse:m}=r["x-component-props"]||{},h=eB(),x=(0,es.createRef)(),f=(0,b4.composeRef)(t,x);return(0,A.jsx)("div",{className:i.designer,ref:f,children:(null==c?void 0:c.params.tree)&&(0,A.jsxs)(e3.Ay,{onClick:()=>{null==c||c.setExpandFlag()},icon:(0,A.jsx)(i6,{type:(null==c?void 0:c.expandFlag)?m:p}),type:e.type,style:null==e?void 0:e.style,children:[null==(l=e.children)?void 0:l[1],(0,A.jsx)("span",{style:{marginLeft:10},children:h((null==c?void 0:c.expandFlag)?u:d)})]})})}),AB=AO;function AE(e,t,n,o){var r,i;((0,ec.isFn)(t)||es.isValidElement(t))&&(o=n,n=t,t="form-dialog");let a={host:document.createElement("div"),form:null,promise:null,openMiddlewares:[],confirmMiddlewares:[],cancelMiddlewares:[]},s=(r=a.host,i=t,{render:function(e){ck.has(i)?ck.set(i,null==e?void 0:e()):r&&function(e,t){if(l){let n;return cF(!0),n=t[cj]||l(t),cF(!1),n.render(e),t[cj]=n}cS(e,t)}((0,A.jsx)(es.Fragment,{children:null==e?void 0:e()}),r)},unmount:function(){var e,t;if(ck.has(i)&&ck.set(i,null),r&&(e=r,l?cA(e):cw(e))&&r.parentNode){null==(t=r.parentNode)||t.removeChild(r)}}}),c=(0,ec.isNum)(e)||(0,ec.isStr)(e)||(0,ec.isBool)(e)||es.isValidElement(e)?{title:e}:e,d={...c,afterClose:()=>{var e;null==c||null==(e=c.afterClose)||e.call(c),s.unmount()}},u=(0,ec.observer)(()=>(0,A.jsx)(es.Fragment,{children:(0,ec.isFn)(n)?n(a.form):n}),{displayName:"DialogContent"}),p=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,{form:l}=a;return l?(0,A.jsx)(yw,{theme:o,children:(0,A.jsx)(ec.Observer,{children:()=>{let{token:o}=iw.A.useToken();return(0,A.jsx)(ox.A,{zIndex:o.zIndexPopupBase+1e3,...d,open:e,confirmLoading:l.submitting,onCancel:e=>{var t;(null==d||null==(t=d.onCancel)?void 0:t.call(d,e))!==!1&&(null==n||n())},onOk:async e=>{var n;(null==d||null==(n=d.onOk)?void 0:n.call(d,e))!==!1&&(null==t||t())},children:(0,A.jsx)(ec.FormProvider,{form:l,children:(0,A.jsx)(u,{})})})}})}):null};document.body.appendChild(a.host);let m={forOpen:e=>((0,ec.isFn)(e)&&a.openMiddlewares.push(e),m),forConfirm:e=>((0,ec.isFn)(e)&&a.confirmMiddlewares.push(e),m),forCancel:e=>((0,ec.isFn)(e)&&a.cancelMiddlewares.push(e),m),open:async e=>(a.promise||(a.promise=new Promise(async(t,n)=>{try{e=await cy(d.loadingText,()=>(0,ec.applyMiddleware)(e,a.openMiddlewares)),a.form=a.form||(0,ec.createForm)(e)}catch(e){n(e)}s.render(()=>p(!0,()=>{var e;null==(e=a.form)||e.submit(async()=>{var e;await (0,ec.applyMiddleware)(a.form,a.confirmMiddlewares),t((0,ec.toJS)(null==(e=a.form)?void 0:e.values)),m.close()}).catch(()=>{})},async()=>{await cy(d.loadingText,()=>(0,ec.applyMiddleware)(a.form,a.cancelMiddlewares)),m.close()}))})),a.promise),close:()=>{a.host&&s.render(()=>p(!1))}};return m}AB.Action=AO,AB.Action.Design=e=>{var t,n;let{t:o}=(0,eT.useTranslation)(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),{dn:i}=eY(),{titleExpand:a,titleCollapse:s,iconExpand:c,iconCollapse:d}=l["x-component-props"]||{};return(0,A.jsxs)(sP,{...e,disableInitializer:!0,children:[(0,A.jsx)(aQ,{title:o("Edit button"),schema:{type:"object",title:o("Edit button"),properties:{titleExpand:{"x-decorator":"FormItem","x-component":"Input",title:"".concat(o("Button title")," - ").concat(o("Expand all")),default:a},titleCollapse:{"x-decorator":"FormItem","x-component":"Input",title:"".concat(o("Button title")," - ").concat(o("Collapse all")),default:s},iconExpand:{"x-decorator":"FormItem","x-component":"IconPicker",title:"".concat(o("Button icon")," - ").concat(o("Expand all")),default:c},iconCollapse:{"x-decorator":"FormItem","x-component":"IconPicker",title:"".concat(o("Button icon")," - ").concat(o("Collapse all")),default:d},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:o("Button background color"),default:(null==l||null==(t=l["x-component-props"])?void 0:t.danger)?"danger":(null==l||null==(n=l["x-component-props"])?void 0:n.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}]}}},onSubmit:e=>{let{titleExpand:t,titleCollapse:n,iconExpand:a,iconCollapse:s,type:c}=e;l.title=o("Expand/Collapse"),r.title=o("Expand/Collapse"),r.componentProps.icon=a,r.componentProps.danger="danger"===c,r.componentProps.type=c,l["x-component-props"]={...l["x-component-props"]||{},titleExpand:t,titleCollapse:n,iconExpand:a,iconCollapse:s,type:c,danger:"danger"===c},i.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":l["x-component-props"],title:l.title}}),i.refresh()}}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:e=>"Space"===e["x-component"]||e["x-component"].endsWith("ActionBar"),confirm:{title:o("Delete action")}})]})},AE.Footer=e=>{let t=(0,es.useRef)(null),[n,o]=(0,es.useState)(),l=(0,es.useRef)(),r=cv("modal");return(0,es.useLayoutEffect)(()=>{var e;let n=null==(e=t.current)?void 0:e.closest(".".concat(r,"-content"));n&&(!l.current&&(l.current=n.querySelector(".".concat(r,"-footer")),l.current||(l.current=document.createElement("div"),l.current.classList.add("".concat(r,"-footer")),n.appendChild(l.current))),o(l.current))},[r]),l.current=n,(0,A.jsx)("div",{ref:t,style:{display:"none"},children:n&&(0,oy.createPortal)(e.children,n)})},(r=e=>(e.id&&!ck.has(e.id)&&ck.set(e.id,null),(0,A.jsxs)(es.Fragment,{children:[e.children,(0,A.jsx)(ec.Observer,{children:()=>{if(!e.id)return(0,A.jsx)(A.Fragment,{});let t=ck.get(e.id);return t?(0,oy.createPortal)(t,document.body):(0,A.jsx)(A.Fragment,{})}})]}))).defaultProps={id:"form-dialog"},AE.Portal=r;let AV=(0,ec.observer)(e=>{let t=(0,ec.useField)(),n=eB(),o=t.form.queryFeedbacks({type:"error",address:"".concat(t.address.concat(e.name),".*")});return o.length?(0,A.jsx)(r1.A,{size:"small",className:"errors-badge",count:o.length,children:n(e.tab)}):(0,A.jsx)(A.Fragment,{children:n(e.tab)})}),Az=e=>{let t=(0,ec.model)({activeKey:e,setActiveKey(e){t.activeKey=e}});return(0,ec.markRaw)(t)},AL=(0,ec.observer)(e=>{let t,n,o,l,r,i,{formTab:a,...s}=e,c=(t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),o=[],n.mapProperties((e,n)=>{var l,r,i;let a=t.query(t.address.concat(n)).take();if((null==a?void 0:a.display)!=="none"&&(null==a?void 0:a.display)!=="hidden"&&(null==(l=e["x-component"])?void 0:l.indexOf("TabPane"))>-1){let t=(null==a||null==(r=a.componentProps)?void 0:r.key)||(null==e||null==(i=e["x-component-props"])?void 0:i.key)||n;o.push({name:n,props:{...null==e?void 0:e["x-component-props"],...null==a?void 0:a.componentProps,key:t},schema:e})}}),o),d=(l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),i=[],r.mapProperties((e,t)=>{var n,o,r;let a=l.query(l.address.concat(t)).take();if((null==a?void 0:a.display)!=="none"&&(null==a?void 0:a.display)!=="hidden"&&(null==(n=e["x-component"])?void 0:n.indexOf("TabExtraContent"))>-1){let n=(null==a||null==(o=a.componentProps)?void 0:o.key)||(null==e||null==(r=e["x-component-props"])?void 0:r.key)||t;i.push({name:t,props:{...null==e?void 0:e["x-component-props"],...null==a?void 0:a.componentProps,key:n},schema:e})}}),i),u=(0,es.useMemo)(()=>a||Az(),[]),p=cv("formily-tab",s),m=s.activeKey||(null==u?void 0:u.activeKey);return(0,A.jsx)(wd.A,{...s,tabBarExtraContent:(0,A.jsx)(A.Fragment,{children:d.map((e,t)=>{let{schema:n,name:o}=e;return(0,A.jsx)(ec.RecursionField,{schema:n,name:o},t)})}),className:r6()(p,s.className),activeKey:m,onChange:e=>{var t,n;null==(t=s.onChange)||t.call(s,e),null==u||null==(n=u.setActiveKey)||n.call(u,e)},items:c.map((e,t)=>{let{props:n,schema:o,name:l}=e;return{key:t,label:(0,A.jsx)(AV,{name:l,tab:n.tab}),...n,children:(0,A.jsx)(ec.RecursionField,{schema:o,name:l})}})})});AL.TabPane=e=>{let{children:t}=e;return(0,A.jsx)(es.Fragment,{children:t})},AL.TabExtraContent=e=>{let{children:t}=e;return(0,A.jsx)(es.Fragment,{children:t})},AL.createFormTab=Az;let AG=(0,ec.observer)(e=>{let t=(0,ec.useFieldSchema)();return(0,A.jsxs)("div",{style:{marginBottom:20,padding:"0 20px",height:50,lineHeight:"50px",background:"#f1f1f1"},children:["Block ",t.title,(0,A.jsx)(SV,{})]})},{displayName:"Block"}),AK=cP("tb-grid",e=>{let{componentCls:t}=e;return{[t]:{".ColDivider":{flexShrink:0,width:e.marginLG,".DraggableNode":{"&::before":{content:"' '",width:"100%",height:"100%",position:"absolute",cursor:"col-resize"},"&:hover":{"&::before":{background:"var(--colorBgSettingsHover) !important"}},width:e.marginLG,height:"100%",position:"absolute",cursor:"col-resize"}},".RowDivider":{height:e.marginLG,width:"100%",position:"absolute",marginTop:"calc(-1 * ".concat(e.marginLG,"px)")},".CardRow":{display:"flex",position:"relative"},".showDivider":{margin:"0 calc(-1 * ".concat(e.marginLG,"px)")}}}}),A$=(0,es.createContext)({});A$.displayName="GridRowContext";let AU=(0,es.createContext)({});AU.displayName="GridColContext";let AW=(0,es.createContext)({});AW.displayName="GridContext";let AH=e=>"Grid"===e["x-component"],AY=e=>"Grid.Row"===e["x-component"],AX=es.memo(ec.RecursionField);AX.displayName="MemorizedRecursionField";let AJ=e=>{var t,n,o;let{token:l}=iw.A.useToken(),r=(0,es.useRef)(null),{isOver:i,setNodeRef:a}=(0,eq.useDroppable)({id:e.id,data:e.data}),{dn:s,designable:c}=eY(),d=(0,es.useRef)(),u=(0,es.useMemo)(()=>i?{backgroundColor:new SD.q(l.colorSettings).setAlpha(.1).toHex8String()}:{},[i]),p=null==(o=(0,eq.useDndContext)().active)||null==(n=o.data.current)||null==(t=n.schema)?void 0:t.parent,m=p?Object.keys(p.properties).length:0,h=!0;if(1===m)if(e.first)h=p!==e.cols[0];else{let t=e.cols[e.index],n=e.cols[e.index+1];h=p!==t&&n!==p}let x=e.cols[e.index],f=e.cols[e.index+1],{attributes:v,listeners:g,setNodeRef:y,isDragging:b}=(0,eq.useDraggable)({disabled:e.first||e.last||!c,id:e.id,data:{dividerRef:d,prevSchema:x,nextSchema:f}}),[C,S]=(0,es.useState)([0,0]);return(0,eq.useDndMonitor)({onDragStart(e){var t;if((null==(t=e.active.data.current.dividerRef)?void 0:t.current)!==d.current)return;r.current=e.active.id;let n=d.current,o=n.previousElementSibling,l=n.nextElementSibling;S([o.clientWidth,l.clientWidth])},onDragMove(e){if(!b)return;r.current===e.active.id&&(r.current=r.current+"_move");let t=d.current,n=t.previousElementSibling,o=t.nextElementSibling;n.style.width="".concat(C[0]+e.delta.x,"px"),o.style.width="".concat(C[1]-e.delta.x,"px")},onDragEnd(t){var n;if(!r.current||(null==(n=r.current)?void 0:n.startsWith(t.active.id))&&!r.current.endsWith("_move")||C[0]<=0||C[1]<=0||(S([0,0]),!x||!f))return;let o=d.current,l=o.previousElementSibling,i=o.nextElementSibling;x["x-component-props"]=x["x-component-props"]||{},f["x-component-props"]=f["x-component-props"]||{};let a=o.clientWidth*(e.cols.length+1)/e.cols.length,c=(100*(l.getBoundingClientRect().width+a)/o.parentElement.clientWidth).toFixed(2),u=(100*(i.getBoundingClientRect().width+a)/o.parentElement.clientWidth).toFixed(2);eu().set(x,"x-component-props.width",c),eu().set(f,"x-component-props.width",u),s.emit("batchPatch",{schemas:[{"x-uid":x["x-uid"],"x-component-props":{...x["x-component-props"]}},{"x-uid":f["x-uid"],"x-component-props":{...f["x-component-props"]}}]})}}),(0,A.jsx)("div",{ref:e=>{h&&(a(e),d.current=e)},className:r6()("tb-col-divider","ColDivider"),style:u,children:(0,A.jsx)("div",{ref:y,...g,...v,tabIndex:-1,className:e.first||e.last||!c?null:"DraggableNode"})})},AQ=e=>{var t,n,o;let{token:l}=iw.A.useToken(),{isOver:r,setNodeRef:i}=(0,eq.useDroppable)({id:e.id,data:e.data}),[a,s]=(0,es.useState)(!1),c=(0,es.useMemo)(()=>r?{zIndex:a?1e3:-1,backgroundColor:new SD.q(l.colorSettings).setAlpha(.1).toHex8String()}:{zIndex:a?1e3:-1},[a,r]),d=(0,eq.useDndContext)(),u=e.rows[e.index],p=null==(o=d.active)||null==(n=o.data.current)||null==(t=n.schema)?void 0:t.parent.parent,m=null==p?void 0:p.mapProperties(e=>"Grid.Col"===e["x-component"]).filter(Boolean).length,h=!0;if(1===m)if(e.first)h=p!==e.rows[0];else{let t=e.rows[e.index+1];h=p!==u&&t!==p}return(0,eq.useDndMonitor)({onDragStart(e){s(!0)},onDragMove(e){},onDragOver(e){},onDragEnd(e){s(!1)},onDragCancel(e){s(!1)}}),(0,A.jsx)("span",{ref:h?i:null,className:r6()("tb-row-divider","RowDivider"),style:c})},AZ=e=>{let t=new ec.Schema({type:"void",name:"row_".concat((0,ec.uid)()),"x-uid":(0,ec.uid)(),"x-component":"Grid.Row"}),n=t.addProperty((0,ec.uid)(),{type:"void","x-uid":(0,ec.uid)(),"x-component":"Grid.Col"});return ec.Schema.isSchemaInstance(e)&&(e.parent=n),n.addProperty(e.name,e),t},A0=e=>{let t=new ec.Schema({type:"void",name:"col_".concat((0,ec.uid)()),"x-uid":(0,ec.uid)(),"x-component":"Grid.Col"});return ec.Schema.isSchemaInstance(e)&&(e.parent=t),t.addProperty(e.name,e),t},A1=e=>!1===e.dndContext?(0,A.jsx)(A.Fragment,{children:e.children}):(0,A.jsx)(SM,{...e.dndContext,children:e.children}),A2=()=>(0,es.useContext)(AW),A6=()=>(0,es.useContext)(A$),A3=(0,ec.observer)(e=>{let t,{distributed:n,showDivider:o=!0}=e,l=(0,es.useRef)(null),r=(0,ec.useField)(),i=(0,ec.useFieldSchema)(),{render:a}=mz(i["x-initializer"],i["x-initializer-props"]),s=r.address.toString(),c=(t=(0,ec.useFieldSchema)(),(0,es.useMemo)(()=>t.reduceProperties((e,t)=>("Grid.Row"!==t["x-component"]||t["x-hidden"]||e.push(t),e),[]),[Object.keys(t.properties||{}).join(",")])),{setPrintContent:d}=Tp(),{wrapSSR:u,componentCls:p,hashId:m}=AK(),h=void 0===n?(null==i?void 0:i.parent["x-component"])==="Page"||(null==i?void 0:i.parent["x-component"])==="Tabs.TabPane":n;return(0,es.useEffect)(()=>{l.current&&(null==d||d(l.current))},[l.current]),u((0,A.jsx)(AW.Provider,{value:{ref:l,fieldSchema:i,renderSchemaInitializer:a,InitializerComponent:e=>a(e),showDivider:o},children:(0,A.jsxs)("div",{className:"tb-grid ".concat(p," ").concat(m),style:{position:"relative"},ref:l,children:[(0,A.jsxs)(A1,{dndContext:e.dndContext,children:[o?(0,A.jsx)(AQ,{rows:c,first:!0,id:"".concat(s,"_0"),data:{breakRemoveOn:AH,wrapSchema:AZ,insertAdjacent:"afterBegin",schema:i}}):null,c.map((e,t)=>(0,A.jsxs)(es.Fragment,{children:[h?(0,A.jsx)(al,{name:e.name,schema:e,distributed:!0}):(0,A.jsx)(AX,{name:e.name,schema:e}),o?(0,A.jsx)(AQ,{rows:c,index:t,id:"".concat(s,"_").concat(t+1),data:{breakRemoveOn:AH,wrapSchema:AZ,insertAdjacent:"afterEnd",schema:e}}):null]},t))]}),a()]})}))},{displayName:"Grid"});A3.Row=(0,ec.observer)(()=>{let e,t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),o=t.address.toString(),l=(e=(0,ec.useFieldSchema)(),(0,es.useMemo)(()=>e.reduceProperties((e,t)=>("Grid.Col"!==t["x-component"]||t["x-hidden"]||e.push(t),e),[]),[Object.keys(e.properties||{}).join(",")])),{showDivider:r}=A2(),{type:i}=Tc();return(0,A.jsx)(A$.Provider,{value:{schema:n,cols:l},children:(0,A.jsxs)("div",{className:r6()("tb-grid-row","CardRow",{showDivider:r}),children:[r&&(0,A.jsx)(AJ,{cols:l,first:!0,id:"".concat(o,"_0"),data:{breakRemoveOn:AY,wrapSchema:A0,insertAdjacent:"afterBegin",schema:n}}),l.map((e,t)=>(0,A.jsxs)(es.Fragment,{children:[(0,A.jsx)(ec.RecursionField,{name:e.name,schema:e,mapProperties:e=>("update"===i&&(e.default=null),e)}),r&&(0,A.jsx)(AJ,{cols:l,index:t,last:t===l.length-1,id:"".concat(o,"_").concat(t+1),data:{breakRemoveOn:AY,wrapSchema:A0,insertAdjacent:"afterEnd",schema:e}})]},t))]})})},{displayName:"Grid.Row"}),A3.Col=(0,ec.observer)(e=>{var t;let{cols:n=[]}=(0,es.useContext)(A$),{showDivider:o}=A2(),l=(0,ec.useFieldSchema)(),r=(0,ec.useField)(),{token:i}=iw.A.useToken(),a=(0,es.useMemo)(()=>{let e="";if(null==n?void 0:n.length){var t;let r=(null==l||null==(t=l["x-component-props"])?void 0:t.width)||100/n.length;e="calc(".concat(r,"% - ").concat(i.marginLG,"px * ").concat((o?n.length+1:0)/n.length,")")}return{width:e}},[null==n?void 0:n.length,null==l||null==(t=l["x-component-props"])?void 0:t.width]),{isOver:s,setNodeRef:c}=(0,eq.useDroppable)({id:r.address.toString(),data:{insertAdjacent:"beforeEnd",schema:l,wrapSchema:e=>e}}),[d,u]=(0,es.useState)(!1),p=(0,es.useMemo)(()=>s?{background:"linear-gradient(to top, ".concat(new SD.q(i.colorSettings).setAlpha(.1).toHex8String()," 20%, transparent 20%)"),borderTopRightRadius:"10px",borderTopLeftRadius:"10px",height:"100%"}:{height:"100%"},[d,s]);return(0,eq.useDndMonitor)({onDragStart(e){u(!0)},onDragMove(e){},onDragOver(e){},onDragEnd(e){u(!1)},onDragCancel(e){u(!1)}}),(0,A.jsx)(AU.Provider,{value:{cols:n,schema:l},children:(0,A.jsx)("div",{ref:c,style:{...a,...p},className:r6()("tb-grid-col CardCol"),children:e.children})})},{displayName:"Grid.Row"}),A3.wrap=e=>({type:"void","x-component":"Grid.Row",properties:{[(0,ec.uid)()]:{type:"void","x-component":"Grid.Col",properties:{[e.name||(0,ec.uid)()]:e}}}});var A5=n(27647),A4=n(43951),A8=n(55460);function A7(){let e=(0,ns._)(["\n color: ",";\n padding: 18px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: ",";\n\n &-failed-text {\n display: inline-block;\n margin-right: 8px;\n }\n "]);return A7=function(){return e},e}let A9=(0,nu.rU)(e=>{let{token:t,css:n}=e;return{infiniteScroll:n(A7(),t.colorTextDescription,t.fontSize)}}),ke=(e,t,n)=>(0,A.jsx)(kn,{hasMore:e,failed:t,retry:n}),kt=e=>{let{threshold:t=250,loadMore:n,children:o=ke,hasMore:l}=e,{styles:r}=A9(),[i,a]=(0,es.useState)(!1),s=(0,A4.A)(async e=>{try{await n(e)}catch(e){throw a(!0),e}}),c=(0,es.useRef)(null),[d,u]=(0,es.useState)({}),p=(0,es.useRef)(d),[m,h]=(0,es.useState)(),{run:x}=(0,A8.A)(async()=>{if(p.current!==d||!l)return;let e=c.current;if(!e||!e.offsetParent)return;let n=(0,eh.getScrollParent)(e);if(h(n),!n)return;let o=e.getBoundingClientRect().top;if((n===window?window.innerHeight:n.getBoundingClientRect().bottom)>=o-t){let e={};p.current=e;try{await s(!1),u(e)}catch(e){console.error(e)}}},{wait:100,leading:!0,trailing:!0});async function f(){a(!1);try{await s(!0),u(p.current)}catch(e){console.error(e)}}return(0,es.useEffect)(()=>{x()}),(0,es.useEffect)(()=>{if(c.current&&m)return m.addEventListener("scroll",e),()=>{m.removeEventListener("scroll",e)};function e(){x()}},[m]),(0,A.jsx)("div",{className:r.infiniteScroll,ref:c,children:"function"==typeof o?o(l,i,f):o})},kn=e=>{let{t}=(0,eT.useTranslation)(),{styles:n}=A9();return e.hasMore?e.failed?(0,A.jsxs)("span",{children:[(0,A.jsx)("span",{className:"".concat(n.infiniteScroll,"-failed-text"),children:t("failed to load")}),(0,A.jsx)("a",{onClick:()=>{e.retry()},children:t("retry")})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{children:t("loading")}),(0,A.jsx)(eD.A,{})]}):(0,A.jsx)("span",{children:t("no more")})};function ko(e){let{params:t}=e,{filter:n}=lD({filterOption:null==t?void 0:t.filter});return(0,es.useMemo)(()=>({...t,filter:n}),[n,t])}let kl=cP("tb-grid-card",e=>{let{componentCls:t}=e;return{[t]:{"& > .tb-block-item":{marginBottom:e.marginLG,"& > .tb-action-bar:has(:first-child:not(:empty))":{padding:e.marginLG,background:e.colorBgContainer},".ant-list-pagination":{padding:e.marginLG,background:e.colorBgContainer}},".ant-formily-item-feedback-layout-loose":{marginBottom:e.marginSM}}}}),kr=(0,es.createContext)({});kr.displayName="GridCardBlockContext";let ki=e=>{var t;let{resource:n,service:o}=nj(),l=(0,ec.useField)(),{wrapSSR:r,componentCls:i,hashId:a}=kl(),s=(0,es.useMemo)(()=>(0,ec.createForm)({readPretty:!0}),[]);return(0,es.useEffect)(()=>{if(!(null==o?void 0:o.loading)){var e;s.setValuesIn(l.address.concat("list").toString(),null==o||null==(e=o.data)?void 0:e.data)}},[l.address,s,null==o||null==(t=o.data)?void 0:t.data,null==o?void 0:o.loading]),r((0,A.jsx)(kr.Provider,{value:{service:o,resource:n,columnCount:e.columnCount,needInfiniteScroll:e.needInfiniteScroll},children:(0,A.jsx)(ec.FormContext.Provider,{value:s,children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)("div",{className:"".concat(i," ").concat(a),children:e.children})})})}))},ka=Tr(e=>{let t=(0,ec.useFieldSchema)()["x-use-decorator-props"]?e.params:ko(e);return(0,A.jsx)(nT,{name:"grid-card",...e,params:t,children:(0,A.jsx)(ki,{...e})})}),ks=()=>({}),kc=[1,2,3,4,6,8,12,24].reduce((e,t)=>(e[t]=t,e),{}),kd={size:["large","small"],wrap:!0},ku=()=>({spaceProps:kd});function kp(){let e=(0,ns._)(["\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n justify-content: space-between;\n gap: 8px;\n "]);return kp=function(){return e},e}function km(){let e=(0,ns._)(["\n /* background-color: re/d; */\n height: 100%;\n > .ant-card-body {\n padding: 24px 24px 0px;\n height: 100%;\n }\n .tb-action-bar {\n padding: 5px 0;\n }\n "]);return km=function(){return e},e}let kh=(0,nu.rU)(e=>{let{css:t}=e;return{itemCss:t(kp()),card:t(km())}}),kx=Tr(e=>{tS();let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),o=tG(),l=(0,ep.useNavigate)(),{styles:r}=kh(),i=(e=>{var t,n,o;let{field:l,fieldSchema:r}=e,{linkCollection:i,fields:a,linkDataSource:s,link:c}=(null==r||null==(o=r.parent)||null==(n=o.parent)||null==(t=n["x-decorator-props"])?void 0:t.linkConfig)||{},{record:d}=l,u="?";return null==a||a.forEach((e,t)=>{if(d[e])return u+="".concat(0===t?"":"&").concat(e,"=").concat(d[e])}),"".concat(c,"/").concat(s,"/").concat(i).concat(u)})({field:t,fieldSchema:n});return(0,A.jsx)(rZ.A,{role:"button","aria-label":"grid-card-item",className:r.card,onClick:()=>{var e,t;let o=null==n||null==(e=n.parent)?void 0:e.parent;(null==o||null==(t=o["x-decorator-props"])?void 0:t.isLinkable)&&l(i)},children:(0,A.jsx)("div",{className:r.itemCss,children:(0,A.jsx)(m1,{record:t.value,parent:o,children:e.children})})})});function kf(){let e=(0,ns._)(["\n width: 100%;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return kf=function(){return e},e}let kv={md:12,sm:5,xs:5},kg=(0,nu.rU)(e=>{let{css:t}=e;return{designer:t(kf())}}),ky=Tr(e=>{var t;let{columnCount:n,pagination:o}=iq(e),{styles:l}=kg(),{service:r,columnCount:i=CE,needInfiniteScroll:a}=(0,es.useContext)(kr),s=n||i,{run:c,params:d}=r,u=null==r||null==(t=r.data)?void 0:t.meta,p=(0,ec.useFieldSchema)(),m=(0,ec.useField)(),h=SF(),[x]=(0,es.useState)(new Map),f=(0,es.useCallback)(e=>(x.has(e)||x.set(e,new ec.Schema({type:"object",properties:{[e]:{...p.properties.item}}})),x.get(e)),[p.properties,x]),v=(0,es.useCallback)((e,t)=>{c({...null==d?void 0:d[0],page:e,pageSize:t})},[c,d]),[g,y]=(0,es.useState)(!0),[b,C]=(0,es.useState)(1),S=(0,es.useCallback)(async()=>{let{pageSize:e=5}=u||{};await v(1,b*e),C(e=>e+1),y(!1)},[u,v,y]);return(0,es.useEffect)(()=>{let{count:e,pageSize:t=10,page:n=1}=u||{};y(e>n*t)},[null==u?void 0:u.pageSize]),(0,A.jsx)(i8,{scope:{useGridCardItemProps:ks,useGridCardActionBarProps:ku},children:(0,A.jsxs)(SE,{className:r6()("tb-card-list",l.designer),children:[(0,A.jsx)(A5.A,{pagination:!!u&&!(u.count<=u.pageSize)&&!a&&{...o,onChange:v,total:(null==u?void 0:u.count)||0,pageSize:(null==u?void 0:u.pageSize)||10,current:(null==u?void 0:u.page)||1,pageSizeOptions:Cq},dataSource:m.value,grid:{...s,sm:s.xs,xl:s.lg,gutter:[kv,kv]},renderItem:(e,t)=>{let n=f(t);return(0,A.jsx)(nd.A,{style:{height:"100%"},children:(0,A.jsx)(ec.RecursionField,{basePath:m.address,name:t,onlyRenderProperties:!0,schema:n},t)})},loading:null==r?void 0:r.loading}),a&&(0,A.jsx)(kt,{loadMore:S,hasMore:g}),(0,A.jsx)(h,{})]})})});ky.Item=kx,ky.Designer=()=>{var e,t,n,o,l,r,i,a;let{name:s,title:c}=tJ(),d=rh(),{t:u}=(0,eT.useTranslation)(),p=(0,ec.useFieldSchema)(),{form:m}=Tp(),h=(0,ec.useField)(),{dn:x}=eY(),f=hd(s);m3();let v=(null==p||null==(t=p["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],g=(null==p||null==(n=p["x-decorator-props"])?void 0:n.resource)||(null==p||null==(o=p["x-decorator-props"])?void 0:o.association),y=h.decoratorProps.columnCount||CE,b=(0,es.useMemo)(()=>({"x-component":"Slider","x-decorator":"FormItem","x-component-props":{min:1,max:24,marks:kc,tooltip:{formatter:e=>"".concat(e).concat(u("Column"))},step:null}}),[u]),C=(0,es.useMemo)(()=>C_.reduce((e,t)=>(e[t]={...b,title:u(CO[t]),description:"".concat(u("Screen size")," ").concat(CB[t]," ").concat(u("pixels"))},e),{}),[b,u]),S=null==v?void 0:v.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return(0,A.jsx)(sP,{template:d,title:c||s,children:(0,A.jsxs)(i8,{components:{Slider:Ax.A},children:[(0,A.jsx)(aQ,{title:u("Set the count of columns displayed in a row"),initialValues:y,schema:{type:"object",title:u("Set the count of columns displayed in a row"),properties:C},onSubmit:e=>{eu().set(p,"x-decorator-props.columnCount",e),h.decoratorProps.columnCount=e,x.emit("patch",{schema:{"x-uid":p["x-uid"],"x-decorator-props":p["x-decorator-props"]}})}}),(0,A.jsx)(il,{collectionName:s,defaultFilter:(null==p||null==(r=p["x-decorator-props"])||null==(l=r.params)?void 0:l.filter)||{},form:m,onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(p,"x-decorator-props.params.filter",t),h.decoratorProps.params={...p["x-decorator-props"].params},x.emit("patch",{schema:{"x-uid":p["x-uid"],"x-decorator-props":p["x-decorator-props"]}})}}),(0,A.jsx)(aQ,{title:u("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:u("Set default sorting rules"),properties:{sort:{type:"array",default:S,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:f,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:u("ASC"),value:"asc"},{label:u("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:u("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{let{sort:t}=e,n=t.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);eu().set(p,"x-decorator-props.params.sort",n),h.decoratorProps.params={...p["x-decorator-props"].params},x.emit("patch",{schema:{"x-uid":p["x-uid"],"x-decorator-props":p["x-decorator-props"]}})}}),(0,A.jsx)(t0,{}),(0,A.jsx)(aW,{title:u("Records per page"),value:(null==(a=h.decoratorProps)||null==(i=a.params)?void 0:i.pageSize)||20,options:Cq.map(e=>({value:e})),onChange:e=>{eu().set(p,"x-decorator-props.params.pageSize",e),h.decoratorProps.params={...p["x-decorator-props"].params,page:1},x.emit("patch",{schema:{"x-uid":p["x-uid"],"x-decorator-props":p["x-decorator-props"]}})}}),(0,A.jsx)(aB,{componentName:"GridCard",collectionName:s,resourceName:g}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})})},ky.Decorator=ka;let kb=e=>{let{changeFilterKey:t}=e,{t:n}=(0,eT.useTranslation)(),o=eu().debounce(e=>{t(e.target.value)},100);return(0,A.jsx)(nJ.A,{allowClear:!0,placeholder:n("The key in Antd, such as 'ApiOutlined', ignoring case"),onChange:o})},kC=e=>{let{currentKey:t,filterKey:n,onChange:o,changePop:l}=e,r=(0,es.useMemo)(()=>{if(!n)return iZ;let e=new Map;for(let t of iZ.keys())t.toLowerCase().includes(n.toLowerCase())&&e.set(t,iZ.get(t));return e},[n]);return(0,A.jsx)("div",{style:{width:"26em",maxHeight:"20em",overflowY:"auto"},children:[...r.keys()].map(e=>(0,A.jsx)("span",{style:{fontSize:18,marginRight:10,cursor:"pointer",backgroundColor:t==e?"#9bb0d393":""},children:(0,A.jsx)(iV.A,{destroyTooltipOnHide:!0,mouseEnterDelay:.3,mouseLeaveDelay:.3,placement:"top",title:e,arrow:{pointAtCenter:!0},children:(0,A.jsx)(i6,{type:e,onClick:()=>{o(e),l(!1)}})})},e))})},kS=(0,ec.connect)(function(e){let{value:t,onChange:n,disabled:o}=e,{t:l}=(0,eT.useTranslation)(),r=(0,eh.useFormLayout)(),[i,a]=(0,es.useState)(!1),[s,c]=(0,es.useState)("");return(0,A.jsx)("div",{children:(0,A.jsxs)(of.A.Compact,{children:[(0,A.jsx)(dE,{placement:"bottom",open:i,onOpenChange:e=>{o||a(e)},content:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(kb,{changeFilterKey:c}),(0,A.jsx)(kC,{currentKey:t,filterKey:s,onChange:n,changePop:a})]}),title:l("Icon"),trigger:"click",children:(0,A.jsx)(e3.Ay,{size:r.size,disabled:o,children:i1(t)?(0,A.jsx)(i6,{type:t}):l("Select icon")})}),t&&!o&&(0,A.jsx)(e3.Ay,{size:r.size,icon:(0,A.jsx)(cp.A,{}),onClick:e=>{n(null)}})]})})},(0,ec.mapProps)((e,t)=>({...e,suffix:(0,A.jsx)("span",{children:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffix})})),(0,ec.mapReadPretty)(e=>(0,ec.isValid)(e.value)?(0,A.jsx)(i6,{type:e.value}):(0,A.jsx)("div",{})));var kw=n(418);let kF=(0,ec.connect)(e=>{let{onChange:t,...n}=e;return(0,A.jsx)(kw.A,{onChange:e=>{let n=parseFloat(e);t(Number.isNaN(n)?null:n)},...n})},(0,ec.mapReadPretty)(Ab));kF.ReadPretty=Ab;let kj={size:["large","small"],wrap:!0},kA=()=>({spaceProps:kj});function kk(){let e=(0,ns._)(["\n .ant-description-input {\n line-height: 34px;\n }\n .ant-formily-item-feedback-layout-loose {\n margin-bottom: 12px;\n }\n "]);return kk=function(){return e},e}let kI=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(kk())}}),kP=(0,es.createContext)({});kP.displayName="ListBlockContext";let kT=e=>{var t;let{resource:n,service:o}=nj(),{styles:l}=kI(),r=(0,ec.useField)(),i=(0,es.useMemo)(()=>(0,ec.createForm)({readPretty:!0}),[]);return(0,es.useEffect)(()=>{if(!(null==o?void 0:o.loading)){var e;i.setValuesIn(r.address.concat("list").toString(),null==o||null==(e=o.data)?void 0:e.data)}},[r.address,i,null==o||null==(t=o.data)?void 0:t.data,null==o?void 0:o.loading]),(0,A.jsx)(kP.Provider,{value:{service:o,resource:n},children:(0,A.jsx)(ec.FormContext.Provider,{value:i,children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)("div",{className:l.container,children:e.children})})})})},kN=Tr(e=>{let{params:t}=e,{filter:n}=lD({filterOption:null==t?void 0:t.filter}),o=(0,es.useMemo)(()=>({...t,filter:n}),[n,t]);return eu().isEmpty(n)&&!eu().isEmpty(null==t?void 0:t.filter)?null:(0,A.jsx)(nT,{name:"list",...e,params:o,children:(0,A.jsx)(kT,{...e})})}),kM=()=>({});function kD(){let e=(0,ns._)(["\n .tb-action-bar {\n gap: 20px !important;\n margin-top: ",";\n }\n "]);return kD=function(){return e},e}let kR=(0,nu.rU)((e,t)=>{let{css:n}=e;return{item:n(kD(),t.designable?"20px":"0px")}}),kq=Tr(e=>{let t=(0,ec.useField)(),{designable:n}=eY(),{styles:o}=kR({designable:n}),l=tG();return(0,A.jsx)("div",{className:r6()(e.className,["itemCss",o.item]),children:(0,A.jsx)(m1,{record:t.value,parent:l,children:e.children})})}),k_=cP("tb-list",e=>{let{componentCls:t}=e;return{[t]:{width:"100%",marginBottom:0,"&:hover":{"> .general-schema-designer":{display:"block"}},"> .general-schema-designer":{position:"absolute",zIndex:999,top:"0",bottom:"0",left:"0",right:"0",display:"none",background:"var(--colorBgSettingsHover)",border:"0",pointerEvents:"none","> .general-schema-designer-icons":{position:"absolute",right:"2px",top:"2px",lineHeight:"16px",pointerEvents:"all",".ant-space-item":{backgroundColor:"var(--colorSettings)",color:"#fff",lineHeight:"16px",width:"16px",paddingLeft:"1px"}}},".itemCss":{display:"flex",width:"100%",flexDirection:"column","&:not(:first-child)":{paddingTop:e.paddingContentVertical},"&:not(:last-child)":{paddingBottom:e.paddingContentVertical,borderBottom:"1px solid ".concat(e.colorBorderSecondary)}}}}}),kO=Tr(e=>{var t,n;let{service:o}=(0,es.useContext)(kP),{run:l,params:r}=o,i=(0,ec.useFieldSchema)(),a=SF(),s=null==o||null==(t=o.data)?void 0:t.meta,c=(0,ec.useField)(),[d]=(0,es.useState)(new Map),{wrapSSR:u,componentCls:p,hashId:m}=k_(),h=(0,es.useCallback)(e=>(d.has(e)||d.set(e,new ec.Schema({type:"object",properties:{[e]:i.properties.item}})),d.get(e)),[i.properties,d]),x=(0,es.useCallback)((e,t)=>{l({...null==r?void 0:r[0],page:e,pageSize:t})},[l,r]);return u((0,A.jsx)(i8,{scope:{useListItemProps:kM,useListActionBarProps:kA},children:(0,A.jsxs)(SE,{className:r6()("tb-list",p,m),children:[(0,A.jsx)(A5.A,{...e,pagination:!!s&&!(s.count<=s.pageSize)&&{onChange:x,total:(null==s?void 0:s.count)||0,pageSize:(null==s?void 0:s.pageSize)||10,current:(null==s?void 0:s.page)||1},loading:null==o?void 0:o.loading,children:(null==(n=c.value)?void 0:n.length)?c.value.map((e,t)=>(0,A.jsx)(ec.RecursionField,{basePath:c.address,name:t,onlyRenderProperties:!0,schema:h(t)},t)):null}),(0,A.jsx)(a,{})]})}))});kO.Item=kq,kO.Designer=()=>{var e,t,n,o,l,r,i,a;let{name:s,title:c}=tJ(),d=rh(),{t:u}=(0,eT.useTranslation)(),p=(0,ec.useFieldSchema)(),{form:m}=Tp(),h=(0,ec.useField)(),{dn:x}=eY(),f=hd(s);m3();let v=(null==p||null==(t=p["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],g=(null==p||null==(n=p["x-decorator-props"])?void 0:n.resource)||(null==p||null==(o=p["x-decorator-props"])?void 0:o.association),y=null==v?void 0:v.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"});return(0,A.jsxs)(sP,{template:d,title:c||s,children:[(0,A.jsx)(aZ,{}),(0,A.jsx)(il,{collectionName:s,defaultFilter:(null==p||null==(r=p["x-decorator-props"])||null==(l=r.params)?void 0:l.filter)||{},form:m,onSubmit:e=>{let{filter:t}=e;t=d5(t),eu().set(p,"x-decorator-props.params.filter",t),h.decoratorProps.params={...p["x-decorator-props"].params,page:1},x.emit("patch",{schema:{"x-uid":p["x-uid"],"x-decorator-props":p["x-decorator-props"]}})}}),(0,A.jsx)(aQ,{title:u("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:u("Set default sorting rules"),properties:{sort:{type:"array",default:y,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:f,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:u("ASC"),value:"asc"},{label:u("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:u("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{let{sort:t}=e,n=t.map(e=>"desc"===e.direction?"-".concat(e.field):e.field);eu().set(p,"x-decorator-props.params.sort",n),h.decoratorProps.params={...p["x-decorator-props"].params,page:1},x.emit("patch",{schema:{"x-uid":p["x-uid"],"x-decorator-props":p["x-decorator-props"]}})}}),(0,A.jsx)(t0,{}),(0,A.jsx)(aW,{title:u("Records per page"),value:(null==(a=h.decoratorProps)||null==(i=a.params)?void 0:i.pageSize)||20,options:[{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"80",value:80},{label:"100",value:100}],onChange:e=>{eu().set(p,"x-decorator-props.params.pageSize",e),h.decoratorProps.params={...p["x-decorator-props"].params,page:1},x.emit("patch",{schema:{"x-uid":p["x-uid"],"x-decorator-props":p["x-decorator-props"]}})}}),(0,A.jsx)(aB,{componentName:"List",collectionName:s,resourceName:g}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})},kO.Decorator=kN;let kB=cP("tb-markdown",(e,t)=>{let{isDarkTheme:n}=t,{componentCls:o}=e,l=new SD.q(e.colorFillAlter).onBackground(e.colorBgContainer).toHexShortString(),r={"&.tb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:e.colorFillQuaternary,border:"1px solid ".concat(e.colorBorder),borderRadius:e.borderRadiusSM},blockquote:{borderLeft:"4px solid #ccc",paddingLeft:"20px",marginLeft:"0",color:"#666",fontStyle:"italic"},img:{maxWidth:"100%"},".hljs":{background:"#f8f8f8",color:"#444"},".hljs-comment":{color:"#697070"},".hljs-punctuation,.hljs-tag":{color:"#444a"},".hljs-tag .hljs-attr,.hljs-tag .hljs-name":{color:"#444"},".hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag":{fontWeight:700},".hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type":{color:"#800"},".hljs-section,.hljs-title":{color:"#800",fontWeight:700},".hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable":{color:"#ab5656"},".hljs-literal":{color:"#695"},".hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code":{color:"#397300"},".hljs-meta":{color:"#1f7199"},".hljs-meta .hljs-string":{color:"#38a"},".hljs-emphasis":{fontStyle:"italic"},".hljs-strong":{fontWeight:700}},"&.tb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:"1px solid ".concat(e.colorBorderSecondary),padding:"".concat(e.paddingContentVertical,"px ").concat(e.paddingContentHorizontal,"px"),textAlign:"left"},th:{backgroundColor:l,fontWeight:"bold",color:e.colorText},"tr:hover":{backgroundColor:e.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}},i={"&.tb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:e.colorFillQuaternary,border:"1px solid ".concat(e.colorBorder),borderRadius:e.borderRadiusSM},".hljs":{color:"#adbac7",background:"#22272e"},".hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_":{color:"#f47067"},".hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_":{color:"#dcbdfb"},".hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable":{color:"#6cb6ff"},".hljs-meta .hljs-string,.hljs-regexp,.hljs-string":{color:"#96d0ff"},".hljs-built_in,.hljs-symbol":{color:"#f69d50"},".hljs-code,.hljs-comment,.hljs-formula":{color:"#768390"},".hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag":{color:"#8ddb8c"},".hljs-subst":{color:"#adbac7"},".hljs-section":{color:"#316dca",fontWeight:700},".hljs-bullet":{color:"#eac55f"},".hljs-emphasis":{color:"#adbac7",fontStyle:"italic"},".hljs-strong":{color:"#adbac7",fontWeight:700},".hljs-addition":{color:"#b4f1b4",backgroundColor:"#1b4721"},".hljs-deletion":{color:"#ffd8d3",backgroundColor:"#78191b"}},"&.tb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:"1px solid ".concat(e.colorBorderSecondary),padding:"".concat(e.paddingContentVertical,"px ").concat(e.paddingContentHorizontal,"px"),textAlign:"left"},th:{backgroundColor:l,fontWeight:"bold",color:e.colorText},"tr:hover":{backgroundColor:e.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}};return{[o]:{lineHeight:e.lineHeight,"& > *:last-child":{marginBottom:"0"},".ant-description-textarea, .ant-description-input":{lineHeight:e.lineHeight},".field-interface-datetime":{minWidth:"100px"},...n?i:r}}});var kE=n(75e3);let kV=new(n.n(kE)())({html:!0,linkify:!0,typographer:!0,breaks:!0});async function kz(e){return e?kV.render(e):e}function kL(e){let[t,n]=(0,es.useState)(""),[o,l]=(0,es.useState)(!1);return(0,es.useEffect)(()=>{l(!0),kz(e).then(e=>{n(e),l(!1)})},[e]),{html:t,loading:o}}let kG=e=>{let{t}=(0,eT.useTranslation)(),[n,o]=(0,es.useState)(e.defaultValue);return(0,A.jsxs)("div",{className:"mb-markdown",style:{position:"relative"},children:[(0,A.jsx)(nJ.A.TextArea,{autoSize:{minRows:3},...e,value:n,onChange:e=>{o(e.target.value)}}),(0,A.jsxs)(of.A,{style:{position:"absolute",bottom:5,right:5},children:[(0,A.jsx)(e3.Ay,{onClick:t=>{var n;null==(n=e.onCancel)||n.call(e,t)},children:t("Cancel")}),(0,A.jsx)(e3.Ay,{type:"primary",onClick:()=>{var t;null==(t=e.onSubmit)||t.call(e,n)},children:t("Save")})]})]})},kK=(0,ec.observer)(e=>{let{isDarkTheme:t}=yS(),{componentCls:n,hashId:o}=kB({isDarkTheme:t}),{content:l,className:r}=e,i=(0,ec.useField)(),a=(0,ec.useFieldSchema)(),{dn:s}=eY(),{onSave:c,onCancel:d}=e,{html:u,loading:p}=kL(l);return p?(0,A.jsx)(eD.A,{}):(null==i?void 0:i.editable)?(0,A.jsx)(kG,{...e,className:!0,defaultValue:l,onCancel:()=>{i.editable=!1,null==d||d()},onSubmit:async e=>{i.editable=!1,null!=a["x-component-props"]||(a["x-component-props"]={}),a["x-component-props"].content=e,i.componentProps.content=e,null==c||c(a),s.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":{content:e}}})}}):(0,A.jsx)("div",{className:r6()([n,o,"tb-markdown tb-markdown-default tb-markdown-table",r]),style:e.style,dangerouslySetInnerHTML:{__html:u}})},{displayName:"MarkdownVoid"});kK.Designer=()=>{let e=(0,ec.useField)(),{t}=(0,eT.useTranslation)();return(0,A.jsxs)(sP,{children:[(0,A.jsx)(az,{title:t("Edit markdown"),onClick:()=>{e.editable=!0}}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})};let k$=(0,ec.connect)(nJ.A.TextArea,(0,ec.mapProps)((e,t)=>({autoSize:{maxRows:10,minRows:3},...e,suffix:(0,A.jsx)("span",{children:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffix})})),(0,ec.mapReadPretty)(e=>(0,A.jsx)(kU,{...e}))),kU=e=>{let t,n,{isDarkTheme:o}=yS(),{wrapSSR:l,hashId:r,componentCls:i}=kB({isDarkTheme:o}),{html:a="",loading:s}=kL(e.value),c=((t=document.createElement("div")).innerHTML=a,n=t.innerText,t=null,(null==n?void 0:n.replace(/[\n\r]/g,""))||""),d=(0,A.jsx)("div",{className:"".concat(r," ").concat(i," tb-markdown tb-markdown-default tb-markdown-table"),dangerouslySetInnerHTML:{__html:a}});return l(s?(0,A.jsx)(eD.A,{}):(0,A.jsx)(gs.TextArea,{...e,autop:!1,text:c,value:d}))};k$.Void=kK;var kW=n(18831);function kH(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n height: 100%;\n\n &.draggable {\n cursor: move;\n padding: 0 10px;\n border-radius: 5px;\n background: #f0f0f0;\n }\n &.leftBorder {\n ::before {\n content: '';\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3px;\n height: 50%;\n background-color: var(--colorPrimaryText);\n\n /* 使用 clip-path 裁剪为梯形 */\n clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);\n }\n }\n\n &.adminMenu {\n .general-schema-designer {\n display: none;\n }\n }\n\n .wrapper {\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n }\n "]);return kH=function(){return e},e}let kY=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{dragHandleMenu:t(kH())}}),kX=e=>{let{isSubMenu:t,name:n,children:o,className:l,isAdminMenu:r}=e,{draggable:i}=(0,es.useContext)(S_),{onOpenChange:a}=(0,es.useContext)(kW.x)||{},{designable:s}=eY(),{attributes:c,listeners:d,setNodeRef:u,transform:p,isDragging:m}=i,{styles:h}=kY(),x=(0,es.useRef)(null),[f,v]=(0,es.useState)({width:0,height:0}),[g,y]=(0,es.useState)({x:0,y:0}),b={x:f.width/4,y:f.height/4},C={position:m?"fixed":"static",top:m?g.y-b.y:0,left:m?g.x-b.x:0,width:m?f.width:"100%",height:m?f.height:"100%",zIndex:m?999:"auto",pointerEvents:m?"none":"auto",transform:p?"translate3d(".concat(p.x,"px, ").concat(p.y,"px, 0) scale(").concat(m?1.05:1,")"):void 0,boxShadow:m?"0 4px 8px rgba(0, 0, 0, 0.1)":"none"};return((0,es.useEffect)(()=>{t&&m&&(null==a||a(n,!1))},[m]),s)?(0,A.jsx)("div",{ref:u,className:(0,nu.cx)(h.dragHandleMenu,{draggable:m,leftBorder:t&&m,adminMenu:r&&m},l),style:C,...d,...c,role:"none",onMouseDown:e=>{if(x.current){let{width:t,height:n}=x.current.getBoundingClientRect(),{clientX:o,clientY:l}=e;v({width:t,height:n}),y({x:o,y:l})}},children:(0,A.jsx)("div",{ref:x,className:"wrapper",children:o})}):o};function kJ(){let e=(0,ns._)(["\n border: none;\n border-radius: 8px 8px 8px 8px;\n background: #ffffff;\n box-shadow:\n 0px 4px 8px 0px rgba(0, 5, 26, 0.15),\n 0px 0px 8px 0px rgba(0, 5, 26, 0.05);\n\n .ant-card-body {\n display: grid;\n grid-template-columns: repeat(3, minmax(120px, 1fr));\n justify-items: center;\n gap: 10px;\n grid-row-gap: 10px;\n }\n\n .ant-card-body::before {\n display: none;\n }\n "]);return kJ=function(){return e},e}function kQ(){let e=(0,ns._)(["\n &.ant-card-grid {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n height: 100%;\n padding: 12px;\n color: inherit;\n border-radius: 8px;\n border: none;\n box-shadow: none;\n\n &:focus,\n &:active {\n background-color: #f4f4f4;\n }\n &:hover {\n border-radius: 8px;\n background-color: #f4f4f4;\n box-shadow: none;\n cursor: pointer;\n }\n\n .card-wrapper {\n width: 100%;\n height: 100%;\n background-color: transparent;\n border: none;\n }\n\n .drag-handle-menu {\n width: 100%;\n height: 100%;\n border-radius: 8px;\n border: none;\n }\n\n .ant-btn-icon {\n font-size: 1.2rem;\n text-align: center;\n }\n }\n\n &.ant-card-grid .ant-btn {\n display: grid;\n place-items: center;\n align-items: end;\n\n width: 100%;\n border: none;\n box-shadow: none;\n }\n\n .field-link {\n display: grid;\n place-items: center;\n\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n border-radius: 8px;\n background-color: transparent;\n box-shadow: none;\n\n color: inherit;\n }\n\n .icon-wrapper {\n font-size: 1.2rem;\n text-align: center;\n margin-bottom: 0.3rem;\n }\n\n .field-title {\n text-align: center;\n vertical-align: middle;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: ",";\n }\n\n .tb-sortable-designer {\n width: 100%;\n height: 5rem;\n }\n\n .general-schema-designer {\n position: absolute;\n left: 0;\n bottom: 0;\n\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n height: 45%;\n border-radius: 1px 1px 8px 8px;\n background: rgba(0, 0, 0, 0.5);\n visibility: hidden;\n }\n\n &.ant-card-grid:hover .general-schema-designer {\n visibility: visible;\n }\n\n .general-schema-designer .anticon-menu {\n padding: 1px;\n border-radius: 2px;\n background-color: #ffffff;\n color: #2f2f2f;\n }\n "]);return kQ=function(){return e},e}let kZ=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{adminMenuStyle:t(kJ()),adminMenuCardStyle:t(kQ(),n.fontSizeSM)}}),k0=e=>{let{items:t,onClick:n}=e,{styles:o}=kZ();return(0,A.jsx)(rZ.A,{className:o.adminMenuStyle,children:null==t?void 0:t.map(e=>(0,A.jsx)(k1,{item:e,onClick:n},e.key))})},k1=e=>{let{item:t,onClick:n}=e,{icon:o,field:l,Designer:r,schema:i}=(null==t?void 0:t.menu)||{},{t:a}=(0,eT.useTranslation)(),{styles:s}=kZ();return(0,A.jsx)(rZ.A.Grid,{className:s.adminMenuCardStyle,onClick:()=>n(t),children:t.menu?(0,A.jsx)(ec.SchemaContext.Provider,{value:i,children:(0,A.jsx)(ec.FieldContext.Provider,{value:l,children:(0,A.jsx)(SE,{className:"card-wrapper",role:"button","aria-label":a(l.title),removeParentsIfNoChildren:!1,overStyle:{background:"transparent"},children:(0,A.jsxs)(kX,{className:"drag-handle-menu",isAdminMenu:!0,children:[(0,A.jsxs)("div",{className:"field-link",role:"button","aria-label":a(l.title),title:a(l.title),children:[(0,A.jsx)("div",{className:"icon-wrapper",children:(0,A.jsx)(i6,{type:null!=o?o:"QuestionCircleOutlined"})}),(0,A.jsx)("div",{className:"field-title",children:a(l.title)})]}),(0,A.jsx)(r,{isAdminMenu:!0})]})})})}):(0,A.jsx)(A.Fragment,{children:t.label})})},k2=()=>(0,eT.useTranslation)("lm-menus"),k6=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[];for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let o=e[n],l={label:o.title,value:"".concat(o["x-uid"],"||").concat(o["x-component"])};if(o.properties){let e=k6(o.properties);(null==e?void 0:e.length)&&(l.children=e)}t.push(l)}return t},k3=e=>{let{t}=(0,eT.useTranslation)(),n=eY(),o=eC(),l=[{type:"onSelfCreate",method:"bindMenuToRole"},{type:"onSelfSave",method:"extractTextToLocale"}],r="beforeEnd",i=e.dn||n.dn;return(0,A.jsxs)(aL,{children:[(0,A.jsx)(aQ,{eventKey:"".concat(r,"group"),icon:(0,A.jsx)(i6,{type:"FolderAddOutlined"}),title:t("Create group"),schema:{type:"object",title:t("Create group"),properties:{title:{"x-decorator":"FormItem","x-component":"Input","x-component-props":{},title:t("Menu item title"),required:!0},icon:{title:t("Icon"),"x-component":"IconPicker","x-decorator":"FormItem"}}},onSubmit:e=>{let{title:t,icon:n}=e;i.insertAdjacent(r,{type:"void",title:t,"x-component":"Menu.SubMenu","x-decorator":"ACLMenuItemProvider","x-component-props":{icon:n},"x-server-hooks":l})}}),(0,A.jsx)(aQ,{eventKey:"".concat(r,"page"),icon:(0,A.jsx)(i6,{type:"FileOutlined"}),title:t("Create page"),schema:{type:"object",title:t("Create page"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:t("Menu item title"),required:!0,"x-component-props":{}},icon:{title:t("Icon"),"x-component":"IconPicker","x-decorator":"FormItem"}}},onSubmit:e=>{let{title:t,icon:n}=e;i.insertAdjacent(r,{type:"void",title:t,"x-component":"Menu.Item","x-decorator":"ACLMenuItemProvider","x-component-props":{icon:n},"x-server-hooks":l,properties:{page:{type:"void","x-component":"Page","x-async":!0,properties:{grid:{type:"void","x-component":"Grid","x-initializer":"page:addBlock",properties:{}}}}}})}}),(0,A.jsx)(aQ,{eventKey:"".concat(r,"link"),icon:(0,A.jsx)(i6,{type:"GlobalOutlined"}),title:t("Create link"),schema:{type:"object",title:t("Create link"),properties:{title:{title:t("Menu item title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:t("Icon"),"x-component":"IconPicker","x-decorator":"FormItem"},href:{title:t("Link"),"x-component":"Input","x-decorator":"FormItem"}}},onSubmit:e=>{let{title:t,icon:n,href:o}=e;i.insertAdjacent(r,{type:"void",title:t,"x-component":"Menu.URL","x-decorator":"ACLMenuItemProvider","x-component-props":{icon:n,href:o},"x-server-hooks":l})}}),(0,A.jsx)(aK,{}),(0,A.jsx)(aQ,{eventKey:"".concat(r,"restore"),icon:(0,A.jsx)(i6,{type:"UploadOutlined"}),title:t("Load menu config"),schema:{type:"object",title:t("Load menu config"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:t("Menu item title"),required:!0,"x-component-props":{}},bindMenuToRole:{type:"boolean",title:'{{ t("Automatically assign permissions to all matching roles") }}',"x-decorator":"FormItem","x-component":"Checkbox",default:!0},file:{type:"object",title:'{{ t("File") }}',required:!0,"x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{action:"attachments:create",multiple:!1}}}},onSubmit:async e=>{let{title:t,file:n,bindMenuToRole:l}=e,{data:a}=await o.request({url:n.url,baseURL:"/"}),s=null!=a?a:{};if(l){let e=a["x-server-hooks"];e.some(e=>"onSelfCreate"===e.type&&"bindMenuToRole"===e.method)||e.push({type:"onSelfCreate",method:"bindMenuToRole"})}s.title=t,i.insertAdjacent(r,s)}})]})};function k5(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n text-overflow: ellipsis;\n\n &:hover {\n .general-schema-designer {\n display: flex;\n }\n .ant-space-item:hover {\n border-radius: 5px;\n background-color: var(--colorSettings);\n color: #fff;\n }\n }\n &.tb-action-link {\n > .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n }\n .submenu-title {\n display: flex;\n flex-direction: row;\n\n width: 100%;\n vertical-align: middle;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .general-schema-designer {\n flex: 1;\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n pointer-events: none;\n display: none;\n .general-schema-designer-icons {\n pointer-events: all;\n .ant-space-item {\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n "]);return k5=function(){return e},e}function k4(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n width: 100%;\n\n &:hover {\n .general-schema-designer {\n display: flex;\n }\n .ant-space-item:hover {\n border-radius: 5px;\n background-color: var(--colorSettings);\n color: #fff;\n }\n }\n &.tb-action-link {\n > .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n }\n\n .menuitem-title-wrapper {\n display: flex;\n flex-direction: row;\n width: 100%;\n overflow: hidden;\n }\n .menuitem-title {\n vertical-align: middle;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .general-schema-designer {\n flex: 1;\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n display: none;\n pointer-events: none;\n > .general-schema-designer-icons {\n pointer-events: all;\n .ant-space-item {\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n "]);return k4=function(){return e},e}function k8(){let e=(0,ns._)(["\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n\n .ant-menu-submenu.ant-menu-submenu-inline .ant-menu-submenu-title {\n position: relative;\n ::before {\n content: '';\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3px;\n height: 50%;\n background-color: ",";\n\n /* 使用 clip-path 裁剪为梯形 */\n clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);\n }\n }\n\n .ant-menu-submenu.ant-menu-submenu-inline.ant-menu-submenu-open > .ant-menu-submenu-title {\n ::before {\n background-color: ",";\n }\n }\n\n .ant-menu-item,\n .ant-menu-submenu-title {\n padding-inline-end: 10px;\n }\n\n .ant-menu-submenu-title {\n .ant-menu-title-content {\n > div {\n > .general-schema-designer {\n right: 6px !important;\n }\n > span.anticon {\n margin-right: 10px;\n }\n }\n }\n }\n "]);return k8=function(){return e},e}function k7(){let e=(0,ns._)(["\n :active {\n background: inherit;\n }\n "]);return k7=function(){return e},e}function k9(){let e=(0,ns._)(["\n display: flex;\n "]);return k9=function(){return e},e}let Ie=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{subMenuDesignerCss:t(k5()),designerCss:t(k4()),sideMenuClass:t(k8(),n.colorBorder,n.colorPrimaryText),menuItemClass:t(k7()),headerMenuClass:t(k9())}}),It=e=>{let{dn:t}=e,{getAriaLabel:n}=sc();return(0,A.jsx)(aO,{title:(0,A.jsx)(i6,{type:"PlusOutlined","aria-label":n("add-menu")}),children:(0,A.jsx)(k3,{dn:t})})};function In(){let e=(0,ns._)(["\n /* NOTE: 这里的样式是为了让搜索框的样式, 避免上层 antd 写死的 padding-left: 24px 的影响 */\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n\n /* NOTE: 放这三个样式是为了提升选择器优先级, 覆盖掉 antd 的默认样式 */\n .ant-input-outlined.ant-input-outlined.ant-input-outlined {\n background-color: #f9f9f9;\n border-radius: 5px;\n border: none;\n box-shadow: none;\n }\n\n /* 移除 antd 默认的后置搜索图标 */\n .ant-input-group-addon {\n display: none;\n }\n\n .menu-add-wrapper {\n .ant-dropdown-trigger {\n display: grid;\n place-items: center;\n\n width: 30px;\n /* 这里是为了和前边元素保持对齐, antd 组件写死了高度 */\n height: 28px;\n\n cursor: pointer;\n\n :hover,\n :active {\n border-radius: 5px;\n color: #ffffff;\n background-color: #f4f4f4;\n }\n }\n }\n "]);return In=function(){return e},e}let Io=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{menuSearchAdd:t(In())}}),Il=e=>{let{designable:t,dn:n,setSearchMenuTitle:o}=e,{t:l}=(0,eT.useTranslation)(),{styles:r}=Io(),i=eu().debounce(e=>{e.stopPropagation(),o(e.target.value.trim())},500);return(0,A.jsxs)("div",{className:r.menuSearchAdd,children:[(0,A.jsx)(nJ.A.Search,{allowClear:!0,placeholder:l("search Menu"),prefix:(0,A.jsx)(i6,{type:"SearchOutlined"}),onChange:i,onSearch:(e,t)=>{t.stopPropagation(),eu().debounce(o,500)(e.trim())}}),(0,A.jsx)("div",{className:"menu-add-wrapper",children:t&&(0,A.jsx)(It,{dn:n})})]})};function Ir(e,t){return ec.Schema.isSchemaInstance(e)||(e=new ec.Schema(e)),e.reduceProperties((e,n)=>{if(n["x-uid"]===t)return n;let o=Ir(n,t);return o||e},null)}function Ii(e){for(let{schema:t}of(ec.Schema.isSchemaInstance(e)||(e=new ec.Schema(e)),ec.Schema.getOrderProperties(e))){if("Menu.Item"===t["x-component"])return t;let e=Ii(t);if(e)return e}return null}function Ia(e,t){var n=Ir(e,t);if(!n)return;let o=[];for(o.push(n.name);n.parent&&"Menu"!==n.parent["x-component"];)o.push(n.parent.name),n=n.parent;return o.reverse()}function Is(){let e=(0,ns._)(["\n .iconButton {\n border: 0;\n height: var(--tb-header-height);\n width: 46px;\n border-radius: 0;\n background: none;\n color: rgba(255, 255, 255, 0.65);\n &:hover {\n background: rgba(255, 255, 255, 0.1) !important;\n }\n }\n "]);return Is=function(){return e},e}let Ic=e=>{let{others:t,schema:n,mode:o,onSelect:l,setLoading:r,setDefaultSelectedKeys:i,designable:a,render:s,children:c}=e,{Component:d,getMenuItems:u}=ro(),{token:p}=iF(),{styles:m}=Ie(),[h,x]=(0,es.useState)([]),f=u(()=>c);(0,es.useEffect)(()=>{x(v())},[c,a,u]);let v=()=>{let e={key:"x-designer-button",label:s({"data-testid":"schema-initializer-Menu-header",style:{background:"none",height:"100%"}}),notdelete:!0,disabled:!0};return a&&f.push(e),f};return(0,A.jsxs)("div",{className:m.headerMenuClass,children:[(0,A.jsx)("div",{style:{flex:1}}),(0,A.jsxs)("div",{className:(0,iS.css)(Is()),children:[(0,A.jsx)(dB.A,{placement:"bottomRight",arrow:!1,overlayInnerStyle:{padding:0},content:(0,A.jsx)(k0,{items:h,onClick:e=>{var t;let a=null==(t=n.properties)?void 0:t[e.key];if(a)if("mix"===o)if("Menu.SubMenu"!==a["x-component"])null==l||l({item:{props:e}});else{let t=Ii(a);if(!t)return null==l?void 0:l({item:{props:e}});r(!0),i(Ia(n,t["x-uid"])),setTimeout(()=>{r(!1)},100),null==l||l({key:t.name,item:{props:{schema:t}}})}else null==l||l({item:{props:e}})}}),children:(0,A.jsx)(e3.Ay,{className:"iconButton",icon:(0,A.jsx)(i6,{type:"apps",style:{color:p.colorTextHeaderMenu}})})}),(0,A.jsx)(d,{})]})]})},Id=e=>{var t;let{loading:n,mode:o,sideMenuSchema:l,sideMenuRef:r,defaultOpenKeys:i,defaultSelectedKeys:a,onSelect:s,render:c,t:d,api:u,refresh:p,designable:m}=e,{Component:h,getMenuItems:x}=ro(),{styles:f}=Ie(),v=(0,es.useRef)(l);v.current=l;let[g,y]=(0,es.useState)(""),b=(0,es.useMemo)(()=>{let e=l;g&&(e=function(e,t){let{title:n,properties:o,...l}=e,r={title:n,...l,properties:{}},i=e=>{if(e){if("Menu.SubMenu"!==e["x-component"]){"string"==typeof(null==e?void 0:e.title)&&e.title.includes(t)&&(r.properties[e.name]={...e});return}e.properties&&Object.values(e.properties).forEach(e=>{if("Menu.SubMenu"===e["x-component"])i(e);else{var n;(null==e||null==(n=e.title)?void 0:n.includes(t))&&(r.properties[e.name]={...e})}})}};return i(e),r}(l,g));let t=x(()=>(0,A.jsx)(ec.RecursionField,{schema:e,onlyRenderProperties:!0},(0,ec.uid)()));{let e=ez({t:d,api:u,refresh:p,current:v.current});e.loadAPIClientEvents();let n={key:"x-menu-search",disabled:!0,label:(0,A.jsx)(Il,{designable:m,setSearchMenuTitle:y,dn:e}),order:-10,notdelete:!0};t.push(n)}return t},[x,m,l,c,d,u,p,g]);return n?null:"mix"===o&&(null==l?void 0:l["x-component"])==="Menu.SubMenu"&&(null==r||null==(t=r.current)?void 0:t.firstChild)&&(0,oy.createPortal)((0,A.jsxs)(Iu.Provider,{value:"inline",children:[(0,A.jsx)(h,{}),(0,A.jsx)(nY.A,{mode:"inline",defaultOpenKeys:i,defaultSelectedKeys:a,onSelect:e=>{null==s||s(e)},className:f.sideMenuClass,items:b,expandIcon:null})]}),r.current.firstChild)},Iu=(0,es.createContext)(null);Iu.displayName="MenuModeContext";let Ip=(0,es.createContext)(null);Ip.displayName="MenuItemDesignerContext";let Im=(0,ec.observer)(e=>{let{onSelect:t,mode:n,selectedUid:o,defaultSelectedUid:l,sideMenuRefScopeKey:r,defaultSelectedKeys:i,defaultOpenKeys:a,children:s,...c}=iq(e),{t:d}=(0,eT.useTranslation)(),{refresh:u}=eY(),p=eC(),m=SF(),h=(0,ec.useFieldSchema)(),{render:x}=mz(h["x-initializer"],h["x-initializer-props"]),f=(()=>{var e;let t=(0,ec.useFieldSchema)(),n=(0,es.useContext)(ec.SchemaExpressionScopeContext),o=null==t||null==(e=t["x-component-props"])?void 0:e.sideMenuRefScopeKey;if(o)return n[o]})(),[v,g]=(0,es.useState)(),[y,b]=(0,es.useState)(()=>i||(l?Ia(h,l):[])),[C,S]=(0,es.useState)(!1),[w,F]=(0,es.useState)(()=>["inline","mix"].includes(n)?a||y:a),j=(0,eq.useSensors)((0,eq.useSensor)(eq.PointerSensor,{activationConstraint:{distance:5}})),k=(0,es.useMemo)(()=>{let e;if(o){let t=Ia(h,o);e=(null==t?void 0:t[0])||null}else e=(null==y?void 0:y[0])||null;if("mix"===n&&e){var t;let n=null==(t=h.properties)?void 0:t[e];if((null==n?void 0:n["x-component"])==="Menu.SubMenu")return n}return null},[y,n,h,o]);(0,es.useEffect)(()=>{if(!o)return void g(void 0);let e=Ia(h,o);g(e),["inline","mix"].includes(n)&&F(a||e)},[o]),(0,es.useEffect)(()=>{["inline","mix"].includes(n)&&F(y)},[y]);let{designable:I}=eY();return(0,A.jsx)(SM,{sensors:j,children:(0,A.jsx)(Ip.Provider,{value:m,children:(0,A.jsxs)(Iu.Provider,{value:n,children:[(0,A.jsx)(Ic,{others:c,schema:h,mode:n,onSelect:t,setLoading:S,setDefaultSelectedKeys:b,designable:I,render:x,children:s}),(0,A.jsx)(Id,{loading:C,mode:n,sideMenuSchema:k,sideMenuRef:f,defaultOpenKeys:w,defaultSelectedKeys:y,onSelect:t,render:x,t:d,api:p,refresh:u,designable:I})]})})})},{displayName:"Menu"});Im.Item=(0,ec.observer)(e=>{let{t}=k2(),{pushMenuItem:n}=rn(),{icon:o,children:l,...r}=e,i=(0,ec.useFieldSchema)(),{styles:a}=Ie(),s=(0,ec.useField)(),c=(0,es.useContext)(Ip),d=(0,es.useMemo)(()=>({...r,className:a.menuItemClass,key:i.name,eventKey:i.name,schema:i,menu:{icon:o,field:s,Designer:c,schema:i,styles:a},label:(0,A.jsx)(ec.SchemaContext.Provider,{value:i,children:(0,A.jsx)(ec.FieldContext.Provider,{value:s,children:(0,A.jsx)(SE,{role:"button","aria-label":t(s.title),className:a.designerCss,removeParentsIfNoChildren:!1,overStyle:{background:"transparent"},children:(0,A.jsxs)(kX,{children:[(0,A.jsxs)("span",{className:"menuitem-title-wrapper",children:[(0,A.jsx)(i6,{type:o}),(0,A.jsx)("span",{className:"menuitem-title",children:t(s.title)})]}),(0,A.jsx)(c,{})]})})})})}),[s.title,o,i,c]);return n?n(d):(0,eh.error)("Menu.Item must be wrapped by GetMenuItemsContext.Provider"),null},{displayName:"Menu.Item"}),Im.URL=(0,ec.observer)(e=>{let{t}=k2(),{pushMenuItem:n}=rn(),{icon:o,children:l,...r}=e,i=(0,ec.useFieldSchema)(),a=(0,ec.useField)(),s=(0,es.useContext)(Ip),{styles:c}=Ie();if(!n)return(0,eh.error)("Menu.URL must be wrapped by GetMenuItemsContext.Provider"),null;let d=(0,es.useMemo)(()=>({...r,className:c.menuItemClass,key:i.name,eventKey:i.name,schema:i,onClick:()=>{window.open(e.href,"_blank")},menu:{icon:o,field:a,Designer:s,schema:i,styles:c},label:(0,A.jsx)(ec.SchemaContext.Provider,{value:i,children:(0,A.jsx)(ec.FieldContext.Provider,{value:a,children:(0,A.jsx)(SE,{className:c.designerCss,removeParentsIfNoChildren:!1,"aria-label":t(a.title),overStyle:{background:"transparent"},children:(0,A.jsxs)(kX,{children:[(0,A.jsxs)("span",{className:"menuitem-title-wrapper",children:[(0,A.jsx)(i6,{type:o}),(0,A.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"inline-block",width:"100%",verticalAlign:"middle"},children:t(a.title)})]}),(0,A.jsx)(s,{})]})})})})}),[a.title,o,e.href,i,s]);return n(d),null},{displayName:"MenuURL"}),Im.SubMenu=(0,ec.observer)(e=>{let{t}=k2(),{Component:n,getMenuItems:o}=ro(),{pushMenuItem:l}=rn(),{icon:r,children:i,...a}=e,s=(0,ec.useFieldSchema)(),c=(0,ec.useField)(),d=(0,es.useContext)(Iu),u=(0,es.useContext)(Ip),{styles:p}=Ie(),m=(0,es.useMemo)(()=>({...a,className:p.menuItemClass,key:s.name,eventKey:s.name,menu:{icon:r,field:c,Designer:u,schema:s,styles:p},label:(0,A.jsx)(ec.SchemaContext.Provider,{value:s,children:(0,A.jsx)(ec.FieldContext.Provider,{value:c,children:(0,A.jsx)(SE,{className:p.subMenuDesignerCss,removeParentsIfNoChildren:!1,"aria-label":t(c.title),overStyle:{background:"transparent"},children:(0,A.jsxs)(kX,{name:s.name,isSubMenu:!0,children:[(0,A.jsxs)("span",{className:"submenu-title",children:[(0,A.jsx)(i6,{type:r}),(0,A.jsx)("span",{className:"menuitem-title",children:t(c.title)})]}),(0,A.jsx)(u,{})]})})})}),children:o(()=>(0,A.jsx)(ec.RecursionField,{schema:s,onlyRenderProperties:!0}))}),[c.title,r,s,i,u]);return l?"mix"===d?(0,A.jsx)(Im.Item,{...e}):(l(m),(0,A.jsx)(n,{})):((0,eh.error)("Menu.SubMenu must be wrapped by GetMenuItemsContext.Provider"),null)},{displayName:"Menu.SubMenu"}),Im.Designer=e=>{let{isAdminMenu:t}=e,n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),l=eC(),{message:r}=eX.A.useApp(),{dn:i,refresh:a}=eY(),{t:s}=(0,eT.useTranslation)(),c=(e=>{let t=e.parent;for(;t;){if("Menu"===t["x-component"])return t;t=t.parent}})(o),d=k6(null==c?void 0:c.properties),u={type:"object",title:s("Edit menu item"),properties:{title:{title:s("Menu item title"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}},icon:{title:s("Menu item icon"),"x-decorator":"FormItem","x-component":"IconPicker"}}},p={title:n.title,icon:n.componentProps.icon},m="Menu.SubMenu"===o["x-component"];return"Menu.URL"===o["x-component"]&&(u.properties.href={title:s("Link"),"x-component":"Input","x-decorator":"FormItem"},p.href=n.componentProps.href),(0,A.jsxs)(sP,{draggable:!1,AddMenuModalComponent:!(t||!m)&&(0,A.jsx)(k3,{}),children:[(0,A.jsx)(aQ,{title:s("Modify the name and icon"),eventKey:"edit",icon:(0,A.jsx)(i6,{type:"FormOutlined"}),schema:u,initialValues:p,onSubmit:e=>{let{title:t,icon:l,href:r}=e,s={"x-uid":o["x-uid"],"x-server-hooks":[{type:"onSelfSave",method:"extractTextToLocale"}]};t&&(o.title=t,n.title=t,s.title=t,a()),n.componentProps.icon=l,n.componentProps.href=r,s["x-component-props"]={icon:l,href:r},o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].icon=l,o["x-component-props"].href=r,i.emit("patch",{schema:s})}}),(0,A.jsx)(aQ,{title:s("Move to"),eventKey:"move-to",components:{TreeSelect:eh.TreeSelect},effects:e=>{(0,ec.onFieldChange)("target",e=>{var t,n;let[,o]=(null==e||null==(n=e.value)||null==(t=n.split)?void 0:t.call(n,"||"))||[];e.query("position").take(e=>{e.dataSource="Menu.SubMenu"===o?[{label:s("Before"),value:"beforeBegin"},{label:s("After"),value:"afterEnd"},{label:s("Inner"),value:"beforeEnd"}]:[{label:s("Before"),value:"beforeBegin"},{label:s("After"),value:"afterEnd"}]})})},icon:(0,A.jsx)(i6,{type:"DragOutlined"}),schema:{type:"object",title:s("Move to"),properties:{target:{title:s("Target"),enum:d,required:!0,"x-decorator":"FormItem","x-component":"TreeSelect","x-component-props":{}},position:{title:s("Position"),required:!0,enum:[{label:s("Before"),value:"beforeBegin"},{label:s("After"),value:"afterEnd"}],default:"afterEnd","x-component":"Radio.Group","x-decorator":"FormItem"}}},onSubmit:e=>{var t;let{target:n,position:r}=e,[i]=(null==n||null==(t=n.split)?void 0:t.call(n,"||"))||[];if(!i)return;let d=ez({t:s,api:l,refresh:a,current:Ir(c,i)});d.loadAPIClientEvents(),d.insertAdjacent(r,o)}}),(0,A.jsx)(aK,{}),(0,A.jsx)(az,{title:s("Dump"),icon:(0,A.jsx)(i6,{type:"DownloadOutlined"}),onClick:async()=>{let e=t=>{delete t.name,delete t["x-uid"],Object.keys(t.properties||{}).forEach(n=>{e(t.properties[n])})},{data:t}=await l.request({url:"/uiSchemas:getJsonSchema/".concat(o["x-uid"],"?includeAsyncNode=true")}),n=(null==t?void 0:t.data)||{};e(n);let i=new Blob([JSON.stringify(n,null,2)],{type:"application/json"});(0,sp.saveAs)(i,o["x-uid"]+".schema.json"),r.success("Save successful!")}}),(0,A.jsx)(a$,{icon:"DeleteOutlined",confirm:{title:s("Delete menu item")}})]})};var Ih=n(24221);let Ix=Object.assign((0,ec.connect)(nJ.A,(0,ec.mapProps)((e,t)=>{let{size:n,customAlphabet:o}=tA()||{},{t:l}=(0,eT.useTranslation)(),r=(0,ec.useForm)();function i(e){if((null==e?void 0:e.length)!==n)return l("Field value size is")+" ".concat(n||21);for(let t=0;t<e.length;t++)if((null==o?void 0:o.indexOf(e[t]))===-1)return l("Field value do not meet the requirements")}return(0,es.useEffect)(()=>{!t.initialValue&&o&&t.setInitialValue((0,Ih.d_)(o,n)()),r.setFieldState(t.props.name,e=>{e.validator=i})},[]),{...e,suffix:(0,A.jsx)("span",{children:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffix})}}),(0,ec.mapReadPretty)(gs.Input)),{ReadPretty:gs.Input});var If=n(9143);let Iv=Tr((0,ec.observer)(e=>{let{hidden:t,...n}=iq(e);return t?null:(0,A.jsx)("div",{onKeyPress:e=>{"Enter"===e.key&&e.preventDefault()},children:(0,A.jsx)(If.A,{...n})})},{displayName:"Pagination"})),Ig=function(e){return e>=48&&e<=57},Iy=function(e){return e>=97&&e<=122},Ib=function(e){return e>=65&&e<=90},IC=function(e){return!(Iy(e)||Ib(e)||Ig(e))},IS=function(e){return Iy(e)||Ib(e)},Iw=e=>(0,ec.isFn)(e.children)?e.children((e=>{let t;if(!e)return 0;let n=0,o=0,l=0,r=0,i=0,a=0,s=0,c=0,d=0,u=()=>n+o+l+r;for(let t=0;t<e.length;t++){let u=e.charCodeAt(t);Ig(u)?(n++,0!==t&&t!==e.length-1&&i++,t>0&&Ig(e.charCodeAt(t-1))&&c++):Iy(u)?(o++,t>0&&Iy(e.charCodeAt(t-1))&&c++):Ib(u)?(l++,t>0&&Ib(e.charCodeAt(t-1))&&c++):(r++,0!==t&&t!==e.length-1&&i++);let p=!1;for(let n=0;n<e.length;n++)e[t]===e[n]&&t!==n&&(p=!0,s+=Math.abs(e.length/(n-t)));if(p){a++;let t=e.length-a;s=t?Math.ceil(s/t):Math.ceil(s)}if(t>1){let n=e.charCodeAt(t-1),o=e.charCodeAt(t-2);if(IS(u)){if(IS(n)&&IS(o)){let n=e.toLowerCase(),o=n.charCodeAt(t),l=n.charCodeAt(t-1);o-l==l-n.charCodeAt(t-2)&&1===Math.abs(o-l)&&d++}}else Ig(u)?Ig(n)&&Ig(o)&&u-n==n-o&&1===Math.abs(u-n)&&d++:IC(n)&&IC(o)&&u-n==n-o&&1===Math.abs(u-n)&&d++}}let p=0,m=u();return(p+=4*m,o>0&&(p+=2*(m-o)),l>0&&(p+=2*(m-l)),n!==m&&(p+=4*n),p+=6*r,p+=2*i,p+=2*((t=+(n>0)+(+(o>0)+ +(l>0)+ +(r>0)))>2&&u()>=8?t+1:0),m===o+l&&(p-=m),m===n&&(p-=n),p-=s,p-=2*c,p-=3*d,(p=(p=p<0?0:p)>100?100:p)>=80)?100:p>=60?80:p>=40?60:p>=20?40:20})(String(e.value||""))):(0,A.jsx)(es.Fragment,{children:e.children}),IF=(0,ec.connect)(e=>{let{value:t,className:n,checkStrength:o,...l}=e,r={position:"absolute",zIndex:1,height:8,top:0,background:"#fff",width:1,transform:"translate(-50%, 0)"};return(0,A.jsxs)("span",{className:n,children:[(0,A.jsx)(nJ.A.Password,{...l,value:t}),o&&(0,A.jsx)(Iw,{value:t,children:e=>(0,A.jsxs)("div",{style:{background:"#e0e0e0",marginBottom:3,position:"relative"},children:[(0,A.jsx)("div",{style:{...r,left:"20%"}}),(0,A.jsx)("div",{style:{...r,left:"40%"}}),(0,A.jsx)("div",{style:{...r,left:"60%"}}),(0,A.jsx)("div",{style:{...r,left:"80%"}}),(0,A.jsx)("div",{style:{position:"relative",backgroundImage:"-webkit-linear-gradient(left, #ff5500, #ff9300)",transition:"all 0.35s ease-in-out",height:8,width:"100%",marginTop:5,clipPath:"polygon(0 0,".concat(e,"% 0,").concat(e,"% 100%,0 100%)")}})]})})]})},(0,ec.mapReadPretty)(e=>e.value?(0,A.jsx)("div",{children:"********"}):(0,A.jsx)("div",{}))),Ij=(e,t)=>(0,ec.isNum)(e)||/^-?\d+(\.\d+)?$/.test(e)?Av.LIG(t(e),9):null,IA=(0,ec.connect)(e=>{let{value:t,onChange:n}=e,o=(0,es.useMemo)(()=>Ij(t,e=>100*e),[t]);return(0,A.jsx)(kw.A,{...e,addonAfter:"%",value:o,onChange:e=>{n&&n(Ij(e,e=>e/100))}})},(0,ec.mapReadPretty)(e=>{let t=(0,es.useMemo)(()=>Ij(e.value,e=>100*e),[e.value]);return(0,A.jsx)(Ab,{...e,value:t})}));function Ik(){let e=(0,ns._)(["\n padding-top: 0;\n .ant-popover-arrow {\n display: none;\n }\n "]);return Ik=function(){return e},e}let II=(0,nu.rU)(e=>{let{css:t}=e;return{overlay:t(Ik())}}),IP=(0,ec.observer)(e=>{let t=(0,ec.useField)(),n=(0,es.useRef)(null),o=(0,ec.useFieldSchema)(),{styles:l}=II(),r=t.value,i={name:o.name,"x-collection-field":o["x-collection-field"],"x-component":"CollectionField","x-read-pretty":!0,default:r,"x-component-props":o["x-component-props"]},a=(0,es.useMemo)(()=>(0,ec.createForm)({values:{[o.name]:r}}),[t.value,o["x-component-props"]]),s=()=>n.current,c=es.Children.map(e.children,e=>es.isValidElement(e)?es.cloneElement(e,{getContainer:s}):e);return(0,A.jsx)(eh.FormItem,{...e,labelStyle:{display:"none"},children:(0,A.jsx)(dE,{content:(0,A.jsx)("div",{style:{width:"100%",height:"100%",minWidth:500},children:(0,A.jsx)("div",{ref:n,children:c})}),trigger:"click",placement:"bottomLeft",overlayClassName:l.overlay,children:(0,A.jsx)("div",{style:{minHeight:30,padding:"0 8px"},children:(0,A.jsx)(ec.FormContext.Provider,{value:a,children:(0,A.jsx)(ec.RecursionField,{schema:i,name:o.name})})})})})},{displayName:"Editable"}),IT=(0,ec.observer)(e=>{let t=(0,ec.useField)(),{getCollectionJoinField:n}=sO();return n((0,ec.useFieldSchema)()["x-collection-field"])?t.editable?(0,A.jsx)(IP,{...e}):(0,A.jsx)(eh.FormItem,{...e,style:{padding:"0 8px"}}):null},{displayName:"QuickEdit"}),IN=(0,ec.connect)(sU.Ay,(0,ec.mapProps)({value:"checked",onInput:"onChange"}));IN.__ANT_RADIO=!0,IN.Group=(0,ec.connect)(sU.Ay.Group,(0,ec.mapProps)({dataSource:"options"},(e,t)=>((0,es.useEffect)(()=>{var n;let o=null==(n=t.dataSource)?void 0:n.find(t=>t.value==e.value);o&&t.setValue(o.value)},[e.value,t.dataSource]),{...e})),(0,ec.mapReadPretty)(e=>{if(!(0,ec.isValid)(e.value))return(0,A.jsx)("div",{});let{value:t}=e,n=(0,ec.useField)(),o=tA(),l=n.dataSource||(null==o?void 0:o.uiSchema.enum)||[];return(0,A.jsx)("div",{children:l.filter(e=>e.value==t).map((e,t)=>(0,A.jsx)(nz.A,{color:e.color,icon:e.icon,children:e.label},t))})}));var IM=n(45107),ID=n.n(IM);let IR=cP("tb-rich-text",e=>{let{componentCls:t}=e;return{[t]:{".ql-container":{boxSizing:"border-box",height:"100%",margin:"0px",position:"relative"},".ql-container.ql-disabled .ql-tooltip":{visibility:"hidden"},".ql-container.ql-disabled .ql-editor ul[data-checked] > li::before":{pointerEvents:"none"},".ql-clipboard":{left:"-100000px",height:"1px",overflowY:"hidden",position:"absolute",top:"50%"},".ql-clipboard p":{margin:"0",padding:"0"},".ql-editor":{minHeight:"10em",boxSizing:"border-box",lineHeight:1.42,height:"100%",outline:"none",overflowY:"auto",padding:"12px 15px",tabSize:4,MozTabSize:"4",textAlign:"left",whiteSpace:"pre-wrap",wordWrap:"break-word"},".ql-editor > *":{cursor:"text"},".ql-editor p,\n.ql-editor ol,\n.ql-editor ul,\n.ql-editor pre,\n.ql-editor blockquote,\n.ql-editor h1,\n.ql-editor h2,\n.ql-editor h3,\n.ql-editor h4,\n.ql-editor h5,\n.ql-editor h6":{margin:"0",padding:"0",counterReset:"list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9"},".ql-editor ol,\n.ql-editor ul":{paddingLeft:"0"},".ql-editor ol > li,\n.ql-editor ul > li":{listStyleType:"none"},".ql-editor ul > li::before":{content:"'\\2022'"},".ql-editor ul[data-checked='true'],\n.ql-editor ul[data-checked='false']":{pointerEvents:"none"},".ql-editor ul[data-checked='true'] > li *,\n.ql-editor ul[data-checked='false'] > li *":{pointerEvents:"all"},".ql-editor ul[data-checked='true'] > li::before,\n.ql-editor ul[data-checked='false'] > li::before":{color:"#777",cursor:"pointer",pointerEvents:"all"},".ql-editor ul[data-checked='true'] > li::before":{content:"'\\2611'"},".ql-editor ul[data-checked='false'] > li::before":{content:"'\\2610'"},".ql-editor li::before":{display:"inline-block",whiteSpace:"nowrap",width:"1.2em"},".ql-editor li:not(.ql-direction-rtl)::before":{marginLeft:"-1.5em",marginRight:"0.3em",textAlign:"right"},".ql-editor li.ql-direction-rtl::before":{marginLeft:"0.3em",marginRight:"-1.5em"},".ql-editor ol li:not(.ql-direction-rtl),\n.ql-editor ul li:not(.ql-direction-rtl)":{paddingLeft:"1.5em"},".ql-editor ol li.ql-direction-rtl,\n.ql-editor ul li.ql-direction-rtl":{paddingRight:"1.5em"},".ql-editor ol li":{counterReset:"list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9",counterIncrement:"list-0"},".ql-editor ol li:before":{content:"counter(list-0, decimal) '. '"},".ql-editor ol li.ql-indent-1":{counterIncrement:"list-1",counterReset:"list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9"},".ql-editor ol li.ql-indent-1:before":{content:"counter(list-1, lower-alpha) '. '"},".ql-editor ol li.ql-indent-2":{counterIncrement:"list-2",counterReset:"list-3 list-4 list-5 list-6 list-7 list-8 list-9"},".ql-editor ol li.ql-indent-2:before":{content:"counter(list-2, lower-roman) '. '"},".ql-editor ol li.ql-indent-3":{counterIncrement:"list-3",counterReset:"list-4 list-5 list-6 list-7 list-8 list-9"},".ql-editor ol li.ql-indent-3:before":{content:"counter(list-3, decimal) '. '"},".ql-editor ol li.ql-indent-4":{counterIncrement:"list-4",counterReset:"list-5 list-6 list-7 list-8 list-9"},".ql-editor ol li.ql-indent-4:before":{content:"counter(list-4, lower-alpha) '. '"},".ql-editor ol li.ql-indent-5":{counterIncrement:"list-5",counterReset:"list-6 list-7 list-8 list-9"},".ql-editor ol li.ql-indent-5:before":{content:"counter(list-5, lower-roman) '. '"},".ql-editor ol li.ql-indent-6":{counterIncrement:"list-6",counterReset:"list-7 list-8 list-9"},".ql-editor ol li.ql-indent-6:before":{content:"counter(list-6, decimal) '. '"},".ql-editor ol li.ql-indent-7":{counterIncrement:"list-7",counterReset:"list-8 list-9"},".ql-editor ol li.ql-indent-7:before":{content:"counter(list-7, lower-alpha) '. '"},".ql-editor ol li.ql-indent-8":{counterIncrement:"list-8",counterReset:"list-9"},".ql-editor ol li.ql-indent-8:before":{content:"counter(list-8, lower-roman) '. '"},".ql-editor ol li.ql-indent-9":{counterIncrement:"list-9"},".ql-editor ol li.ql-indent-9:before":{content:"counter(list-9, decimal) '. '"},".ql-editor .ql-indent-1:not(.ql-direction-rtl)":{paddingLeft:"3em"},".ql-editor li.ql-indent-1:not(.ql-direction-rtl)":{paddingLeft:"4.5em"},".ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right":{paddingRight:"3em"},".ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right":{paddingRight:"4.5em"},".ql-editor .ql-indent-2:not(.ql-direction-rtl)":{paddingLeft:"6em"},".ql-editor li.ql-indent-2:not(.ql-direction-rtl)":{paddingLeft:"7.5em"},".ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right":{paddingRight:"6em"},".ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right":{paddingRight:"7.5em"},".ql-editor .ql-indent-3:not(.ql-direction-rtl)":{paddingLeft:"9em"},".ql-editor li.ql-indent-3:not(.ql-direction-rtl)":{paddingLeft:"10.5em"},".ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right":{paddingRight:"9em"},".ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right":{paddingRight:"10.5em"},".ql-editor .ql-indent-4:not(.ql-direction-rtl)":{paddingLeft:"12em"},".ql-editor li.ql-indent-4:not(.ql-direction-rtl)":{paddingLeft:"13.5em"},".ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right":{paddingRight:"12em"},".ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right":{paddingRight:"13.5em"},".ql-editor .ql-indent-5:not(.ql-direction-rtl)":{paddingLeft:"15em"},".ql-editor li.ql-indent-5:not(.ql-direction-rtl)":{paddingLeft:"16.5em"},".ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right":{paddingRight:"15em"},".ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right":{paddingRight:"16.5em"},".ql-editor .ql-indent-6:not(.ql-direction-rtl)":{paddingLeft:"18em"},".ql-editor li.ql-indent-6:not(.ql-direction-rtl)":{paddingLeft:"19.5em"},".ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right":{paddingRight:"18em"},".ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right":{paddingRight:"19.5em"},".ql-editor .ql-indent-7:not(.ql-direction-rtl)":{paddingLeft:"21em"},".ql-editor li.ql-indent-7:not(.ql-direction-rtl)":{paddingLeft:"22.5em"},".ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right":{paddingRight:"21em"},".ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right":{paddingRight:"22.5em"},".ql-editor .ql-indent-8:not(.ql-direction-rtl)":{paddingLeft:"24em"},".ql-editor li.ql-indent-8:not(.ql-direction-rtl)":{paddingLeft:"25.5em"},".ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right":{paddingRight:"24em"},".ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right":{paddingRight:"25.5em"},".ql-editor .ql-indent-9:not(.ql-direction-rtl)":{paddingLeft:"27em"},".ql-editor li.ql-indent-9:not(.ql-direction-rtl)":{paddingLeft:"28.5em"},".ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right":{paddingRight:"27em"},".ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right":{paddingRight:"28.5em"},".ql-editor .ql-video":{display:"block",maxWidth:"100%"},".ql-editor .ql-video.ql-align-center":{margin:"0 auto"},".ql-editor .ql-video.ql-align-right":{margin:"0 0 0 auto"},".ql-editor .ql-bg-black":{backgroundColor:"#000"},".ql-editor .ql-bg-red":{backgroundColor:"#e60000"},".ql-editor .ql-bg-orange":{backgroundColor:"#f90"},".ql-editor .ql-bg-yellow":{backgroundColor:"#ff0"},".ql-editor .ql-bg-green":{backgroundColor:"#008a00"},".ql-editor .ql-bg-blue":{backgroundColor:e.colorPrimaryTextHover},".ql-editor .ql-bg-purple":{backgroundColor:"#93f"},".ql-editor .ql-color-white":{color:"#fff"},".ql-editor .ql-color-red":{color:"#e60000"},".ql-editor .ql-color-orange":{color:"#f90"},".ql-editor .ql-color-yellow":{color:"#ff0"},".ql-editor .ql-color-green":{color:"#008a00"},".ql-editor .ql-color-blue":{color:e.colorPrimaryTextHover},".ql-editor .ql-color-purple":{color:"#93f"},".ql-editor .ql-font-serif":{fontFamily:"Georgia, Times New Roman, serif"},".ql-editor .ql-font-monospace":{fontFamily:"Monaco, Courier New, monospace"},".ql-editor .ql-size-small":{fontSize:"0.75em"},".ql-editor .ql-size-large":{fontSize:"1.5em"},".ql-editor .ql-size-huge":{fontSize:"2.5em"},".ql-editor .ql-direction-rtl":{direction:"rtl",textAlign:"inherit"},".ql-editor .ql-align-center":{textAlign:"center"},".ql-editor .ql-align-justify":{textAlign:"justify"},".ql-editor .ql-align-right":{textAlign:"right"},".ql-editor.ql-blank::before":{color:"rgba(0, 0, 0, 0.6)",content:"attr(data-placeholder)",fontStyle:"italic",left:"15px",pointerEvents:"none",position:"absolute",right:"15px"},".ql-snow.ql-toolbar:after,\n.ql-snow .ql-toolbar:after":{clear:"both",content:"''",display:"table"},".ql-snow.ql-toolbar button,\n.ql-snow .ql-toolbar button":{background:"none",border:"none",cursor:"pointer",display:"inline-block",cssFloat:"left",height:"24px",padding:"3px 5px",width:"28px"},".ql-snow.ql-toolbar button svg,\n.ql-snow .ql-toolbar button svg":{cssFloat:"left",height:"100%"},".ql-snow.ql-toolbar button:active:hover,\n.ql-snow .ql-toolbar button:active:hover":{outline:"none"},".ql-snow.ql-toolbar input.ql-image[type='file'],\n.ql-snow .ql-toolbar input.ql-image[type='file']":{display:"none"},".ql-snow.ql-toolbar button:hover,\n.ql-snow .ql-toolbar button:hover,\n.ql-snow.ql-toolbar button:focus,\n.ql-snow .ql-toolbar button:focus,\n.ql-snow.ql-toolbar button.ql-active,\n.ql-snow .ql-toolbar button.ql-active,\n.ql-snow.ql-toolbar .ql-picker-label:hover,\n.ql-snow .ql-toolbar .ql-picker-label:hover,\n.ql-snow.ql-toolbar .ql-picker-label.ql-active,\n.ql-snow .ql-toolbar .ql-picker-label.ql-active,\n.ql-snow.ql-toolbar .ql-picker-item:hover,\n.ql-snow .ql-toolbar .ql-picker-item:hover,\n.ql-snow.ql-toolbar .ql-picker-item.ql-selected,\n.ql-snow .ql-toolbar .ql-picker-item.ql-selected":{color:e.colorPrimaryTextHover},".ql-snow.ql-toolbar button:hover .ql-fill,\n.ql-snow .ql-toolbar button:hover .ql-fill,\n.ql-snow.ql-toolbar button:focus .ql-fill,\n.ql-snow .ql-toolbar button:focus .ql-fill,\n.ql-snow.ql-toolbar button.ql-active .ql-fill,\n.ql-snow .ql-toolbar button.ql-active .ql-fill,\n.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,\n.ql-snow .ql-toolbar .ql-picker-label:hover .ql-fill,\n.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill,\n.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill,\n.ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill,\n.ql-snow .ql-toolbar .ql-picker-item:hover .ql-fill,\n.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill,\n.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill,\n.ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill,\n.ql-snow .ql-toolbar button:hover .ql-stroke.ql-fill,\n.ql-snow.ql-toolbar button:focus .ql-stroke.ql-fill,\n.ql-snow .ql-toolbar button:focus .ql-stroke.ql-fill,\n.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill,\n.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill,\n.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,\n.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,\n.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,\n.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,\n.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,\n.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,\n.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill,\n.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill":{fill:e.colorPrimaryTextHover},".ql-snow.ql-toolbar button:hover .ql-stroke,\n.ql-snow .ql-toolbar button:hover .ql-stroke,\n.ql-snow.ql-toolbar button:focus .ql-stroke,\n.ql-snow .ql-toolbar button:focus .ql-stroke,\n.ql-snow.ql-toolbar button.ql-active .ql-stroke,\n.ql-snow .ql-toolbar button.ql-active .ql-stroke,\n.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,\n.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke,\n.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,\n.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke,\n.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke,\n.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke,\n.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke,\n.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke,\n.ql-snow.ql-toolbar button:hover .ql-stroke-miter,\n.ql-snow .ql-toolbar button:hover .ql-stroke-miter,\n.ql-snow.ql-toolbar button:focus .ql-stroke-miter,\n.ql-snow .ql-toolbar button:focus .ql-stroke-miter,\n.ql-snow.ql-toolbar button.ql-active .ql-stroke-miter,\n.ql-snow .ql-toolbar button.ql-active .ql-stroke-miter,\n.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter,\n.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter,\n.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,\n.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,\n.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter,\n.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter,\n.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter,\n.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter":{stroke:e.colorPrimaryTextHover},"@media (pointer: coarse)":{".ql-snow.ql-toolbar button:hover:not(.ql-active),\n .ql-snow .ql-toolbar button:hover:not(.ql-active)":{color:e.colorTextSecondary},".ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-fill,\n .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-fill,\n .ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill,\n .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill":{fill:e.colorTextSecondary},".ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke,\n .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke,\n .ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter,\n .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter":{stroke:e.colorTextSecondary}},".ql-snow":{boxSizing:"border-box"},".ql-snow *":{boxSizing:"border-box"},".ql-snow .ql-hidden":{display:"none"},".ql-snow .ql-out-bottom,\n.ql-snow .ql-out-top":{visibility:"hidden"},".ql-snow .ql-tooltip":{position:"absolute",transform:"translateY(10px)",backgroundColor:"#fff",border:"1px solid ".concat(e.colorBorder),boxShadow:"0px 0px 5px #ddd",color:e.colorTextSecondary,padding:"5px 12px",whiteSpace:"nowrap"},".ql-snow .ql-tooltip a":{cursor:"pointer",textDecoration:"none",lineHeight:"26px"},".ql-snow .ql-tooltip.ql-flip":{transform:"translateY(-10px)"},".ql-snow .ql-formats":{display:"inline-block",verticalAlign:"middle"},".ql-snow .ql-formats:after":{clear:"both",content:"''",display:"table"},".ql-snow .ql-stroke":{fill:"none",stroke:e.colorTextSecondary,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2},".ql-snow .ql-stroke-miter":{fill:"none",stroke:e.colorTextSecondary,strokeMiterlimit:"10",strokeWidth:2},".ql-snow .ql-fill,\n.ql-snow .ql-stroke.ql-fill":{fill:e.colorTextSecondary},".ql-snow .ql-empty":{fill:"none"},".ql-snow .ql-even":{fillRule:"evenodd"},".ql-snow .ql-thin,\n.ql-snow .ql-stroke.ql-thin":{strokeWidth:1},".ql-snow .ql-transparent":{opacity:.4},".ql-snow .ql-direction svg:last-child":{display:"none"},".ql-snow .ql-direction.ql-active svg:last-child":{display:"inline"},".ql-snow .ql-direction.ql-active svg:first-child":{display:"none"},".ql-snow .ql-editor h1":{fontSize:"2em"},".ql-snow .ql-editor h2":{fontSize:"1.5em"},".ql-snow .ql-editor h3":{fontSize:"1.17em"},".ql-snow .ql-editor h4":{fontSize:"1em"},".ql-snow .ql-editor h5":{fontSize:"0.83em"},".ql-snow .ql-editor h6":{fontSize:"0.67em"},".ql-snow .ql-editor a":{textDecoration:"underline"},".ql-snow .ql-editor blockquote":{borderLeft:"4px solid #ccc",marginBottom:"5px",marginTop:"5px",paddingLeft:"16px"},".ql-snow .ql-editor code,\n.ql-snow .ql-editor pre":{backgroundColor:"#f0f0f0",borderRadius:"3px"},".ql-snow .ql-editor pre":{whiteSpace:"pre-wrap",marginBottom:"5px",marginTop:"5px",padding:"5px 10px"},".ql-snow .ql-editor code":{fontSize:"85%",padding:"2px 4px"},".ql-snow .ql-editor pre.ql-syntax":{backgroundColor:"#23241f",color:"#f8f8f2",overflow:"visible"},".ql-snow .ql-editor img":{maxWidth:"100%"},".ql-snow .ql-picker":{color:e.colorTextSecondary,display:"inline-block",cssFloat:"left",fontSize:"14px",fontWeight:500,height:"24px",position:"relative",verticalAlign:"middle"},".ql-snow .ql-picker-label":{cursor:"pointer",display:"inline-block",height:"100%",paddingLeft:"8px",paddingRight:"2px",position:"relative",width:"100%"},".ql-snow .ql-picker-label::before":{display:"inline-block",lineHeight:"22px"},".ql-snow .ql-picker-options":{backgroundColor:"#fff",display:"none",minWidth:"100%",padding:"4px 8px",position:"absolute",whiteSpace:"nowrap"},".ql-snow .ql-picker-options .ql-picker-item":{cursor:"pointer",display:"block",paddingBottom:"5px",paddingTop:"5px"},".ql-snow .ql-picker.ql-expanded .ql-picker-label":{color:"#ccc",zIndex:2},".ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill":{fill:"#ccc"},".ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke":{stroke:"#ccc"},".ql-snow .ql-picker.ql-expanded .ql-picker-options":{display:"block",marginTop:"-1px",top:"100%",zIndex:1},".ql-snow .ql-color-picker,\n.ql-snow .ql-icon-picker":{width:"28px"},".ql-snow .ql-color-picker .ql-picker-label,\n.ql-snow .ql-icon-picker .ql-picker-label":{padding:"2px 4px"},".ql-snow .ql-color-picker .ql-picker-label svg,\n.ql-snow .ql-icon-picker .ql-picker-label svg":{right:"4px"},".ql-snow .ql-icon-picker .ql-picker-options":{padding:"4px 0px"},".ql-snow .ql-icon-picker .ql-picker-item":{height:"24px",width:"24px",padding:"2px 4px"},".ql-snow .ql-color-picker .ql-picker-options":{padding:"3px 5px",width:"152px"},".ql-snow .ql-color-picker .ql-picker-item":{border:"1px solid transparent",cssFloat:"left",height:"16px",margin:"2px",padding:"0px",width:"16px"},".ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg":{position:"absolute",marginTop:"-9px",right:"0",top:"50%",width:"18px"},".ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=''])::before,\n.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=''])::before,\n.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=''])::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=''])::before,\n.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=''])::before,\n.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=''])::before":{content:"attr(data-label)"},".ql-snow .ql-picker.ql-header":{width:"98px"},".ql-snow .ql-picker.ql-header .ql-picker-label::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item::before":{content:"'Normal'"},".ql-snow .ql-picker.ql-header .ql-picker-label[data-value='1']::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before":{content:"'Heading 1'"},".ql-snow .ql-picker.ql-header .ql-picker-label[data-value='2']::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before":{content:"'Heading 2'"},".ql-snow .ql-picker.ql-header .ql-picker-label[data-value='3']::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='3']::before":{content:"'Heading 3'"},".ql-snow .ql-picker.ql-header .ql-picker-label[data-value='4']::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='4']::before":{content:"'Heading 4'"},".ql-snow .ql-picker.ql-header .ql-picker-label[data-value='5']::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='5']::before":{content:"'Heading 5'"},".ql-snow .ql-picker.ql-header .ql-picker-label[data-value='6']::before,\n.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='6']::before":{content:"'Heading 6'"},".ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before":{fontSize:"2em"},".ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before":{fontSize:"1.5em"},".ql-snow .ql-picker.ql-header .ql-picker-item[data-value='3']::before":{fontSize:"1.17em"},".ql-snow .ql-picker.ql-header .ql-picker-item[data-value='4']::before":{fontSize:"1em"},".ql-snow .ql-picker.ql-header .ql-picker-item[data-value='5']::before":{fontSize:"0.83em"},".ql-snow .ql-picker.ql-header .ql-picker-item[data-value='6']::before":{fontSize:"0.67em"},".ql-snow .ql-picker.ql-font":{width:"108px"},".ql-snow .ql-picker.ql-font .ql-picker-label::before,\n.ql-snow .ql-picker.ql-font .ql-picker-item::before":{content:"'Sans Serif'"},".ql-snow .ql-picker.ql-font .ql-picker-label[data-value='serif']::before,\n.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='serif']::before":{content:"'Serif'"},".ql-snow .ql-picker.ql-font .ql-picker-label[data-value='monospace']::before,\n.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='monospace']::before":{content:"'Monospace'"},".ql-snow .ql-picker.ql-font .ql-picker-item[data-value='serif']::before":{fontFamily:"Georgia, Times New Roman, serif"},".ql-snow .ql-picker.ql-font .ql-picker-item[data-value='monospace']::before":{fontFamily:"Monaco, Courier New, monospace"},".ql-snow .ql-picker.ql-size":{width:"98px"},".ql-snow .ql-picker.ql-size .ql-picker-label::before,\n.ql-snow .ql-picker.ql-size .ql-picker-item::before":{content:"'Normal'"},".ql-snow .ql-picker.ql-size .ql-picker-label[data-value='small']::before,\n.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='small']::before":{content:"'Small'"},".ql-snow .ql-picker.ql-size .ql-picker-label[data-value='large']::before,\n.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='large']::before":{content:"'Large'"},".ql-snow .ql-picker.ql-size .ql-picker-label[data-value='huge']::before,\n.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='huge']::before":{content:"'Huge'"},".ql-snow .ql-picker.ql-size .ql-picker-item[data-value='small']::before":{fontSize:"10px"},".ql-snow .ql-picker.ql-size .ql-picker-item[data-value='large']::before":{fontSize:"18px"},".ql-snow .ql-picker.ql-size .ql-picker-item[data-value='huge']::before":{fontSize:"32px"},".ql-snow .ql-color-picker.ql-background .ql-picker-item":{backgroundColor:"#fff"},".ql-snow .ql-color-picker.ql-color .ql-picker-item":{backgroundColor:"#000"},".ql-toolbar.ql-snow":{border:"1px solid ".concat(e.colorBorder),boxSizing:"border-box",padding:"8px",borderTopLeftRadius:"2px",borderTopRightRadius:"2px",lineHeight:1.6},".ql-toolbar.ql-snow .ql-formats":{marginRight:"15px"},".ql-toolbar.ql-snow .ql-picker-label":{border:"1px solid transparent"},".ql-toolbar.ql-snow .ql-picker-options":{border:"1px solid transparent",boxShadow:"rgba(0, 0, 0, 0.2) 0 2px 8px"},".ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label":{borderColor:e.colorBorder},".ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options":{borderColor:e.colorBorder},".ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected,\n.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover":{borderColor:"#000"},".ql-toolbar.ql-snow + .ql-container.ql-snow":{borderTop:"0px"},".ql-snow .ql-tooltip::before":{content:"'Visit URL:'",lineHeight:"26px",marginRight:"8px"},".ql-snow .ql-tooltip input[type='text']":{display:"none",border:"1px solid ".concat(e.colorBorder),fontSize:"13px",height:"26px",margin:"0px",padding:"3px 5px",width:"170px"},".ql-snow .ql-tooltip a.ql-preview":{display:"inline-block",maxWidth:"200px",overflowX:"hidden",textOverflow:"ellipsis",verticalAlign:"top"},".ql-snow .ql-tooltip a.ql-action::after":{borderRight:"1px solid #ccc",content:"'Edit'",marginLeft:"16px",paddingRight:"8px"},".ql-snow .ql-tooltip a.ql-remove::before":{content:"'Remove'",marginLeft:"8px"},".ql-snow .ql-tooltip.ql-editing a.ql-preview,\n.ql-snow .ql-tooltip.ql-editing a.ql-remove":{display:"none"},".ql-snow .ql-tooltip.ql-editing input[type='text']":{display:"inline-block"},".ql-snow .ql-tooltip.ql-editing a.ql-action::after":{borderRight:"0px",content:"'Save'",paddingRight:"0px"},".ql-snow .ql-tooltip[data-mode='link']::before":{content:"'Enter link:'"},".ql-snow .ql-tooltip[data-mode='formula']::before":{content:"'Enter formula:'"},".ql-snow .ql-tooltip[data-mode='video']::before":{content:"'Enter video:'"},".ql-snow a":{color:e.colorPrimaryTextHover},".ql-container.ql-snow":{border:"1px solid ".concat(e.colorBorder),borderBottomLeftRadius:"2px",borderBottomRightRadius:"2px"}}}}),Iq=(0,ec.connect)(e=>{let{wrapSSR:t,hashId:n,componentCls:o}=IR(),{value:l,defaultValue:r,onChange:i,disabled:a}=e,s=oY(l||r)?void 0:l||r||"";return t((0,A.jsx)(ID(),{className:"".concat(o," ").concat(n),modules:{toolbar:[["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]]},formats:["header","bold","italic","underline","strike","blockquote","list","bullet","indent","link","image"],value:s,onChange:i,readOnly:a}))},(0,ec.mapProps)({initialValue:"defaultValue"}),(0,ec.mapReadPretty)(e=>(0,A.jsx)(gs.Html,{...e}))),I_=(e,t)=>{(0,es.useEffect)(()=>{let n,o,l,r;if(!e.current)return;let i=e.current,a=!1,s=0,c=0,d=0,u=0,p=0,m=0,h=0,x=0,f=eu().debounce(function(e){C(e.deltaY,0)},16);i.addEventListener("mousedown",y),i.addEventListener("mousemove",j),i.addEventListener("mouseup",b),i.addEventListener("touchstart",y),i.addEventListener("touchmove",j),i.addEventListener("touchend",b),i.addEventListener("contextmenu",function(e){e.stopPropagation(),e.preventDefault(),t.onContextmenu(e)}),i.addEventListener("mousewheel",f);let v=((n=document.createElement("canvas")).width=40,n.height=40,(o=n.getContext("2d")).beginPath(),o.lineWidth=6,o.arc(n.width/2,n.width/2,40,0,2*Math.PI,!0),o.stroke(),n),g=((l=document.createElement("canvas")).width=60,l.height=60,(r=l.getContext("2d")).beginPath(),r.lineWidth=6,r.arc(l.width/2,l.width/2,5,0,2*Math.PI,!0),r.stroke(),r.beginPath(),r.lineWidth=2,r.arc(l.width/2,l.width/2,10,0,2*Math.PI,!0),r.stroke(),l);function y(e){1===e.buttons&&(a=!0,s=k(e).x,c=k(e).y,g.style.visibility="visible",v.style.visibility="visible",A(v.style,s-v.width/2,c-v.height/2),A(g.style,s-g.width/2,c-g.height/2))}function b(e){a=!1,g.style.visibility="hidden",v.style.visibility="hidden"}function C(e,t){let n=document.querySelectorAll(".ant-table-content"),o=document.querySelector("main");n.forEach(t=>{t.scrollBy(10*e,0)}),o.scrollBy(0,-(10*t*1))}i.appendChild(g),g.style.position="absolute",g.style.visibility="hidden",i.appendChild(v),v.style.position="absolute",v.style.visibility="hidden";let S=0,w=0,F=setInterval(()=>{a&&C(S,w)},16);function j(e){if(a){d=k(e).x,u=k(e).y;let t=Math.sqrt(Math.pow(p=d-s,2)+Math.pow(m=c-u,2)),n=p/t,o=m/t;S=n,w=o,t<=20?(h=d-v.width/2,x=u-v.height/2):(h=20*n+s-v.width/2,x=-(20*o)+c-v.height/2),A(v.style,h,x)}}function A(e,t,n){let o=function(){let e,t=["webkitTransform","MozTransform","msTransform","OTransform","transform"],n=document.createElement("p");for(let o=0;o<t.length;o++)if(e=t[o],null!=n.style[e])return e}();o?e[o]="translate("+t+"px,"+n+"px)":(e.left=t+"px",e.top=n+"px")}function k(e){return e instanceof TouchEvent?{x:e.touches[0].clientX,y:e.touches[0].clientY}:{x:e.clientX-i.offsetLeft,y:e.clientY-i.offsetTop}}return()=>{clearInterval(F),null==i||i.removeEventListener("mousedown",y),null==i||i.removeEventListener("mousemove",j),null==i||i.removeEventListener("mouseup",b),null==i||i.removeEventListener("touchstart",y),null==i||i.removeEventListener("touchmove",j),null==i||i.removeEventListener("touchend",b)}})},IO=e=>{let t=(0,es.useRef)(null),{t:n}=(0,eT.useTranslation)();return I_(t),(0,A.jsx)("div",{ref:t,style:{display:"grid",placeItems:"center",minWidth:"150px",height:"30px",padding:"2px 10px",border:"2px dashed rgba(0, 0, 0, 0.2)",color:"rgba(0, 0, 0, 0.2)",cursor:"pointer",userSelect:"none"},...e,children:n("Horizontal scrolling area")})},IB=e=>{var t;let{split:n}=e;"|"===n&&(n=(0,A.jsx)("span",{children:"\xa0"}));let o=(0,eh.useFormLayout)();return es.createElement(of.A,{size:null!=(t=e.size)?t:null==o?void 0:o.spaceGap,...e,split:n})};var IE=n(19160);function IV(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n "]);return IV=function(){return e},e}function Iz(){let e=(0,ns._)(["\n position: absolute;\n right: 50%;\n transform: translateX(50%);\n &:not(.checked) {\n display: none;\n }\n "]);return Iz=function(){return e},e}function IL(){let e=(0,ns._)(["\n &:hover .general-schema-designer {\n display: block;\n }\n "]);return IL=function(){return e},e}function IG(){let e=(0,ns._)(["\n max-width: 300px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n "]);return IG=function(){return e},e}function IK(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n padding-right: 8px;\n .tb-table-index {\n opacity: 0;\n }\n &:not(.checked) {\n .tb-table-index {\n opacity: 1;\n }\n }\n &:hover {\n .tb-table-index {\n opacity: 0;\n }\n .tb-origin-node {\n display: block;\n }\n }\n "]);return IK=function(){return e},e}function I$(){let e=(0,ns._)(["\n .ant-table {\n overflow-x: auto;\n overflow-y: hidden;\n }\n "]);return I$=function(){return e},e}function IU(){let e=(0,ns._)(["\n border-bottom: 2px solid "," !important;\n "]);return IU=function(){return e},e}let IW=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{drag:t(IV()),node:t(Iz()),headerCell:t(IL()),bodyCell:t(IG()),cell:t(IK()),table:t(I$()),line:t(IU(),new SD.q(n.colorSettings).setAlpha(.6).toHex8String())}}),IH=()=>{let[e,t]=(0,es.useState)([]);return[e,t]},IY=(e,t)=>{let n=(0,ec.useField)();return ek(()=>Promise.resolve({data:n.value}),e)},IX=e=>(0,A.jsx)(ss.A,{className:"drag-handle",style:{cursor:"grab"},...e}),IJ=e=>{let{index:t,...n}=e;return(0,A.jsx)("div",{className:r6()("tb-table-index"),style:{padding:"0 8px 0 16px"},...n,children:t+1})},IQ=()=>({async move(){}}),IZ=(0,ec.observer)(e=>{var t,n;let{token:o}=iw.A.useToken(),l=(0,ec.useField)(),r=(()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{exists:n,render:o}=mz(t["x-initializer"],t["x-initializer-props"]),l=(0,es.useContext)(ec.SchemaExpressionScopeContext),r=tG(),i=tz(),{styles:a}=IW(),s=t.reduceProperties((e,t)=>{var n;return(null==(n=t["x-component"])?void 0:n.endsWith(".Column"))>-1&&!1!==l[t["x-visible"]]?e.concat([t]):e},[]).map(t=>({title:(0,A.jsx)(ec.RecursionField,{name:t.name,schema:t,onlyRenderSelf:!0}),dataIndex:t.name,key:t.name,...t["x-component-props"],render:(n,o)=>{var l;let a=null==(l=e.value)?void 0:l.indexOf(o);return(0,A.jsx)(m6,{index:a,children:(0,A.jsx)(m1,{record:o,parent:r||i,children:(0,A.jsx)(ec.RecursionField,{schema:t,name:o.__index||a,onlyRenderProperties:!0})})})}}));return n?s.concat({title:o(),dataIndex:"TABLE_COLUMN_INITIALIZER",key:"TABLE_COLUMN_INITIALIZER"}):s})(),{dragSort:i=!1,showIndex:a=!0,useSelectedRowKeys:s=IH,useDataSource:c=IY,useAction:d=IQ,onChange:u,...p}=e,[m,h]=s(),{styles:x}=IW(),f=(0,es.useMemo)(()=>({header:{wrapper:e=>(0,A.jsx)(SM,{children:(0,A.jsx)("thead",{...e})}),cell:e=>(0,A.jsx)("th",{...e,className:r6()(e.className,x.headerCell)})},body:{wrapper:e=>(0,A.jsx)(SM,{children:(0,A.jsx)("tbody",{...e})}),row:e=>(0,A.jsx)("tr",{...e}),cell:e=>(0,A.jsx)("td",{...e,className:r6()(e.className,x.bodyCell)})}}),[x]);c({onSuccess(e){l.value=(null==e?void 0:e.data)||[]}});let{move:v}=d(),g={rowSelection:e.rowSelection?{type:"checkbox",selectedRowKeys:m,onChange(e){h(e)},getCheckboxProps:e=>({"aria-label":"checkbox-".concat(e.name)}),renderCell:(t,n,o,l)=>{var r,s;let c=null==e||null==(r=e.pagination)?void 0:r.current,d=(null==e||null==(s=e.pagination)?void 0:s.pageSize)||20;return c&&(o+=(c-1)*d),(0,A.jsxs)("div",{className:r6()(t?"checked":null,x.cell),children:[(0,A.jsxs)("div",{className:r6()(t?"checked":null,x.drag),children:[i&&(0,A.jsx)(IX,{role:"button","aria-label":"sort-handle-".concat((null==n?void 0:n.name)||o)}),a&&(0,A.jsx)(IJ,{role:"button","aria-label":"table-index-".concat((null==n?void 0:n.name)||o),index:o})]}),(0,A.jsx)("div",{className:r6()("tb-origin-node",t?"checked":null,x.node),children:l})]})},...e.rowSelection}:void 0};return(0,A.jsx)("div",{className:x.table,children:(0,A.jsx)(IE.A,{handleSelector:".drag-handle",onDragEnd:async(e,t)=>{let n=l.value[e],o=l.value[t];l.move(e,t),await v(n,o)},lineClassName:x.line,children:(0,A.jsx)(xF.A,{rowKey:e=>{var t,n;return null==(n=l.value)||null==(t=n.indexOf)?void 0:t.call(n,e)},...p,...g,components:f,columns:r,dataSource:null==l||null==(n=l.value)||null==(t=n.slice)?void 0:t.call(n)})})})},{displayName:"TableArray"});function I0(){let e=(0,ns._)(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n display: none;\n background: var(--colorBgSettingsHover) !important;\n border: 0 !important;\n top: -16px !important;\n bottom: -16px !important;\n left: -16px !important;\n right: -16px !important;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return I0=function(){return e},e}let I1=(0,nu.rU)(e=>{let{css:t}=e;return{designer:t(I0())}}),I2=(0,ec.observer)(e=>{let{styles:t}=I1(),n=SF();return(0,A.jsxs)(SE,{className:t.designer,children:[(0,A.jsx)(n,{}),e.children]})},{displayName:"TableColumnActionBar"}),I6=(e,t)=>ek((e=>{let{request:t,pagination:n,dataSource:o}=e;if(t){if(!1===n)return t;let e=(0,ed.cloneDeep)(t.params||{});return e.page||(e.page=(null==n?void 0:n.current)||(null==n?void 0:n.defaultCurrent)||1),e.pageSize||(e.pageSize=(null==n?void 0:n.pageSize)||(null==n?void 0:n.defaultPageSize)||10),t.params=e,t}return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{page:t=1,pageSize:l=10}=e,r=(t-1)*l,i=r+l-1;return Promise.resolve({data:!1===n?o:null==o?void 0:o.slice(r,i+1),meta:{page:t,pageSize:l,count:(null==o?void 0:o.length)||0}})}})(t),e),I3=()=>{var e;let t=xX();return[null==t||null==(e=t.state)?void 0:e.selectedRowKeys,e=>{var n;return null==t||null==(n=t.setState)?void 0:n.call(t,{selectedRowKeys:e})}]},I5=(0,ec.observer)(e=>{let{rowKey:t="id",useDataSource:n=I6,useSelectedRowKeys:o=I3}=e,l=(0,ec.useField)(),r=(0,ec.useFieldSchema)(),i=(0,es.useMemo)(()=>(0,ec.createForm)(),[]),a=e_(i.createArrayField({...l.props,basePath:""})),s=n({uid:r["x-uid"],onSuccess(e){var t,n,o,a,s;i.setValues({[r.name]:null==e?void 0:e.data}),(null==l||null==(t=l.componentProps)?void 0:t.pagination)!==!1&&(l.componentProps.pagination=l.componentProps.pagination||{},(null==e||null==(n=e.meta)?void 0:n.count)&&(l.componentProps.pagination.total=null==e||null==(s=e.meta)?void 0:s.count),l.componentProps.pagination.current=(null==e||null==(o=e.meta)?void 0:o.page)||1,l.componentProps.pagination.pageSize=(null==e||null==(a=e.meta)?void 0:a.pageSize)||10)}},e);return(0,A.jsx)(xY,{value:s,children:(0,A.jsx)(ec.FormContext.Provider,{value:i,children:(0,A.jsx)(ec.FieldContext.Provider,{value:a,children:(0,A.jsx)(IZ,{...e,rowKey:t,useSelectedRowKeys:o,loading:null==s?void 0:s.loading,pagination:((e,t)=>{var n,o,l,r,i;if(!1===e.pagination)return!1;let a=e.pagination||{};if((null==e||null==(o=e.request)||null==(n=o.params)?void 0:n.pageSize)&&(a.defaultPageSize=null==e||null==(i=e.request)||null==(r=i.params)?void 0:r.pageSize),!a.total&&(null==t||null==(l=t.data)?void 0:l.meta)){let{count:e,page:n,pageSize:o}=t.data.meta;a.total=e,a.current=n,a.pageSize=o}return{showSizeChanger:!0,...a,onChange(e,n){var o;null==t||t.run({...null==t||null==(o=t.params)?void 0:o[0],page:e,pageSize:n})}}})(e,s)})})})})},{displayName:"TableVoid"}),I4=(0,ec.observer)(e=>{let t,{rowKey:n="id",objectValue:o}=e,l=(0,ec.useField)(),r={type:"checkbox",...e.rowSelection,selectedRowKeys:(t=l.value,(0,ec.isArr)(t)?t:(0,ec.isValid)(t)?[t]:[]).map(e=>"object"==typeof e?e[n]:e),onChange(t,n){"checkbox"===r.type?e.onChange(o?n:t):e.onChange([...o?n:t].shift())}};return(0,A.jsx)(I5,{...e,rowSelection:r})},{displayName:"TableRowSelection"}),I8=()=>null;I8.Array=IZ,I8.Void=I5,I8.Void.Designer=()=>{var e,t,n,o,l,r,i;let{name:a,title:s}=tJ(),c=(0,ec.useField)(),d=(0,ec.useFieldSchema)(),u=hm(a),p=hd(a),m=hn(),{t:h}=(0,eT.useTranslation)(),{dn:x}=eY(),f=(null==d||null==(n=d["x-decorator-props"])||null==(t=n.request)||null==(e=t.params)?void 0:e.filter)||{},v=(null==d||null==(r=d["x-decorator-props"])||null==(l=r.request)||null==(o=l.params)?void 0:o.sort)||[],g=null==v?void 0:v.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"}),y=rh();return(0,A.jsxs)(sP,{template:y,title:s||a,children:[(0,A.jsx)(aY,{title:h("Enable drag and drop sorting"),checked:c.decoratorProps.dragSort,onChange:e=>{var t;c.decoratorProps.dragSort=e,d["x-decorator-props"].dragSort=e,m.run({...null==(t=m.params)?void 0:t[0],sort:"sort"}),x.emit("patch",{schema:{"x-uid":d["x-uid"],"x-decorator-props":d["x-decorator-props"]}})}}),(0,A.jsx)(aQ,{title:"设置数据范围",schema:{type:"object",title:"设置数据范围",properties:{filter:{default:f,title:"数据范围",enum:u,"x-component":"Filter","x-component-props":{}}}},onSubmit:e=>{var t;let{filter:n}=e,o=c.decoratorProps.request.params||{};o.filter=n,c.decoratorProps.request.params=o,d["x-decorator-props"].request.params=o,m.run({...null==(t=m.params)?void 0:t[0],filter:n}),x.emit("patch",{schema:{"x-uid":d["x-uid"],"x-decorator-props":d["x-decorator-props"]}})}}),(0,A.jsx)(aQ,{title:h("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:h("Set default sorting rules"),properties:{sort:{type:"array",default:g,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:p,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:h("ASC"),value:"asc"},{label:h("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:h("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{var t;let{sort:n}=e,o=n.map(e=>"desc"===e.direction?"-".concat(e.field):e.field),l=c.decoratorProps.request.params||{};l.sort=o,c.decoratorProps.request.params=l,d["x-decorator-props"].request.params=l,x.emit("patch",{schema:{"x-uid":d["x-uid"],"x-decorator-props":d["x-decorator-props"]}}),m.run({...null==(t=m.params)?void 0:t[0],sort:o})}}),(0,A.jsx)(aW,{title:"每页显示",value:(null==(i=c.decoratorProps.request.params)?void 0:i.pageSize)||20,options:[{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:e=>{var t;let n=c.decoratorProps.request.params||{};n.pageSize=e,c.decoratorProps.request.params=n,d["x-decorator-props"].request.params=n,m.run({...null==(t=m.params)?void 0:t[0],pageSize:e}),x.emit("patch",{schema:{"x-uid":d["x-uid"],"x-decorator-props":d["x-decorator-props"]}})}}),(0,A.jsx)(aK,{}),(0,A.jsx)(aB,{componentName:"Table",collectionName:a}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})},I8.RowSelection=I4,I8.Column=e=>{let t=(0,ec.useField)();return(0,A.jsx)("div",{children:t.title})},I8.Column.ActionBar=I2,I8.Column.Decorator=e=>{let t=SF(),n=(0,ec.useField)(),{fieldSchema:o,uiSchema:l,collectionField:r}=(()=>{let{getField:e}=tJ(),t=eB(),n=(0,ec.useFieldSchema)(),o=n.reduceProperties((e,t)=>"CollectionField"===t["x-component"]?t:e,null);if(!o)return{};let l=e(o.name);return{columnSchema:n,fieldSchema:o,collectionField:l,uiSchema:t(null==l?void 0:l.uiSchema)}})(),{styles:i}=I1(),{refresh:a}=eY(),s=eB();return(0,es.useLayoutEffect)(()=>{n.title||o&&(null==l?void 0:l.title)&&(n.title=null==l?void 0:l.title)},[null==l?void 0:l.title]),(0,A.jsxs)(SE,{className:i.designer,children:[(0,A.jsx)(t,{fieldSchema:o,uiSchema:l,collectionField:r}),n.title||s(null==l?void 0:l.title)]})},I8.Column.Designer=e=>{var t,n,o;let{uiSchema:l,fieldSchema:r,collectionField:i}=e,a=(0,ec.useField)(),s=(0,ec.useFieldSchema)(),{dn:c}=eY(),d={title:null==s?void 0:s.title},u=(e=>{var t,n,o;let l=eB(),{getCollectionFields:r}=sO();if(!e)return[];let i=r(e);return null==i||null==(o=i.filter)||null==(n=o.call(i,e=>!(null==e?void 0:e.target)&&"boolean"!==e.type))||null==(t=n.map)?void 0:t.call(n,e=>{var t;return{value:e.name,label:l((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name)}})})(null==i?void 0:i.target);return(0,A.jsxs)(sP,{children:[(0,A.jsx)(aX,{title:"编辑",schema:{title:"编辑字段","x-component":"Action.Modal","x-component-props":{width:520},"x-decorator":"Form","x-decorator-props":{initialValue:d},type:"void",properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:"字段标题","x-component-props":{},description:"原字段标题:".concat(null==i||null==(t=i.uiSchema)?void 0:t.title)},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction(){let e=co();return{async run(){e.setVisible(!1)}}}}},submit:{type:"void",title:"Submit","x-component":"Action","x-component-props":{type:"primary",useAction(){let e=(0,ec.useForm)(),t=co();return{async run(){let{title:n}=e.values;n&&(a.title=n,s.title=n,c.emit("patch",{schema:{"x-uid":s["x-uid"],title:s.title}})),t.setVisible(!1),c.refresh()}}}}}}}}}}),(null==i?void 0:i.target)&&(0,A.jsx)(aW,{title:"标题字段",options:u,value:null==r||null==(o=r["x-component-props"])||null==(n=o.fieldNames)?void 0:n.label,onChange:e=>{var t;let n={...null==(t=r["x-component-props"])?void 0:t.fieldNames,label:e};eu().set(r,"x-component-props.fieldNames",n),a.query(".*.".concat(r.name)).take(e=>{e.componentProps.fieldNames=n}),c.emit("patch",{schema:{"x-uid":r["x-uid"],"x-component-props":{fieldNames:n}}}),c.refresh()}}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})},I8.RowActionDesigner=e=>{let t=(0,ec.useFieldSchema)(),{render:n}=mz(t["x-initializer"],t["x-initializer-props"]),{getAriaLabel:o}=sc();return(0,A.jsx)("div",{className:"general-schema-designer",children:(0,A.jsx)("div",{className:"general-schema-designer-icons",children:(0,A.jsxs)(of.A,{size:2,align:"center",children:[(0,A.jsx)(SV,{children:(0,A.jsx)(sj.A,{role:"button","aria-label":o("drag-handler")})}),n()]})})})},I8.Designer=()=>{let{name:e,title:t}=tJ();return(0,A.jsx)(sP,{title:t||e,children:(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})})},I8.Array.Designer=()=>(0,A.jsx)(sP,{children:(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})});let I7=()=>{let{fields:e}=tJ(),t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{t:o}=(0,eT.useTranslation)(),{dn:l}=eY(),r=eB(),{service:i}=lz(),a=e.filter(e=>!(null==e?void 0:e.target)&&"sort"===e.interface).map(e=>{var t;return{value:null==e?void 0:e.name,label:r(null==e||null==(t=e.uiSchema)?void 0:t.title)||(null==e?void 0:e.name)}});return(0,A.jsx)(aW,{title:o("Drag and drop sorting field"),options:a,value:t.decoratorProps.dragSortBy,onChange:e=>{var o;n["x-decorator-props"].dragSortBy=e,i.run({...null==(o=i.params)?void 0:o[0],sort:e}),t.decoratorProps.dragSortBy=e,l.emit("patch",{schema:{"x-uid":n["x-uid"],"x-decorator-props":n["x-decorator-props"]}}),l.refresh()}},"sort-field")},I9=()=>{var e,t,n,o,l,r,i,a,s,c;let{name:d,title:u}=tJ(),{getCollectionField:p,getCollection:m}=sO(),h=(0,ec.useField)(),x=(0,ec.useFieldSchema)(),{form:f}=Tp(),v=hd(d),{service:g}=lz(),{t:y}=(0,eT.useTranslation)(),{dn:b}=eY(),C=(null==x||null==(t=x["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],S=(null==x||null==(n=x["x-decorator-props"])?void 0:n.resource)||(null==x||null==(o=x["x-decorator-props"])?void 0:o.association),w=!(null==x||null==(l=x["x-decorator-props"])?void 0:l.disableTemplate),F=null==C?void 0:C.map(e=>(null==e?void 0:e.startsWith("-"))?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"}),j=rh(),k=tJ(),{dragSort:I,resource:P}=h.decoratorProps,T=P&&p(P),N=(null==P?void 0:P.includes("."))?null==(r=m(null==T?void 0:T.target))?void 0:r.tree:!!(null==k?void 0:k.tree),M=(0,es.useCallback)(e=>{var t,n,o;let{filter:l}=e;l=d5(l);let r=h.decoratorProps.params||{};r.filter=l,h.decoratorProps.params=r,x["x-decorator-props"].params=r;let i=(null==(n=g.params)||null==(t=n[1])?void 0:t.filters)||{};g.run({...null==(o=g.params)?void 0:o[0],filter:pA([...Object.values(i),l]),page:1},{filters:i}),b.emit("patch",{schema:{"x-uid":x["x-uid"],"x-decorator-props":x["x-decorator-props"]}})},[b,h.decoratorProps,x,g]),D=eC();return(0,A.jsxs)(sP,{template:j,title:u||d,children:[(0,A.jsx)(aZ,{}),(null==k?void 0:k.tree)&&(null==T?void 0:T.collectionName)===(null==T?void 0:T.target)&&(0,A.jsx)(aY,{title:y("Tree table"),defaultChecked:!0,checked:!!N&&!1!==h.decoratorProps.treeTable,onChange:e=>{var t;h.decoratorProps.treeTable=e,x["x-decorator-props"].treeTable=e;let n={...null==(t=g.params)?void 0:t[0],tree:!!e||null};b.emit("patch",{schema:x}),b.refresh(),g.run(n)}}),(0,A.jsx)(aY,{title:y("Enable drag and drop sorting"),checked:h.decoratorProps.dragSort,onChange:async e=>{if(e&&T){let{data:e}=await D.resource("collections.fields",T.collectionName).update({filterByTk:T.name,values:{sortable:!0}})}h.decoratorProps.dragSort=e,x["x-decorator-props"].dragSort=e,b.emit("patch",{schema:{"x-uid":x["x-uid"],"x-decorator-props":x["x-decorator-props"]}})}}),h.decoratorProps.dragSort&&(0,A.jsx)(I7,{}),(0,A.jsx)(bM,{}),(0,A.jsx)(il,{collectionName:d,defaultFilter:(null==x||null==(a=x["x-decorator-props"])||null==(i=a.params)?void 0:i.filter)||{},form:f,onSubmit:M}),!I&&(0,A.jsx)(aQ,{title:y("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:y("Set default sorting rules"),properties:{sort:{type:"array",default:F,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:v,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:y("ASC"),value:"asc"},{label:y("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:y("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{var t;let{sort:n}=e,o=n.map(e=>"desc"===e.direction?"-".concat(e.field):e.field),l=h.decoratorProps.params||{};l.sort=o,h.decoratorProps.params=l,x["x-decorator-props"].params=l,b.emit("patch",{schema:{"x-uid":x["x-uid"],"x-decorator-props":x["x-decorator-props"]}}),g.run({...null==(t=g.params)?void 0:t[0],sort:o})}}),(0,A.jsx)(t0,{}),(0,A.jsx)(aW,{title:y("Records per page"),value:(null==(c=h.decoratorProps)||null==(s=c.params)?void 0:s.pageSize)||20,options:[{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:e=>{var t;let n=h.decoratorProps.params||{};n.pageSize=e,h.decoratorProps.params=n,x["x-decorator-props"].params=n,g.run({...null==(t=g.params)?void 0:t[0],pageSize:e,page:1}),b.emit("patch",{schema:{"x-uid":x["x-uid"],"x-decorator-props":x["x-decorator-props"]}})}}),(0,A.jsx)(aU,{type:pj.TABLE,emptyDescription:y("No blocks to connect")}),w&&(0,A.jsx)(aK,{}),w&&(0,A.jsx)(aB,{componentName:"Table",collectionName:d,resourceName:S}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})},Pe=(0,ec.observer)(e=>{let t=(0,ec.useFieldSchema)(),{getField:n}=tJ(),o=(0,ec.useField)(),l=n(t.name),r=eB(),i=Tp();return(0,es.useEffect)(()=>{if(!o.title){var e;o.title=r(null==l||null==(e=l.uiSchema)?void 0:e.title)}(null==i?void 0:i.field)&&(i.field.added=i.field.added||new Set,i.field.added.add(t.name))},[]),(0,es.useEffect)(()=>{o.decoratorProps.asterisk=t.required},[t.required]),(0,A.jsx)("div",{children:e.children})},{displayName:"TableField"});Pe.ActionBar=(0,ec.observer)(e=>(0,ec.useForm)().readPretty?null:(0,A.jsx)("div",{style:{marginBottom:8,marginTop:-32},children:(0,A.jsx)(d_,{...e})}),{displayName:"TableField.ActionBar"});let Pt=()=>{var e,t,n,o,l,r;let{name:i,title:a}=tJ(),{getCollectionJoinField:s,getAllCollectionsInheritChain:c}=sO(),d=(0,ec.useField)(),u=(0,ec.useFieldSchema)(),{form:p}=Tp(),m=hd(i),{service:h,extraFilter:x}=l2(),{t:f}=(0,eT.useTranslation)(),{dn:v}=eY(),g=(null==u||null==(t=u["x-decorator-props"])||null==(e=t.params)?void 0:e.sort)||[],y=l0(u,"CollectionField"),b=s(null==y?void 0:y["x-collection-field"]),C=null==g?void 0:g.map(e=>e.startsWith("-")?{field:e.substring(1),direction:"desc"}:{field:e,direction:"asc"}),S=rh(),w=tJ(),{dragSort:F}=d.decoratorProps,j=m3(),k=lN(),{currentFormCollection:I}=(0,es.useContext)(g_),P=lT({collectionName:I});return(0,A.jsxs)(sP,{template:S,title:a||i,disableInitializer:!0,children:[(0,A.jsx)(il,{defaultFilter:(null==u||null==(o=u["x-decorator-props"])||null==(n=o.params)?void 0:n.filter)||{},form:p,onSubmit:e=>{var t;let{filter:n}=e;n=d5(n);let o=d.decoratorProps.params||{};o.filter=n,d.decoratorProps.params=o,u["x-decorator-props"].params=o;let l=eu().cloneDeep(n);x&&(l=l?{$and:[x,l]}:x),h.run({...null==(t=h.params)?void 0:t[0],filter:l,page:1}),v.emit("patch",{schema:{"x-uid":u["x-uid"],"x-decorator-props":u["x-decorator-props"]}})},collectionName:i,dynamicComponent:e=>(0,A.jsx)(rW,{...e,form:p,collectionField:e.collectionField,record:j,shouldChange:rH({collectionField:e.collectionField,variables:k,localVariables:P,getAllCollectionsInheritChain:c}),currentFormCollectionName:I,currentIterationCollectionName:b.collectionName})}),(null==w?void 0:w.tree)&&(null==b?void 0:b.target)===(null==b?void 0:b.collectionName)&&(0,A.jsx)(aY,{title:f("Tree table"),defaultChecked:!0,checked:!1!==d.decoratorProps.treeTable,onChange:e=>{var t;d.form.clearFormGraph("".concat(d.address,".*")),d.decoratorProps.treeTable=e,u["x-decorator-props"].treeTable=e;let n={...null==(t=h.params)?void 0:t[0],tree:!!e||null};v.emit("patch",{schema:u}),v.refresh(),h.run(n)}}),(0,A.jsx)(t0,{}),!F&&(0,A.jsx)(aQ,{title:f("Set default sorting rules"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:f("Set default sorting rules"),properties:{sort:{type:"array",default:C,"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:m,required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260},optionLabelProp:"fullLabel"}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:f("ASC"),value:"asc"},{label:f("DESC"),value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:f("Add sort field"),"x-component":"ArrayItems.Addition"}}}}},onSubmit:e=>{var t;let{sort:n}=e,o=n.map(e=>"desc"===e.direction?"-".concat(e.field):e.field),l=d.decoratorProps.params||{};l.sort=o,d.decoratorProps.params=l,u["x-decorator-props"].params=l,v.emit("patch",{schema:{"x-uid":u["x-uid"],"x-decorator-props":u["x-decorator-props"]}}),h.run({...null==(t=h.params)?void 0:t[0],sort:o})}}),(0,A.jsx)(aW,{title:f("Records per page"),value:(null==(r=d.decoratorProps)||null==(l=r.params)?void 0:l.pageSize)||20,options:[{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:e=>{var t;let n=d.decoratorProps.params||{};n.pageSize=e,d.decoratorProps.params=n,u["x-decorator-props"].params=n,h.run({...null==(t=h.params)?void 0:t[0],pageSize:e,page:1}),v.emit("patch",{schema:{"x-uid":u["x-uid"],"x-decorator-props":u["x-decorator-props"]}})}}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})};function Pn(){let e=(0,ns._)(["\n &.ant-switch-checked {\n background-color: #52c41a !important;\n }\n min-height: 16px;\n height: 16px;\n line-height: 16px;\n "]);return Pn=function(){return e},e}let Po=(0,nu.rU)(e=>{let{css:t}=e;return{switchClass:t(Pn())}}),Pl=(0,ec.observer)(function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{styles:n}=Po(),o=tz(),l=eC(),{refresh:r}=t6(),{t:i}=(0,eT.useTranslation)(),a=t.fieldName||"enabled",s=null!=(e=null==o?void 0:o[a])&&e,c=t.resource||"workflows",d=t.checkedChildren||i("On"),u=t.unCheckedChildren||i("Off"),p=async e=>{if(!t.disabled)try{await l.resource(c).update({filterByTk:o.id,values:{[a]:e}}),cg.Ay.success(i("Operation succeeded")),r()}catch(e){cg.Ay.error(i("Operation failed")),console.error(e)}};return(0,A.jsx)(oh.A,{checked:s,onChange:p,checkedChildren:d,unCheckedChildren:u,size:"small",className:n.switchClass,disabled:t.disabled})}),Pr=jw;Pr.Column=e=>{let t=(0,ec.useField)();return(0,A.jsx)("div",{role:"button",children:t.title})},Pr.Column.ActionBar=sg,Pr.Column.Decorator=e=>{let t=SF(),{isInSubTable:n}=lu()||{},{styles:o}=sv({margin:n?"-12px -8px":"-18px -16px",padding:n?"12px 8px":"18px 16px"}),l=(0,ec.useField)(),{fieldSchema:r,uiSchema:i,collectionField:a}=sb(),s=eB();return(0,es.useLayoutEffect)(()=>{l.title||r&&(null==i?void 0:i.title)&&(l.title=null==i?void 0:i.title)},[null==i?void 0:i.title]),(0,A.jsx)(SE,{className:o.designer,children:(0,A.jsxs)(tF.Provider,{value:a,children:[(0,A.jsx)(t,{fieldSchema:r,uiSchema:i,collectionField:a}),(0,A.jsx)("div",{role:"button",children:(null==l?void 0:l.title)||s(null==i?void 0:i.title)})]})})},Pr.Column.Designer=ue,Pr.ActionColumnDesigner=e=>{let t=(0,ec.useFieldSchema)(),{render:n}=mz(t["x-initializer"],t["x-initializer-props"]),{getAriaLabel:o}=sc();return(0,A.jsx)("div",{className:"general-schema-designer",children:(0,A.jsx)("div",{className:"general-schema-designer-icons",children:(0,A.jsxs)(of.A,{size:2,align:"center",children:[(0,A.jsx)(SV,{children:(0,A.jsx)(sj.A,{role:"button","aria-label":o("drag-handler")})}),n()]})})})},Pr.Selector=jw,Pr.Index=e=>{let t=m5();return(0,A.jsx)("div",{children:t+1})};let Pi=es.createContext({}),Pa=e=>{let{children:t,...n}=e;return(0,A.jsx)(Pi.Provider,{value:n,children:t})},Ps=()=>es.useContext(Pi);function Pc(){let e=(0,ns._)(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.tb-action-link {\n > .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "]);return Pc=function(){return e},e}let Pd=(0,nu.rU)(e=>{let{css:t}=e;return{designer:t(Pc())}}),Pu=(0,ec.observer)(e=>{let t=(0,ec.useFieldSchema)(),{render:n}=mz(t["x-initializer"],t["x-initializer-props"]),o=Ps(),{PaneRoot:l=es.Fragment}=o,r=(0,es.useMemo)(()=>t.mapProperties((e,t)=>({key:t,label:(0,A.jsx)(ec.RecursionField,{name:t,schema:e,onlyRenderSelf:!0}),children:(0,A.jsx)(l,{...l!==es.Fragment?{active:t===o.activeKey}:{},children:(0,A.jsx)(ec.RecursionField,{name:t,schema:e,onlyRenderProperties:!0})})})),[t.mapProperties((e,t)=>t).join()]);return(0,A.jsx)(SM,{children:(0,A.jsx)(wd.A,{...o,destroyInactiveTabPane:!0,tabBarExtraContent:n(),style:e.style,items:r})})},{displayName:"Tabs"});Pu.TabPane=(0,ec.observer)(e=>{let{styles:t}=Pd(),n=SF(),o=(0,ec.useField)();return(0,A.jsxs)(SE,{className:r6()("tb-action-link",t.designer,e.className),children:[e.icon&&(0,A.jsx)(i6,{style:{marginRight:2},type:e.icon})," ",e.tab||o.title,(0,A.jsx)(n,{})]})},{displayName:"Tabs.TabPane"}),Pu.Designer=()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{dn:n}=eY(),{t:o}=(0,eT.useTranslation)(),l=eC(),{message:r}=eX.A.useApp(),i=(0,ec.useField)();return(0,A.jsxs)(sP,{disableInitializer:!0,children:[(0,A.jsx)(aQ,{title:o("Edit"),schema:{type:"object",title:o("Edit tab"),properties:{title:{title:o("Tab name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}},icon:{title:o("Icon"),"x-decorator":"FormItem","x-component":"IconPicker","x-component-props":{}}}},initialValues:{title:e.title,icon:e.componentProps.icon},onSubmit:o=>{let{title:l,icon:r}=o,i=t["x-component-props"]||{};t.title=l,e.title=l,i.icon=r,e.componentProps.icon=r,t["x-component-props"]=t["x-component-props"]||{},t["x-component-props"].icon=r,n.emit("patch",{schema:{"x-uid":t["x-uid"],title:l,"x-component-props":i}}),n.refresh()}},"edit"),(0,A.jsx)(az,{title:o("Dump"),onClick:async()=>{let e=t=>{delete t.name,delete t["x-uid"],Object.keys(t.properties||{}).forEach(n=>{e(t.properties[n])})},{data:n}=await l.request({url:"/uiSchemas:getJsonSchema/".concat(t["x-uid"],"?includeAsyncNode=true")}),o=(null==n?void 0:n.data)||{};e(o);let i=new Blob([JSON.stringify(o,null,2)],{type:"application/json"});(0,sp.saveAs)(i,t.parent["x-uid"]+".schema.json"),r.success("Save successful!")}}),(0,A.jsx)(aQ,{title:o("Load"),schema:{"x-decorator":"Form","x-component":"Action.Modal","x-component-props":{width:520},type:"void",title:o("Load"),properties:{file:{type:"object",title:'{{ t("File") }}',required:!0,"x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{action:"attachments:create",multiple:!1}}}},onSubmit:async e=>{let{file:t}=e;null!=i.data||(i.data={}),i.data.loading=!0;let{data:o}=await l.request({url:t.url,baseURL:"/"});n.insertAfterEnd(null!=o?o:{}),i.data.loading=!1}}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{})]})};var Pp=n(30196);let Pm=e=>{let{value:t,format:n="HH:mm:ss"}=e,o=(0,eh.usePrefixCls)("description-text",e),l=(0,ec.toArr)(t);return(0,A.jsx)("div",{className:r6()(o,e.className),style:e.style,children:l.map(e=>P()(e,"HH:mm:ss").format(n)).join("~")})},Ph=function(){return(e,t)=>{let n=e.format||"HH:mm:ss",o=e.onChange;return{...e,format:n,value:(0,eh.dayjsable)(e.value,n),onChange:e=>{o&&o((0,eh.formatDayjsValue)(e,n)||null)}}}},Px=(0,ec.connect)(Pp.A,(0,ec.mapProps)(Ph()),(0,ec.mapReadPretty)(Pm));Px.RangePicker=(0,ec.connect)(Pp.A.RangePicker,(0,ec.mapProps)(Ph()),(0,ec.mapReadPretty)(Pm));let Pf=(0,ec.observer)(e=>{var t,n;let o,l=(0,ec.useField)(),{placeholder:r}=e,i=(0,eh.usePrefixCls)("description-tree-select",e),a=(null==l||null==(t=l.dataSource)?void 0:t.length)?l.dataSource:(null==e||null==(n=e.treeData)?void 0:n.length)?e.treeData:[],s=(e,t)=>{for(let n=0;n<(null==t?void 0:t.length);n++){let o=t[n];if((null==o?void 0:o.value)===e)return null==o?void 0:o.label;{let t=s(e,null==o?void 0:o.children);if(t)return t}}};return(0,A.jsx)("div",{className:r6()(i,e.className),style:e.style,children:(null==(o=(()=>{let t=e.value;if(e.multiple)if(e.labelInValue)return(0,ec.isArr)(t)?t:[];else return(0,ec.isArr)(t)?t.map(e=>({label:e,value:e})):[];return e.labelInValue?t?[t]:[]:t?[{label:t,value:t}]:[]})())?void 0:o.length)?o.map((e,t)=>{let{value:n,label:o}=e;return(0,A.jsx)(nz.A,{children:s(n,a)||o||r},t)}):(0,A.jsx)(nz.A,{children:r})})},{displayName:"ReadPretty"}),Pv=(0,ec.connect)(w9.A,(0,ec.mapProps)({dataSource:"treeData"},(e,t)=>({...e,suffixIcon:(null==t?void 0:t.loading)||(null==t?void 0:t.validating)?(0,A.jsx)(tn.A,{}):e.suffixIcon})),(0,ec.mapReadPretty)(Pf));function Pg(e){let t=[];return!function e(n){null==n||n.forEach(n=>{n.id&&t.push(n.id),n.children&&e(n.children)})}(e),t}let Py=Tr((0,ec.observer)(e=>{var t,n,o;let l,r=(0,ec.useFieldSchema)(),[i,a]=(0,es.useState)([]),{expandFlag:s,sleepTime:c,titleRender:d}=(null==r?void 0:r.parent["x-decorator-props"])||{},{service:u,expandFlag:p}=l8(),m=(l=(0,ec.useField)(),e.field||l),{onSelectNode:h}=e,x=null==m||null==(t=m.data)?void 0:t.treeData;return(0,es.useEffect)(()=>{let e=null;return c>0&&(e=setInterval(()=>{u.refresh()},1e3*Number(c))),()=>{e&&clearInterval(e)}},[]),(0,es.useEffect)(()=>{var e;let t=Pg(null==m||null==(e=m.data)?void 0:e.treeData);a(p?t:[])},[p,null==m||null==(n=m.data)?void 0:n.treeData]),(0,es.useEffect)(()=>{var e;let t=Pg(null==m||null==(e=m.data)?void 0:e.treeData);a(s?t:[])},[s,null==m||null==(o=m.data)?void 0:o.treeData]),(0,A.jsx)(rS.A,{...e,treeData:x,titleRender:e=>{let t={};if(!(d&&d.includes("{{")))return e.title;{let n,o=/{{(.*?)}}/g;for(;n=o.exec(d);)t[n[1]]=e[n[1]]||"";return d.replace(/{{(.*?)}}/g,function(e,n){return(null==t?void 0:t.hasOwnProperty(n))?t[n]:e})}},onSelect:h,expandedKeys:i,onExpand:e=>{a(e)}})})),Pb=(e,t)=>e?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"millisecond";return"second"===t&&(e*=1e3),P()(e)}(e,t):null,PC=(0,ec.connect)(e=>{let{value:t,onChange:n,accuracy:o}=e,l=(0,es.useMemo)(()=>Pb(t,o),[t]);return(0,A.jsx)(AD,{...e,value:l,onChange:e=>{n&&n(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"millisecond";return"second"===t?P()(e).unix():P()(e).valueOf()}(e,o))}})},(0,ec.mapReadPretty)(e=>{let{value:t,accuracy:n}=e,o=(0,es.useMemo)(()=>Pb(t,n),[t]);return(0,A.jsx)(AD.ReadPretty,{...e,value:o})})),PS=(0,ec.connect)(e=>(0,A.jsx)(xg.A,{...gw(e)}),(0,ec.mapProps)({value:"fileList"}),(0,ec.mapReadPretty)(gI.Upload));PS.Attachment=(0,ec.connect)(e=>{var t,n,o,l;let{disabled:r,multiple:i,value:a,onChange:s}=e,[c,d]=(0,es.useState)([]),[u,p]=(0,es.useState)(!0),m=os().AttachmentPreviewManager.get(),[h,x]=(0,es.useState)(0),[f,v]=(0,es.useState)(!1),{t:g}=(0,eT.useTranslation)(),y=gw({...e}),{wrapSSR:b,hashId:C,componentCls:S}=gk(),w=(0,es.useRef)([]);return(0,es.useEffect)(()=>{if(u){let e=gj(a);d(e),w.current=e}},[a,u]),b((0,A.jsxs)("div",{children:[(0,A.jsx)("div",{className:r6()("".concat(S,"-wrapper"),"".concat(S,"-picture-card-wrapper"),"tb-upload",C),children:(0,A.jsxs)("div",{className:r6()("".concat(S,"-list"),"".concat(S,"-list-picture-card")),children:[c.map((e,t)=>{let n={file:e,prefixCls:S,fileList:c,setFileIndex:x,setVisible:v,disabled:r,t:g,setSync:p,setFileList:d,multiple:i,onChange:s,internalFileList:w,preview:m[null==e?void 0:e.mimetype]||m.default};return(0,es.createElement)(Pw,{...n,key:t})}),!r&&(i||gx(a).length<1)&&(0,A.jsx)("div",{className:r6()("".concat(S,"-list-picture-card-container"),"".concat(S,"-list-item-container")),children:(0,A.jsx)(xg.A,{...y,disabled:r,multiple:i,listType:"picture-card",fileList:c,onChange:e=>{var t,n,o;let l,r,a=(t=e.file,-1===(r=(l=[...w.current]).findIndex(e=>{let{uid:n}=e;return n===t.uid}))?l.push(t):l[r]=t,l);if(w.current=a,p(!1),i)"done"===e.file.status&&(null==s||s(gA(a))),null==s||s(gA(a)),d(a.map(gF)),p(!0);else{if("done"===e.file.status){null==s||s(null),null==s||s(null==(o=e.file)||null==(n=o.response)?void 0:n.data)}d([gF(e.file)]),p(!0)}},showUploadList:!1,children:!r&&(i||gx(a).length<1)&&(0,A.jsxs)("span",{children:[(0,A.jsx)(sF.A,{}),(0,A.jsx)("br",{})," ",g("Upload")]})})})]})}),f&&(0,A.jsx)(eh.Lightbox,{mainSrc:null==(t=c[h])?void 0:t.imageUrl,nextSrc:null==(n=c[(h+1)%c.length])?void 0:n.imageUrl,prevSrc:null==(o=c[(h+c.length-1)%c.length])?void 0:o.imageUrl,mainFile:c[h],nextFile:c[(h+1)%c.length],prevFile:c[(h+c.length-1)%c.length],previewList:m,onCloseRequest:()=>v(!1),onMovePrevRequest:()=>x((h+c.length-1)%c.length),onMoveNextRequest:()=>x((h+1)%c.length),imageTitle:null==(l=c[h])?void 0:l.title,toolbarButtons:[(0,A.jsx)("button",{style:{fontSize:22,background:"none",lineHeight:1},type:"button","aria-label":"Zoom in",title:"Zoom in",className:"ril-zoom-in ril__toolbarItemChild ril__builtinButton",onClick:e=>{e.preventDefault();let t=c[h];(0,sp.saveAs)(t.url,"".concat(t.title).concat(t.extname))},children:(0,A.jsx)(gu.A,{})},"preview-img")]})]}))},(0,ec.mapReadPretty)(gI.File)),PS.Dragger=(0,ec.connect)(e=>{let{tipContent:t}=e,{wrapSSR:n,hashId:o,componentCls:l}=gk();return n((0,A.jsx)("div",{className:r6()("".concat(l,"-dragger"),o),children:(0,A.jsxs)(xg.A.Dragger,{...gw(e),children:[t,e.children]})}))},(0,ec.mapProps)({value:"fileList"})),PS.DraggerV2=Tr((0,ec.connect)(e=>{let{t}=(0,eT.useTranslation)(),n=t("Click or drag file to this area to upload"),o=t("Support for a single or bulk upload, file size should not exceed")+" 10MB",{title:l=n,subTitle:r=o,...i}=iq(e),[a,s]=(0,es.useState)(!1),{wrapSSR:c,hashId:d,componentCls:u}=gk();return c((0,A.jsx)("div",{className:r6()("".concat(u,"-dragger"),d),children:(0,A.jsxs)(xg.A.Dragger,{...gw({...e,...i,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{onChange:t}=i;null==t||t(e),e.some(e=>"uploading"===e.status)?s(!0):s(!1)}}),children:[(0,A.jsx)("p",{className:"".concat(u,"-drag-icon"),children:a?(0,A.jsx)(tn.A,{style:{fontSize:36},spin:!0}):(0,A.jsx)(xv.A,{})}),(0,A.jsx)("p",{className:"".concat(u,"-text"),children:l}),(0,A.jsx)("p",{className:"".concat(u,"-hint"),children:r})]})}))},(0,ec.mapProps)({value:"fileList"})),{displayName:"Upload.DraggerV2"});let Pw=e=>{let{file:t,prefixCls:n,fileList:o,setFileIndex:l,setVisible:r,disabled:i,t:a,setSync:s,setFileList:c,multiple:d,onChange:u,internalFileList:p,preview:m}=e,h=e=>{e.preventDefault(),e.stopPropagation();let n=o.indexOf(t);r(!0),l(n)},{viewComponet:x}=m;return(0,A.jsx)("div",{className:"".concat(n,"-list-picture-card-container ").concat(n,"-list-item-container"),children:(0,A.jsxs)("div",{className:r6()("".concat(n,"-list-item"),"".concat(n,"-list-item-done"),"".concat(n,"-list-item-list-type-picture-card")),children:[(0,A.jsx)("div",{className:"".concat(n,"-list-item-info"),children:(0,A.jsxs)("span",{className:"".concat(n,"-span"),children:[(0,A.jsx)("a",{className:"".concat(n,"-list-item-thumbnail"),href:t.url,target:"_blank",rel:"noopener noreferrer",onClick:h,style:{lineHeight:"100%"},children:x({prefixCls:n,file:t,setFileIndex:l,setVisible:r})}),(0,A.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"".concat(n,"-list-item-name"),title:t.title,href:t.url,onClick:h,children:"uploading"===t.status?a("Uploading"):t.title})]})}),(0,A.jsx)("span",{className:"".concat(n,"-list-item-actions"),children:(0,A.jsxs)(of.A,{size:3,children:[(0,A.jsx)(e3.Ay,{size:"small",type:"text",icon:(0,A.jsx)(gu.A,{}),onClick:()=>{(0,sp.saveAs)(t.url,"".concat(t.title).concat(t.extname))}}),!i&&(0,A.jsx)(e3.Ay,{size:"small",type:"text",icon:(0,A.jsx)(x7.A,{}),onClick:()=>{s(!1),c(e=>{if(!d)return null==u||u(null),s(!0),[];let n=e.indexOf(t);return e.splice(n,1),p.current=p.current.filter(e=>e.uid!==t.uid),null==u||u(gA([...e])),[...e]})}})]})}),"uploading"===t.status&&(0,A.jsx)("div",{className:"".concat(n,"-list-item-progress"),children:(0,A.jsx)(gp.A,{strokeWidth:2,type:"line",showInfo:!1,percent:t.percent})})]})},t.uid||t.id)},PF=cP("tb-variable-select",e=>{let{componentCls:t}=e;return{[t]:{position:"relative",".ant-select.ant-cascader":{position:"absolute",top:"-1px",right:"-1px",minWidth:"auto",width:"calc(100% + 2px)",height:"calc(100% + 2px)",overflow:"hidden",opacity:0},".variable-btn":{fontStyle:"italic",fontFamily:"'New York', 'Times New Roman', Times, serif"},".Cascader-popupClassName":{".ant-cascader-menu":{marginBottom:0}}}}}),Pj=(0,es.forwardRef)((e,t)=>{let n=(0,es.useMemo)(()=>({fontStyle:"italic",fontFamily:"New York, Times New Roman, Times, serif"}),[]);return(0,A.jsxs)(e3.Ay,{"aria-label":"variable-button",ref:t,style:n,...e,children:["x",e.children]})});function PA(e){let{options:t,setOptions:n,onInsert:o,changeOnSelect:l=!1,fieldNames:r={},className:i}=e,{t:a}=(0,eT.useTranslation)(),[s,c]=(0,es.useState)([]),{wrapSSR:d,componentCls:u,hashId:p}=PF(),{token:m}=iw.A.useToken();async function h(e){var t;let o=e[e.length-1];(null==(t=o.children)?void 0:t.length)||o.isLeaf||!o.loadChildren||(await o.loadChildren(o),n(e=>[...e]))}return d((0,A.jsx)(Pj,{className:r6()("x-button",u,p,i),children:(0,A.jsx)(om.A,{placeholder:a("Select a variable"),value:[],options:t,fieldNames:r,loadData:h,onChange:function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(c(t),!t.length)return;let l=n[n.length-1];(null==l||null==(e=l.children)?void 0:e.length)||o(t)},changeOnSelect:l,onClick:e=>{if(2===e.detail&&l)for(let n=e.target;n&&n!==e.currentTarget;n=n.parentNode){var t;Array.from(null!=(t=n.classList)?t:[]).includes("ant-cascader-menu-item")&&o(s)}},popupClassName:"Cascader-popupClassName",dropdownRender:l?e=>(0,A.jsxs)(A.Fragment,{children:[e,(0,A.jsx)("div",{style:{padding:"0.5em",borderTop:"1px solid ".concat(m.colorBorder),color:m.colorTextDescription},children:a("Double click to choose entire object")})]}):null})}))}function Pk(){let e=(0,ns._)(["\n display: flex;\n border: dashed 1px #eee;\n flex-direction: row;\n "]);return Pk=function(){return e},e}function PI(){let e=(0,ns._)(["\n flex: 1;\n text-align: center;\n color: #e5e5e5;\n "]);return PI=function(){return e},e}function PP(){let e=(0,ns._)([""]);return PP=function(){return e},e}function PT(){let e=(0,ns._)(["\n border: dashed 1px #eee;\n "]);return PT=function(){return e},e}function PN(){let e=(0,ns._)(["\n .","-input {\n padding: 3px 7px;\n border-width: ",";\n border-style: ",";\n border-color: ",";\n font-size: ",";\n line-height: ",";\n &:hover {\n border-color: ",";\n }\n &:focus {\n border-color: ",";\n outline: none;\n }\n }\n "]);return PN=function(){return e},e}function PM(){let e=(0,ns._)(["\n display: flex;\n .ant-input {\n flex-grow: 1;\n min-width: 200px;\n }\n .ant-input-disabled {\n .ant-tag {\n color: #bfbfbf;\n border-color: #d9d9d9;\n }\n }\n\n > .x-button {\n height: min-content;\n }\n "]);return PM=function(){return e},e}function PD(){let e=(0,ns._)(["\n overflow: auto;\n white-space: ",";\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0 0.5em;\n padding: 2px 7px;\n border-radius: 10px;\n }\n "]);return PD=function(){return e},e}function PR(){let e=(0,ns._)(["\n overflow: auto;\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0 0.25em;\n padding: 2px 7px;\n border-radius: 10px;\n }\n "]);return PR=function(){return e},e}function Pq(){let e=(0,ns._)(["\n position: relative;\n line-height: 0;\n\n &:hover {\n .clear-button {\n display: inline-block;\n }\n }\n\n .ant-input {\n overflow: auto;\n white-space: nowrap;\n ","\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0;\n padding: 2px 7px;\n border-radius: 10px;\n white-space: nowrap;\n }\n }\n "]);return Pq=function(){return e},e}function P_(){let e=(0,ns._)(["\n margin-left: -1px;\n "]);return P_=function(){return e},e}Pj.displayName="XButton";let PO=(0,nu.rU)((e,t)=>{let{token:n,css:o,prefixCls:l}=e,{multiline:r,disabled:i}=t,{lineWidth:a,colorFillQuaternary:s}=n,c=n.paddingSM-1,d=n.fontSizeSM,u="".concat(n.lineHeightSM*d,"px");return{fixInput:o(PN(),l,(0,cI.unit)(n.lineWidth),n.lineType,n.colorBorder,(0,cI.unit)(n.fontSize),n.lineHeight,n.colorPrimaryBorderHover,n.colorPrimaryBorderHover),outerContainer:{width:"auto",display:"flex","&.ant-input-group-compact":{display:"flex"},".ant-input-disabled":{".ant-tag":{color:"#bfbfbf",borderColor:"#d9d9d9"}},".ant-input.null-value":{width:"4em",minWidth:"4em"},".ant-formily-item .ant-formily-item-control .ant-formily-item-control-content .ant-formily-item-control-content-component":{lineHeight:"normal"},".ant-formily-item":{marginBottom:0},".ant-input":{borderTopRightRadius:0,borderBottomRightRadius:0},".ant-tag":{display:"inline-block",height:"auto",marginInlineEnd:n.marginXS,paddingInline:8-a,fontSize:d,lineHeight:u,whiteSpace:"nowrap",background:s,border:"".concat(n.lineWidth,"px ").concat(n.lineType," ").concat(n.colorBorder),borderRadius:n.borderRadiusSM,opacity:1,transition:"all ".concat(n.motionDurationMid),textAlign:"start"},".ant-tag-blue":{color:n.colorPrimaryText,background:n.colorPrimaryBg,borderColor:n.colorPrimaryBorder},".clear-button":{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:c,zIndex:1,display:"none",width:n.fontSizeIcon,height:n.fontSizeIcon,marginTop:-n.fontSizeIcon/2,color:n.colorTextQuaternary,fontSize:n.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",background:n.colorBgContainer,cursor:"pointer",opacity:.8,transition:"color ".concat(n.motionDurationMid," ease, opacity ").concat(n.motionDurationSlow," ease"),textRendering:"auto",userSelect:"none","&:before":{display:"block"},"&:hover":{color:n.colorTextTertiary}},".ant-btn":{height:"auto"},".variable":{flex:1}},container:o(PM()),button:o(PD(),r?"normal":"nowrap"),pretty:o(PR()),container2:o(Pq(),i?"":"padding-right: 28px;"),button2:o(P_())}}),PB=/^\s*{{\s*([^{}]+)\s*}}\s*$/,PE={string:{label:'{{t("String")}}',value:"string",component:function(e){let{onChange:t,value:n,...o}=e;return(0,A.jsx)(nJ.A,{value:n,onChange:e=>t(e.target.value),...o})},default:""},number:{label:'{{t("Number")}}',value:"number",component:function(e){let{onChange:t,value:n,...o}=e;return(0,A.jsx)(kw.A,{value:n,onChange:t,...o})},default:0},boolean:{label:'{{t("Boolean")}}',value:"boolean",component:function(e){let{onChange:t,value:n,...o}=e,{t:l}=(0,eT.useTranslation)();return(0,A.jsx)(oo.A,{value:n,onChange:t,placeholder:l("Select"),options:[{value:!0,label:l("True")},{value:!1,label:l("False")}],...o})},default:!1},date:{label:'{{t("Date")}}',value:"date",component:function(e){let{onChange:t,value:n,...o}=e;return(0,A.jsx)(AA.A,{value:P()(n),onChange:e=>e?t(e.toDate()):null,allowClear:!1,showTime:!0,...o})},default:new Date((i=new Date).getFullYear(),i.getMonth(),i.getDate(),0,0,0)},null:{label:'{{t("Null")}}',value:"null",component:function(){let{t:e}=(0,eT.useTranslation)();return(0,A.jsx)(nJ.A,{style:{width:"100%"},readOnly:!0,placeholder:e("Null"),className:"null-value"})},default:null}};function PV(){let e=(0,ns._)(["\n position: relative;\n .ant-input {\n width: 100%;\n }\n "]);return PV=function(){return e},e}function Pz(){let e=(0,ns._)(["\n position: absolute;\n right: 0;\n top: 0;\n .ant-btn-sm {\n font-size: 85%;\n }\n "]);return Pz=function(){return e},e}function PL(){let e=(0,ns._)(["\n &:not(:hover) {\n border-right-color: transparent;\n border-top-color: transparent;\n }\n background-color: transparent;\n "]);return PL=function(){return e},e}(0,nu.rU)((e,t)=>{let{css:n}=e,{disabled:o}=t;return{}});let PG=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(PV()),group:t(Pz()),select:t(PL())}});function PK(e){var t;let n=(0,es.useRef)(null),{changeOnSelect:o,component:l=nJ.A.TextArea,...r}=e,i="function"==typeof e.scope?e.scope():e.scope,[a,s]=(0,es.useState)(i?(0,ed.cloneDeep)(i):[]),{styles:c}=PG();return(0,A.jsxs)("div",{className:c.container,children:[(0,A.jsx)(l,{...r,ref:n}),(0,A.jsx)(e3.Ay.Group,{className:c.group,children:(0,A.jsx)(PA,{className:null!=(t=e.buttonClass)?t:c.select,fieldNames:e.fieldNames,options:a,setOptions:s,onInsert:function(e){var t;let o;if(!n.current)return;let l="{{".concat(e.join("."),"}}"),{textArea:r}=n.current.resizableTextArea,i=r.value.slice(0,r.selectionStart)+l+r.value.slice(r.selectionEnd),a=[r.selectionStart,r.selectionStart+l.length];null==(o=null==(t=Object.getOwnPropertyDescriptor(r.constructor.prototype,"value"))?void 0:t.set)||o.call(r,i),r.dispatchEvent(new Event("input",{bubbles:!0})),r.setSelectionRange(...a),r.focus()},changeOnSelect:o})})]})}function P$(){let e=(0,ns._)(["\n &:not(:hover) {\n border-right-color: transparent;\n border-top-color: transparent;\n }\n background-color: transparent;\n "]);return P$=function(){return e},e}let PU=(0,nu.rU)(e=>{let{css:t}=e;return{button:t(P$())}});var PW=n(59272),PH=n.n(PW);let PY=/{{\s*([^{}]+)\s*}}/g;function PX(e,t){var n,o;let l,{selectPastedContent:r=!1,range:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=null==(n=(o=window).getSelection)?void 0:n.call(o),s=null==a?void 0:a.getRangeAt(0);if(!s)return;if(i){let t=Array.from(e.childNodes);-1===i[0]?i[1]?s.setStartAfter(t[i[1]-1]):s.setStart(e,0):s.setStart(t[i[0]],i[1]),-1===i[2]?i[3]?s.setEndAfter(t[i[3]-1]):s.setEnd(e,0):s.setEnd(t[i[2]],i[3])}let c=document.createElement("div");c.innerHTML=t;let d=document.createDocumentFragment();for(;c.firstChild;)l=d.appendChild(c.firstChild);let{firstChild:u}=d;if(s.deleteContents(),s.insertNode(d),l){let e=new Range;e.setStartAfter(l),r?u&&e.setStartBefore(u):e.collapse(!0),a.removeAllRanges(),a.addRange(e)}}function PJ(e){let t=[];for(let n of e.childNodes)"SPAN"===n.nodeName&&n.dataset.variable?t.push("{{".concat(n.dataset.variable,"}}")):t.push(n.textContent);return t.join("")}function PQ(e,t){return e.replace(PY,(e,n)=>{var o;return null!=(o=P0(n.trim(),t))?o:""})}function PZ(e){let t=new Map;for(let n of e)if(t.set(n.value,[n.label]),n.children)for(let[e,o]of PZ(n.children))t.set("".concat(n.value,".").concat(e),[n.label,...o]);return t}function P0(e,t){let n=t.get(e);return'<span class="ant-tag ant-tag-blue" contentEditable="false" data-variable="'.concat(e,'">').concat(n?n.join(" / "):"...","</span>")}function P1(e,t,n){if(-1===t){var o,l;let t=n,r=!1;t&&"#text"===e[t-1].nodeName&&(null==(o=e[t])?void 0:o.nodeName)==="#text"&&(r=!0);let i=0;for(let o=n-1;o>=0;o--)r&&("#text"===e[o].nodeName?i+=e[o].textContent.length:r=!1),"#text"===e[o].nodeName&&(null==(l=e[o+1])?void 0:l.nodeName)==="#text"&&(t-=1);return i?[t,i]:[-1,t]}{let o=0,l=0;for(let r=0;r<t+1;r++)"#text"===e[r].nodeName?(r!==t&&e[r+1]&&"#text"!==e[r+1].nodeName&&(o+=1),l+=r===t?n:e[r].textContent.length):(o+=1,l=0);return[o,l]}}function P2(e){var t,n;let o=null==(t=(n=window).getSelection)?void 0:t.call(n),l=null==o?void 0:o.getRangeAt(0);if(!l)return[-1,0,-1,0];let r=Array.from(e.childNodes);if(!r.length)return[-1,0,-1,0];let i=l.startContainer===e?-1:r.indexOf(l.startContainer),a=l.endContainer===e?-1:r.indexOf(l.endContainer);return[...P1(r,i,l.startOffset),...P1(r,a,l.endOffset)]}function P6(e){let{value:t,scope:n,onChange:o,multiline:l=!0,changeOnSelect:r}=e,i=(0,ec.useFieldSchema)(),a=t||(null==i?void 0:i.default)||"",{styles:s}=PO({multiline:l}),c=(0,es.useRef)(null),[d,u]=(0,es.useState)([]),p=(0,ec.useForm)(),m=(0,es.useMemo)(()=>PZ(d),[d]),[h,x]=(0,es.useState)(!1),[f,v]=(0,es.useState)(!1),[g,y]=(0,es.useState)(()=>PQ(null!=a?a:"",m)),[b,C]=(0,es.useState)([-1,0,-1,0]);(0,es.useEffect)(()=>{P3(n,a).then(e=>{u(e)}).catch(e=>console.error)},[n,a]),(0,es.useEffect)(()=>{y(PQ(null!=a?a:"",m)),f||C([-1,0,-1,0])},[a,m]),(0,es.useEffect)(()=>{let{current:e}=c;if(!e)return;let t=new Range;if(f){var n,o;if("-1,0,-1,0"===b.join())return;let l=null==(n=(o=window).getSelection)?void 0:n.call(o);if(l)try{let n=Array.from(e.childNodes);n.length&&(-1===b[0]?b[1]&&t.setStartAfter(n[b[1]-1]):t.setStart(n[b[0]],b[1]),-1===b[2]?b[3]&&t.setEndAfter(n[b[3]-1]):t.setEnd(n[b[2]],b[3])),t.collapse(!0),l.removeAllRanges(),l.addRange(t)}catch(e){}}else{let{lastChild:n}=e;if(n){t.setStartAfter(n),t.setEndAfter(n);let o=Array.from(e.childNodes),l=t.startContainer===e?-1:o.indexOf(n),r=t.startContainer===e?-1:o.indexOf(n);C([l,t.startOffset,r,t.endOffset])}}},[g]);let S=(0,es.useCallback)(function(e){let t=e.filter(e=>!!e.trim()),{current:n}=c;n&&t&&(n.focus(),PX(n,P0(t.join("."),m),{range:b}),v(!0),C(P2(n)),o(PJ(n)))},[m,o,b]),w=(0,es.useCallback)(function(e){let{currentTarget:t}=e;h||(v(!0),C(P2(t)),o(PJ(t)))},[h,o]),F=(0,es.useCallback)(function(e){let{currentTarget:t}=e;C(P2(t))},[]),j=(0,es.useCallback)(function(e){"Enter"===e.key&&e.preventDefault()},[]),k=(0,es.useCallback)(function(){x(!0)},[]),I=(0,es.useCallback)(e=>{let{currentTarget:t}=e;x(!1),v(!0),C(P2(t)),o(PJ(t))},[o]),P=(0,es.useCallback)(function(e){e.preventDefault();let t=e.clipboardData.getData("text/html")||e.clipboardData.getData("text"),n=PH()(t,{allowedTags:["span"],allowedAttributes:{span:["data-variable","contenteditable"]},allowedClasses:{span:["ant-tag","ant-tag-*"]},transformTags:{span:(e,t)=>t["data-variable"]?{tagName:e,attribs:t}:{}}}).replace(/\n/g," ");v(!0),PX(e.currentTarget,n),C(P2(e.currentTarget)),o(PJ(e.currentTarget))},[o]),T=e.disabled||p.disabled;return(0,A.jsxs)(of.A.Compact,{className:r6()(s.fixInput,s.outerContainer,s.container),children:[(0,A.jsx)("div",{role:"button","aria-label":"textbox",onInput:w,onBlur:F,onKeyDown:j,onPaste:P,onCompositionStart:k,onCompositionEnd:I,className:r6()("ant-input",{"ant-input-disabled":T},s.button),ref:c,contentEditable:!T,dangerouslySetInnerHTML:{__html:g}}),T?null:(0,A.jsx)(PA,{className:"",options:d,setOptions:u,onInsert:S,changeOnSelect:r})]})}async function P3(e,t){let n=(0,ed.cloneDeep)(null!=e?e:[]);PY.lastIndex=0;for(let e;e=PY.exec(null!=t?t:"");){let t=e[1].split("."),l=null;for(let e=0;e<t.length;e++){let r=t[e];try{if(0===e)l=n.find(e=>e.value===r);else{var o;!l.loadChildren||(null==(o=l.children)?void 0:o.length)||await l.loadChildren(l),l=l.children.find(e=>e.value===r)}}catch(e){(0,eh.error)(e)}}}return n}P6.ReadPretty=function(e){let{value:t}=e,n="function"==typeof e.scope?e.scope():e.scope,[o,l]=(0,es.useState)([]),r=(0,es.useMemo)(()=>PZ(o),[o]),{styles:i}=PO();(0,es.useEffect)(()=>{P3(n,t).then(e=>{l(e)}).catch(eh.error)},[n,t]);let a=PQ(null!=t?t:"",r),s=(0,A.jsx)("span",{dangerouslySetInnerHTML:{__html:a},className:i.pretty});return(0,A.jsx)(gi,{ellipsis:!0,popoverContent:s,children:s})};let P5=(0,es.createContext)([]);function P4(e){let{scope:t=[],children:n}=e;return(0,A.jsx)(P5.Provider,{value:t,children:n})}function P8(){return(0,es.useContext)(P5)}function P7(){return null}P5.displayName="VariableScopeContext",P7.Input=(0,ec.connect)(function(e){var t;let{value:n="",onChange:o,children:l,button:r,useTypedConstant:i,style:a,className:s,changeOnSelect:c,fieldNames:d}=e,u="function"==typeof e.scope?e.scope():e.scope,p=eB(),{t:m}=(0,eT.useTranslation)(),h=(0,ec.useForm)(),[x,f]=es.useState([]),[v,g]=es.useState(""),y=(0,es.useMemo)(()=>(function(e){if(null==e)return"null";let t=typeof e;if("string"===t){let t=e.match(PB);if(t)return t[1].split(".")}return"object"===t&&e instanceof Date?"date":t})(n),[n]),b="string"==typeof y,C=b?y:"",S=b?null:y,w=Object.assign({label:"label",value:"value",children:"children"},null!=d?d:{}),{component:F,...j}=(0,es.useMemo)(()=>{if(l)return{value:"",label:m("Constant"),[w.value]:"",[w.label]:m("Constant")};if(i){var e;let t,n;return t=Object.values(PE),{value:"",label:'{{t("Constant")}}',children:n=(i?t.filter(e=>Array.isArray(i)&&i.includes(e.value)||!0===i):t).map(e=>Object.keys(e).reduce((t,n)=>w[n]in e?t:Object.assign(t,{[w[n]]:e[n]}),e)),[w.value]:"",[w.label]:'{{t("Constant")}}',[w.children]:n,component:null==(e=PE[C])?void 0:e.component}}return{value:"",label:m("Null"),[w.value]:"",[w.label]:m("Null"),component:PE.null.component}},[C,i]);(0,es.useEffect)(()=>{f([p(j),...u?(0,ed.cloneDeep)(u):[]])},[u]);let k=async e=>{var t;let n=e[e.length-1];(null==(t=n.children)?void 0:t.length)||n.isLeaf||!n.loadChildren||(await n.loadChildren(n),f(e=>[...e]))},I=(0,es.useCallback)((e,t)=>{if(""===e[0]){if(e[1]){if(e[1]!==C){var n,l;o(null!=(l=null==(n=PE[e[1]])?void 0:n.default)?l:null,t)}}else S&&o(null,t);return}o("{{".concat(e.join("."),"}}"),t)},[C,S,o]);(0,es.useEffect)(()=>{(async()=>{if(!S||x.length<=1)return;let e=null,t=[];for(let o=0;o<S.length;o++){let l=S[o];try{if(0===o)e=x.find(e=>e[w.value]===l);else{var n;!e.loadChildren||(null==(n=e.children)?void 0:n.length)||await e.loadChildren(e),e=e.children.find(e=>e[w.value]===l)}if(!e)return;t.push(e[w.label])}catch(e){(0,eh.error)(e)}}f([...x]),g(t.join(" / "))})()},[S,x.length]);let P=e.disabled||h.disabled,{styles:T}=PO({disabled:P});return(0,A.jsxs)(of.A.Compact,{style:a,className:r6()(T.outerContainer,T.fixInput,s),children:[S?(0,A.jsxs)("div",{className:r6()("variable",T.container2),children:[(0,A.jsx)("div",{role:"button","aria-label":"variable-tag",onInput:e=>e.preventDefault(),onKeyDown:e=>{"Backspace"!==e.key?e.preventDefault():o(null)},className:r6()("ant-input",{"ant-input-disabled":P}),contentEditable:!P,suppressContentEditableWarning:!0,children:(0,A.jsx)(nz.A,{contentEditable:!1,color:"blue",children:v})}),P?null:(0,A.jsx)("span",{role:"button","aria-label":"icon-close",className:r6()("clear-button"),unselectable:"on",onClick:()=>o(null),children:(0,A.jsx)(Sp.A,{})})]}):(0,A.jsx)("div",{style:{flex:1},children:null!=l?l:(0,A.jsx)(F,{role:"button","aria-label":"variable-constant",value:n,onChange:o})}),(0,A.jsx)(om.A,{options:x,value:null!=S?S:["",...!l&&(null==(t=j.children)?void 0:t.length)?[C]:[]],onChange:I,loadData:k,changeOnSelect:c,fieldNames:d,disabled:P,children:null!=r?r:(0,A.jsx)(Pj,{className:T.button2,type:S?"primary":"default"})})]})}),P7.TextArea=(0,ec.connect)(P6,(0,ec.mapReadPretty)(P6.ReadPretty)),P7.RawTextArea=(0,ec.connect)(PK),P7.JSON=(0,ec.connect)(function(e){let{styles:t}=PU();return(0,A.jsx)(PK,{buttonClass:t.button,...e,component:gd.JSON})}),P7.CodeMirror=(0,ec.connect)(e=>{let{value:t="",changeOnSelect:n,onChange:o,...l}=e,r="function"==typeof e.scope?e.scope():e.scope,{t:i}=(0,eT.useTranslation)(),[a,s]=(0,es.useState)(r?(0,ed.cloneDeep)(r):[]),[c,d]=(0,es.useState)(t),u=(0,ec.useForm)(),p=e.disabled||u.disabled;return(0,A.jsxs)("div",{children:[(0,A.jsxs)("div",{className:(0,iS.css)(Pk()),children:[(0,A.jsx)("div",{className:(0,iS.css)(PI()),children:i("Click on the right to select variables →")}),p?null:(0,A.jsx)(PA,{className:(0,iS.css)(PP()),options:a,setOptions:s,onInsert:e=>{let t="{{".concat(e.join("."),"}}"),n="".concat(t,"\n").concat(c);d(n),null==o||o(n)},changeOnSelect:n})]}),(0,A.jsx)(eh.CodeMirror,{className:(0,iS.css)(PT()),value:c,defaultLanguage:"Plain Text",onChange:e=>{d(e),null==o||o(e)},...l})]})});let P9=(0,ec.connect)(e=>{var t,n;let o,{supportsLineBreak:l,password:r,number:i,boolean:a,...s}=e,c=(t=e.scope,o=ou("$env"),(0,es.useMemo)(()=>o?[o].filter(Boolean):t,[o,t])),d={value:"name",label:"title"};return l?(0,A.jsx)(PK,{...s,scope:c,fieldNames:d,rows:3}):i?(0,A.jsx)(P7.Input,{...e,scope:c,fieldNames:d}):r&&e.value&&(n=e.value,!/{{.*?}}/.test(n))?(0,A.jsx)(IF,{...s,autoFocus:!0}):a?(0,A.jsx)(P7.Input,{...e,scope:c,fieldNames:d}):(0,A.jsx)(P6,{...s,scope:c,fieldNames:d})},(0,ec.mapReadPretty)(gd.ReadPretty));function Te(){let e=(0,ns._)(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: 10px;\n width: fit-content;\n padding: 10px;\n cursor: pointer;\n\n &.layout {\n flex-direction: column;\n }\n :hover {\n border-radius: 10px;\n transform: scale(1.05);\n transition: all 0.3s;\n }\n\n &.need-hover:hover {\n background-color: var(--colorPrimaryText);\n }\n\n .icon-wrapper {\n padding: 20px;\n border-radius: 40%;\n .icon {\n padding: 10px;\n border-radius: 50%;\n background-color: #ffffff;\n font-size: 20px;\n }\n }\n\n .title {\n flex: 1;\n display: inline-block;\n font-size: 16px;\n color: #2f2f2f;\n overflow: hidden;\n }\n "]);return Te=function(){return e},e}let Tt=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{mediaCardStyle:t(Te())}}),Tn=e=>{let{icon:t,color:n,title:o,layout:l="horizontal",onClick:r=()=>{},className:i,needHover:a=!0}=e,{styles:s}=Tt();return(0,A.jsxs)("div",{className:(0,nu.cx)(s.mediaCardStyle,{layout:"vertical"===l,"need-hover":a},i),onClick:r,children:[(0,A.jsx)("div",{className:"icon-wrapper",style:{backgroundColor:null!=n?n:"#e5e5e5"},children:(0,A.jsx)(i6,{className:"icon",type:null!=t?t:"AppstoreOutlined",style:{color:null!=n?n:"#e5e5e5"}})}),(0,A.jsx)("div",{className:"title",children:o})]})},To=e=>{var t;let{href:n,trackingKey:o="link",children:l,target:r="_blank",rel:i="noreferrer"}=e,a=os(),s=ub(),c=null==s||null==(t=s.data)?void 0:t.data;return(0,A.jsx)("a",{href:n,target:r,rel:i,onClick:()=>{a.trackingManager.logEvent("click",o,{href:n,userId:null==c?void 0:c.id})},children:l})},Tl=()=>void 0;function Tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.displayName||e.displayName||e.name,o=t=>{let{dn:n,findComponent:l}=eY(),r=(0,ec.useExpressionScope)(),i=(0,es.useMemo)(()=>{let e=n.getSchemaAttribute("x-component"),t=n.getSchemaAttribute("x-decorator"),r=n.getSchemaAttribute("x-use-component-props"),i=n.getSchemaAttribute("x-use-decorator-props");return e&&r&&l(e)===o?r:t&&i&&l(t)===o?i:void 0},[n]),a=(0,es.useMemo)(()=>{let e,t=(e,t,n)=>{let o;return eu().isFunction(e)?o=e:(o=t[e])||console.error("".concat(n," is not registered")),o||Tl};if(!i)return Tl;if(eu().isFunction(i))return i;for(let n of i.split("."))e=t(n,e||r,i);return e},[r,i])(t),s=(0,es.useMemo)(()=>({...t,...a}),[a,t]);return(0,A.jsx)(e,{...s,children:t.children})};return e.displayName=n,o.displayName="withSchemaProps(".concat(n,")"),o}function Ti(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(t,n)=>{let o=e.displayName||t.displayName||t.name,l=e=>{let{dn:n,findComponent:o}=eY(),r=(0,ec.useExpressionScope)(),i=(0,es.useMemo)(()=>{let e=n.getSchemaAttribute("x-component"),t=n.getSchemaAttribute("x-decorator"),r=n.getSchemaAttribute("x-use-component-props"),i=n.getSchemaAttribute("x-use-decorator-props");return e&&r&&o(e)===l?r:t&&i&&o(t)===l?i:void 0},[n]),a=(0,es.useMemo)(()=>{let e,t=(e,t,n)=>{let o;return eu().isFunction(e)?o=e:(o=t[e])||console.error("".concat(n," is not registered")),o||Tl};if(!i)return Tl;if(eu().isFunction(i))return i;for(let n of i.split("."))e=t(n,e||r,i);return e},[r,i])(e),s=(0,es.useMemo)(()=>({...e,...a}),[a,e]);return(0,A.jsx)(t,{...s,children:e.children})};return t.displayName=o,l.displayName="withSchemaProps(".concat(o,")"),l}}let Ta=(0,es.createContext)({});Ta.displayName="FormBlockContext";let Ts=e=>{var t,n;let o=tg(),l=Tp(),{action:r,readPretty:i,params:a,collection:s,association:c}=e,d=(0,ec.useField)(),u=(0,es.useMemo)(()=>(0,ec.createForm)({readPretty:i}),[i]),{resource:p,service:m,updateAssociationValues:h}=nj(),x=(0,es.useRef)(),f=tV(),v=(0,es.useMemo)(()=>{var e;return{...l,params:a,action:r,form:u,type:"get"===r?"update":"create",field:d,service:m,resource:p,updateAssociationValues:h,formBlockRef:x,collectionName:s||(null==(e=o.getCollectionField(c))?void 0:e.target),formRecord:f}},[r,c,o,s,l,d,u,a,f,p,m,h]);return m.loading&&(null==(t=Object.keys(null==u?void 0:u.initialValues))?void 0:t.length)===0&&r?(0,A.jsx)(eD.A,{}):(0,A.jsx)(Ta.Provider,{value:v,children:(0,A.jsx)(m1,{isNew:null==f?void 0:f.isNew,parent:null==f||null==(n=f.parentRecord)?void 0:n.data,record:null==f?void 0:f.data,children:(0,A.jsx)("div",{ref:x,children:(0,A.jsx)(Th,{form:u})})})})},Tc=()=>{let e=Tp()||{};return(0,es.useMemo)(()=>({type:e.type}),[e.type])},Td=()=>{let e=Tp(),{fieldSchema:t}=co();return"create"!==e.type&&(null==t?void 0:t["x-acl-action"])!=="create"&&(null==t?void 0:t["x-action"])!=="create"},Tu=Tr(e=>{let t=tG(),{parentRecord:n}=e;return(0,A.jsx)(nT,{name:e.name||"form",...e,block:"form",parentRecord:n||t,children:(0,A.jsx)(uN,{name:"form",children:(0,A.jsx)(Ts,{...e})})})}),Tp=()=>(0,es.useContext)(Ta),Tm=function(){var e,t;arguments.length>0&&void 0!==arguments[0]&&arguments[0];let n=Tp(),o=m3(),{fieldSchema:l}=co(),r=null==l||null==(e=l["x-component-props"])?void 0:e.addChild;return(0,es.useEffect)(()=>{if(r){var e;null==(e=n.form)||e.query("parent").take(e=>{e.disabled=!0,e.value=new Proxy({...null==o?void 0:o.__parent},{})})}}),(0,es.useEffect)(()=>{var e,t,o,l;(null==n||null==(e=n.service)?void 0:e.loading)||null==(l=n.form)||l.setInitialValues(null==(o=n.service)||null==(t=o.data)?void 0:t.data)},[null==n||null==(t=n.service)?void 0:t.loading]),{form:n.form}},Th=e=>{var t;let{form:n}=e,o=(0,ec.useFieldSchema)(),{findComponent:l}=eY(),r=(0,ec.useField)(),i=l(null==(t=r.component)?void 0:t[0])||es.Fragment;return(0,A.jsxs)(i,{...r.componentProps,children:[(0,A.jsx)(wl,{style:{marginBottom:18},form:n}),(0,A.jsx)(ec.RecursionField,{schema:o,onlyRenderProperties:!0})]})},Tx=e=>{for(;e;){if("FormBlockProvider"===e["x-decorator"])return e;e=e.parent}return null},Tf=e=>{let{component:t}=e,n=eB(),o=(0,ec.useField)(),l=(0,ec.useFieldSchema)(),{uiSchema:r,defaultValue:i}=tA(),{isAllowToSetDefaultValue:a}=sz(),s=n(r),c=eE(t||(null==s?void 0:s["x-component"])||"Input"),d=(e,t)=>{o[e]=void 0===o[e]?t:o[e]},u=Tp();return((0,es.useEffect)(()=>{(null==u?void 0:u.field)&&(u.field.added=u.field.added||new Set,u.field.added.add(l.name))}),(0,eM.A)(()=>{if(!s)return;if(d("content",s["x-content"]),d("title",s.title),d("description",s.description),null==u?void 0:u.form){let e=a()?l.default||i:void 0;null!=e&&d("initialValue",e)}!o.validator&&(s["x-validator"]||l["x-validator"])&&(o.validator=(0,ed.concat)([],s["x-validator"]||[],l["x-validator"]||[])),!0===l["x-disabled"]&&(o.disabled=!0),!0===l["x-read-pretty"]&&(o.readPretty=!0),void 0===l.required&&(o.required=!!s.required),o.dataSource=s.enum;let e=n(s["x-component-props"])||{},t=(0,ec.merge)(e,o.componentProps||{});o.component=[c,t]},[s]),s)?(0,A.jsx)(c,{...e}):null},Tv=(0,ec.connect)(e=>{let t=(0,ec.useFieldSchema)();return(0,A.jsx)(tj,{name:t.name,children:(0,A.jsx)(Tf,{...e})})});Tv.displayName="CollectionField";let Tg=e=>{let{children:t}=e,{token:n}=iF(),o=n.colorFillTertiary,l=new SD.q(n.colorFill).onBackground(n.colorFillSecondary).toHexShortString(),r=new SD.q(n.colorFill).onBackground(n.colorFill).toHexShortString(),i=new SD.q(n.colorFill).onBackground(n.colorFill).onBackground(n.colorFill).toHexShortString(),a=(0,es.useMemo)(()=>{let e=new SD.q(n.colorBgElevated);return e.isDark()?n.colorBgElevated:e.darken(4).toHexString()},[n.colorBgElevated]);return(0,es.useEffect)(()=>{document.body.style.setProperty("--tb-spacing","".concat(n.marginLG,"px")),document.body.style.setProperty("--tb-designer-offset","".concat(n.marginXS,"px")),document.body.style.setProperty("--tb-header-height","".concat(n.sizeXXL-2,"px")),document.body.style.setProperty("--tb-box-bg",n.colorBgLayout),document.body.style.setProperty("--tb-box-bg",n.colorBgLayout),document.body.style.setProperty("--controlHeightLG","".concat(n.controlHeightLG,"px")),document.body.style.setProperty("--paddingContentVerticalSM","".concat(n.paddingContentVerticalSM,"px")),document.body.style.setProperty("--marginSM","".concat(n.marginSM,"px")),document.body.style.setProperty("--colorInfoBg",n.colorInfoBg),document.body.style.setProperty("--colorInfoBorder",n.colorInfoBorder),document.body.style.setProperty("--colorText",n.colorText),document.body.style.setProperty("--colorPrimaryText",n.colorPrimaryText),document.body.style.setProperty("--colorPrimaryTextActive",n.colorPrimaryTextActive),document.body.style.setProperty("--colorPrimaryTextHover",n.colorPrimaryTextHover),document.body.style.setProperty("--colorBgScrollTrack",o),document.body.style.setProperty("--colorBgScrollBar",l),document.body.style.setProperty("--colorBgScrollBarHover",r),document.body.style.setProperty("--colorBgScrollBarActive",i),document.body.style.setProperty("--colorBgDrawer",a),document.body.style.setProperty("--colorSettings",n.colorSettings||yv.token.colorSettings),document.body.style.setProperty("--colorBgSettingsHover",n.colorBgSettingsHover),document.body.style.setProperty("--colorBorderSettingsHover",n.colorBorderSettingsHover),document.body.style.setProperty("background-color",n.colorBgContainer)},[n.marginLG,n.colorBgLayout,n.sizeXXL,n.marginXS,n.controlHeightLG,n.paddingContentVerticalSM,n.marginSM,n.colorInfoBg,n.colorInfoBorder,n.colorText,n.colorBgContainer,n.colorFillQuaternary,n.colorFillSecondary,n.colorFill,n.colorFillTertiary,o,l,r,i,a,n.colorPrimaryText,n.colorPrimaryTextActive,n.colorPrimaryTextHover,n.colorSettings,n.colorBgSettingsHover,n.colorBorderSettingsHover]),t};Tg.displayName="CSSVariableProvider";let Ty=Tg;var Tb=n(72945);let TC=e=>{var t;let[n,o]=(0,Tb.A)((t=e.appName)?"tachybase_".concat(t,"_designable").toUpperCase():"TACHYBASE_DESIGNABLE",{defaultValue:!!e.designable});return(0,A.jsx)(au,{...e,designable:n,onDesignableChange:e=>{o(e)}})},TS=e=>"boolean"==typeof e.designable?(0,A.jsx)(au,{...e}):(0,A.jsx)(TC,{...e});class Tw{get(){return this.attachmentItem}getTypeItem(e){return this.attachmentItem[e]}add(e){this.attachmentItem[e.key]=e}constructor(e,t){(0,em._)(this,"attachmentItem",{}),(0,em._)(this,"app",void 0),this.app=t,Object.entries(e||{}).forEach(e=>{let[t,n]=e;this.add(n)})}}var TF=n(4082);let Tj=(0,ec.observer)(e=>{var t,n;let{app:o}=e,l=(0,es.useCallback)((e,t)=>{console.error(e);let n=Error();n.stack=t.componentStack.trim(),console.error(n)},[]);(0,es.useEffect)(()=>{o.load()},[o]);let r=o.getComponent("AppError");return o.loading?o.renderComponent("AppSpin",{app:o}):!o.maintained&&o.maintaining?o.renderComponent("AppMaintaining",{app:o}):(null==(t=o.error)?void 0:t.code)==="LOAD_ERROR"||(null==(n=o.error)?void 0:n.code)==="APP_ERROR"?(0,A.jsx)(r,{app:o,error:o.error}):(0,A.jsxs)(wu.tH,{FallbackComponent:e=>(0,A.jsx)(r,{app:o,error:o.error,...e}),onError:l,children:[(0,A.jsxs)(oa.Provider,{value:o,children:[o.maintained&&o.maintaining&&o.renderComponent("AppMaintainingDialog",{app:o}),o.renderComponent("AppMain")]}),(0,A.jsx)(TF.b,{editor:"vscode"})]})},{displayName:"AppComponent"}),TA=e=>{let{children:t}=e;return(0,A.jsx)(A.Fragment,{children:t})},Tk=es.memo(()=>{let e=os(),t=(0,es.useMemo)(()=>e.router.getRouterComponent(),[e]),n=(0,es.useMemo)(()=>e.getComposeProviders(),[e]);return(0,A.jsx)(t,{BaseLayout:n})});Tk.displayName="MainComponent";let TI={AppMain:Tk,AppSpin:()=>(0,A.jsx)("div",{children:"Loading..."}),AppError:e=>{let{error:t}=e;return(0,A.jsxs)("div",{children:[(0,A.jsx)("div",{children:"Load Plugin Error"}),null==t?void 0:t.message]})},AppNotFound:()=>(0,A.jsx)("div",{})},TP=es.memo(e=>(0,A.jsx)(ep.UNSAFE_RouteContext.Provider,{value:{outlet:null,matches:[],isDataRoute:!1},children:(0,A.jsx)(ep.UNSAFE_LocationContext.Provider,{value:null,children:e.children})}));TP.displayName="RouterContextCleaner";var TT=n(77349),TN=((d={}).INFO="info",d.WARNING="warning",d.SUCCESS="success",d.ERROR="error",d),TM=((u={}).STATUS="status",u.TOAST="toast",u.NOTIFICATION="notification",u.CUSTOM="custom",u.MODAL="modal",u),TD=((p={}).Short="SHORT",p);let TR=(0,es.createContext)(null),Tq=e=>{let{children:t}=e,n=os();return(0,A.jsx)(TR.Provider,{value:{manager:n.noticeManager},children:t})},T_=()=>(0,es.useContext)(TR),TO=(e,t)=>{let{manager:n}=T_();(0,es.useEffect)(()=>(n.emitter.on(e,t),()=>{n.emitter.off(e,t)}),[n.emitter,e,t])};class TB{on(e){"notification"===e.type?this.notification(e.title,e.content,e.level,e.duration):"modal"===e.type?this.modal(e.title,e.content,e.level,e.duration):"toast"===e.type?this.toast(e.content,e.level,e.duration):"custom"===e.type?this.emitter.emit(e.eventType,e.event):this[e.type](e.content,e.level)}status(e,t,n){this.currentStatus=e,this.currentStatusUpdatedAt=Date.now()}toast(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3;cg.Ay[t]({content:e,duration:n})}notification(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"topRight";ex.Ay[n]({message:e,description:t,placement:l,duration:o})}modal(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},r=ox.A[n]({title:e,content:t,destroyOnClose:!0,maskClosable:!1,...l});o||(o=30),setTimeout(()=>{null==r||r.destroy()},1e3*o)}constructor(e){(0,em._)(this,"app",void 0),(0,em._)(this,"ws",void 0),(0,em._)(this,"emitter",void 0),(0,em._)(this,"currentStatus",void 0),(0,em._)(this,"currentStatusUpdatedAt",void 0),this.app=e,this.currentStatus="",this.currentStatusUpdatedAt=Date.now(),this.ws=e.ws,this.emitter=(0,TT.A)(),(0,ec.define)(this,{currentStatus:ec.observable.ref}),setInterval(()=>{Date.now()-this.currentStatusUpdatedAt>3e4&&(this.currentStatus="")},1e3)}}class TE{get(){return this.menuItems}add(e,t){this.menuItems[e]={name:e,...t}}constructor(e){(0,em._)(this,"menuItems",{}),Object.entries(e||{}).forEach(e=>{let[t,n]=e;this.add(t,n)})}}async function TV(e){let{requirejs:t,pluginData:n,devDynamicImport:o}=e;if(0===n.length)return console.warn("[getPlugins] ⚠ Early return: pluginData.length === 0"),[];let l=[],r={};if(o){for await(let e of n){let t=await o(e.packageName);t&&(l.push([e.name,t.default]),r[e.packageName]=t)}Object.entries(r).forEach(e=>{let[t,n]=e;"@tachybase/module-hera"===t&&window.define("@hera/plugin-core/client",()=>n),window.define("".concat(t,"/client"),()=>n)})}let i=n.filter(e=>!r[e.packageName]);if(0===i.length)return l;let a=await function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.requirejs.config({waitSeconds:120,paths:t.reduce((e,t)=>(e[t.packageName]=t.url,e),{})});let n=t.map(e=>e.packageName);return n.forEach(e=>{"@tachybase/module-hera"===e&&window.define("@hera/plugin-core/client",["exports","@hera/plugin-core/client"],function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){"__esModule"===n||n in e&&e[n]===t[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})}),window.define("".concat(e,"/client"),["exports",e],function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){"__esModule"===n||n in e&&e[n]===t[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})})}),new Promise((o,l)=>{e.requirejs(n,function(){for(var e=arguments.length,n=Array(e),l=0;l<e;l++)n[l]=arguments[l];o(n.map((e,n)=>[t[n].name,(null==e?void 0:e.default)||e]).filter(e=>e[1]));let r=n.map((e,t)=>e?null:t).filter(e=>null!==e).map(e=>t[e].packageName);r.length>0&&console.error("[tachybase load plugin error]: These plugins do not have an `export.default` exported content or there is an error in the plugins. error plugins: \r\n%s",r.join(", \r\n"))},e=>{console.error("[getRemotePlugins] requirejs error:",e),l(e)})})}(t,i);return l.push(...a),l}class Tz{async init(e){await this.initStaticPlugins(e),this.loadRemotePlugins&&await this.initRemotePlugins()}async initStaticPlugins(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for await(let t of e){let e=Array.isArray(t)?t[0]:t,n=Array.isArray(t)?t[1]:void 0;await this.add(e,n)}}async initRemotePlugins(){var e;let t=await this.app.apiClient.request({url:"pm:listEnabled"}),n=(null==t||null==(e=t.data)?void 0:e.data)||[];for await(let[e,t]of(await TV({requirejs:this.app.requirejs,pluginData:n,devDynamicImport:this.app.devDynamicImport})))try{let o=n.find(t=>t.name===e);await this.add(t,o)}catch(n){throw console.error("[PluginManager.initRemotePlugins] ✗ Error adding plugin ".concat(e,":"),{error:n,errorMessage:null==n?void 0:n.message,errorStack:null==n?void 0:n.stack,pluginClass:t}),n}}async add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getInstance(e,t);this.pluginInstances.set(e,n),t.name&&(this.pluginsAliases[t.name]=n),t.packageName&&(this.pluginsAliases[t.packageName]=n),await n.afterAdd()}get(e){return"string"==typeof e?this.pluginsAliases[e]:this.pluginInstances.get(e.default||e)}getInstance(e,t){try{return new e(t,this.app)}catch{return new eR({},this.app)}}async load(){for(let e of(await this.initPlugins,this.pluginInstances.values()))await e.beforeLoad();for(let e of this.pluginInstances.values())await e.load();for(let e of this.pluginInstances.values())await e.afterLoad()}constructor(e,t,n){(0,em._)(this,"_plugins",void 0),(0,em._)(this,"loadRemotePlugins",void 0),(0,em._)(this,"app",void 0),(0,em._)(this,"pluginInstances",void 0),(0,em._)(this,"pluginsAliases",void 0),(0,em._)(this,"initPlugins",void 0),this._plugins=e,this.loadRemotePlugins=t,this.app=n,this.pluginInstances=new Map,this.pluginsAliases={},this.app=n,this.initPlugins=this.init(e)}}let TL=es.createContext(null);TL.displayName="NavigateNoUpdateContext";let TG=es.createContext(null);TG.displayName="LocationNoUpdateContext";let TK=es.createContext("");TK.displayName="LocationSearchContext";let T$=es.createContext(!1);T$.displayName="IsAdminPageContext",es.createContext("").displayName="CurrentPageUidContext";let TU=es.createContext(!1);TU.displayName="MatchAdminContext";let TW=es.createContext(!1);TW.displayName="MatchAdminNameContext";let TH=es.createContext(!1);TH.displayName="IsInSettingsPageContext",es.createContext("").displayName="CurrentTabUidContext";let TY=es.createContext(new URLSearchParams);TY.displayName="SearchParamsContext";let TX=es.createContext("");TX.displayName="RouterBasenameContext",es.createContext({isSubPageClosedByPageMenu:()=>!1,setFieldSchema:()=>{},reset:()=>{}}).displayName="IsSubPageClosedByPageMenuContext";let TJ=e=>{let{children:t}=e,n=(0,ep.useHref)("/");return(0,A.jsx)(TX.Provider,{value:n,children:t})},TQ=e=>{let{children:t}=e,[n]=(0,eN.useSearchParams)();return(0,A.jsx)(TY.Provider,{value:n,children:t})},TZ=e=>{let{children:t}=e,n=(0,ep.useLocation)().pathname.includes("/settings");return(0,A.jsx)(TH.Provider,{value:n,children:t})},T0=e=>{let{children:t}=e,n=!!(0,ep.useMatch)("/admin");return(0,A.jsx)(TU.Provider,{value:n,children:t})},T1=e=>{let{children:t}=e,n=!!(0,ep.useMatch)("/admin/:name");return(0,A.jsx)(TW.Provider,{value:n,children:t})},T2=e=>{let{children:t}=e,n=(0,ep.useLocation)().pathname.startsWith("/admin");return(0,A.jsx)(T$.Provider,{value:n,children:t})},T6=e=>{let{children:t}=e,n=(0,ep.useNavigate)(),o=es.useRef(n);o.current=n;let l=es.useCallback((e,t)=>{o.current(e,t)},[]);return(0,A.jsx)(TL.Provider,{value:l,children:t})},T3=e=>{let{children:t}=e,n=(0,ep.useLocation)(),o=es.useRef({});return(0,es.useEffect)(()=>{Object.assign(o.current,n)},[n]),(0,A.jsx)(TG.Provider,{value:o.current,children:t})},T5=e=>{let{children:t}=e,n=(0,ep.useLocation)();return(0,A.jsx)(TK.Provider,{value:n.search,children:t})},T4=e=>{let{children:t}=e;return(0,A.jsx)(T6,{children:(0,A.jsx)(T3,{children:(0,A.jsx)(T2,{children:(0,A.jsx)(T5,{children:(0,A.jsx)(T0,{children:(0,A.jsx)(T1,{children:(0,A.jsx)(TQ,{children:(0,A.jsx)(TJ,{children:(0,A.jsx)(TZ,{children:t})})})})})})})})})};class T8{get basename(){return this.router.basename}get state(){return this.router.state}get navigate(){return this.router.navigate}getRoutesTree(){let e={};for(let[t,n]of Object.entries(this.routes))(0,ed.set)(e,t.split(".").join(".children."),{...(0,ed.get)(e,t.split(".").join(".children.")),...n});let t=e=>Object.values(e).reduce((e,n)=>{if(1===Object.keys(n).length&&n.children)e.push(...t(n.children));else{let{Component:o,element:l,children:r,...i}=n,a=l;o&&(a="string"==typeof o?this.app.renderComponent(o):es.createElement(o));let s={...i,element:a,children:r?t(r):void 0};e.push(s)}return e},[]);return t(e)}getRoutes(){return this.routes}setType(e){this.options.type=e}getBasename(){return this.options.basename}setBasename(e){this.options.basename=e}getRouterComponent(e){let{type:t="browser",...n}=this.options,o={hash:eN.createHashRouter,browser:eN.createBrowserRouter,memory:ep.createMemoryRouter},l=this.getRoutesTree(),r=(0,es.createContext)(null);return this.router=o[t]([{element:(0,A.jsx)(()=>{let t=(0,es.useContext)(r);return(0,A.jsx)(T4,{children:(0,A.jsx)(t,{children:(0,A.jsxs)(o4,{children:[(0,A.jsx)(ep.Outlet,{}),e]})})})},{}),errorElement:(0,A.jsx)(()=>{throw(0,ep.useRouteError)()},{}),children:l}],n),e=>{let{BaseLayout:t=TA}=e;return(0,A.jsx)(r.Provider,{value:t,children:(0,A.jsx)(TP,{children:(0,A.jsx)(eN.RouterProvider,{router:this.router})})})}}add(e,t){this.routes[e]=t}get(e){return this.routes[e]}has(e){return!!this.get(e)}remove(e){delete this.routes[e]}constructor(e={},t){(0,em._)(this,"routes",{}),(0,em._)(this,"options",void 0),(0,em._)(this,"app",void 0),(0,em._)(this,"router",void 0),this.options=e,this.app=t,this.routes=e.routes||{}}}function T7(e,t){return new T8(e,t)}let T9="admin-settings.",Ne="/_admin/",Nt="pm.";class Nn{setAclSnippets(e){this.aclSnippets=e}getAclSnippet(e){let t=this.settings[e];return(null==t?void 0:t.aclSnippet)?t.aclSnippet:"".concat(Nt).concat(e)}getRouteName(e){return"".concat(T9).concat(e)}getRoutePath(e){return"".concat(Ne).concat(e.replaceAll(".","/"))}add(e,t){let n=e.split("."),o=n[0];this.settings[e]={...this.settings[e],Component:ep.Outlet,...t,name:e,topLevelName:t.topLevelName||o},n.length>1&&(0,ed.set)(this.settings,n.join(".children."),this.settings[e]),this.app.router.add(this.getRouteName(e),{path:this.getRoutePath(e),Component:this.settings[e].Component})}remove(e){Object.keys(this.settings).forEach(t=>{t.startsWith(e)&&(delete this.settings[t],this.app.router.remove("".concat(T9).concat(t)))})}hasAuth(e){return!this.aclSnippets.includes("!".concat(this.getAclSnippet("*")))&&!1===this.aclSnippets.includes("!".concat(this.getAclSnippet(e)))}getSetting(e){return this.settings[e]}has(e){return!!this.hasAuth(e)&&!!this.getSetting(e)}get(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.hasAuth(e),o=this.getSetting(e);if(t&&!n||!o)return null;let l=Object.keys(o.children||{}).sort((e,t)=>e.localeCompare(t)).map(e=>this.get(o.children[e].name,t)).filter(Boolean).sort((e,t)=>(e.sort||0)-(t.sort||0)),{title:r,icon:i,aclSnippet:a,...s}=o;return{...s,aclSnippet:this.getAclSnippet(e),title:r,isAllow:n,label:r,icon:"string"==typeof i?(0,es.createElement)(i6,{type:i}):i,path:this.getRoutePath(e),key:e,children:l.length?l:void 0}}getList(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return Array.from(new Set(Object.values(this.settings).map(e=>e.topLevelName))).sort((e,t)=>e.localeCompare(t)).map(t=>this.get(t,e)).filter(Boolean).sort((e,t)=>(e.sort||0)-(t.sort||0))}getAclSnippets(){return Object.keys(this.settings).map(e=>this.getAclSnippet(e))}constructor(e,t){(0,em._)(this,"settings",{}),(0,em._)(this,"aclSnippets",[]),(0,em._)(this,"app",void 0),(0,em._)(this,"cachedList",{}),this.app=t,Object.entries(e||{}).forEach(e=>{let[t,n]=e;this.add(t,n)})}}class No{async logEvent(e,t,n){await this.api.resource("instrumentation").create({values:{type:e,key:t,values:n}})}constructor(e){(0,em._)(this,"app",void 0),(0,em._)(this,"api",void 0),this.app=e,this.api=this.app.apiClient}}let Nl="profilers.",Nr="/profilers/";class Ni{setAclSnippets(e){this.aclSnippets=e}getAclSnippet(e){let t=this.settings[e];return(null==t?void 0:t.aclSnippet)?t.aclSnippet:"".concat("pm.").concat(e)}getRouteName(e){return"".concat(Nl).concat(e)}getRoutePath(e){return"".concat(Nr).concat(e.replaceAll(".","/"))}add(e,t){let n=e.split("."),o=n[0];this.settings[e]={...this.settings[e],Component:ep.Outlet,...t,name:e,topLevelName:t.topLevelName||o},n.length>1&&(0,ed.set)(this.settings,n.join(".children."),this.settings[e]),this.app.router.add(this.getRouteName(e),{path:this.getRoutePath(e),Component:this.settings[e].Component})}remove(e){Object.keys(this.settings).forEach(t=>{t.startsWith(e)&&(delete this.settings[t],this.app.router.remove("".concat(Nl).concat(t)))})}hasAuth(e){return!this.aclSnippets.includes("!".concat(this.getAclSnippet("*")))&&!1===this.aclSnippets.includes("!".concat(this.getAclSnippet(e)))}getSetting(e){return this.settings[e]}has(e){return!!this.hasAuth(e)&&!!this.getSetting(e)}get(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.hasAuth(e),o=this.getSetting(e);if(t&&!n||!o)return null;let l=Object.keys(o.children||{}).sort((e,t)=>e.localeCompare(t)).map(e=>this.get(o.children[e].name,t)).filter(Boolean).sort((e,t)=>(e.sort||0)-(t.sort||0)),{title:r,icon:i,aclSnippet:a,...s}=o;return{...s,aclSnippet:this.getAclSnippet(e),title:r,isAllow:n,label:r,icon:"string"==typeof i?(0,es.createElement)(i6,{type:i}):i,path:this.getRoutePath(e),key:e,children:l.length?l:void 0}}getList(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=JSON.stringify(e);return this.cachedList[t]?this.cachedList[t]:this.cachedList[t]=Array.from(new Set(Object.values(this.settings).map(e=>e.topLevelName))).sort((e,t)=>e.localeCompare(t)).map(t=>this.get(t,e)).filter(Boolean).sort((e,t)=>(e.sort||0)-(t.sort||0))}getAclSnippets(){return Object.keys(this.settings).map(e=>this.getAclSnippet(e))}constructor(e,t){(0,em._)(this,"settings",{}),(0,em._)(this,"aclSnippets",[]),(0,em._)(this,"app",void 0),(0,em._)(this,"cachedList",{}),this.app=t,Object.entries(e||{}).forEach(e=>{let[t,n]=e;this.add(t,n)})}}function Na(e){if(!e)return console.warn("Failed to mount app: mount target should not be null or undefined."),null;if("string"==typeof e){let t=document.querySelector(e);return t||console.warn('Failed to mount app: mount target selector "'.concat(e,'" returned null.')),t}return window.ShadowRoot&&e instanceof window.ShadowRoot&&"closed"===e.mode&&console.warn('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs'),e}let Ns=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let o=t.reduce((e,t)=>{let[n,o]=t,l=t=>{let{children:l}=t;return(0,A.jsx)(e,{children:(0,A.jsx)(n,{...o,children:l})})};return l.displayName="compose(".concat(n.displayName||n.name,")"),l},TA);return e=>t=>(0,A.jsx)(o,{children:e&&(0,A.jsx)(e,{...t})})};var Nc=n(75114),Nd=n(71318),Nu=n(58531),Np=n(13258),Nm=n(58338),Nh=n(95367);class Nx{getURL(){var e;if(!this.app)return;let t=this.app.getOptions(),n=null==t||null==(e=t.apiClient)?void 0:e.baseURL;if(!n)return;let o=window.__tachybase_location_hostname__,l=window.location.hostname,r=o||l,i=window.__tachybase_fix_websocket_hostname__;if("function"==typeof i){let e=i(r);e&&"string"==typeof e&&(r=e)}let a=(0,eh.getSubAppName)(this.app.getPublicPath()),s=a?"?__appName=".concat(a):"?__hostname=".concat(r),c=this.options.basename||"/ws",d=r!==window.location.hostname;if(this.options.url){let e=new URL(this.options.url);if(d){let t="wss:"===e.protocol?"wss":"ws",n=e.port||"",o=n?"".concat(r,":").concat(n):r;return"".concat(t,"://").concat(o).concat(c).concat(s)}return"".concat(this.options.url).concat(s)}try{let e=new URL(n),t=d?r:e.hostname,o=e.port||"",l=o?"".concat(t,":").concat(o):t;return"".concat("https:"===e.protocol?"wss":"ws","://").concat(l).concat(c).concat(s)}catch(o){let e=location.port;if(!e&&n)try{e=new URL(n).port}catch(e){}let t=e?"".concat(r,":").concat(e):r;return"".concat("https:"===location.protocol?"wss":"ws","://").concat(t).concat(c).concat(s)}}get reconnectAttempts(){var e;return(null==(e=this.options)?void 0:e.reconnectAttempts)||30}get reconnectInterval(){var e;return(null==(e=this.options)?void 0:e.reconnectInterval)||1e3}get pingInterval(){var e;return(null==(e=this.options)?void 0:e.pingInterval)||3e4}get readyState(){return this._ws?this._ws.readyState:-1}connect(){let e;if(!this.enabled||(0===this._reconnectTimes&&console.log("[tachybase-ws]: connecting..."),this._reconnectTimes>=this.reconnectAttempts||this.readyState===WebSocket.OPEN))return;this._reconnectTimes++;let t=new WebSocket(this.getURL(),this.options.protocols);t.onopen=()=>{for(let{type:e,listener:n,options:o}of(console.log("[tachybase-ws]: connected."),this.serverDown=!1,this._ws&&this.removeAllListeners(),this._reconnectTimes=0,this._ws=t,this.events))this._ws.addEventListener(e,n,o);e=setInterval(()=>this.send("ping"),this.pingInterval),this.connected=!0},t.onerror=async()=>{console.log("onerror",this.readyState,this._reconnectTimes)},t.onclose=async t=>{setTimeout(()=>this.connect(),this.reconnectInterval),console.log("onclose",this.readyState,this._reconnectTimes,this.serverDown),this.connected=!1,clearInterval(e),this._reconnectTimes>=Math.min(this.reconnectAttempts,5)&&(this.serverDown=!0,this.emit("serverDown",t))}}reconnect(){this._reconnectTimes=0,this.connect()}close(){if(this._ws)return this._reconnectTimes=this.reconnectAttempts,this._ws.close()}send(e){if(this._ws)return this._ws.send(e)}on(e,t,n){this.events.push({type:e,listener:t,options:n}),this._ws&&this._ws.addEventListener(e,t,n)}emit(e,t){for(let n of this.events)n.type===e&&n.listener(t)}off(e,t,n){let o=0;for(let n of this.events){if(n.type===e&&n.listener===t){this.events.splice(o,1);break}o++}this._ws&&this._ws.removeEventListener(e,t,n)}removeAllListeners(){if(this._ws)for(let{type:e,listener:t,options:n}of this.events)this._ws.removeEventListener(e,t,n)}constructor(e,t){if((0,em._)(this,"app",void 0),(0,em._)(this,"_ws",void 0),(0,em._)(this,"_reconnectTimes",void 0),(0,em._)(this,"events",void 0),(0,em._)(this,"options",void 0),(0,em._)(this,"enabled",void 0),(0,em._)(this,"connected",void 0),(0,em._)(this,"serverDown",void 0),(0,em._)(this,"lastMessage",void 0),this.app=t,this._reconnectTimes=0,this.events=[],this.connected=!1,this.serverDown=!1,this.lastMessage={},!e){this.enabled=!1;return}this.options=!0===e?{}:e,this.enabled=!0,(0,ec.define)(this,{serverDown:ec.observable.ref,connected:ec.observable.ref,lastMessage:ec.observable.ref})}}class Nf{get pm(){return this.pluginManager}get adminUrl(){return"main"===this.name?"/admin/":"/apps/".concat(this.name,"/admin/")}initRequireJs(){var e;this.requirejs=(0,eh.getRequireJs)(),(e=this.requirejs).define("react",()=>es),e.define("react-dom",()=>oy),e.define("react/jsx-runtime",()=>A),e.define("react-router",()=>ep),e.define("react-router-dom",()=>eN),e.define("antd",()=>Np),e.define("antd-style",()=>Nm),e.define("@ant-design/icons",()=>iL),e.define("@ant-design/cssinjs",()=>cI),e.define("i18next",()=>fz),e.define("react-i18next",()=>eT),e.define("@tego/client",()=>eh),e.define("@tachybase/client",()=>j),e.define("@tachybase/schema",()=>ec),e.define("@tachybase/utils/client",()=>eh),e.define("@dnd-kit/accessibility",()=>Nc),e.define("@dnd-kit/core",()=>eq),e.define("@dnd-kit/modifiers",()=>Nd),e.define("@dnd-kit/sortable",()=>jl),e.define("@dnd-kit/utilities",()=>wD),e.define("axios",()=>Nh.A),e.define("dayjs",()=>P()),e.define("lodash",()=>eu()),e.define("ahooks",()=>Nu),e.define("@emotion/css",()=>iS),e.define("@floating-ui/react",()=>SR),window.define=this.requirejs.define,window.require=this.requirejs.require}addDefaultProviders(){this.use(eP,{apiClient:this.apiClient}),this.use(eT.I18nextProvider,{i18n:this.i18n}),this.use(yw),this.use(Ty),this.use(TS,{designable:this.options.designable,appName:this.name,components:this.components,scope:this.scopes}),this.use(yb),this.use(t_,{dataSourceManager:this.dataSourceManager})}addReactRouterComponents(){this.addComponents({Link:eN.Link,Navigate:ep.Navigate,NavLink:eN.NavLink})}addRoutes(){this.router.add("not-found",{path:"*",Component:this.components.AppNotFound}),this.router.add("share.notAuthorized",{path:"/share/not-authorized",element:null})}getOptions(){return this.options}getPublicPath(){return this.options.publicPath||"/"}getName(){return(0,eh.getSubAppName)(this.getPublicPath())||null}getApiUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this.apiClient.axios.defaults.baseURL;if(!t.startsWith("http://")&&!t.startsWith("https://")){let{protocol:e,host:n}=window.location;t="".concat(e,"//").concat(n).concat(t)}return t.replace(/\/$/g,"")+"/"+e.replace(/^\//g,"")}getRouteUrl(e){return this.options.publicPath.replace(/\/$/g,"")+e}getHref(e){let t=this.name;return t&&"main"!==t?this.getPublicPath()+"apps/"+t+"/"+e.replace(/^\//g,""):this.getPublicPath()+e.replace(/^\//g,"")}getCollectionManager(e){var t;return null==(t=this.dataSourceManager.getDataSource(e))?void 0:t.collectionManager}getComposeProviders(){let e=Ns(...this.providers)(TA);return e.displayName="Providers",e}use(e,t){return this.addProvider(e,t)}addProvider(e,t){return this.providers.push([e,t])}addProviders(e){e.forEach(e=>{Array.isArray(e)?this.addProvider(e[0],e[1]):this.addProvider(e)})}async load(){let e=!1;this.ws.on("message",t=>{var n,o,l;let r=JSON.parse(t.data);if(null==r||null==(n=r.payload)?void 0:n.refresh)return void window.location.reload();if("notification"===r.type)return void this.notification[(null==(o=r.payload)?void 0:o.type)||"info"]({message:null==(l=r.payload)?void 0:l.message});if("notice"===r.type&&this.noticeManager.on(r.payload),"maintaining"===r.type&&"APP_RUNNING"!==r.payload.code)this.maintaining=!0,this.error=r.payload;else{if(e)return void window.location.reload();this.maintaining=!1,this.maintained=!0,this.error=null}}),this.ws.on("serverDown",()=>{this.maintaining=!0,this.maintained=!0}),this.ws.connect();try{this.loading=!0,await this.pm.load()}catch(a){var t,n,o,l,r;this.ws.enabled&&await new Promise(e=>{setTimeout(()=>e(null),1e3)}),e=!0;let i=(null==a||null==(n=a.response)||null==(t=n.data)?void 0:t.error)||(null==a||null==(r=a.response)||null==(l=r.data)||null==(o=l.errors)?void 0:o[0])||{message:null==a?void 0:a.message};this.error={code:"LOAD_ERROR",...i},console.error(a,this.error)}this.loading=!1}getComponent(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=e=>t&&console.error(e);if(!e)return void n("getComponent called with ".concat(e));if("function"==typeof e)return e;if("string"==typeof e){let t=(0,ed.get)(this.components,e);return t||void n("Component ".concat(e," not found"))}n("Component ".concat(e," should be a string or a React component"))}renderComponent(e,t){return es.createElement(this.getComponent(e),t)}addComponent(e,t){let n=t||e.displayName||e.name;n?(0,ed.set)(this.components,n,e):console.error("Component must have a displayName or pass name as second argument")}addComponents(e){Object.keys(e).forEach(t=>{this.addComponent(e[t],t)})}addScopes(e){this.scopes=(0,ed.merge)(this.scopes,e)}getRootComponent(){return()=>(0,A.jsx)(Tj,{app:this})}mount(e){let t=Na(e);if(!t)return;let n=this.getRootComponent(),o=(0,k.createRoot)(t);return o.render((0,A.jsx)(n,{})),o}addFieldInterfaceComponentOption(e,t){return this.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption(e,t)}addGlobalVar(e,t){(0,ed.set)(this.globalVars,e,t)}getGlobalVar(e){return(0,ed.get)(this.globalVars,e)}constructor(e={}){(0,em._)(this,"options",void 0),(0,em._)(this,"providers",void 0),(0,em._)(this,"router",void 0),(0,em._)(this,"scopes",void 0),(0,em._)(this,"i18n",void 0),(0,em._)(this,"ws",void 0),(0,em._)(this,"apiClient",void 0),(0,em._)(this,"components",void 0),(0,em._)(this,"pluginManager",void 0),(0,em._)(this,"systemSettingsManager",void 0),(0,em._)(this,"userSettingsManager",void 0),(0,em._)(this,"devDynamicImport",void 0),(0,em._)(this,"requirejs",void 0),(0,em._)(this,"notification",void 0),(0,em._)(this,"schemaInitializerManager",void 0),(0,em._)(this,"schemaSettingsManager",void 0),(0,em._)(this,"dataSourceManager",void 0),(0,em._)(this,"noticeManager",void 0),(0,em._)(this,"trackingManager",void 0),(0,em._)(this,"pluginContextMenu",void 0),(0,em._)(this,"AttachmentPreviewManager",void 0),(0,em._)(this,"name",void 0),(0,em._)(this,"globalVars",void 0),(0,em._)(this,"loading",void 0),(0,em._)(this,"maintained",void 0),(0,em._)(this,"maintaining",void 0),(0,em._)(this,"error",void 0),this.options=e,this.providers=[],this.scopes={},this.components={DataBlockProvider:t4,...TI,...f,CollectionField:Tv},this.globalVars={},this.loading=!0,this.maintained=!1,this.maintaining=!1,this.error=null,this.initRequireJs(),(0,ec.define)(this,{maintained:ec.observable.ref,loading:ec.observable.ref,maintaining:ec.observable.ref,error:ec.observable.ref}),this.devDynamicImport=e.devDynamicImport,this.scopes=(0,ed.merge)(this.scopes,e.scopes),this.components=(0,ed.merge)(this.components,e.components),this.apiClient=e.apiClient instanceof ey?e.apiClient:new ey(e.apiClient),this.apiClient.app=this,this.i18n=e.i18n||fG,this.router=new T8(e.router,this),this.schemaSettingsManager=new oi(e.schemaSettings,this),this.pluginManager=new Tz(e.plugins,e.loadRemotePlugins,this),this.schemaInitializerManager=new mG(e.schemaInitializers,this),this.dataSourceManager=new tt(e.dataSourceManager,this),this.noticeManager=new TB(this),this.trackingManager=new No(this),this.addDefaultProviders(),this.addReactRouterComponents(),this.addProviders(e.providers||[]),this.ws=new Nx(e.ws,this),this.systemSettingsManager=new Nn(e.pluginSettings,this),this.userSettingsManager=new Ni(e.userSettings,this),this.addRoutes(),this.name=this.options.name||(0,eh.getSubAppName)(e.publicPath)||"main",this.pluginContextMenu=new TE(e.pluginMenuItems),this.AttachmentPreviewManager=new Tw(e.attachmentItem,this),this.i18n.on("languageChanged",e=>{this.apiClient.auth.locale=e})}}let Nv=(0,es.createContext)({});Nv.displayName="ACLContext";let Ng=e=>(0,A.jsx)(i8,{components:{ACLCollectionFieldProvider:NM,ACLActionProvider:NT,ACLMenuItemProvider:ND,ACLCollectionProvider:Nk},children:e.children}),Ny=e=>{var t;return(null==e?void 0:e.match)?e.match:e&&Ny(null==e||null==(t=e.children)?void 0:t.props)},Nb=e=>{Ny(e.children.props);let{setDesignable:t}=eY(),n=eC(),o=os(),l=ek({url:"roles:check"},{onSuccess(e){var l,r,i,a;(null==e||null==(l=e.data)?void 0:l.snippets.includes("ui.*"))||t(!1),(null==e||null==(r=e.data)?void 0:r.role)!==n.auth.role&&n.auth.setRole(null==e||null==(a=e.data)?void 0:a.role),o.systemSettingsManager.setAclSnippets((null==e||null==(i=e.data)?void 0:i.snippets)||[])}});if(!l.loading)return l.error?(0,A.jsx)(ep.Navigate,{replace:!0,to:"/signin"}):(0,A.jsx)(Nv.Provider,{value:l,children:e.children})},NC=()=>{let e=(0,es.useContext)(Nv),{allowAll:t}=NA();return()=>{t||e.refresh()}},NS=()=>(0,es.useContext)(Nv),Nw=(0,es.createContext)({});Nw.displayName="ACLActionParamsContext";let NF=()=>{var e,t;let n=(0,es.useContext)(Nv),o=tc(),{dataSources:l}=(null==n||null==(e=n.data)?void 0:e.meta)||{},r={...null==n||null==(t=n.data)?void 0:t.data,...(0,ed.omit)(null==l?void 0:l[o],"snippets")},i=e=>{var t;let n=e.split(":").pop();return(null==r||null==(t=r.actionAlias)?void 0:t[n])||n};return{data:r,getActionAlias:i,inResources:e=>{var t,n;return null==r||null==(n=r.resources)||null==(t=n.includes)?void 0:t.call(n,e)},getResourceActionParams:e=>{var t,n;let[o]=e.split(":"),l=i(e);return(null==r||null==(t=r.actions)?void 0:t["".concat(o,":").concat(l)])||(null==r||null==(n=r.actions)?void 0:n[e])},getStrategyActionParams:e=>{var t,n;let o=i(e);return(null==r||null==(n=r.strategy)||null==(t=n.actions)?void 0:t.find(e=>{let[t]=e.split(":");return t===o}))?{}:null}}},Nj=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{schema:n,recordPkValue:o}=t,l=!1;return t.ignoreScope&&(l=!0),(null==n?void 0:n["x-acl-ignore-scope"])&&(l=!0),(null==n||null==(e=n["x-acl-action-props"])?void 0:e.skipScopeCheck)&&(l=!0),o||(l=!0),l};function NA(){var e,t,n;let o,l,{data:r,getActionAlias:i,inResources:a,getResourceActionParams:s,getStrategyActionParams:c}=NF(),d=(o=hn(),null!=(n=null==(l=nj())?void 0:l.allowedActions)?n:null==o||null==(t=o.data)||null==(e=t.meta)?void 0:e.allowedActions),{getCollectionJoinField:u}=sO();return{...r,parseAction:function(e){var t,n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[l,p]=e.split(":"),m=(null==l?void 0:l.includes("."))&&(null==(t=u(l))?void 0:t.target);if(!Nj(o)){let e,t=(n=o.recordPkValue,e=i(p),Array.isArray(null==d?void 0:d[e])?d[e].includes(n):null);if(null!==t)return t?{}:null}return(null==r?void 0:r.allowAll)?{}:a(m)?s("".concat(m,":").concat(p)):a(l)?s(e):c(e)}}}let Nk=e=>{let{allowAll:t,parseAction:n}=NA(),o=(0,ec.useFieldSchema)();if(t)return e.children;let l=(null==o?void 0:o["x-acl-action"])||e.actionPath;if(!l)return e.children;let r=n(l,{schema:o});if(!r)return null;let[i,a]=l.split(":");return r.actionName=a,(0,A.jsx)(Nw.Provider,{value:{params:r},children:e.children})},NI=()=>(0,es.useContext)(Nw),NP=()=>{let{getPrimaryKey:e}=tJ(),t=m3(),n=e();return null==t?void 0:t[n]},NT=e=>{var t,n,o,l;let r,i,{template:a,writableView:s}=tJ(),c=NP(),d=(r=hn(),(null==(i=nj()||{service:r})||null==(t=i.props)?void 0:t.resource)||(null==i||null==(n=i.props)?void 0:n.collection)||(null==i||null==(l=i.service)||null==(o=l.defaultRequest)?void 0:o.resource)),{parseAction:u}=NA(),p=(0,ec.useFieldSchema)(),m=p["x-acl-action"],h=["create","update","destroy","importXlsx"];if(!m&&d&&p["x-action"]&&(m="".concat(d,":").concat(p["x-action"])),(null==m?void 0:m.includes(":"))||(m="".concat(d,":").concat(m)),!m||!d)return(0,A.jsx)(A.Fragment,{children:e.children});let x=u(m,{schema:p,recordPkValue:c});return x?h.includes(m)||h.includes(null==m?void 0:m.split(":")[1])?"view"!==a||s?(0,A.jsx)(Nw.Provider,{value:x,children:e.children}):null:(0,A.jsx)(Nw.Provider,{value:x,children:e.children}):(0,A.jsx)(Nw.Provider,{value:x,children:e.children})},NN=()=>{let e=(0,es.useContext)(Nw),t=[].concat((null==e?void 0:e.whitelist)||[]).concat((null==e?void 0:e.fields)||[]).concat((null==e?void 0:e.appends)||[]);return{whitelist:t,schemaInWhitelist(e,n){if(n||0===t.length||!e||!e["x-collection-field"])return!0;let[o,l]=e["x-collection-field"].split(".");return null==t?void 0:t.includes(l||o)}}},NM=e=>{let t=(0,ec.useFieldSchema)(),n=(0,ec.useField)(),{allowAll:o}=NA(),{whitelist:l}=NN(),[r]=t.name.split("."),i=!!t["x-acl-ignore"]||!(l.length>0)||l.includes(r);return((0,es.useEffect)(()=>{i||(n.required=!1,n.display="hidden")},[i]),o||!t["x-collection-field"]||i)?(0,A.jsx)(A.Fragment,{children:e.children}):null},ND=e=>{let{allowAll:t,allowMenuItemIds:n=[],snippets:o}=NA(),l=(0,ec.useFieldSchema)();return t||o.includes("ui.*")||!l["x-uid"]||n.includes(l["x-uid"])?(0,A.jsx)(A.Fragment,{children:e.children}):null},NR=()=>"default-admin-menu";function Nq(e,t){let n=(0,es.useRef)();if(n.current&&t.length===n.current.deps.length&&t.every((e,t)=>e===n.current.deps[t]))return n.current.value;if(!n.current||t.length!==n.current.deps.length||t.some((e,t)=>{let o=n.current.deps[t];return e!==o&&!eu().isEqual(e,o)})){let o=e();return n.current={deps:t,value:o},o}return n.current.deps=t,n.current.value}function N_(){let e,t,{metaRef:n,restore:o}=(e=(0,es.useRef)("initial-scale=0.1"),t=(0,es.useRef)(),(0,es.useEffect)(()=>{let n=document.querySelector('meta[name="viewport"]');n?e.current=n.content:(n=document.createElement("meta")).name="viewport",n&&(n.content="width=device-width, initial-scale=1, user-scalable=0",t.current=n)},[]),{metaRef:t,restore:()=>{t.current&&(t.current.content=e.current)}});(0,es.useEffect)(()=>{if(n.current)return document.head.insertBefore(n.current,document.head.firstChild),()=>{o()}},[])}let NO=(0,es.createContext)(null);NO.displayName="MenuItemsContext";let NB=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[];for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let o=e[n],l={title:o.title,uid:o["x-uid"]};o.properties&&(l.children=NB(o.properties)),t.push(l)}return t},NE=e=>{var t,n;let o=NR(),l=ek({url:"uiSchemas:getProperties/".concat(o)});if(l.loading)return(0,A.jsx)(eD.A,{});let r=NB(null==(n=l.data)||null==(t=n.data)?void 0:t.properties);return(0,A.jsx)(NO.Provider,{value:{service:l,items:r},children:e.children})},NV=e=>{if(!Array.isArray(e))return[];let t=[];for(let n of e)t.push(n.uid),t.push(...NV(n.children));return t},Nz=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!e)return[];for(let o of e){if(n.push(o.uid),t(o))return n;if(o.children){let e=Nz(o.children,t,n);if(e.length)return e}n.pop()}return[]},NL=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];for(let n of e)t.push(n.uid),n.children&&n.children.length&&NL(n.children,t);return t},NG=()=>{let{styles:e}=wm(),t=m3(),n=eC(),{message:o}=eX.A.useApp(),{items:l}=(0,es.useContext)(NO),{t:r}=(0,eT.useTranslation)(),i=NV(l),[a,s]=(0,es.useState)([]),{loading:c,refresh:d}=ek({resource:"roles.menuUiSchemas",resourceOf:t.name,action:"list",params:{paginate:!1}},{onSuccess(e){var t;s((null==e||null==(t=e.data)?void 0:t.map(e=>e["x-uid"]))||[])}}),u=n.resource("roles.menuUiSchemas",t.name),p=i.length===a.length,m=async(e,t)=>{let n=Nz(l,e=>e.uid===t.uid),i=NL(null==t?void 0:t.children,[]);if(e){let e=i.concat(t.uid);s([...a.filter(t=>!e.includes(t))]),await u.remove({values:e})}else{let e=i.concat(n);s(t=>(0,ed.uniq)([...t,...e])),await u.add({values:e})}o.success(r("Saved successfully"))},h=e=>e.map(e=>{let t=r(e.title);return e.children?{...e,title:t,children:h(e.children)}:{...e,title:t}});return(0,A.jsx)(xF.A,{className:e,loading:c,rowKey:"uid",pagination:!1,expandable:{defaultExpandAllRows:!0},columns:[{dataIndex:"title",title:r("Menu item title")},{dataIndex:"accessible",title:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(j0.A,{checked:p,onChange:async e=>{p?await u.set({values:[]}):await u.set({values:i}),d(),o.success(r("Saved successfully"))}})," ",r("Accessible")]}),render:(e,t)=>{let n=a.includes(t.uid);return(0,A.jsx)(j0.A,{checked:n,onChange:()=>m(n,t)})}}],dataSource:h(l)})},NK=e=>{var t;let{currentRecord:n}=(0,es.useContext)(N$);return(null==n||null==(t=n.snippets)?void 0:t.includes("pm.*"))?(0,A.jsx)("div",{children:e.children}):null},N$=(0,es.createContext)(null);N$.displayName="PermissionContext";let NU=e=>{let t=eC(),n=m3(),{t:o}=(0,eT.useTranslation)(),{message:l}=eX.A.useApp(),{snippets:r}=n;null==r||r.forEach(e=>{n[e]=!0});let[i,a]=(0,es.useState)(n);return(0,A.jsx)(N$.Provider,{value:{currentRecord:i,update:async(e,r)=>{let{path:s,value:c}=e.getState();if(["ui.*","pm","pm.*"].includes(s)){let e=t.resource("roles.snippets",n.name);c?await e.add({values:[s]}):await e.remove({values:[s]}),a({...i,...r.values,[s]:c})}else await t.resource("roles").update({filterByTk:n.name,values:r.values}),a({...i,...r.values});l.success(o("Saved successfully"))}},children:e.children})},NW=(0,ec.connect)(e=>{let{t}=(0,eT.useTranslation)();return(0,A.jsxs)(j0.A.Group,{style:{width:"100%",display:"block"},value:e.value,onChange:t=>{let n=["ui.*","pm","pm.*","app"],o=n.map(e=>"!".concat(e)),l=j2()([...e.value||[],...t]).filter(e=>e&&!o.includes(e)).map(e=>!n.includes(e)||(null==t?void 0:t.includes(e))?e:"!".concat(e));for(let e of n)l.includes(e)||l.includes("!".concat(e))||l.push("!".concat(e));e.onChange(l)},children:[(0,A.jsx)("div",{style:{marginTop:16},children:(0,A.jsx)(j0.A,{value:"ui.*",children:t("Allows to configure interface")})}),(0,A.jsx)("div",{style:{marginTop:8},children:(0,A.jsx)(j0.A,{value:"pm",children:t("Allows to install, activate, disable plugins")})}),(0,A.jsx)("div",{style:{marginTop:8},children:(0,A.jsx)(j0.A,{value:"pm.*",children:t("Allows to configure plugins")})}),(0,A.jsx)("div",{style:{marginTop:8},children:(0,A.jsx)(j0.A,{value:"app",children:t("Allows to clear cache, reboot application")})})]})}),NH=()=>{let{update:e,currentRecord:t}=(0,es.useContext)(N$),{t:n}=(0,eT.useTranslation)();return(0,A.jsx)(al,{components:{SnippetCheckboxGroup:NW},schema:{type:"void",name:"form","x-component":"Form","x-component-props":{useValues:e=>{let n=eC();return ek(()=>n.resource("roles").get({filterByTk:t.name}).then(e=>{var t,n;let o=null==e||null==(t=e.data)?void 0:t.data;return null==(n=o.snippets)||n.forEach(e=>{o[e]=!0}),{data:o}}),e)},effects(){(0,ec.onFieldChange)("*",async(t,n)=>{n.modified&&await e(t,n)})}},properties:{snippets:{title:n("Configure permissions"),type:"boolean","x-decorator":"FormItem","x-component":"SnippetCheckboxGroup"},allowNewMenu:{title:n("Menu permissions"),"x-decorator":"FormItem","x-component":"Checkbox","x-content":n("New menu items are allowed to be accessed by default.")}}}})};var NY=n(40222),NX=n.n(NY);let NJ={name:"roles",filterTargetKey:"name",targetKey:"name",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Role display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Role UID")}}',type:"string","x-component":"Input"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{title:'{{t("Default role")}}',type:"boolean","x-component":"Checkbox"}}]},NQ={type:"object",properties:{block1:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:NJ,resourceName:"roles",request:{resource:"roles",action:"list",params:{pageSize:50,filter:{"name.$ne":"root"},showAnonymous:!0,sort:["createdAt"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:NJ},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete role')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add role")}}',"x-component":"Action","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(e){let t=co();return ek(()=>Promise.resolve({data:{name:"r_".concat((0,ec.uid)()),snippets:["!ui.*","!pm","!pm.*"]}}),{...e,refreshDeps:[t.visible]})}},title:'{{t("Add role")}}',properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'},default:{"x-component":"CollectionField","x-decorator":"FormItem",title:"","x-content":'{{t("Default role")}}'},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{default:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-decorator":"ACLActionProvider","x-acl-action":"roles:update","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"PermissionProvider",title:'{{t("Configure permissions")}}',properties:{tabs1:{type:"void","x-component":"Tabs","x-component-props":{},properties:{tab1:{type:"void",title:'{{t("General permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{role:{"x-component":"RoleConfigure"}}},tab3:{type:"void",title:'{{t("Menu permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{menu:{"x-decorator":"MenuItemsProvider","x-component":"MenuConfigure"}}},tab4:{type:"void",title:'{{t("Plugin settings permissions")}}',"x-decorator":"SettingCenterPermissionProvider","x-component":"Tabs.TabPane","x-component-props":{},properties:{menu:{"x-decorator":"SettingCenterProvider","x-component":"SettingsCenterConfigure"}}}}}}}}},update:{type:"void",title:'{{t("Edit")}}',"x-decorator":"ACLActionProvider","x-acl-action":"roles:update","x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:e=>{let t=m3(),n=ek(()=>Promise.resolve({data:NX()(t,["title","name","default"])}),{...e,manual:!0}),o=co();return(0,es.useEffect)(()=>{o.visible&&n.run()},[o.visible]),n}},title:'{{t("Edit role")}}',properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},default:{title:"","x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default role")}}'},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"roles:destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete role')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}}}},NZ=(0,es.createContext)([]);NZ.displayName="AvailableActionsContext";let N0=e=>{let{data:t,loading:n}=ek({resource:"availableActions",action:"list"});return n?(0,A.jsx)(eD.A,{}):(0,A.jsx)(NZ.Provider,{value:null==t?void 0:t.data,children:e.children})},N1=()=>(0,es.useContext)(NZ),N2=()=>(0,A.jsx)("div",{children:(0,A.jsx)(eV.Provider,{value:{designable:!1},children:(0,A.jsx)(N0,{children:(0,A.jsx)(al,{schema:NQ,components:{MenuItemsProvider:NE,SettingCenterPermissionProvider:NK,PermissionProvider:NU}})})})}),N6={name:"rolesResourcesScopes",fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Scope name")}}',type:"string","x-component":"Input",required:!0}}]},N3={type:"object",properties:{scope:{"x-component":"RecordPicker","x-component-props":{size:"small",fieldNames:{label:"name",value:"id"},multiple:!1,association:{target:"rolesResourcesScopes"},onChange:"{{ onChange }}"},properties:{selector:{type:"void",title:'{{ t("Select record") }}',"x-component":"RecordPicker.Selector","x-component-props":{className:"tb-record-picker-selector"},properties:{tableBlock:{type:"void","x-decorator":"TableSelectorProvider","x-decorator-props":{collection:N6,resource:"rolesResourcesScopes",action:"list",params:{pageSize:20},useParams:()=>({filter:{$or:[{resourceName:(0,es.useContext)(N9).name},{resourceName:null}]}}),rowKey:"id"},"x-component":"BlockItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{ t("Add new") }}',"x-action":"create","x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"rolesResourcesScopes",collection:N6},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":()=>{let{name:e}=(0,es.useContext)(N9),t=Tp();return(0,es.useEffect)(()=>{t.form.setInitialValues({resourceName:e})},[e]),{form:t.form}},properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>({options:d0((0,es.useContext)(N9).name)}),"x-component-props":{dynamicComponent:rW}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}}},value:{type:"array","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"rolesResourcesScopes",collection:N6,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>({options:d0((0,es.useContext)(N9).name)}),"x-component-props":{dynamicComponent:rW}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{update:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},N5=(0,es.createContext)(null);N5.displayName="RolesResourcesScopesSelectedRowKeysContext";let N4=e=>{let[t,n]=(0,es.useState)([]);return(0,A.jsx)(N5.Provider,{value:[t,n],children:e.children})},N8=()=>(0,es.useContext)(N5),N7=e=>{let t=(0,es.useMemo)(()=>(0,ec.createForm)({values:{scope:e.value}}),[]);return(0,A.jsx)(ae,{form:t,children:(0,A.jsx)(al,{components:{RolesResourcesScopesSelectedRowKeysProvider:N4},scope:{onChange(t){var n;null==e||null==(n=e.onChange)||n.call(e,t)}},schema:N3})})},N9=(0,es.createContext)({});N9.displayName="RoleResourceCollectionContext";let Me=(0,ec.connect)(e=>{var t,n,o,l,r,i;let a,{styles:s}=wm(),c=t=>{let n=t.map(e=>({...e,scope:(0,ed.isEmpty)(e.scope)?null:e.scope}));e.onChange(n)};(0,ec.useForm)();let d=m3(),u=N1(),{getCollection:p,getCollectionFields:m}=sO(),h=p(d.collectionName),x=m(d.collectionName),f=eB(),{t:v}=(0,eT.useTranslation)(),g=(r=(0,ec.useField)().value||[],a={},null==r||null==(i=r.forEach)||i.call(r,e=>{e.name&&(a[e.name]=e,a[e.name].scope=(0,ed.isEmpty)(e.scope)?null:e.scope)}),a),y=(e,t)=>{var n;let o=null==g?void 0:g[e];return!!o&&(null==o||null==(n=o.fields)?void 0:n.includes(t))},b=u.filter(e=>e.allowConfigureFields),C=null==x||null==(t=x.filter(e=>e.interface))?void 0:t.map(e=>{let t={...e};for(let n of b)t[n.name]=y(n.name,e.name);return t}),S=e=>{if(g[e])delete g[e];else{var t,n;g[e]={name:e,fields:null==x||null==(n=x.filter(e=>e.interface))||null==(t=n.map)?void 0:t.call(n,e=>e.name)}}c(Object.values(g))},w={};for(let e of b)w[e.name]=(null==x||null==(n=x.filter(e=>e.interface))?void 0:n.length)===(null==g||null==(l=g[e.name])||null==(o=l.fields)?void 0:o.length);return(0,A.jsx)("div",{children:(0,A.jsx)(N9.Provider,{value:h,children:(0,A.jsxs)(eh.FormLayout,{layout:"vertical",children:[(0,A.jsx)(eh.FormItem,{label:v("Action permission"),children:(0,A.jsx)(xF.A,{className:s,size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:v("Action display name"),render:e=>f(e)},{dataIndex:"onNewRecord",title:v("Action type"),render:e=>e?(0,A.jsx)(nz.A,{color:"green",children:v("Action on new records")}):(0,A.jsx)(nz.A,{color:"geekblue",children:v("Action on existing records")})},{dataIndex:"enabled",title:v("Allow"),render:(e,t)=>(0,A.jsx)(j0.A,{checked:e,onChange:()=>{S(t.name)}})},{dataIndex:"scope",title:v("Data scope"),render:(e,t)=>!t.onNewRecord&&(0,A.jsx)(N7,{value:e,onChange:e=>{var n;n=t.name,g[n]?(g[n].scope=e,c(Object.values(g))):(S(n),g[n].scope=e)}})}],dataSource:null==u?void 0:u.map(e=>{let t=!1,n=null;return g[e.name]&&(t=!0,e.onNewRecord||(n=g[e.name].scope)),{...e,enabled:t,scope:n}})})}),(0,A.jsx)(eh.FormItem,{label:v("Field permission"),children:(0,A.jsx)(xF.A,{className:s,pagination:!1,dataSource:C,columns:[{dataIndex:["uiSchema","title"],title:v("Field display name"),render:e=>f(e)},...b.map(e=>{let t=null==w?void 0:w[e.name];return{dataIndex:e.name,title:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(j0.A,{checked:t,onChange:()=>{let n=g[e.name]||{name:e.name};if(t)n.fields=[];else{var o;n.fields=null==x||null==(o=x.map)?void 0:o.call(x,e=>e.name)}g[e.name]=n,c(Object.values(g))}})," ",f(e.displayName)]}),render:(t,n)=>(0,A.jsx)(j0.A,{checked:t,"aria-label":"".concat(e.name,"_checkbox"),onChange:()=>{let o=g[e.name]||{name:e.name},l=o.fields||[];if(t){let e=l.indexOf(n.name);l.splice(e,1)}else l.push(n.name);o.fields=l,g[e.name]=o,c(Object.values(g))}})}})]})})]})})})}),Mt=e=>{let t=[];for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let o=e[n];"all"===o?t.push(n):t.push("".concat(n,":").concat(o))}return t},Mn=(0,ec.connect)(e=>{let{onChange:t}=e,n=N1(),o=eB(),{t:l}=(0,eT.useTranslation)(),r=(e=>{var t;if(!e)return{};let n={};return null==e||null==(t=e.forEach)||t.call(e,e=>{let[t,o]=e.split(":");n[t]=o||"all"}),n})((0,ec.useField)().value);return(0,A.jsx)("div",{children:(0,A.jsx)(xF.A,{size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:l("Action display name"),render:e=>o(e)},{dataIndex:"onNewRecord",title:l("Action type"),render:e=>e?(0,A.jsx)(nz.A,{color:"green",children:l("Action on new records")}):(0,A.jsx)(nz.A,{color:"geekblue",children:l("Action on existing records")})},{dataIndex:"enabled",title:l("Allow"),render:(e,n)=>(0,A.jsx)(j0.A,{checked:e,"aria-label":"".concat(n.name,"_checkbox"),onChange:o=>{e?delete r[n.name]:r[n.name]="all",t(Mt(r))}})},{dataIndex:"scope",title:l("Data scope"),render:(e,n)=>!n.onNewRecord&&(0,A.jsx)(oo.A,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:e,options:[{label:l("All records"),value:"all"},{label:l("Own records"),value:"own"}],onChange:e=>{r[n.name]=e,t(Mt(r))}})}],dataSource:null==n?void 0:n.map(e=>{let t="all",n=!1;return r[e.name]&&(n=!0,t=r[e.name]),{...e,enabled:n,scope:t}})})})});var Mo=n(43377),Ml=n(46884),Mr=n(18861),Mi=n(80653),Ma=n(20496),Ms=n(64170),Mc=n(65242);let Md=()=>{let e=os().getComponent("CustomAdminContent");return e?(0,A.jsx)(e,{}):(0,A.jsx)(ep.Outlet,{})};var Mu=n(40497),Mp=n(9553);let Mm=(0,es.createContext)({items:{}});function Mh(){let e=(0,ns._)(["\n display: inline-block;\n .ant-btn {\n border: 0;\n height: var(--tb-header-height);\n width: 46px;\n border-radius: 0;\n background: none;\n color: rgba(255, 255, 255, 0.65);\n &:hover {\n background: rgba(255, 255, 255, 0.1) !important;\n }\n }\n .ant-float-btn {\n margin-bottom: 16px;\n }\n "]);return Mh=function(){return e},e}Mm.displayName="PinnedPluginListContext";let Mx=e=>{let{children:t,items:n}=e,o=(0,es.useContext)(Mm);return(0,A.jsx)(Mm.Provider,{value:{items:{...o.items,...n}},children:t})},Mf=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(Mh())}}),Mv=e=>{let{belongToFilter:t}=e,{allowAll:n,snippets:o}=NA(),l=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n||t||(null==o?void 0:o.includes(e))},{styles:r}=Mf(t),i=(0,es.useContext)(Mm),{components:a}=(0,es.useContext)(ec.SchemaOptionsContext);return(0,A.jsx)("div",{className:r.container,children:Object.keys(i.items).filter(e=>i.items[e].belongTo===t).sort((e,t)=>i.items[e].order-i.items[t].order).filter(e=>l(i.items[e].snippet,i.items[e].isPublic)).map(e=>{let t=(0,ed.get)(a,i.items[e].component);return t?(0,A.jsx)(t,{},e):null})})},Mg=e=>(0,A.jsx)(Tq,{children:(0,A.jsx)(ug,{children:(0,A.jsx)(uw,{children:(0,A.jsx)(hU,{children:(0,A.jsx)(o4,{children:(0,A.jsx)(Nb,{children:e.children})})})})})});var My=n(96140);let Mb=()=>{let e=os().getComponent("CustomAdminHeader");return e?(0,A.jsx)(e,{}):null},MC=(e,t)=>{let{allowAll:n,allowMenuItemIds:o=[]}=t;if(n)return e;let l=e=>{if(e){for(let t in e.properties)if(Object.prototype.hasOwnProperty.call(e.properties,t)){let n=e.properties[t];n["x-uid"]&&!o.includes(n["x-uid"])&&delete e.properties[t],n["x-uid"]&&l(n)}}};return l(e),e},MS=(0,es.createContext)(null);MS.displayName="SchemaIdContext";let Mw=()=>{let e=(0,es.useContext)(MS);return{selectedUid:e,defaultSelectedUid:e}},MF=e=>{let{sideMenuRef:t}=e,{setTitle:n}=wT(),o=(0,ep.useNavigate)(),l=(0,ep.useParams)(),r=(0,ep.useLocation)(),i=(0,ep.useMatch)("/admin"),a=(0,ep.useMatch)("/admin/welcome"),s=(0,ep.useMatch)("/admin/:name"),c=l.name,d=NA(),[u,p]=(0,es.useState)(null),m=NR(),{data:h,loading:x}=ek({url:"/uiSchemas:getJsonSchema/".concat(m)},{refreshDeps:[m],onSuccess(e){let t=MC(null==e?void 0:e.data,d);if(i&&!a){let e=Ii(t);e?(o("/admin/".concat(e["x-uid"])),n(e.title)):o("/admin/welcome");return}if(!s||a)return;let l=Ir(t,c);if(l)n(l.title);else{let e=Ii(t);e?(o("/admin/".concat(e["x-uid"])),n(e.title)):o("/admin/")}}}),f=(0,ep.useMatch)("/admin/:name");(0,es.useEffect)(()=>{if(f){let e=Ir(MC(null==h?void 0:h.data,d),c);e&&n(e.title)}},[null==h?void 0:h.data,r.pathname,c]),(0,es.useEffect)(()=>{var e,n,o;let i=(null==(e=Object.values((null==u||null==(n=u.root)?void 0:n.properties)||{}).shift())?void 0:e.properties)||(null==h||null==(o=h.data)?void 0:o.properties);if(null==t?void 0:t.current){let e=i&&Object.values(i).find(e=>e["x-uid"]===l.name&&"Menu.Item"===e["x-component"]),n=null==r?void 0:r.pathname.includes("/settings");e||n?t.current.style.display="none":t.current.style.display="block"}},[null==h?void 0:h.data,l.name,t]);let v=(0,es.useMemo)(()=>{let e=MC(null==h?void 0:h.data,d);return(null==e?void 0:e["x-component-props"])&&(e["x-component-props"].useProps=Mw),e},[null==h?void 0:h.data]);if(!x)return(0,A.jsx)(MS.Provider,{value:c,children:(0,A.jsx)(al,{memoized:!0,scope:{useMenuProps:Mw,onSelect:e=>{let{item:t}=e,l=t.props.schema||{};n(l.title),p(l),o("/admin/".concat(l["x-uid"]))},sideMenuRef:t,defaultSelectedUid:c},schema:v})})};function Mj(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column;\n height: 100vh;\n max-height: 100vh;\n "]);return Mj=function(){return e},e}function MA(){let e=(0,ns._)(["\n .ant-menu.ant-menu-dark .ant-menu-item-selected,\n .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected,\n .ant-menu-submenu-horizontal.ant-menu-submenu-selected {\n background-color: "," !important;\n color: "," !important;\n }\n .ant-menu-submenu-horizontal.ant-menu-submenu-selected > .ant-menu-submenu-title {\n color: "," !important;\n }\n .ant-menu-dark.ant-menu-horizontal > .ant-menu-item:hover {\n background-color: "," !important;\n color: "," !important;\n }\n\n height: var(--tb-header-height);\n line-height: var(--tb-header-height);\n padding: 0;\n background-color: "," !important;\n\n .ant-menu {\n background-color: transparent;\n }\n\n .ant-menu-item,\n .ant-menu-submenu-horizontal {\n color: "," !important;\n }\n "]);return MA=function(){return e},e}function Mk(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n "]);return Mk=function(){return e},e}function MI(){let e=(0,ns._)(["\n position: relative;\n z-index: 1;\n flex: 1 1 auto;\n display: flex;\n height: 100%;\n "]);return MI=function(){return e},e}function MP(){let e=(0,ns._)(["\n display: inline-flex;\n flex-shrink: 0;\n color: #fff;\n padding: 0;\n align-items: center;\n padding: 0 12px 0 12px;\n cursor: pointer;\n "]);return MP=function(){return e},e}function MT(){let e=(0,ns._)(["\n object-fit: contain;\n height: 28px;\n "]);return MT=function(){return e},e}function MN(){let e=(0,ns._)(["\n color: #fff;\n height: 32px;\n margin: 0 0 0 12px;\n font-weight: 600;\n font-size: 18px;\n line-height: 32px;\n "]);return MN=function(){return e},e}function MM(){let e=(0,ns._)(["\n display: inline-flex;\n position: relative;\n flex-shrink: 0;\n height: 100%;\n z-index: 10;\n "]);return MM=function(){return e},e}function MD(){let e=(0,ns._)(["\n flex: 1 1 auto;\n display: flex;\n width: 0;\n overflow: hidden;\n white-space: nowrap;\n margin: 0;\n "]);return MD=function(){return e},e}function MR(){let e=(0,ns._)(["\n flex: 1;\n "]);return MR=function(){return e},e}function Mq(){let e=(0,ns._)(["\n height: 100%;\n position: relative;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 100;\n "]);return Mq=function(){return e},e}function M_(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column;\n position: relative;\n height: 100%;\n > div {\n position: relative;\n }\n .ant-layout-content {\n height: calc(100vh - var(--tb-header-height));\n overflow: auto;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "]);return M_=function(){return e},e}let MO=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{layout:t(Mj()),header:t(MA(),n.colorBgHeaderMenuActive,n.colorTextHeaderMenuActive,n.colorTextHeaderMenuActive,n.colorBgHeaderMenuHover,n.colorTextHeaderMenuHover,n.colorBgHeader,n.colorTextHeaderMenu),headerA:t(Mk()),headerB:t(MI()),titleContainer:t(MP()),logo:t(MT()),title:t(MN()),right:t(MM()),headerTabs:t(MD()),notice:t(MR()),sider:t(Mq()),main:t(M_())}}),MB=e=>{var t,n,o,l,r;let i=(0,es.useRef)(),a=wg(),s=os(),c=(0,ep.useParams)(),{styles:d}=MO();return(0,A.jsxs)(My.A,{className:d.layout,children:[(0,A.jsx)(My.A.Header,{className:d.header,children:(0,A.jsxs)("div",{className:d.headerA,children:[(0,A.jsxs)("div",{className:d.headerB,children:[(0,A.jsxs)("div",{className:d.titleContainer,onClick:()=>{location.href=s.adminUrl},children:[(0,A.jsx)("img",{className:d.logo,src:null==a||null==(o=a.data)||null==(n=o.data)||null==(t=n.logo)?void 0:t.url}),(0,A.jsx)("h1",{className:d.title,children:null==a||null==(r=a.data)||null==(l=r.data)?void 0:l.title})]}),(0,A.jsx)(MF,{sideMenuRef:i}),(0,A.jsx)("div",{className:d.headerTabs,children:(0,A.jsx)(Mb,{})})]}),(0,A.jsxs)("div",{className:d.right,children:[(0,A.jsx)(Mv,{belongToFilter:"pinnedmenu"}),(0,A.jsx)(uP,{})]})]})}),(0,A.jsxs)(My.A,{children:[c.name&&(0,A.jsx)(My.A.Sider,{className:d.sider,theme:"light",ref:i}),(0,A.jsx)(My.A.Content,{className:d.main,children:(0,A.jsx)("div",{className:"amplifier-block",children:(0,A.jsx)(Md,{})})})]})]})},ME=(0,ec.observer)(e=>{let t=T_();return t.manager.currentStatus?(0,A.jsx)(ov.A,{banner:!0,message:t.manager.currentStatus}):""},{displayName:"NoticeArea"}),MV=e=>(0,A.jsxs)(Mg,{children:[(0,A.jsx)(ME,{}),(0,A.jsx)(MB,{...e}),(0,A.jsx)(Mp.A.Group,{trigger:"click",type:"default",style:{right:24,zIndex:1250},icon:(0,A.jsx)(Mu.A,{}),children:(0,A.jsx)(Mv,{belongToFilter:"hoverbutton"})})]});class Mz extends eR{async afterAdd(){await this.app.pm.add(rv)}async load(){this.app.addComponents({AdminLayout:MV})}}function ML(){let e=(0,ns._)(["\n /* Depends on antd's ProLayout component structure */\n .ant-pro-global-header-logo {\n cursor: pointer;\n }\n "]);return ML=function(){return e},e}let MG=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{settingLayout:t(ML())}}),MK=e=>{var t,n,o,l,r,i,a,s;let{selectedKeys:c,onClick:d,route:u,children:p,fullscreen:m}=e,h=os(),x=(0,ep.useLocation)(),f=(0,ep.useNavigate)(),{data:v}=ub(),g=wg(),{styles:y}=MG();return(0,A.jsx)(Mg,{children:(0,A.jsx)(Ma.TY,{hashed:!1,children:(0,A.jsx)(Ms.i,{className:y.settingLayout,title:null==g||null==(n=g.data)||null==(t=n.data)?void 0:t.title,logo:(0,A.jsx)("img",{src:null==g||null==(r=g.data)||null==(l=r.data)||null==(o=l.logo)?void 0:o.url}),onMenuHeaderClick:()=>{h.adminUrl.startsWith("/")?f(h.adminUrl):window.location.href=h.adminUrl},bgLayoutImgList:[{src:"https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png",left:85,bottom:100,height:"303px"},{src:"https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png",bottom:-68,right:-45,height:"303px"},{src:"https://img.alicdn.com/imgextra/i3/O1CN018NxReL1shX85Yz6Cx_!!6000000005798-2-tps-884-496.png",bottom:0,left:0,width:"331px"}],route:u,token:{header:{colorBgMenuItemSelected:"rgba(0,0,0,0.04)"}},location:x,siderMenuType:"group",menuProps:{onClick:d,selectedKeys:c},menu:{collapsedShowGroupTitle:!0},avatarProps:{src:"https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg",size:"small",title:(null==v||null==(i=v.data)?void 0:i.nickname)||(null==v||null==(a=v.data)?void 0:a.username)||(null==v||null==(s=v.data)?void 0:s.email),render:(e,t)=>(0,A.jsx)(nX.A,{dropdownRender:()=>(0,A.jsx)(uA,{}),children:t})},actionsRender:e=>e.isMobile||"undefined"==typeof window?[]:[(0,A.jsx)(e3.Ay,{type:"text",onClick:()=>{f("/admin")},icon:(0,A.jsx)(Mo.A,{},"HomeFilled")}),(0,A.jsx)(e3.Ay,{type:"text",target:"_blank",href:"https://tachybase.org",icon:(0,A.jsx)(Ml.A,{},"InfoCircleFilled")}),(0,A.jsx)(e3.Ay,{type:"text",target:"_blank",href:"https://github.com/tegojs/tego-standard/issues",icon:(0,A.jsx)(Mr.A,{},"QuestionCircleFilled")}),(0,A.jsx)(e3.Ay,{type:"text",target:"_blank",href:"https://github.com/tegojs/tego-standard",icon:(0,A.jsx)(Mi.A,{},"GithubFilled")})],pageTitleRender:!1,headerTitleRender:(e,t,n)=>{let o=(0,A.jsxs)(A.Fragment,{children:[e,t]});return"undefined"==typeof window||document.body.clientWidth<1400||n.isMobile?o:(0,A.jsx)(A.Fragment,{children:o})},...{fixSiderbar:!0,layout:"mix",splitMenus:!1,navTheme:"light",contentWidth:"Fluid",fixedHeader:!0,siderMenuType:"sub"},headerContentRender:()=>(0,A.jsx)(ME,{}),contentStyle:{padding:0},children:m?p:(0,A.jsx)(Mc.LN,{children:p})})})})},M$=(0,es.createContext)({});M$.displayName="SettingsCenterContext";let MU=()=>{var e;let t=os(),n=(0,ep.useNavigate)(),o=(0,ep.useLocation)(),l=eB(),r=(0,es.useMemo)(()=>{let e=t.systemSettingsManager.getList();return!function e(t){t.forEach(t=>{var n;t.title=l(t.title),t.label=l(t.title),(null==(n=t.children)?void 0:n.length)&&e(t.children)})}(e),e},[t.systemSettingsManager,l]),i=(0,es.useMemo)(()=>(function e(t){return t.map(t=>{var n;return t.path.includes(":")&&(t.hideInMenu=!0),t.title=l(t.title),t.label=l(t.title),(null==(n=t.children)?void 0:n.length)&&(t.children=e(t.children)),{...t,name:t.label}})})(t.systemSettingsManager.getList()),[t.systemSettingsManager,l]),a=(0,es.useCallback)(e=>{var t;if(!e||!e.length)return"/_admin";let n=e[0];return(null==(t=n.children)?void 0:t.length)?a(n.children):n.path},[]),s=(0,es.useMemo)(()=>{let e={},t=n=>{n.forEach(n=>{var o;e[n.path]=n,(null==(o=n.children)?void 0:o.length)&&t(n.children)})};return t(r),e},[r]),c=(0,es.useMemo)(()=>{let e={},t=n=>{n.forEach(n=>{var o;e[n.key]=n,(null==(o=n.children)?void 0:o.length)&&t(n.children)})};return t(r),e},[r]),d=(0,es.useMemo)(()=>(function(e,t){let n=Object.keys(e);if(e[t])return e[t];for(let o of n){let n=o.replace(/:[^/]+/g,"([^/]+)");if(t.match(new RegExp("^".concat(n,"$"))))return e[o]}return null})(s,o.pathname),[o.pathname,s]);return d&&o.pathname!==Ne&&o.pathname!==Ne+"/"?(0,A.jsx)(MK,{fullscreen:!!(null==d?void 0:d.fullscreen),route:{path:"/",children:i},selectedKeys:[null!=(e=null==d?void 0:d.groupKey)?e:null==d?void 0:d.key],onClick:e=>{let{key:t}=e,o=c[t];(null==o?void 0:o.path)&&n(o.path)},children:d?(0,A.jsx)(ep.Outlet,{}):(0,A.jsx)(e6.Ay,{status:"404",title:"404",subTitle:"Sorry, the page you visited does not exist."})}):(0,A.jsx)(ep.Navigate,{replace:!0,to:a(r)})};var MW=n(76730);let MH=()=>{let e=eB(),{token:t}=iF(),n=os(),o=n.userSettingsManager.getList(),l=[];o.filter(e=>!1!==e.isTopLevel).forEach(t=>{l.push({key:"userSetting:"+t.name,icon:t.icon,label:(0,A.jsx)(eN.Link,{to:t.path,children:e(t.title)})})}),l.push({type:"divider"});let r=(0,es.useMemo)(()=>(function t(n){return n.filter(e=>!e.path.includes(":")).map(n=>{var o;return n.title=e(n.title),n.label=(0,A.jsx)(eN.Link,{to:n.path,children:e(n.title)}),(null==(o=n.children)?void 0:o.length)&&(n.children=t(n.children),n.label=e(n.title)),{key:n.key,label:n.label,path:n.path,children:n.children,name:n.title}})})(n.systemSettingsManager.getList()),[n.systemSettingsManager,e]);return l.push(...r),(0,A.jsx)(nX.A,{menu:{style:{maxHeight:"70vh",overflow:"auto"},items:l},children:(0,A.jsx)(e3.Ay,{"data-testid":"plugin-settings-button",icon:(0,A.jsx)(MW.A,{style:{color:t.colorTextHeaderMenu}})})})};var MY=n(25619),MX=n(81770);function MJ(){let e=(0,ns._)(["\n .ant-card-actions {\n li .ant-space {\n gap: 2px !important;\n }\n li a {\n .anticon {\n margin-right: 3px;\n /* display: none; */\n }\n }\n li:last-child {\n width: 20% !important;\n }\n li:first-child {\n width: 80% !important;\n border-inline-end: 0;\n text-align: left;\n padding-left: 16px;\n }\n }\n "]);return MJ=function(){return e},e}let MQ=(0,nu.rU)(e=>{let{token:t,css:n}=e;return{cardActionDisabled:{color:t.colorTextDisabled,cursor:"not-allowed"},pageHeader:{backgroundColor:t.colorBgContainer,paddingTop:t.paddingSM,paddingBottom:0,paddingInline:t.paddingLG,".ant-page-header-footer":{marginBlockStart:"0"},"& .ant-tabs-nav":{marginBottom:0},".ant-page-header-heading-title":{color:t.colorText}},pageContent:{margin:t.marginLG},PluginDetailBaseInfo:{display:"flex",flexDirection:"column",marginBottom:t.margin},PluginDocument:{background:t.colorBgContainer,padding:t.paddingLG,height:"60vh",overflowY:"auto"},avatar:{".ant-card-meta-avatar":{marginTop:"8px",".ant-avatar":{borderRadius:"2px"}}},version:{display:"block",color:t.colorTextDescription,fontWeight:"normal",fontSize:t.fontSize},card:n(MJ())}}),MZ=(0,es.memo)(e=>{let{isDarkTheme:t}=yS(),{componentCls:n,hashId:o}=kB({isDarkTheme:t}),{styles:l}=MQ(),{url:r,packageName:i}=e,[a,s]=(0,es.useState)(r),{data:c,loading:d,error:u}=ek({url:a,baseURL:"/"},{refreshDeps:[a]}),{html:p,loading:m}=kL(c),h=(0,es.useMemo)(()=>{if(p){let e=p;return(e=e.replace(/<a\s+href="\..*?\/([^/]+)"/g,(e,t)=>e+'onclick="return false;"')).replace(/src="(.*?)"/g,(e,t)=>t.startsWith("http")||t.startsWith("//:")?e:'src="'.concat("/static/plugins/").concat(i,"/").concat(t,'"'))}return""},[p,i]),x=(0,es.useCallback)(e=>{let t=e.target.getAttribute("href");if(!t)return;let n=new URL(a,window.location.origin);s(new URL(t,n).pathname)},[]);return(0,es.useEffect)(()=>(document.getElementById("pm-md-preview").addEventListener("click",x),()=>{removeEventListener("click",x)}),[x]),(0,A.jsx)("div",{className:l.PluginDocument,id:"pm-md-preview",children:d||m?(0,A.jsx)(eD.A,{}):(0,A.jsx)("div",{className:"".concat(n," ").concat(o," tb-markdown tb-markdown-default tb-markdown-table"),dangerouslySetInnerHTML:{__html:u?"":h}})})});MZ.displayName="PluginDocument";let M0=e=>{var t,n,o,l,r,i,a,s,c,d;let{plugin:u,onCancel:p}=e,{t:m}=(0,eT.useTranslation)(),h=(0,es.useMemo)(()=>[{title:m("Name"),dataIndex:"name",key:"name"},{title:m("Version range"),dataIndex:"versionRange",key:"versionRange"},{title:m("Plugin's version"),dataIndex:"packageVersion",key:"packageVersion"},{title:m("Result"),dataIndex:"result",key:"result",render:e=>(0,A.jsx)(nz.A,{color:e?"success":"error",children:e?"Yes":"No"})}],[m]),{data:x,loading:f}=ek({url:"pm:get",params:{filterByTk:u.name}},{refreshDeps:[u.name],ready:!!u.name}),v=(0,es.useMemo)(()=>{var e,t,n;if(!(null==x||null==(t=x.data)||null==(e=t.packageJson)?void 0:e.repository))return null;let o=null==x||null==(n=x.data)?void 0:n.packageJson.repository;return("string"==typeof o?o:o.url).replace(/\.git$/,"").replace(/^git\+/,"")},[x]),g=(0,es.useMemo)(()=>{var e;let t=null==x||null==(e=x.data)?void 0:e.packageJson.author;return t?"string"==typeof t?t:t.name:null},[x]),{styles:y,theme:b}=MQ(),C=[{key:"readme",label:m("Readme"),children:(0,A.jsxs)(nc.A,{gutter:20,children:[u.name&&(0,A.jsx)(nd.A,{span:12,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("Name")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:u.name})]})}),u.displayName&&(0,A.jsx)(nd.A,{span:12,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("DisplayName")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:u.displayName})]})}),(0,A.jsx)(nd.A,{span:24,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("PackageName")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:u.packageName})]})}),v&&(0,A.jsx)(nd.A,{span:24,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("Repository")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:v})]})}),(null==x||null==(t=x.data)?void 0:t.packageJson.homepage)&&(0,A.jsx)(nd.A,{span:24,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("Homepage")}),(0,A.jsx)("a",{href:null==x||null==(n=x.data)?void 0:n.packageJson.homepage,target:"_blank",rel:"noreferrer",children:null==x||null==(o=x.data)?void 0:o.packageJson.homepage})]})}),u.description&&(0,A.jsx)(nd.A,{span:24,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("Description")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:u.description})]})}),(null==x||null==(l=x.data)?void 0:l.packageJson.license)&&(0,A.jsx)(nd.A,{span:12,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("License")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:null==x||null==(r=x.data)?void 0:r.packageJson.license})]})}),g&&(0,A.jsx)(nd.A,{span:12,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("Author")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:g})]})}),(0,A.jsx)(nd.A,{span:12,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("Last updated")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:P()(null==x||null==(i=x.data)?void 0:i.lastUpdated).fromNow()})]})}),(0,A.jsx)(nd.A,{span:12,children:(0,A.jsxs)("div",{className:y.PluginDetailBaseInfo,children:[(0,A.jsx)(e2.A.Text,{type:"secondary",children:m("Version")}),(0,A.jsx)(e2.A.Text,{strong:!0,children:null==u?void 0:u.version})]})})]})},{key:"dependencies",label:m("Dependencies compatibility check"),children:(0,A.jsx)(A.Fragment,{children:(null==x||null==(a=x.data)?void 0:a.depsCompatible)===!1?(0,A.jsx)(e2.A.Text,{type:"danger",children:m("`dist/externalVersion.js` not found or failed to `require`. Please rebuild this plugin.")}):(0,A.jsxs)(A.Fragment,{children:[!(null==x||null==(s=x.data)?void 0:s.isCompatible)&&(0,A.jsx)(ov.A,{showIcon:!0,type:"error",message:m("Plugin dependencies check failed, you should change the dependent version to meet the version requirements.")}),(0,A.jsx)(xF.A,{style:{marginTop:b.margin},rowKey:"name",pagination:!1,columns:h,dataSource:null==x||null==(c=x.data)?void 0:c.depsCompatible})]})})},{key:"changelog",label:m("Changelog"),children:(null==u?void 0:u.changelogUrl)?(0,A.jsx)(MZ,{url:null==u?void 0:u.changelogUrl}):m("No CHANGELOG.md file")}];return(0,A.jsx)(ox.A,{open:!!u,footer:!1,destroyOnClose:!0,width:600,onCancel:p,children:f?(0,A.jsx)(eD.A,{}):u&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(e2.A.Title,{level:3,children:u.packageName}),(0,A.jsxs)(of.A,{split:(0,A.jsx)("span",{children:"\xa0•\xa0"}),children:[(0,A.jsx)("span",{children:u.version}),(0,A.jsxs)("span",{children:[m("Last updated")," ",P()(null==x||null==(d=x.data)?void 0:d.lastUpdated).fromNow()]})]}),(0,A.jsx)(wd.A,{style:{minHeight:"50vh"},items:C,defaultActiveKey:u.isCompatible?void 0:"dependencies"})]})})},M1=e=>{let{name:t,enabled:n,builtIn:o,error:l,isCompatible:r}=e,i=eC(),{t:a}=(0,eT.useTranslation)(),{modal:s,message:c}=eX.A.useApp();return(0,A.jsx)(oh.A,{"aria-label":"enable",size:"small",disabled:o||l,onChange:async(e,n)=>{(n.stopPropagation(),!r&&e)?c.error(a("Dependencies check failed, can't enable.")):e?await i.request({url:"pm:enable",params:{filterByTk:t}}):s.confirm({title:a("Are you sure to disable this plugin?"),onOk:async()=>{await i.request({url:"pm:disable",params:{filterByTk:t}})}})},checked:!!n},"enable")},M2=e=>{let{record:t}=e,[n,o]=(0,es.useState)(void 0);return(0,A.jsxs)(A.Fragment,{children:[n&&(0,A.jsx)(M0,{plugin:n,onCancel:()=>o(void 0)}),(0,A.jsx)(e3.Ay,{type:"link",onClick:()=>{o(t)},children:fG.t("View")})]})},M6=e=>{let{description:t,record:n}=e,{theme:o}=MQ();return(0,A.jsx)(e2.A.Paragraph,{type:n.isCompatible?"secondary":"danger",children:n.isCompatible?t:fG.t("Plugin dependencies check failed")})},M3=()=>{let{t:e}=(0,eT.useTranslation)(),{theme:t}=MQ(),{data:n,loading:o,refresh:l}=ek({url:"pm:list"}),[r,i]=(0,es.useState)(""),[a,s]=(0,es.useState)("all"),[c,d]=(0,es.useState)([]),u=(0,es.useMemo)(()=>[{title:e("Index"),dataIndex:"index",key:"index",render:(e,t,n)=>(0,A.jsx)("span",{children:n+1}),width:80,align:"center"},{title:e("Name"),dataIndex:"name",key:"name",render:(e,t)=>{let{displayName:n,name:o,packageName:l}=t;return(0,A.jsx)("span",{children:n||o||l})}},{title:e("PackageName"),dataIndex:"packageName",key:"packageName",render:(e,t)=>{let{packageName:n}=t;return(0,A.jsx)("span",{children:n})}},{title:e("Version"),dataIndex:"version",key:"version",render:(e,t)=>{let{version:n}=t;return(0,A.jsx)("span",{children:n})}},{title:e("Keywords"),dataIndex:"keywords",key:"keywords",render:t=>null==t?void 0:t.map(t=>(0,A.jsx)(nz.A,{children:e(t)},t))},{title:e("Description"),dataIndex:"description",key:"description",render:(e,t)=>(0,A.jsx)(M6,{description:e,record:t})},{title:e("Action"),key:"action",render:(e,t)=>(0,A.jsxs)(of.A,{size:"middle",children:[(0,A.jsx)(M2,{record:t}),(0,A.jsx)(M1,{...t})]})}],[]),p=(0,es.useMemo)(()=>((null==n?void 0:n.data)||[]).filter(e=>{var t;return(0,eh.fuzzysearch)(r,e.name)||(0,eh.fuzzysearch)(r,e.packageName)||(0,eh.fuzzysearch)(r,null!=(t=e.description)?t:"")||(0,eh.fuzzysearch)(r,e.displayName)}).filter(e=>"all"===a||"enabled"===a&&e.enabled||"disabled"===a&&!e.enabled).filter(e=>0===c.length||c.some(t=>{var n;return null==(n=e.keywords)?void 0:n.includes(t)})).sort((e,t)=>e.builtIn===t.builtIn?e.id-t.id:e.builtIn?-1:1),[null==n?void 0:n.data,a,c,r]),m=(0,es.useMemo)(()=>{let e=(null==n?void 0:n.data)||[];return[{type:"All",list:e=e.reverse()},{type:"Built-in",list:eu().filter(e,e=>e.builtIn)},{type:"Enabled",list:eu().filter(e,e=>e.enabled)},{type:"Not enabled",list:eu().filter(e,e=>!e.enabled)},{type:"Problematic",list:eu().filter(e,e=>!e.isCompatible)}]},[null==n?void 0:n.data]),[h,x]=(0,es.useState)(0),[f,v]=(0,es.useState)(null),g=(0,MY.A)(r,{wait:100}),y=["Data model tools","Data sources","Collections","Collection fields","Blocks","Actions","Workflow","Users & permissions","Authentication","System management","Logging and monitoring","Others"],b=(0,es.useMemo)(()=>y.map(e=>{if("Others"===e)return{key:e,list:null==n?void 0:n.data.filter(e=>!e.keywords||!e.keywords.every(e=>y.includes(e)))};let t=null==n?void 0:n.data.filter(t=>{var n;return null==(n=t.keywords)?void 0:n.includes(e)});return{key:e,list:t}}),[y]);return((0,es.useMemo)(()=>{var e;let t=(null==(e=m[h])?void 0:e.list)||[];!h&&f?t=b.find(e=>e.key===f).list:h&&f&&(t=b.find(e=>e.key===f).list.filter(e=>t.find(t=>t.name===e.name)));let n=g.toLocaleLowerCase().trim();return n&&(t=eu().filter(t,e=>String(e.displayName||"").toLocaleLowerCase().includes(n)||String(e.description||"").toLocaleLowerCase().includes(n))),t.sort((e,t)=>e.displayName.localeCompare(t.displayName))},[h,m,g,f]),o)?(0,A.jsx)(eD.A,{}):(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)(rZ.A,{style:{marginTop:"8px"},children:[(0,A.jsxs)(MX.A,{style:{marginBottom:"8px"},layout:"inline",children:[(0,A.jsx)(MX.A.Item,{label:e("Status"),children:(0,A.jsx)(sU.Ay.Group,{options:[{label:e("all"),value:"all"},{label:e("enabled"),value:"enabled"},{label:e("disabled"),value:"disabled"}],onChange:e=>s(e.target.value),value:a,optionType:"button"})}),(0,A.jsx)(MX.A.Item,{label:e("Keywords"),children:(0,A.jsx)(oo.A,{mode:"multiple",style:{minWidth:"10em"},allowClear:!0,value:c,placeholder:e("Please select"),onChange:d,options:y.map(t=>({label:e(t),value:t}))})}),(0,A.jsx)(MX.A.Item,{label:e("Search"),children:(0,A.jsx)(nJ.A,{style:{minWidth:"20em"},value:r,placeholder:e("Name or descriptions"),onChange:e=>i(e.target.value)})})]}),(0,A.jsx)(xF.A,{columns:u,dataSource:p,rowKey:"id",pagination:{pageSize:100}})]})})},M5=()=>{let{snippets:e=[]}=NA();return e.includes("pm")?(0,A.jsx)(M3,{}):(0,A.jsx)(e6.Ay,{status:"404",title:"404",subTitle:"Sorry, the page you visited does not exist."})};class M4 extends eR{async load(){this.addComponents(),this.addRoutes(),this.addSettings()}addSettings(){this.app.systemSettingsManager.add("business-components.ui-schema-storage",{title:'{{t("Block templates")}}',icon:"LayoutOutlined",Component:rC,aclSnippet:"pm.ui-schema-storage.block-templates"}),this.app.systemSettingsManager.add("system-settings",{icon:"SettingOutlined",title:'{{t("System settings")}}',Component:wj,aclSnippet:"pm.system-settings.system-settings",sort:-100}),this.app.systemSettingsManager.add("system-services.plugin-manager",{icon:"ApiOutlined",title:'{{t("Plugin manager")}}',Component:M5,aclSnippet:"pm",sort:-90})}addComponents(){this.app.addComponents({SettingsCenterDropdown:MH})}addRoutes(){this.app.router.add("admin-settings",{path:Ne,element:(0,A.jsx)(MU,{})})}}let M8=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];for(let n of e)t.push(n.aclSnippet),n.children&&n.children.length&&M8(n.children,t);return t},M7=(0,es.createContext)(null);M7.displayName="SettingMenuContext";let M9=e=>{let t=(0,es.useContext)(M$);return(0,A.jsx)(M7.Provider,{value:t,children:e.children})},De=()=>{let e=os(),{message:t}=eX.A.useApp(),{styles:n}=wm(),o=m3(),l=eC(),r=eB(),i=e.systemSettingsManager.getList(!1),a=e.systemSettingsManager.getAclSnippets(),[s,c]=(0,es.useState)([]),d=(0,es.useMemo)(()=>s.includes("pm.*")&&s.every(e=>!e.startsWith("!pm.")),[s]),{t:u}=(0,eT.useTranslation)(),{loading:p,refresh:m}=ek({resource:"roles.snippets",resourceOf:o.name,action:"list",params:{paginate:!1}},{onSuccess(e){c((null==e?void 0:e.data)||[])}}),h=l.resource("roles.snippets",o.name),x=async(e,n)=>{let o=M8(null==n?void 0:n.children,[]).concat(n.aclSnippet);e?await h.add({values:o.map(e=>"!"+e)}):await h.remove({values:o.map(e=>"!"+e)}),m(),t.success(u("Saved successfully"))};return(0,A.jsx)(xF.A,{className:n,loading:p,rowKey:"key",pagination:!1,expandable:{defaultExpandAllRows:!0},columns:[{dataIndex:"title",title:u("Plugin name"),render:e=>r(e)},{dataIndex:"accessible",title:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(j0.A,{checked:d,onChange:async()=>{let e=a.map(e=>"!"+e);d?await h.add({values:e}):await h.remove({values:e}),m(),t.success(u("Saved successfully"))}})," ",u("Accessible")]}),render:(e,t)=>{let n=!s.includes("!"+t.aclSnippet);return(0,A.jsx)(j0.A,{checked:n,onChange:()=>x(n,t)})}}],dataSource:i.filter(e=>!1!==e.isTopLevel).map(e=>!1!==e.showTabs?e:(0,ed.omit)(e,"children"))})},Dt={type:"object",properties:{[(0,ec.uid)()]:{"x-component":"RoleTable"}}},Dn=()=>(0,A.jsx)(rZ.A,{"data-testid":"acl-pane-card",bordered:!1,children:(0,A.jsx)(al,{components:F,schema:Dt})});class Do extends eR{async load(){this.app.addComponents({ACLCollectionFieldProvider:NM,ACLActionProvider:NT,ACLMenuItemProvider:ND,ACLCollectionProvider:Nk})}}var Dl=n(96804),Dr=n(48899);let Di=e=>e.visible?(0,A.jsx)("div",{children:e.children}):null;function Da(e){let t=(0,ep.useParams)();return(0,A.jsx)(aa,{onlyRenderProperties:!0,uid:t.name})}let Ds=()=>{let{t:e}=(0,eT.useTranslation)();return(0,A.jsx)(dB.A,{trigger:"click",content:(0,A.jsx)(Dc,{}),children:(0,A.jsx)(e3.Ay,{type:"primary",children:e("Add Entry")})})},Dc=e=>{let[t,n]=(0,es.useState)(!1),o=(0,ep.useNavigate)(),l=eC(),r=async e=>{var t;let{data:n}=await l.request({resource:"uiSchemas",action:"insertAdjacent/default-admin-menu",params:{position:"beforeEnd",values:e}});(null==n||null==(t=n.data)?void 0:t["x-uid"])&&(o("/admin/".concat(n.data["x-uid"])),window.location.reload())};return(0,A.jsxs)(p9.Provider,{value:{visible:t,setVisible:n,insert:r,options:e},children:[(0,A.jsx)(bJ,{}),(0,A.jsx)(bQ,{}),(0,A.jsx)(bZ,{})]})};function Dd(){let e=(0,ns._)(["\n max-width: 800px;\n margin: 24px auto;\n "]);return Dd=function(){return e},e}function Du(){let e=(0,ns._)(["\n margin-top: 48px;\n "]);return Du=function(){return e},e}let Dp=()=>{let{refresh:e}=eY(),{t}=(0,eT.useTranslation)(),n=(0,ep.useNavigate)(),o=eC(),{data:l}=ek({url:"/uiSchemas:getJsonSchema/default-admin-menu"});return ez({t,api:o,refresh:e,current:null==l?void 0:l.data}),(0,A.jsxs)(rZ.A,{className:(0,iS.css)(Dd()),children:[(0,A.jsx)(e2.A.Title,{children:t("Welcome to the Tachy Platform!")}),(0,A.jsx)(e2.A.Text,{children:t("The Tachy Platform is dedicated to creating a user-friendly application development environment, aiming to lower development barriers, enhance efficiency, and provide enterprise users and developers with one-stop solutions.")}),(0,A.jsx)(cQ.A,{justify:"flex-end",className:(0,iS.css)(Du()),children:(0,A.jsxs)(of.A,{children:[(0,A.jsx)(e3.Ay,{onClick:()=>window.open("https://tachybase.org","_blank"),children:t("Official Website")}),(0,A.jsx)(e3.Ay,{onClick:()=>n("/_admin/system-services/plugin-manager"),children:t("Plugin Management")}),(0,A.jsx)(Ds,{})]})})]})},Dm={key:"image/jpeg",type:"image/jpeg",viewComponet:e=>{let{file:t,prefixCls:n}=e;return t.imageUrl&&(0,A.jsx)("img",{src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),style:{width:"100%",height:"100%"},alt:t.title,className:"".concat(n,"-list-item-image")})},checkedComponent:e=>{let{file:t}=e;return t.imageUrl&&(0,A.jsx)("img",{...e,src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),alt:t.title,style:{width:"90%",height:"auto",display:"flex",justifyContent:"center",alignItems:"center"}})}},Dh={key:"image/png",type:"image/png",viewComponet:e=>{let{file:t,prefixCls:n}=e;return t.imageUrl&&(0,A.jsx)("img",{src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),style:{width:"100%",height:"100%"},alt:t.title,className:"".concat(n,"-list-item-image")})},checkedComponent:e=>{let{file:t}=e;return t.imageUrl&&(0,A.jsx)("img",{...e,src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),alt:t.title,style:{width:"90%",height:"auto",display:"flex",justifyContent:"center",alignItems:"center"}})}};var Dx=n(43911);let Df={key:"default",type:"default",viewComponet:e=>{let{mimetype:t,file:n}=e;return!0===RegExp("image/").test(t||(null==n?void 0:n.mimetype))?(0,A.jsx)(Dv,{...e}):(0,A.jsx)(Dy,{...e})},checkedComponent:e=>{let{mimetype:t,file:n}=e;return!0===RegExp("image/").test(t||(null==n?void 0:n.mimetype))?(0,A.jsx)(Dg,{...e}):(0,A.jsx)(Db,{...e})}},Dv=e=>{let{file:t,prefixCls:n}=e;return t.imageUrl&&(0,A.jsx)("img",{src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),style:{width:"100%",height:"100%"},alt:t.title,className:"".concat(n,"-list-item-image")})},Dg=e=>{let{file:t}=e;return t.imageUrl&&(0,A.jsx)("img",{...e,src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),alt:t.title,style:{width:"90%",height:"auto",display:"flex",justifyContent:"center",alignItems:"center"}})},Dy=e=>{let{prefixCls:t}=e;return(0,A.jsx)(Dx.A,{className:"".concat(t,"-list-item-image"),style:{width:"100%",height:"100%",lineHeight:"100%",color:"#000000"}})},Db=e=>(0,A.jsx)("div",{children:(0,A.jsx)(Dx.A,{style:{color:"#ffffff",fontSize:"30rem",display:"block",lineHeight:"100vh"}})});var DC=n(22245),DS=n(58255),Dw=n(18002),DF=n(5767);function Dj(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column;\n /* justify-content: center; */\n width: 100%;\n height: 90vh;\n overflow-x: scroll;\n overflow-y: scroll;\n "]);return Dj=function(){return e},e}function DA(){let e=(0,ns._)(["\n text-align: center;\n border-bottom: 1px dashed;\n "]);return DA=function(){return e},e}function Dk(){let e=(0,ns._)(["\n margin-bottom: 2px;\n "]);return Dk=function(){return e},e}let DI=(0,nu.rU)(e=>{let{css:t}=e;return{container:t(Dj()),footer:t(DA()),footerText:t(Dk())}});n(64055),n(9529);let DP={cMapUrl:"https://assets.tachybase.com/pdfjs-dist@".concat("5.3.31","/cmaps/"),cMapPacked:!0,standardFontDataUrl:"https://assets.tachybase.com/pdfjs-dist@".concat("5.3.31","/standard_fonts/")};DC.EA.workerSrc="https://assets.tachybase.com/pdfjs-dist@".concat("5.3.31","/build/pdf.worker.min.mjs");let DT=e=>{let{noTransformWrapper:t=!1,children:n}=e;return t?n:(0,A.jsx)(DF.GT,{children:(0,A.jsx)(DF.WZ,{children:n})})},DN=e=>{let{file:t,fileInfo:n,width:o,noTransformWrapper:l}=e,r=(null==t?void 0:t.url)||n,{t:i}=(0,eT.useTranslation)(),{styles:a}=DI(),s=(0,es.useRef)(null),[c,d]=(0,es.useState)(600),[u,p]=(0,es.useState)(1),m=uD(),h=async e=>{var t;let{numPages:n,_transport:o}=e,l=null==(t=s.current)?void 0:t.offsetWidth,r=await o.getPage(1),i=r.getViewport({scale:1}).width,a=r.getViewport({scale:l/i});p(n),d(a.width)};return(0,A.jsx)(DS.A,{className:a.container,inputRef:s,file:r,options:DP,onLoadError:e=>{var t,n;null==(n=window)||null==(t=n.Sentry)||t.captureException(e)},noData:(0,A.jsx)("div",{style:{height:"100vh"}}),error:(0,A.jsx)("div",{children:i("Load PDF file error")}),loading:"",onLoadSuccess:h,children:(0,A.jsx)(DT,{noTransformWrapper:l||!m,children:Array.from(Array(u),(e,t)=>(0,A.jsx)(Dw.A,{pageNumber:t+1,width:o||c,children:(0,A.jsx)("div",{className:a.footer,children:(0,A.jsxs)(nz.A,{className:a.footerText,bordered:!1,children:[t+1,"/",u]})})},"page_".concat(t+1)))})})},DM=e=>{let{file:t,prefixCls:n}=e;return t.imageUrl&&(0,A.jsx)("img",{src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),style:{width:"100%",height:"100%"},alt:t.title,className:"".concat(n,"-list-item-image")})},DD={key:"application/pdf",type:"application/pdf",viewComponet:e=>(0,A.jsx)(DM,{...e}),checkedComponent:e=>(0,A.jsx)(DN,{...e})};var DR=n(59588);function Dq(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n /* width: 100%;\n height: 90vh; */\n "]);return Dq=function(){return e},e}function D_(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n height: 90vh;\n overflow-x: scroll;\n overflow-y: scroll;\n "]);return D_=function(){return e},e}function DO(){let e=(0,ns._)(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: white;\n background-color: rgba(255, 255, 255, 0.75);\n "]);return DO=function(){return e},e}let DB=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{excelPreview:t(Dq()),container:t(D_()),loading:t(DO())}});n(28507);let DE=e=>{let{file:t}=e,n=t.url,{styles:o}=DB(),l=(0,es.useRef)(null),r=(0,es.useRef)(null),[i,a]=(0,es.useState)(!0);return(0,es.useEffect)(()=>{let e=l.current;if(e&&!r.current){let t=DR.A.init(e);r.current=t,a(!0);let o=async()=>{await t.preview(n),a(!1)};try{o()}catch(e){console.log("%c Line:36 \uD83E\uDD5F e",e)}}},[n]),(0,A.jsxs)("div",{className:o.excelPreview,children:[(0,A.jsx)("div",{ref:l,className:o.container}),i&&(0,A.jsx)("div",{className:o.loading,children:(0,A.jsx)(eD.A,{size:"large"})})]})},DV=e=>{var t;let{file:n}=e,o=null!=(t=n.url)?t:"";return o.startsWith("/storage")&&window.location.origin&&(o=window.location.origin+o),(0,A.jsx)("iframe",{src:"https://view.officeapps.live.com/op/embed.aspx?src=".concat(o),width:"100%",height:"600px",frameBorder:"0"})},Dz=e=>{let{file:t,prefixCls:n}=e;return t.imageUrl&&(0,A.jsx)("img",{src:"".concat(t.imageUrl).concat(t.thumbnailRule||""),style:{width:"100%",height:"100%"},alt:t.title,className:"".concat(n,"-list-item-image")})},DL={key:"application/vnd.ms-excel",type:"application/vnd.ms-excel",viewComponet:e=>(0,A.jsx)(Dz,{...e}),checkedComponent:e=>(0,A.jsx)(DV,{...e})},DG={key:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",viewComponet:e=>(0,A.jsx)(Dz,{...e}),checkedComponent:e=>(0,A.jsx)(DV,{...e})},DK={key:"text/csv",type:"text/csv",viewComponet:e=>(0,A.jsx)(Dz,{...e}),checkedComponent:e=>(0,A.jsx)(DE,{...e})},D$={key:"image/svg+xml",type:"image/svg+xml",viewComponet:e=>{let{file:t,prefixCls:n}=e;return t.imageUrl&&(0,A.jsx)("img",{src:"".concat(t.url)})},checkedComponent:e=>{let{file:t}=e;return t.imageUrl&&(0,A.jsx)("img",{...e,src:"".concat(t.url)})}};class DU extends eR{async load(){this.app.AttachmentPreviewManager.add(Dh),this.app.AttachmentPreviewManager.add(Dm),this.app.AttachmentPreviewManager.add(D$),this.app.AttachmentPreviewManager.add(Df),this.app.AttachmentPreviewManager.add(DD),this.app.AttachmentPreviewManager.add(DL),this.app.AttachmentPreviewManager.add(DG),this.app.AttachmentPreviewManager.add(DK)}}let DW=e=>(0,A.jsx)(sN,{initializer:!1,showBorder:!1,showBackground:!0,...e}),DH=e=>{let{t}=(0,eT.useTranslation)(),n=tg(),{name:o,title:l}=tS()||{},r=rh(),{association:i}=t7()||{},a=eB();if(i){let[e]=i.split("."),{name:t,title:r}=n.getCollection(e);o=t,l=r}let s=n.getCollectionField(i),c=["FormItem","ReadPrettyFormItem"].includes(null==r?void 0:r.componentName)?"".concat(null==r?void 0:r.name," ").concat(t("(Fields only)")):null==r?void 0:r.name,d=(0,es.useMemo)(()=>[function(e){let{collectionTitle:t,collectionName:n,associationField:o,compile:l}=e;if(o){var r;return"".concat(l(t||n)," > ").concat(l((null==(r=o.uiSchema)?void 0:r.title)||o.name))}return t||n}({collectionTitle:l,collectionName:o,associationField:s,compile:a}),c].filter(Boolean),[a,l,o,s,c]);return(0,A.jsx)(sN,{title:d,...e})};function DY(e){let t;return e.association&&(t=lR(e.association)),{parentRecord:t}}function DX(){return oj()}function DJ(e){let t,n=nq();return e.association&&(t=DQ(e.association)),{params:n,parentRecord:t}}function DQ(e){let t=(0,ec.useFieldSchema)(),n=tz(),o=tG();if(e)return t["x-is-current"]?o:n}function DZ(){return oj()}function D0(e){let t;return e.association&&(t=lR(e.association)),{parentRecord:t}}function D1(){return Tm()}function D2(e){let t,n=nq();return e.association&&(t=DQ(e.association)),{params:{...n,...e.params},parentRecord:t}}function D6(){return Tm()}function D3(e){let t,n=ko(e);return e.association&&(t=lR(e.association)),{params:n,parentRecord:t}}function D5(e){let t;return e.association&&(t=lR(e.association)),{parentRecord:t}}function D4(){}let D8=()=>{var e,t,n,o,l,r,i,a,s,c,d;let u=(0,ec.useField)(),p=(0,ec.useFieldSchema)(),m=lz(),h=(null==(t=p.parent)||null==(e=t["x-decorator-props"])?void 0:e.dragSort)===!0?null==(o=p.parent)||null==(n=o["x-decorator-props"])?void 0:n.dragSortBy:void 0,{getDataBlocks:x}=nV(),f=null==m||null==(l=m.service)?void 0:l.loading;return null==m||null==(r=m.service)||r.params,(0,es.useEffect)(()=>{if(!f){var e,t,n;let o=null==m||null==(e=m.service)?void 0:e.data,l=(null==o?void 0:o.data)||[],r=(null==o?void 0:o.meta)||{},i=null==m||null==(n=m.field)||null==(t=n.data)?void 0:t.selectedRowKeys;eu().isEqual(u.value,l)||(u.value=l,null==u||u.setInitialValue(l)),u.data=u.data||{},eu().isEqual(u.data.selectedRowKeys,i)||(u.data.selectedRowKeys=i),u.componentProps.pagination=u.componentProps.pagination||{},u.componentProps.pagination.pageSize=null==r?void 0:r.pageSize,u.componentProps.pagination.total=null==r?void 0:r.count,u.componentProps.pagination.current=null==r?void 0:r.page}},[null==m||null==(a=m.field)||null==(i=a.data)?void 0:i.selectedRowKeys,null==m||null==(s=m.service)?void 0:s.data,u,f]),{childrenColumnName:m.childrenColumnName,loading:null==m||null==(c=m.service)?void 0:c.loading,showIndex:m.showIndex,dragSort:m.dragSort&&m.dragSortBy,rowKey:m.rowKey||"id",pagination:(null==p||null==(d=p["x-component-props"])?void 0:d.pagination)!==!1&&u.componentProps.pagination,onRowSelectionChange(e){var t,n,o;m.field.data=(null==m||null==(t=m.field)?void 0:t.data)||{},m.field.data.selectedRowKeys=e,null==m||null==(o=m.field)||null==(n=o.onRowSelect)||n.call(o,e)},async onRowDragEnd(e){let{from:t,to:n}=e;await m.resource.move({sourceId:t[m.rowKey||"id"],targetId:n[m.rowKey||"id"],sortField:m.dragSort&&m.dragSortBy}),m.service.refresh()},onChange(e,t,n){var o,l,r,i;let{current:a,pageSize:s}=e,c=null==(r=p.parent)||null==(l=r["x-decorator-props"])||null==(o=l.params)?void 0:o.sort,d=[...new Set([...m.params.sort||[],...c||[]])],u=h||(n.order?"ascend"===n.order?[n.field]:["-".concat(n.field)]:d);m.service.run({...m.service.params[0],page:a,pageSize:s,sort:u},{filters:null==(i=m.service.params[1])?void 0:i.filters})},onClickRow(e,t,n){let{targets:o,uid:l}=u$(p),r=x();if(!o||!o.some(e=>r.some(t=>t.uid===e.uid)))return void t(e=>e.length?[]:e);let i=[e[m.rowKey]],a={};r.forEach(t=>{var s,c,d,u,p,h;let x=o.find(e=>e.uid===t.uid);if(!x)return;let f=(null==(s=t.service.params)?void 0:s[0])||{},v=(null==(d=t.service.params)||null==(c=d[1])?void 0:c.filters)||{};if(n.includes(e[m.rowKey])){if("manual"===t.dataLoadingMode)return t.clearData();delete v[l]}else v[l]={$and:[{[(null==x?void 0:x.field)||m.rowKey]:{[(null==x?void 0:x.field)?"$in":"$eq"]:i}}]};let g=no()((null==(h=t.service)||null==(p=h.params)||null==(u=p[0])?void 0:u.filter)||{});Object.entries(g).forEach(e=>{let[t,o]=e;t.includes(m.rowKey)&&n.includes(o)&&delete g[t]});let y=uR(pA([...Object.values(v).map(e=>d5(e)),no().unflatten(g),t.defaultFilter,a]));return a=y,r.forEach(e=>{if(o.map(e=>e.uid).includes(e.uid)&&!e.associatedFields.find(e=>{var t;return e.name===x.field||(null==(t=x.field)?void 0:t.includes(e.name))})){let e=no()(a);Object.entries(e).forEach(t=>{let[n,o]=t;(n.split(".").includes(x.field)||n.includes(x.field))&&delete e[n],e[n]||delete e[n]}),a=no().unflatten(e)}}),t.doFilter({...f,page:1,filter:y},{filters:v})}),t(t=>(null==t?void 0:t.includes(e[m.rowKey]))?[]:[...i])},onExpand(e,t){var n,o;null==m||null==(n=(o=m.field).onExpandClick)||n.call(o,e,t)}}},D7=e=>(0,A.jsx)(sN,{initializer:!1,...e});function D9(){}function Re(){}function Rt(){return Tm()}class Rn extends eR{async load(){this.addComponents(),this.addScopes()}addComponents(){this.app.addComponents({TableFieldProvider:lU,TableBlockProvider:lV,TableSelectorProvider:l1,FormBlockProvider:Tu,FilterFormBlockProvider:oA,FormFieldProvider:oT,TreeBlockProvider:l4,DetailsBlockProvider:ow,RecordLink:n_,BlockSchemaToolbar:DH,ActionSchemaToolbar:DW,FormItemSchemaToolbar:bn,CollapseItemSchemaToolbar:D7,TableColumnSchemaToolbar:bw})}addScopes(){this.app.addScopes({...x,useSourceIdFromRecord:nD,useSourceIdFromParentRecord:nR,useParamsFromRecord:nq,useFormBlockProps:Tm,useCreateFormBlockProps:D1,useCreateFormBlockDecoratorProps:D0,useEditFormBlockDecoratorProps:D2,useEditFormBlockProps:D6,useTreeBlockProps:l7,useFormFieldProps:oM,useDetailsBlockProps:oj,useDetailsProps:DZ,useDetailsWithPaginationProps:DX,useDetailsDecoratorProps:DJ,useDetailsWithPaginationDecoratorProps:DY,useTableFieldProps:lH,useTableBlockProps:D8,useTableSelectorProps:l6,useTableBlockDecoratorProps:lq,useListBlockDecoratorProps:D5,useTableSelectorDecoratorProps:D4,useCollapseBlockDecoratorProps:D9,useFilterFormBlockProps:Rt,useFilterFormBlockDecoratorProps:Re,useGridCardBlockDecoratorProps:D3})}}let Ro=(0,es.createContext)(null),Rl=e=>{let{children:t}=e,[n,o]=(0,es.useState)(!1);return(0,A.jsx)(Ro.Provider,{value:{enable:n,setEnable:o},children:t})},Rr=()=>{let{enable:e,setEnable:t}=(0,es.useContext)(Ro);return{enable:e,setEnable:t}},Ri=e=>{let{children:t}=e,[n,o]=(0,Tb.A)("context-menu-enabled",{defaultValue:!0}),[l,r]=(0,Tb.A)("show-scroll-area",{defaultValue:!1}),i=os().pluginContextMenu.get(),[a,s]=(0,es.useState)({x:0,y:0}),c=[];return Object.values(i).sort((e,t)=>(e.sort||0)-(t.sort||0)).forEach(e=>{let{actionProps:t,title:i,icon:s}=e.useLoadMethod({enable:n,setEnable:o,showScrollArea:l,setShowScrollArea:r,position:a});c.push({label:i,key:i,icon:s,onClick:t.onClick})}),(0,A.jsx)(wh.Provider,{value:{contextMenuEnabled:n,setContextMenuEnable:o,showScrollArea:l,setShowScrollArea:r,position:a},children:(0,A.jsx)(nX.A,{menu:{items:c},trigger:n?["contextMenu"]:[],children:(0,A.jsx)("div",{onContextMenu:e=>{s({x:e.clientX,y:e.clientY})},children:t})})})},Ra=()=>{let{contextMenuEnabled:e,setContextMenuEnable:t}=wx();return(0,A.jsx)(Mp.A,{type:e?"primary":"default",icon:(0,A.jsx)(Mu.A,{}),onClick:()=>t(!e)})},Rs=e=>(0,A.jsx)(Mx,{items:{cm:{order:90,component:"ContextMenuButton",pin:!0,isPublic:!0,belongTo:"hoverbutton"}},children:(0,A.jsx)(i8,{components:{ContextMenuButton:Ra},children:e.children})}),Rc={name:"designerMode",useLoadMethod:()=>{let{designable:e,setDesignable:t}=eY(),{t:n}=(0,eT.useTranslation)();return{title:n("Designer mode"),actionProps:{onClick:()=>{t(!e)}}}}},Rd={name:"fullScreen",useLoadMethod:e=>{let{position:t}=e,{t:n}=(0,eT.useTranslation)(),{message:o}=eX.A.useApp();return{title:n("Fullscreen"),actionProps:{onClick:()=>{Rm(t,o,n)}}}}},Ru={name:"disableRightMenu",sort:4,useLoadMethod:e=>{let{enable:t,setEnable:n}=e,{t:o}=(0,eT.useTranslation)();return{title:o("Disable contextmenu"),actionProps:{onClick:()=>{n(!t)}}}}},Rp={name:"showScrollArea",sort:3,useLoadMethod:e=>{let{showScrollArea:t,setShowScrollArea:n}=e,{t:o}=(0,eT.useTranslation)();return{title:o(t?"Hidden scroll area":"Show scroll area"),actionProps:{onClick:()=>{n(!t)}}}}},Rm=(e,t,n)=>{let o=document.elementFromPoint(null==e?void 0:e.x,null==e?void 0:e.y).closest(".ant-card"),l=null==o?void 0:o.closest(".CardRow"),r=document.querySelector(".ant-layout-header");o.closest(".ant-modal-body");let i=o.closest(".amplifier-block"),a=r.getBoundingClientRect(),s=(0,eh.uid)();if(o){let e=null==o?void 0:o.closest(".ant-tb-page "),t=null==o?void 0:o.closest(".ant-drawer-body"),r=null==o?void 0:o.closest(".ant-modal-body"),c=i.querySelector(".ant-tabs-nav");c&&(c.style.display="none"),Array.from(l.parentNode.children).forEach(e=>{e!==l&&(e.style.display="none")});let d=document.createElement("div");d.style.width=i.getBoundingClientRect().width+"px",d.className="autoPage"+s,d.style.position="fixed",d.style.top="0",d.style.zIndex="100";let u=document.createElement("div");if(u.style.width="100%",u.style.height="30px",u.style.textAlign="center",u.style.lineHeight="30px",u.style.backgroundColor="#e6e6e6",u.textContent="".concat(n("Exit fullscreen")),d.appendChild(u),d.addEventListener("click",()=>{Rh({gridRow:l,classId:s})}),e){d.style.marginTop="".concat(a.height,"px");let t=document.querySelector(".ant-page-header"),n=document.querySelector(".ant-layout-sider");t.style.display="none",n.style.display="none",e.style.marginTop="30px",e.insertAdjacentElement("beforebegin",d)}else t?(d.style.position="",t.insertAdjacentElement("beforebegin",d)):r&&(d.style.position="",d.style.width="100%",r.insertAdjacentElement("beforebegin",d))}else t.warning(n("There are no fullscreen blocks available at the current location"))},Rh=e=>{let{gridRow:t,classId:n}=e,o=null==t?void 0:t.closest(".ant-tb-page"),l=null==t?void 0:t.closest(".ant-drawer-body"),r=t.parentNode,i=document.querySelector(".ant-tabs-nav");if(i&&(i.style.display=""),Array.from(r.children).forEach(e=>{e!==t&&(e.style.display=""),e.id.includes("DndDescribedBy")&&(e.style.display="none")}),o){o.style.marginTop="";let e=document.querySelector(".ant-layout-sider"),t=document.querySelector(".ant-page-header");e.style.display="",t.style.display=""}else l&&(l.style.marginTop="");let a=document.querySelector(".autoPage"+n);a&&a.parentNode.removeChild(a)};class Rx extends eR{async load(){this.app.use(Rl),this.app.use(Ri),this.app.use(Rs),this.app.pluginContextMenu.add(Rc.name,Rc),this.app.pluginContextMenu.add(Rd.name,Rd),this.app.pluginContextMenu.add(Ru.name,Ru),this.app.pluginContextMenu.add(Rp.name,Rp)}}let Rf=()=>{let e=(0,ep.useParams)();if(!e["*"])return(0,A.jsx)(aa,{uid:e.name,onlyRenderProperties:!0});{let t=na.getInstance().parse(e["*"],e.name);return t?(0,A.jsx)(t4,{params:{filterByTk:t.filterByTk},action:"get",collection:t.collection,children:(0,A.jsx)(mZ.Provider,{value:{id:t.filterByTk},children:(0,A.jsx)(aa,{uid:e.name,onlyRenderProperties:!0})})}):(0,A.jsx)(qj,{})}};class Rv extends eR{async beforeLoad(){this.app.use(Ry)}async load(){this.app.router.remove("app.page"),this.app.router.add("app.page",{path:"/:entry/:name/*",Component:Rf}),this.app.usePageMode=Rb}async afterLoad(){this.app.pluginContextMenu.add(RC.name,RC)}}let Rg=es.createContext({enable:!1,setEnable:()=>{}}),Ry=e=>{let{children:t}=e,[n,o]=(0,Tb.A)("tb-page-mode",{defaultValue:!1});return(0,A.jsx)(Rg.Provider,{value:{enable:n,setEnable:o},children:t})},Rb=()=>es.useContext(Rg),RC={name:"pageMode",useLoadMethod:()=>{let{enable:e,setEnable:t}=Rb(),{t:n}=(0,eT.useTranslation)();return{title:n("Page mode: {{enabled}}",{enabled:e?"On":"Off"}),actionProps:{onClick:()=>{t(!e)}}}}};class RS{atX0SecondsPastTheMinuteGt20(){return this.data.atX0SecondsPastTheMinuteGt20}atX0MinutesPastTheHourGt20(){return this.data.atX0MinutesPastTheHourGt20}commaMonthX0ThroughMonthX1(){return this.data.commaMonthX0ThroughMonthX1}commaYearX0ThroughYearX1(){return this.data.commaYearX0ThroughYearX1}use24HourTimeFormatByDefault(){return this.data.use24HourTimeFormatByDefault}anErrorOccuredWhenGeneratingTheExpressionD(){return this.data.anErrorOccuredWhenGeneratingTheExpressionD}everyMinute(){return this.data.everyMinute}everyHour(){return this.data.everyHour}atSpace(){return this.data.atSpace}everyMinuteBetweenX0AndX1(){return this.data.everyMinuteBetweenX0AndX1}at(){return this.data.at}spaceAnd(){return this.data.spaceAnd}everySecond(){return this.data.everySecond}everyX0Seconds(){return this.data.everyX0Seconds}secondsX0ThroughX1PastTheMinute(){return this.data.secondsX0ThroughX1PastTheMinute}atX0SecondsPastTheMinute(){return this.data.atX0SecondsPastTheMinute}everyX0Minutes(){return this.data.everyX0Minutes}minutesX0ThroughX1PastTheHour(){return this.data.minutesX0ThroughX1PastTheHour}atX0MinutesPastTheHour(){return this.data.atX0MinutesPastTheHour}everyX0Hours(){return this.data.everyX0Hours}betweenX0AndX1(){return this.data.betweenX0AndX1}atX0(){return this.data.atX0}commaEveryDay(){return this.data.commaEveryDay}commaEveryX0DaysOfTheWeek(){return this.data.commaEveryX0DaysOfTheWeek}commaX0ThroughX1(){return this.data.commaX0ThroughX1}commaAndX0ThroughX1(){return this.data.commaAndX0ThroughX1}first(){return this.data.first}second(){return this.data.second}third(){return this.data.third}fourth(){return this.data.fourth}fifth(){return this.data.fifth}commaOnThe(){return this.data.commaOnThe}spaceX0OfTheMonth(){return this.data.spaceX0OfTheMonth}lastDay(){return this.data.lastDay}commaOnTheLastX0OfTheMonth(){return this.data.commaOnTheLastX0OfTheMonth}commaOnlyOnX0(){return this.data.commaOnlyOnX0}commaAndOnX0(){return this.data.commaAndOnX0}commaEveryX0Months(){return this.data.commaEveryX0Months}commaOnlyInX0(){return this.data.commaOnlyInX0}commaOnTheLastDayOfTheMonth(){return this.data.commaOnTheLastDayOfTheMonth}commaOnTheLastWeekdayOfTheMonth(){return this.data.commaOnTheLastWeekdayOfTheMonth}commaDaysBeforeTheLastDayOfTheMonth(){return this.data.commaDaysBeforeTheLastDayOfTheMonth}firstWeekday(){return this.data.firstWeekday}weekdayNearestDayX0(){return this.data.weekdayNearestDayX0}commaOnTheX0OfTheMonth(){return this.data.commaOnTheX0OfTheMonth}commaEveryX0Days(){return this.data.commaEveryX0Days}commaBetweenDayX0AndX1OfTheMonth(){return this.data.commaBetweenDayX0AndX1OfTheMonth}commaOnDayX0OfTheMonth(){return this.data.commaOnDayX0OfTheMonth}commaEveryHour(){return this.data.commaEveryHour}commaEveryX0Years(){return this.data.commaEveryX0Years}commaStartingX0(){return this.data.commaStartingX0}daysOfTheWeek(){return this.data.daysOfTheWeek}monthsOfTheYear(){return this.data.monthsOfTheYear}constructor(e){(0,em._)(this,"data",void 0),this.data=e}}class Rw extends eR{async afterAdd(){var e,t,o,l,r,i,a,s,c;let d=this.app.apiClient,u=d.auth.locale;try{let s=await d.request({url:"app:getLang",params:{locale:u},headers:{"X-Role":"anonymous"}}),p=null==s?void 0:s.data;this.locales=(null==p?void 0:p.data)||{},this.app.use(og.Ay,{locale:this.locales.antd,popupMatchSelectWidth:!1}),this.app.use(eX.A,{component:!1}),(null==p||null==(e=p.data)?void 0:e.lang)&&(d.auth.setLocale(null==p||null==(i=p.data)?void 0:i.lang),this.app.i18n.changeLanguage(null==p||null==(a=p.data)?void 0:a.lang)),Object.keys((null==p||null==(t=p.data)?void 0:t.resources)||{}).forEach(e=>{var t,n;this.app.i18n.addResources(null==p||null==(t=p.data)?void 0:t.lang,e,(null==p||null==(n=p.data)?void 0:n.resources[e])||{})}),(0,ec.setValidateLanguage)(null==p||null==(o=p.data)?void 0:o.lang),c=null==p?void 0:p.data,(As().initialize?As().initialize:As().default.initialize)({load(e){e[null==c?void 0:c.lang]=new RS(null==c?void 0:c.cronstrue)}});let m=ot[null==p||null==(l=p.data)?void 0:l.lang]||"en";await n(20181)("./".concat(m,".js")),P().locale(m),P().updateLocale(m,{invalidDate:"-"}),window.cronLocale=null==p||null==(r=p.data)?void 0:r.cron}catch(e){throw(null==e||null==(s=e.response)?void 0:s.status)===401&&setTimeout(()=>{window.location.href="/signIn"},1e3),e}}constructor(...e){super(...e),(0,em._)(this,"locales",{})}}function RF(){var e;let t,n,{t:o}=(0,eT.useTranslation)(),{updateUserPageStyle:l}=(t=eC(),n=ub(),{updateUserPageStyle:(0,es.useCallback)(async e=>{var o;if(e!==(null==(o=n.data.data.systemSettings)?void 0:o.pageStyle))try{await t.resource("users").updateProfile({values:{systemSettings:{...n.data.data.systemSettings,pageStyle:e}}}),n.mutate({data:{...n.data.data,systemSettings:{...n.data.data.systemSettings,pageStyle:e}}})}catch(e){(0,eh.error)(e)}},[t,n])}),r=ub();return(0,A.jsx)(ol,{title:o("Page style"),defaultValue:(null==(e=r.data.data.systemSettings)?void 0:e.pageStyle)||"classical",options:[{label:o("classical"),value:"classical"},{label:o("tabs"),value:"tab"}],onChange:l})}let Rj=(0,es.createContext)({style:"classical"}),RA=e=>{var t,n,o;let{children:l}=e,r=ub(),i={key:"tab",eventKey:"tab",label:(0,A.jsx)(RF,{})},[a,s]=(0,es.useState)([]),{addMenuItem:c}=n5();return(0,es.useEffect)(()=>{c(i,{before:"divider_3"})},[c,i]),(0,A.jsx)(Rj.Provider,{value:{style:(null==r||null==(o=r.data)||null==(n=o.data)||null==(t=n.systemSettings)?void 0:t.pageStyle)||"classical",items:a,setItems:s},children:l})};function Rk(){let e=(0,ns._)(["\n display: flex;\n justify-content: flex-start;\n align-items: center;\n width: 100%;\n padding: 0 10px;\n "]);return Rk=function(){return e},e}function RI(){let e=(0,ns._)(["\n flex: 0 1 auto;\n position: relative;\n\n display: inline-flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n min-width: 10px;\n height: 32px;\n margin: 6px 2px;\n padding: 4px 15px;\n border: 1px solid transparent;\n border-radius: 6px;\n overflow: hidden;\n\n background-image: none;\n background: transparent;\n color: rgba(255, 255, 255, 0.88);\n\n font-size: 14px;\n font-weight: 400;\n line-height: 1.5714285714285714;\n outline: none;\n text-align: center;\n touch-action: manipulation;\n user-select: none;\n white-space: nowrap;\n cursor: pointer;\n\n transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);\n\n &.active {\n background-color: rgba(0, 0, 0, 0.07);\n }\n\n .tab-text {\n min-width: 5px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n "]);return RI=function(){return e},e}let RP=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{tabWrapper:t(Rk()),tabHeader:t(RI())}});function RT(){let e=(0,ns._)(["\n color: rgba(255, 255, 255, 0.88);\n "]);return RT=function(){return e},e}let RN=e=>{let{onClick:t,onClose:n,children:o,active:l}=e,{styles:r}=RP();return(0,A.jsxs)("span",{onClick:t,className:r6()(r.tabHeader,{active:l}),children:[(0,A.jsx)("span",{className:"tab-text",children:o}),(0,A.jsx)(e3.Ay,{className:(0,iS.css)(RT()),type:"text",onClick:n,icon:(0,A.jsx)(i6,{type:"CloseOutlined"})})]})},RM=()=>{let e=(0,ep.useNavigate)(),t=(0,ep.useLocation)(),{items:n,setItems:o}=(0,es.useContext)(Rj),l=t.pathname,{styles:r}=RP();return(0,A.jsx)("div",{className:r.tabWrapper,children:n.map(t=>(0,A.jsx)(RN,{active:t.key===l,onClick:()=>{e(t.key)},onClose:e=>{e.stopPropagation(),o(e=>e.filter(e=>e.key!==t.key))},children:t.label},t.key))})},RD=()=>(0,es.useContext)(Rj).style,RR=()=>"tab"===RD()?(0,A.jsx)(RM,{}):null;function Rq(){let e=(0,ns._)(["\n display: none;\n "]);return Rq=function(){return e},e}let R_=e=>{let{items:t,activeKey:n}=e;return t.map(e=>(0,A.jsx)("div",{className:n!==e.key?(0,iS.css)(Rq()):"",children:e.children},e.key))},RO=()=>{let{title:e,setTitle:t}=wT(),n=(0,ep.useLocation)(),{items:o,setItems:l}=(0,es.useContext)(Rj),r=n.pathname,i=(0,ep.useOutlet)();return(0,es.useEffect)(()=>{if(r&&e){let n=o.find(e=>e.key===r);n?t(n.label):l([...o,{key:r,label:e,children:i}])}},[r,e]),(0,A.jsx)(R_,{items:o,activeKey:r})},RB=()=>{let e=(0,ep.useParams)(),t=RD();return e.name&&"tab"===t?(0,A.jsx)(RO,{}):(0,A.jsx)(ep.Outlet,{})};class RE extends eR{async load(){this.app.use(RA),this.app.addComponents({CustomAdminContent:RB,CustomAdminHeader:RR})}}class RV extends eR{async load(){this.app.use(Mx,this.options.config)}}var Rz=n(80410);let RL="grid",RG=new or({name:"blockSettings:quickAccess",items:[{name:"title",Component:function(){var e;let t=(0,ec.useField)(),n=(0,ec.useFieldSchema)(),{dn:o}=eY(),{t:l}=(0,eT.useTranslation)();return(0,A.jsx)(aQ,{title:l("Edit block title"),schema:{type:"object",title:l("Edit block title"),properties:{title:{title:l("Block title"),type:"string",default:null==n||null==(e=n["x-decorator-props"])?void 0:e.title,"x-decorator":"FormItem","x-component":"Input"}}},onSubmit:e=>{let{title:l}=e;console.log("titleSchemaTest",n,t);let r=n["x-decorator-props"]||{};r.title=l,n["x-decorator-props"]=r,t.decoratorProps.title=l,o.emit("patch",{schema:{"x-uid":n["x-uid"],"x-decorator-props":n["x-decorator-props"]}}),o.refresh()}})}},{name:"layout",Component:()=>{var e;let{t}=(0,eT.useTranslation)(),n=(0,ec.useFieldSchema)(),o=(0,ec.useField)(),{dn:l}=eY();return(0,A.jsx)(aW,{title:t("Layout"),options:[{label:t("Grid"),value:RL},{label:t("List"),value:"list"}],value:(null==n||null==(e=n["x-component-props"])?void 0:e.layout)||RL,onChange:e=>{o.componentProps.layout=e;let t={"x-uid":n["x-uid"]};n["x-component-props"]=n["x-component-props"]||{},t["x-component-props"]=n["x-component-props"]||{},t["x-component-props"].layout=e,n["x-component-props"].layout=e,l.emit("patch",{schema:t}),l.refresh()}})}},{type:"remove",name:"remove"}]});function RK(){let e=(0,ns._)(["\n .ant-list-item-meta-avatar {\n margin-inline-end: 0px !important;\n }\n .ant-list-item-meta-title {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .ant-list-item-meta-title button {\n font-size: 16px;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 100%;\n text-align: left;\n }\n "]);return RK=function(){return e},e}let R$=(0,ec.observer)(()=>{let{render:e}=mz((0,ec.useFieldSchema)()["x-initializer"]);return e()},{displayName:"QuickAccessConfigureActionsButton"}),RU=()=>{let e=(0,ec.useFieldSchema)(),{designable:t}=eY(),{layout:n=RL}=e.parent["x-component-props"]||{},[o,l]=(0,es.useState)(8);return(0,es.useEffect)(()=>{let e=()=>{let e=document.getElementsByClassName("mobile-page-content")[0];if(e){let t=e.offsetWidth-48,n=Math.floor(t/100),o=t-100*n;o>0?l(o/(n-1)):l(0)}};return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}},[Object.keys((null==e?void 0:e.properties)||{}).length]),(0,A.jsx)("div",{style:{marginBottom:t?"1rem":0},children:(0,A.jsx)(SM,{children:n===RL?(0,A.jsx)(of.A,{wrap:!0,size:o,children:e.mapProperties((e,t)=>(0,A.jsx)(ec.RecursionField,{name:t,schema:e},t))}):(0,A.jsx)(A5.A,{itemLayout:"horizontal",children:e.mapProperties((e,t)=>{var n,o;let l=null==(n=e["x-component-props"])?void 0:n.icon,r=null==(o=e["x-component-props"])?void 0:o.iconColor;return(0,A.jsx)(A5.A.Item,{className:(0,iS.css)(RK()),children:(0,A.jsx)(A5.A.Item.Meta,{avatar:(0,A.jsx)(Rz.A,{style:{backgroundColor:r},icon:(0,A.jsx)(i6,{type:l})}),title:(0,A.jsx)(ec.RecursionField,{name:t,schema:e},t)})},t)})})})})},RW=(0,es.createContext)({layout:"grid"}),RH=Tr(e=>{let{layout:t="grid"}=(0,ec.useFieldSchema)()["x-component-props"]||{};return(0,A.jsx)(RW.Provider,{value:{layout:t},children:(0,A.jsx)(ti.Provider,{value:void 0,children:(0,A.jsx)(tb.Provider,{value:void 0,children:e.children})})})},{displayName:"QuickAccessBlock"});function RY(){let e=(0,ns._)(["\n background-color: transparent;\n border: 0;\n height: auto;\n box-shadow: none;\n "]);return RY=function(){return e},e}function RX(){let e=(0,ns._)(["\n margin-top: ","px;\n text-overflow: ellipsis;\n overflow: hidden;\n "]);return RX=function(){return e},e}RH.ActionBar=()=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(RU,{}),(0,A.jsx)(R$,{})]});let RJ=(0,nu.rU)(e=>{let{token:t,css:n}=e;return{action:n(RY()),title:n(RX(),t.marginSM)}});function RQ(){var e,t;let n=(0,ec.useFieldSchema)(),o=null==(e=n["x-component-props"])?void 0:e.icon,l=null==(t=n["x-component-props"])?void 0:t.iconColor,{layout:r}=(0,es.useContext)(RW),{styles:i,cx:a}=RJ();return r===RL?(0,A.jsxs)("div",{title:n.title,style:{width:"70px",overflow:"hidden"},children:[(0,A.jsx)(Rz.A,{style:{backgroundColor:l},size:54,icon:(0,A.jsx)(i6,{type:o})}),(0,A.jsx)("div",{className:a(i.title),children:n.title})]}):(0,A.jsx)("a",{children:n.title})}let RZ=Tr(e=>{let{className:t,...n}=e,{styles:o,cx:l}=RJ(),r=(0,ec.useFieldSchema)(),i=eE(null==e?void 0:e.targetComponent)||dT;return(0,A.jsx)(i,{className:l(t,o.action),...n,icon:null,title:(0,A.jsx)(RQ,{}),confirmTitle:r.title})}),R0={type:"void","x-decorator":"CardItem","x-decorator-props":{title:""},"x-settings":"blockSettings:quickAccess","x-schema-toolbar":"BlockSchemaToolbar","x-component":"QuickAccessBlock",properties:{actions:{"x-component":"QuickAccessBlock.ActionBar","x-initializer":"quickAccess:configureActions"}}},R1={type:"item",name:"quickAccessBlock",icon:"FileImageOutlined",useComponentProps(){let{t:e}=(0,eT.useTranslation)(),{insert:t}=me();return{title:e("Quick access"),onClick:()=>{t(R0)}}}};function R2(){let e=(0,ns._)(["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n "]);return R2=function(){return e},e}let R6=e=>t=>{let n=(0,ec.useFieldSchema)(),{form:o}=Tp(),l=rU({collectionField:{uiSchema:n},form:o,record:m3(),uiSchema:n,noDisabled:!0});return(0,A.jsx)(e,{...t,scope:l})},R3=()=>{let e=(0,ec.useField)(),t=(0,ec.useFieldSchema)(),{dn:n}=eY(),{t:o}=(0,eT.useTranslation)(),{urlSchema:l,paramsSchema:r,openInNewWindowSchema:i}=(()=>{let{t:e}=(0,eT.useTranslation)(),t=(0,es.useMemo)(()=>R6(P7.TextArea),[]),n=(0,es.useMemo)(()=>({title:e("URL"),type:"string","x-decorator":"FormItem","x-component":t,description:e("Do not concatenate search params in the URL"),"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}),[e,t]),o=(0,es.useMemo)(()=>({title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"url",enum:[{value:"url",label:e("URL")},{value:"html",label:e("HTML")}]}),[e]),l=(0,es.useMemo)(()=>({title:e("html"),type:"string","x-decorator":"FormItem","x-component":R6(P7.RawTextArea),"x-component-props":{rows:10},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}}),[e]);return{urlSchema:n,paramsSchema:(0,es.useMemo)(()=>({type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{t("Search parameters")}}',items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:(0,iS.css)(R2())},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":t,"x-component-props":{placeholder:'{{t("Value")}}',useTypedConstant:!0,changeOnSelect:!0}},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"}}}),[t]),openInNewWindowSchema:(0,es.useMemo)(()=>({type:"boolean","x-content":e("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}),[e]),modeSchema:o,htmlSchema:l}})(),a=t["x-component-props"]||{},s={url:a.url,params:a.params||[{}],openInNewWindow:a.openInNewWindow};return(0,A.jsx)(aQ,{title:o("Edit link"),components:{ArrayItems:eh.ArrayItems},schema:{type:"object",title:o("Edit link"),properties:{url:{...l,required:!0},params:r,openInNewWindow:i}},onSubmit:o=>{let{url:l,params:r,openInNewWindow:i}=o;a.url=l,a.params=r,a.openInNewWindow=i,t["x-component-props"]=a,e.componentProps.url=l,e.componentProps.params=r,e.componentProps.openInNewWindow=i,n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-component-props":a}}),n.refresh()},initialValues:s})};function R5(e){let{modalSchema:t={},...n}=e,{properties:o,...l}=t,[r,i]=(0,es.useState)(!1),{setVisible:a}=me(),s=(0,es.useMemo)(()=>({name:(0,eh.uid)(),"x-component":"Action.Modal","x-component-props":{width:"520px"},type:"void","x-decorator":"FormV2","x-decorator-props":{},...l,properties:{...o,footer1:{"x-component":"Action.Modal.Footer",type:"void",properties:{close:{title:"Cancel","x-component":"Action","x-component-props":{type:"default"},"x-use-component-props":()=>({onClick(){var t;i(!1),null==e||null==(t=e.onCancel)||t.call(e)}})},submit:{title:"OK","x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":()=>{let t=(0,ec.useForm)();return{async onClick(){var n;await t.submit(),i(!1),null==e||null==(n=e.onSubmit)||n.call(e,t.values)}}}}}}}}),[r]);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(mf,{...n,onClick:t=>{var n;a(!1),i(!0),null==e||null==(n=e.onClick)||n.call(e,t)}}),(0,A.jsx)(ct,{value:{visible:r,setVisible:i},children:(0,A.jsx)(al,{components:{Action:dT},schema:s})})]})}new or({name:"actionSettings:link",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"editLink",Component:R3},{name:"linkageRules",Component:a1,useVisible(){let e=tV();return!eu().isEmpty(null==e?void 0:e.data)},useComponentProps(){let{name:e}=tJ(),{linkageRulesProps:t}=sw();return{...t,collectionName:e}}},{name:"remove",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]});let R4=new or({name:"quickAccess:actionSettings:link",items:[{name:"editButton",Component:dc,useComponentProps:()=>({hasIconColor:!0})},{name:"editLink",Component:R3},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]}),R8=new mL({name:"quickAccess:configureActions",title:'{{t("Configure actions")}}',insertPosition:"beforeEnd",items:[{name:"link",title:'{{t("Link")}}',Component:function(e){let t=mn(),{insert:n}=me(),{t:o}=(0,eT.useTranslation)();return(0,A.jsx)(R5,{title:t.title,modalSchema:{title:o("Add link"),properties:{title:{title:o("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:o("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:o("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:e=>{n({type:"void",title:e.title,"x-action":"customize:link","x-toolbar":"ActionSchemaToolbar","x-settings":"quickAccess:actionSettings:link","x-component":"QuickAccessAction","x-use-component-props":"useLinkActionProps","x-component-props":{icon:e.icon,iconColor:e.iconColor}})}})}}]}),R7=new or({name:"quickAccess:actionSettings:customRequest",items:[{name:"editButton",Component:dc,useComponentProps:()=>({hasIconColor:!0})},{name:"editLink",Component:R3},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function R9(e){let{insert:t}=me(),{t:n}=(0,eT.useTranslation)();return(0,A.jsx)(R5,{title:n("Custom request"),modalSchema:{title:n("Add custom request"),properties:{title:{title:n("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:n("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:n("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:e=>{t({type:"void",title:e.title,"x-component":"QuickAccessAction","x-component-props":{icon:e.icon,iconColor:e.iconColor,targetComponent:"CustomRequestAction"},"x-action":"customize:form:request","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:customRequest","x-decorator":"CustomRequestAction.Decorator","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Request success")}}'}}})}})}let qe=new or({name:"quickAccess:actionSettings:popup",items:[{name:"editButton",Component:dc,useComponentProps:()=>({hasIconColor:!0})},{name:"openMode",Component:c6},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function qt(e){let{insert:t}=me(),{t:n}=(0,eT.useTranslation)();return(0,A.jsx)(R5,{title:n("Popup"),modalSchema:{title:n("Add popup"),properties:{title:{title:n("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:n("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:n("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:e=>{t({type:"void",title:e.title,"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"quickAccess:actionSettings:popup","x-component":"QuickAccessAction","x-component-props":{icon:e.icon,iconColor:e.iconColor,refreshDataBlockRequest:!1,openMode:"drawer"},properties:{drawer:{type:"void",title:e.title,"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"page:addBlock",properties:{}}}}}}}}}})}})}class qn extends eR{async load(){this.app.addComponents({QuickAccessBlock:RH,QuickAccessAction:RZ}),this.app.schemaSettingsManager.add(RG),this.app.schemaInitializerManager.add(R8),this.app.schemaInitializerManager.addItem("page:addBlock","otherBlocks.".concat(R1.name),R1),this.app.schemaInitializerManager.addItem("popup:common:addBlock","otherBlocks.".concat(R1.name),R1),this.app.schemaSettingsManager.add(R4),this.app.schemaSettingsManager.add(qe),this.app.schemaInitializerManager.addItem("quickAccess:configureActions","popup",{Component:qt}),this.app.schemaSettingsManager.add(R7),this.app.schemaInitializerManager.addItem("quickAccess:configureActions","customRequest",{Component:R9})}}function qo(){let e=(0,ns._)(["\n position: absolute;\n top: 0;\n left: 500px;\n right: 500px;\n height: var(--tb-header-height);\n z-index: 99999;\n background-color: rgba(226, 252, 173, 0.274);\n "]);return qo=function(){return e},e}let ql=e=>{let{children:t}=e,{enable:n,setEnable:o}=Rr(),l=(0,es.useRef)();return I_(l,{onContextmenu(){o(!1)}}),(0,A.jsxs)(A.Fragment,{children:[t,n&&(0,A.jsx)("div",{ref:l,className:(0,iS.css)(qo())})]})},qr={name:"scrollAssistant",useLoadMethod:()=>{let{setEnable:e}=Rr(),{t}=(0,eT.useTranslation)();return{title:t("Scroll assistant"),actionProps:{onClick:()=>{e(e=>!e)}}}}};class qi extends eR{async load(){this.app.use(ql),this.app.pluginContextMenu.add(qr.name,qr)}}function qa(e,t){if(!e)return null;let n=e.match(/^\d+\.\d+\.\d+-([0-9a-f]{7})(?:@.+)?$/i);if(n){let e=n[1];return"".concat(t,"/commit/").concat(e)}{let n=e.startsWith("v")?e:"v".concat(e);return"".concat(t,"/releases/tag/").concat(n)}}let qs=()=>{var e,t;let n=uv(),{t:o}=(0,eT.useTranslation)(),l=null==n||null==(t=n.data)||null==(e=t.version)?void 0:e.core,r=qa(l,"https://github.com/tegojs/tego");return(0,A.jsxs)("span",{children:[o("Core Version")," -"," ",r?(0,A.jsx)("a",{href:r,target:"_blank",children:l}):l]})},qc=()=>{var e,t;let n=uv(),{t:o}=(0,eT.useTranslation)(),l=null==n||null==(t=n.data)||null==(e=t.version)?void 0:e.app,r=qa(l,"https://github.com/tegojs/tego-standard");return(0,A.jsxs)("span",{children:[o("App Version")," -"," ",r?(0,A.jsx)("a",{href:r,target:"_blank",children:l}):l]})},qd=e=>{let{children:t}=e,{addMenuItem:n}=n5();return(0,es.useEffect)(()=>{n({key:"system-version-app",label:(0,A.jsx)(qc,{})},{before:"divider_1"}),n({key:"system-version-core",label:(0,A.jsx)(qs,{})},{before:"divider_1"})},[n]),(0,A.jsx)(A.Fragment,{children:t})};class qu extends eR{async load(){this.app.use(qd)}}function qp(){let e=(0,ns._)(["\n .ant-card-actions {\n li .ant-space {\n gap: 2px !important;\n }\n li a {\n .anticon {\n margin-right: 3px;\n /* display: none; */\n }\n }\n li:last-child {\n width: 20% !important;\n }\n li:first-child {\n width: 80% !important;\n border-inline-end: 0;\n text-align: left;\n padding-left: 16px;\n }\n }\n "]);return qp=function(){return e},e}let qm=(0,nu.rU)(e=>{let{token:t,css:n}=e;return{cardActionDisabled:{color:t.colorTextDisabled,cursor:"not-allowed"},pageHeader:{backgroundColor:t.colorBgContainer,paddingTop:t.paddingSM,paddingBottom:0,paddingInline:t.paddingLG,".ant-page-header-footer":{marginBlockStart:"0"},"& .ant-tabs-nav":{marginBottom:0},".ant-page-header-heading-title":{color:t.colorText}},pageContent:{margin:t.marginLG},PluginDetailBaseInfo:{display:"flex",flexDirection:"column",marginBottom:t.margin},PluginDocument:{background:t.colorBgContainer,padding:t.paddingLG,height:"60vh",overflowY:"auto"},avatar:{".ant-card-meta-avatar":{marginTop:"8px",".ant-avatar":{borderRadius:"2px"}}},version:{display:"block",color:t.colorTextDescription,fontWeight:"normal",fontSize:t.fontSize},card:n(qp())}});function qh(e){return e.map(e=>{var t;return{key:e.name,label:e.label,title:e.title,icon:e.icon,children:(null==(t=e.children)?void 0:t.length)?qh(e.children):void 0}})}let qx=()=>{var e,t,n;let{styles:o,theme:l}=qm(),r=os(),i=(0,ep.useNavigate)(),a=(0,ep.useLocation)(),s=(0,ep.useParams)(),c=eB(),d=(0,es.useMemo)(()=>{let e=r.userSettingsManager.getList();return!function e(t){t.forEach(t=>{var n;t.title=c(t.title),t.label=c(t.title),(null==(n=t.children)?void 0:n.length)&&e(t.children)})}(e),e},[r.userSettingsManager,c]),u=(0,es.useCallback)(e=>{var t;if(!e||!e.length)return"/admin";let n=e[0];return(null==(t=n.children)?void 0:t.length)?u(n.children):n.path},[]),p=(0,es.useMemo)(()=>{let e={},t=n=>{n.forEach(n=>{var o;e[n.path]=n,(null==(o=n.children)?void 0:o.length)&&t(n.children)})};return t(d),e},[d]),m=(0,es.useMemo)(()=>(function(e,t){let n=Object.keys(e);if(e[t])return e[t];for(let o of n){let n=o.replace(/:[^/]+/g,"([^/]+)");if(t.match(new RegExp("^".concat(n,"$"))))return e[o]}return null})(p,a.pathname),[a.pathname,p]),h=(0,es.useMemo)(()=>m?d.find(e=>e.name===m.topLevelName):null,[m,d]),x=(0,es.useMemo)(()=>qh(d.filter(e=>!1!==e.isTopLevel).map(e=>({...e,children:null}))),[d]);return m&&a.pathname!==Nr&&a.pathname!==Nr+"/"?a.pathname===h.path&&(null==(e=h.children)?void 0:e.length)>0?(0,A.jsx)(ep.Navigate,{replace:!0,to:u(h.children)}):(0,A.jsx)("div",{children:(0,A.jsxs)(My.A,{children:[(0,A.jsx)(My.A.Sider,{theme:"light",children:(0,A.jsx)(nY.A,{selectedKeys:[(null==m?void 0:m.pluginKey)||m.topLevelName],style:{height:"calc(100vh - 46px)",overflowY:"auto",overflowX:"hidden"},onClick:e=>{var t;let{key:n}=e,o=d.find(e=>e.name===n);return(null==(t=o.children)?void 0:t.length)?i(u(o.children)):i(o.path)},items:x})}),(0,A.jsxs)(My.A.Content,{children:[m&&(0,A.jsx)(rl.z,{className:o.pageHeader,style:{paddingBottom:(null==(t=h.children)?void 0:t.length)>0&&!1!==h.showTabs?0:l.paddingSM},ghost:!1,title:h.title,footer:(null==(n=h.children)?void 0:n.length)>0&&!1!==h.showTabs&&(0,A.jsx)(nY.A,{style:{marginLeft:-l.margin},onClick:e=>{var t;let{key:n}=e;i((t=r.systemSettingsManager.getRoutePath(n),t.replace(/:\w+/g,e=>{let t=e.substring(1);return(null==s?void 0:s[t])||e})))},selectedKeys:[null==m?void 0:m.name],mode:"horizontal",items:qh(h.children)})}),(0,A.jsx)("div",{className:o.pageContent,children:m?(0,A.jsx)(ep.Outlet,{}):(0,A.jsx)(e6.Ay,{status:"404",title:"404",subTitle:"Sorry, the page you visited does not exist."})})]})]})}):(0,A.jsx)(ep.Navigate,{replace:!0,to:u(d)})};class qf extends eR{async load(){this.app.router.add("profilers",{path:Nr,element:(0,A.jsx)(MV,{children:(0,A.jsx)(qx,{})})})}}function qv(){let e=(0,ns._)(["\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100vw;\n height: 100vh;\n background-color: #f5f5f5;\n overflow: hidden;\n "]);return qv=function(){return e},e}function qg(){let e=(0,ns._)(["\n top: 50%;\n position: absolute;\n width: 100%;\n transform: translate(0, -50%);\n "]);return qg=function(){return e},e}let qy=()=>(0,A.jsx)("div",{className:(0,iS.css)(qv()),children:(0,A.jsx)(Dr.GL,{style:{width:"100%",maxWidth:"640px"},src:"https://assets.tachybase.com/imgs/spin.lottie",loop:!0,autoplay:!0})}),qb=(0,nu.rU)(e=>{let{css:t}=e;return{modal:t(qg())}}),qC=(0,ec.observer)(e=>{let{app:t,error:n}=e,o=((e,t)=>{var n,o,l;let r=eC();if(!t)return{};let i=(null==t||null==(l=t.response)||null==(o=l.data)||null==(n=o.errors)?void 0:n[0])||t,a=(0,eh.getSubAppName)(e.getPublicPath());return"USER_HAS_NO_ROLES_ERR"===i.code?{title:e.i18n.t("Permission denied"),subTitle:i.message,extra:[(0,A.jsx)(e3.Ay,{type:"primary",onClick:()=>{r.auth.setToken(null),window.location.reload()},children:e.i18n.t("Sign in with another account")},"try"),a?(0,A.jsx)(e3.Ay,{onClick:()=>window.location.href="/admin",children:e.i18n.t("Return to the main application")},"back"):null]}:{}})(t,n),{styles:l}=qb();return(0,A.jsx)("div",{children:(0,A.jsx)(e6.Ay,{className:l.modal,status:"error",title:t.i18n.t("App error"),subTitle:t.i18n.t(null==n?void 0:n.message),extra:[(0,A.jsx)(e3.Ay,{type:"primary",onClick:()=>window.location.reload(),children:t.i18n.t("Try again")},"try")],...o})})},{displayName:"AppError"}),qS=e=>{var t,n,o,l,r,i,a,s,c,d,u;return e.ws.serverDown?{status:"error",icon:(0,A.jsx)(Dl.A,{}),title:"You're offline",subTitle:"Please check the server status or network connection status"}:e.error?"APP_NOT_FOUND"===e.error.code?{status:"warning",title:"App not found",subTitle:null==(t=e.error)?void 0:t.message}:"APP_INITIALIZING"===e.error.code?{status:"info",icon:(0,A.jsx)(tn.A,{}),title:"App initializing",subTitle:null==(n=e.error)?void 0:n.message}:"APP_INITIALIZED"===e.error.code?{status:"warning",title:"App initialized",subTitle:null==(o=e.error)?void 0:o.message}:"APP_ERROR"===e.error.code||"LOAD_ERROR"===e.error.code?{status:"error",title:"App error",subTitle:null==(l=e.error)?void 0:l.message}:"APP_NOT_INSTALLED_ERROR"===e.error.code?{status:"warning",title:"App not installed",subTitle:null==(r=e.error)?void 0:r.message}:"APP_STOPPED"===e.error.code?{status:"warning",title:"App stopped",subTitle:null==(i=e.error)?void 0:i.message}:"APP_COMMANDING"===e.error.code?{...{status:"info",icon:(0,A.jsx)(tn.A,{}),title:null==(s=e.error)||null==(a=s.command)?void 0:a.name,subTitle:null==(c=e.error)?void 0:c.message},...{start:{title:"App starting"},restart:{title:"App restarting"},install:{title:"App installing"},upgrade:{title:"App upgrading"},"pm.add":{title:"Adding plugin"},"pm.update":{title:"Updating plugin"},"pm.enable":{title:"Enabling plugin"},"pm.disable":{title:"Disabling plugin"},"pm.remove":{title:"Removing plugin"},refreshEventSource:{title:"Refreshing event source"}}[null==(u=e.error)||null==(d=u.command)?void 0:d.name]}:{}:{}},qw=(0,ec.observer)(e=>{let{app:t}=e,{icon:n,status:o,title:l,subTitle:r}=qS(t),{styles:i}=qb();return(0,A.jsx)("div",{children:(0,A.jsx)(e6.Ay,{className:i.modal,icon:n,status:o,title:t.i18n.t(l),subTitle:t.i18n.t(r)})})},{displayName:"AppMaintaining"}),qF=(0,ec.observer)(e=>{let{app:t}=e,{icon:n,status:o,title:l,subTitle:r}=qS(t);return t.noticeManager.status(t.i18n.t(l)+" "+t.i18n.t(r),TN.INFO),null},{displayName:"AppMaintainingDialog"}),qj=()=>{let{t:e}=(0,eT.useTranslation)(),t=os();return(0,A.jsx)(e6.Ay,{status:"404",title:"404",subTitle:e("Sorry, the page you visited does not exist."),extra:(0,A.jsx)(e3.Ay,{onClick:()=>location.href=t.adminUrl,type:"primary",children:e("Back Home")})})};class qA extends eR{async afterAdd(){this.app.addComponents({AppSpin:qy,AppError:qC,AppMaintaining:qw,AppMaintainingDialog:qF,AppNotFound:qj}),await this.addPlugins()}async load(){this.addComponents(),this.addRoutes(),this.app.use(uS),this.app.use(n4),this.addSystemSettingGroups()}addSystemSettingGroups(){this.app.systemSettingsManager.add("id-auth",{title:this.t("Identity and Authentication"),icon:"UserOutlined",sort:-50}),this.app.systemSettingsManager.add("data-modeling",{title:this.t("Data Modeling"),icon:"DatabaseOutlined",sort:-40}),this.app.systemSettingsManager.add("business-components",{title:this.t("Business Features"),icon:"BlockOutlined",sort:-30}),this.app.systemSettingsManager.add("security",{title:this.t("Security"),icon:"SafetyOutlined",sort:-20}),this.app.systemSettingsManager.add("system-services",{title:this.t("System Services"),icon:"CloudServerOutlined",sort:-10})}addRoutes(){this.router.add("root",{path:"/",element:(0,A.jsx)(ep.Navigate,{replace:!0,to:"/admin"})}),this.router.add("not-found",{path:"*",Component:qj}),this.router.add("app",{path:"/:entry",Component:"AdminLayout"}),this.router.add("app.page",{path:"/:entry/:name",Component:"RouteSchemaComponent"}),this.router.add("app.welcome",{path:"/:entry/welcome",Component:"WelcomeCard"})}addComponents(){this.app.addComponents({ErrorFallback:wV,RouteSchemaComponent:Da,BlockTemplatePage:rb,BlockTemplateDetails:ri,WelcomeCard:Dp,PageLayout:Di})}async addPlugins(){await this.app.pm.add(gJ),await this.app.pm.add(Rw,{name:"builtin-locale"}),await this.app.pm.add(Mz,{name:"admin-layout"}),await this.app.pm.add(wA,{name:"system-setting"}),await this.app.pm.add(RV,{name:"pinned-list",config:{items:{ui:{order:50,component:"DesignableSwitch",pin:!0,snippet:"ui.*",belongTo:"pinnedmenu"},wf:{order:100,component:"WorkflowLink",pin:!0,snippet:"pm.*",belongTo:"pinnedmenu"},ds:{order:200,component:"DatasourceLink",pin:!0,snippet:"pm.*",belongTo:"pinnedmenu"},sc:{order:400,component:"SettingsCenterDropdown",pin:!0,snippet:"pm.*",isPublic:!0,belongTo:"pinnedmenu"},ca:{order:300,component:"CalculatorButton",pin:!0,isPublic:!0,belongTo:"hoverbutton"},cm:{order:90,component:"ContextMenuButton",pin:!0,isPublic:!0,belongTo:"hoverbutton"},db:{order:60,component:"DesignableButton",pin:!0,snippet:"ui.*",belongTo:"hoverbutton"},saj:{order:30,component:"SearchAndJumpButton",pin:!0,snippet:"pm.*",belongTo:"hoverbutton"},ai:{order:330,component:"AIChatButton",pin:!0,isPublic:!0,belongTo:"hoverbutton"}}}}),await this.app.pm.add(i5,{name:"schema-component"}),await this.app.pm.add(Cr,{name:"schema-initializer"}),await this.app.pm.add(SS,{name:"schema-settings"}),await this.app.pm.add(Rn,{name:"block-schema-component"}),await this.app.pm.add(w7,{name:"antd-schema-component"}),await this.app.pm.add(Do,{name:"builtin-acl"}),await this.app.pm.add(wM,{name:"remote-document-title"}),await this.app.pm.add(M4,{name:"builtin-pm"}),await this.app.pm.add(vC,{name:"builtin-collection"}),await this.app.pm.add(Rx,{name:"context-menu"}),await this.app.pm.add(qf,{name:"user-settings"}),await this.app.pm.add(DU,{name:"attachment-preview"}),await this.app.pm.add(RE,{name:"page-style"}),await this.app.pm.add(qn,{name:"quick-access"}),await this.app.pm.add(qi,{name:"scroll-assistant"}),await this.app.pm.add(Rv,{name:"dynamic-page"}),await this.app.pm.add(qu,{name:"system-version"})}}function qk(){let e=(0,ns._)(["\n text-align: center;\n color: ",";\n a {\n color: ",";\n &:hover {\n color: ",";\n }\n }\n "]);return qk=function(){return e},e}let qI=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{powerBy:t(qk(),n.colorTextDescription,n.colorTextDescription,n.colorText)}}),qP=()=>{let{styles:e}=qI(),t=new Date().getFullYear(),{t:n}=(0,eT.useTranslation)();return(0,A.jsx)("div",{className:e.powerBy,children:"\xa92023-".concat(t," ").concat(n("TachyBase Team"))})};class qT extends ey{mockAdapter(){return new(n(71242))(this.axios)}}let qN=()=>{let e=new qT,t=e.mockAdapter();return{apiClient:e,mockRequest:t}};function qM(e){let{collection:t}=e;return t}function qD(e){return!0}function qR(e){return e.target&&e.interface}function qq(e){let t=q_.call(this,e.field.target,e);return t.length&&t.some(e=>qR(e.field))||(e.isLeaf=!0),t}function q_(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{needLeaf:!0},{needLeaf:o}=n,[l,r]=vS(e),i=this.getCollectionFields(r,l),a=o?i:i.filter(qR),s=qq.bind(this);return a.filter(this.filter).map(e=>{var n,o,l;let r=t?"".concat(t.value?"".concat(t.value,"."):"").concat(e.name):e.name,i=null!=(o=this.compile(null==(n=e.uiSchema)?void 0:n.title))?o:e.name,a=!this.getCollectionFields(e.target).filter(qR).filter(this.filter).length;return{pId:null!=(l=null==t?void 0:t.key)?l:null,id:r,key:r,value:r,title:i,isLeaf:a,loadChildren:a?null:s,field:e,fullTitle:t?[...t.fullTitle,i]:[i]}})}let qO=e=>{let{title:t,value:n,onChange:o,collection:l,useCollection:r=qM,filter:i=qD,rootOption:a,loadData:s,needLeaf:c=!1,...d}=e,u=eB(),{t:p}=(0,eT.useTranslation)(),[m,h]=(0,es.useState)({}),x=r({collection:l}),[f,v]=vS(x),{getCollectionFields:g}=sO(f),y=Object.values(m),b=(0,es.useMemo)(()=>e.multiple?(n||[]).map(e=>m[e]).filter(Boolean):n,[n,e.multiple,m]),C=(0,es.useCallback)(async e=>{if(null!=s)return s(e);if(!e.isLeaf&&e.loadChildren){let t=e.loadChildren(e);h(e=>t.reduce((e,t)=>{var n;return Object.assign(e,{[t.value]:{...t,label:t.fullTitle.length?null==(n=t.fullTitle)?void 0:n.join(" / "):t.title}})},{...e}))}},[s]);(0,es.useEffect)(()=>{let e=a?{...a,id:a.value,key:a.value,title:a.label,fullTitle:a.label,isLeaf:!1}:null,t=(null===s?[]:q_.call({compile:u,getCollectionFields:g,filter:i},x,e,{needLeaf:c})).reduce((e,t)=>{var n;return Object.assign(e,{[t.value]:{...t,label:t.fullTitle.length?null==(n=t.fullTitle)?void 0:n.join(" / "):t.title}})},{});e&&(t[e.value]=e),h(t)},[x,a,i,s]),(0,es.useEffect)(()=>{let t=e.multiple?n:"string"==typeof n?[n]:n||[];if(!(null==t?void 0:t.length)||t.every(e=>!!m[e]))return;let o=[];t.forEach(e=>{let t=e.split("."),n=m[t[0]];for(let e=1;e<t.length&&n;e++){let l=t.slice(0,e+1).join(".");if(m[l]){n=m[l];break}if(!n.isLeaf&&n.loadChildren){let l=n.loadChildren(n);(null==l?void 0:l.length)&&(o.push(...l),n=l.find(n=>n.value===t.slice(0,e+1).join(".")))}}}),h(e=>o.reduce((e,t)=>{var n;return Object.assign(e,{[t.value]:{...t,label:t.fullTitle.length?null==(n=t.fullTitle)?void 0:n.join(" / "):t.title}})},{...e}))},[n,y.length,e.multiple]);let S=(0,es.useCallback)(t=>{if(!e.multiple)return void o(t);let n=t.map(e=>e.value).filter(Boolean),l=new Set(n),r=b.find(e=>!l.has(e.value));if(r){let e="".concat(r.value,".");Object.keys(m).forEach(t=>{t.startsWith(e)&&l.delete(t)})}else n.forEach(e=>{let t=e.split(".");if(t.length)for(let e=1;e<=t.length;e++)l.add(t.slice(0,e).join("."))});o(Array.from(l))},[e.multiple,b,o,m]),w=(0,es.useCallback)(e=>{var t;let{value:n,onClose:o,disabled:l,closable:r}=e;if(!n)return null;let{fullTitle:i}=null!=(t=m[n])?t:{};return(0,A.jsx)(nz.A,{closable:r&&!l,onClose:o,children:null==i?void 0:i.join(" / ")})},[m]),F=Array.isArray(b)?b.filter(e=>e.value in m):b,j=e.multiple?n:null!=n?[n]:[];return(0,A.jsx)(w9.A,{"data-testid":"select-field".concat(t?"-".concat(t):""),value:F,placeholder:p("Select field"),showCheckedStrategy:w9.A.SHOW_ALL,treeDefaultExpandedKeys:j,allowClear:{clearIcon:(0,A.jsx)(Sp.A,{role:"button","aria-label":"icon-close"})},treeCheckStrictly:e.multiple,treeCheckable:e.multiple,tagRender:w,treeNodeLabelProp:"label",onChange:S,treeDataSimpleMode:!0,treeData:y,loadData:C,...d})},qB="workflow";function qE(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fG.t(e,{...t,ns:[qB,"core"]})}function qV(){return(0,eT.useTranslation)([qB,"core"])}let qz=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fL(e,{ns:[qB,"core"],...t})},qL=()=>{let{t:e}=qV(),t=(0,ep.useNavigate)(),{token:n}=iF();return(0,A.jsx)(iV.A,{title:e("Workflow"),children:(0,A.jsx)(e3.Ay,{icon:(0,A.jsx)(i6,{type:"workflow",style:{color:n.colorTextHeaderMenu}}),title:e("Workflow"),onClick:()=>{t("/_admin/business-components/workflow")}})})};var qG=n(98313),qK=n(55701),q$=n(70877);let qU=(e,t)=>({getAriaLabel:(0,es.useCallback)(n=>["add-button",null==e?void 0:e.type,null==e?void 0:e.title,null!=t?String(t):"",n].filter(Boolean).join("-"),[t,null==e?void 0:e.title,null==e?void 0:e.type])}),qW=es.createContext({}),qH=qW.Provider,qY=es.createContext({});function qX(){return(0,es.useContext)(qY)}function qJ(){let e=(0,ns._)(["\n display: flex;\n justify-content: center;\n align-items: center;\n width: 20px;\n height: 20px;\n margin-right: 10px;\n border-radius: 50%;\n background-color: ",";\n color: white;\n\n svg {\n width: 100%;\n height: 100%;\n }\n "]);return qJ=function(){return e},e}qY.Provider;let qQ=[{key:"control",label:qE("Control")},{key:"collection",label:qE("Collection operations")},{key:"manual",label:qE("Manual")},{key:"extended",label:qE("Extended types")}],qZ={key:"hot",label:qE("Hot tools")},q0={key:"load",label:qE("Load")};function q1(e,t){return(0,A.jsx)("div",{className:(0,iS.css)(qJ(),t),children:(0,A.jsx)(i6,{type:e})})}function q2(){let e=(0,ns._)(["\n flex-shrink: 0;\n padding: 2em 0;\n\n > .ant-btn {\n border-radius: 8px;\n background-color: #fff;\n color: #000;\n\n &:disabled {\n visibility: hidden;\n }\n }\n "]);return q2=function(){return e},e}function q6(){let e=(0,ns._)(["\n .ant-dropdown-menu-root {\n max-height: 30em;\n border-radius: 8px;\n overflow-y: auto;\n }\n "]);return q6=function(){return e},e}function q3(){let e=(0,ns._)([""]);return q3=function(){return e},e}let q5=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{addButtonClass:t(q2()),dropDownClass:t(q6()),iconContainerClass:t(q3())}});function q4(){let e=co(),t=(0,ec.useForm)();return{async onClick(){var n;null==e||null==(n=e.setVisible)||n.call(e,!1),t.reset()}}}function q8(){var e;let{t}=qV(),n=eC(),o=co(),{workflow:l,refresh:r}=null!=(e=qX())?e:{},i=(0,ec.useForm)(),{upstream:a,branchIndex:s}=(0,es.useContext)(qW);return{async onClick(){try{let c=await fetch(i.values.file.url),d=await c.json();if(l){var e;await n.resource("workflows.nodes",l.id).create({values:{type:d.type,upstreamId:null!=(e=null==a?void 0:a.id)?e:null,branchIndex:s,title:d.title,config:d.config}}),o.setVisible(!1),cg.Ay.success(t("Operation succeeded")),r(),i.reset()}}catch(e){o.setVisible(!1),console.error("JSON解析失败:",e),r()}}}}let q7={type:"void","x-decorator":"FormV2",properties:{file:{type:"object",title:'{{ t("File") }}',required:!0,"x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{action:"attachments:create",multiple:!1,style:{marginTop:"20px"}}},footer:{type:"void","x-component":"ActionBar","x-component-props":{style:{justifyContent:"right"}},properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":"useCreateActionProps"}}}}},q9=()=>(0,A.jsx)(al,{schema:q7,scope:{useCancelActionProps:q4,useCreateActionProps:q8}}),_e=e=>{let{t}=qV(),{styles:n}=q5(),{upstream:o,branchIndex:l=null}=e,{workflow:r,menu:i,isShowUploadModal:a,setIsShowUploadModal:s}=function(e){var t;let{upstream:n,branchIndex:o=null}=e,l=oc(Lz),r=eB(),i=eC(),{workflow:a,refresh:s}=null!=(t=qX())?t:{},c=Array.from(l.instructions.getValues()),d=(0,es.useMemo)(()=>(function(e,t){let{engine:n,workflow:o,upstream:l,branchIndex:r,compile:i}=t,a=[],s=[];for(let t of qQ){let c=e.filter(e=>{var i,a;return e.group===t.key&&(null==(a=null==(i=e.isAvailable)?void 0:i.call(e,{engine:n,workflow:o,upstream:l,branchIndex:r}))||a)}),d=[];for(let e of c){let{type:t,title:n,icon:o,color:l,options:r,isHot:a}=e,c=q1(o,l),u={role:"button","aria-label":t,key:t,label:i(n),type:r?"subMenu":null,icon:c,children:r?r.map(e=>({role:"button","aria-label":e.key,key:e.key,label:i(e.label)})):null};d.push(u),a&&s.push(u)}let u={...t,type:"group",children:d};a.push(u)}return a.unshift({...q0,type:"group",children:[{key:"load","aria-label":"load",role:"button",label:qE("Upload node"),icon:q1("ToTopOutlined","#ff92ca")}]}),a.unshift({...qZ,type:"group",children:s}),a.filter(e=>e.children.length)})(c,{engine:l,workflow:a,upstream:n,branchIndex:o,compile:r}),[o,l,c,n,a]),[u,p]=(0,es.useState)(!1),m=(0,es.useCallback)(async e=>{var t,c,d;let{keyPath:u}=e,p=u.pop(),m={},[h]=u,x=l.instructions.get(p);if(h){let{value:e}=null!=(c=null==(t=x.options)?void 0:t.find(e=>e.key===h))?c:{};Object.assign(m,"function"==typeof e?e():e)}a&&(await i.resource("workflows.nodes",a.id).create({values:{type:p,upstreamId:null!=(d=null==n?void 0:n.id)?d:null,branchIndex:o,title:r(x.title),config:m}}),s())},[i,o,l.instructions,s,null==n?void 0:n.id,a]);return{workflow:a,menu:(0,es.useMemo)(()=>({onClick:e=>{let{keyPath:t}=e||{};(null==t?void 0:t[0])==="load"?p(!0):m(e)},items:d}),[d,m]),isShowUploadModal:u,setIsShowUploadModal:p}}(e);return r?(0,A.jsxs)("div",{className:n.addButtonClass,children:[(0,A.jsx)(nX.A,{trigger:["click"],disabled:r.executed,overlayClassName:n.dropDownClass,menu:i,children:(0,A.jsx)(e3.Ay,{className:"add-btn",icon:(0,A.jsx)(sF.A,{}),type:"primary","aria-label":e["aria-label"]||"add-button"})}),(0,A.jsx)(ox.A,{footer:null,closable:!1,title:t("Upload node"),open:a,children:(0,A.jsx)(ct,{value:{visible:a,setVisible:s},children:(0,A.jsx)(qH,{value:{upstream:o,branchIndex:l},children:(0,A.jsx)(q9,{})})})})]}):null};function _t(e,t){let n=[];if(!e)return[];for(let o=e.upstream;o;o=o.upstream)("function"!=typeof t||t(o))&&n.push(o);return n}let _n=es.createContext({}),_o=_n.Provider;function _l(){return(0,es.useContext)(_n)}function _r(){let e=(0,ns._)(["\n flex-grow: 1;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n "]);return _r=function(){return e},e}let _i=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{nodeBlockClass:t(_r())}}),_a=e=>{let{data:t}=e,{styles:n}=_i(),{getAriaLabel:o}=qU(t),{Component:l=zd,end:r,group:i}=oc(Lz).instructions.get(t.type);return(0,A.jsx)(_o,{value:{...t,group:i},children:(0,A.jsxs)("div",{className:(0,iS.cx)(n.nodeBlockClass),children:[(0,A.jsx)(l,{data:t}),r&&("function"!=typeof r||r(t))?(0,A.jsx)("div",{className:"end-sign",children:(0,A.jsx)(cp.A,{})}):(0,A.jsx)(_e,{"aria-label":o(),upstream:t})]})})};function _s(){let e=(0,ns._)(["\n flex-grow: 1;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n height: calc(100vh - 56px);\n .workflow-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n position: relative;\n padding: 0.5rem 1rem;\n background: ",";\n border-bottom: 1px solid ",";\n\n header {\n display: flex;\n align-items: center;\n }\n\n aside {\n display: flex;\n align-items: center;\n gap: 0.5em;\n }\n\n .workflow-versions {\n label {\n margin-right: 0.5em;\n }\n }\n }\n\n .workflow-content {\n display: flex;\n height: 100%;\n }\n\n .workflow-operator-area {\n overflow-x: hidden;\n overflow-y: scroll;\n padding: 0px 18px 48px 18px;\n background-color: white;\n }\n\n .workflow-canvas-wrapper {\n flex-grow: 1;\n overflow: hidden;\n position: relative;\n height: 100%;\n }\n\n .workflow-canvas-zoomer {\n display: flex;\n align-items: center;\n position: absolute;\n top: 2em;\n right: 2em;\n height: 10em;\n padding: 1em 0;\n border-radius: 0.5em;\n background: ",";\n }\n\n .workflow-canvas {\n overflow: auto;\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 2em;\n padding-bottom: 200px;\n scrollbar-width: none;\n\n > .ant-alert {\n margin-bottom: 2em;\n font-size: 85%;\n }\n }\n\n .workflow-canvas::-webkit-scrollbar {\n display: none;\n }\n "]);return _s=function(){return e},e}function _c(){let e=(0,ns._)(["\n .ant-dropdown-menu-item {\n justify-content: flex-end;\n .ant-dropdown-menu-title-content {\n display: flex;\n align-items: baseline;\n justify-content: flex-end;\n text-align: right;\n\n time {\n width: 14em;\n font-size: 80%;\n }\n }\n }\n "]);return _c=function(){return e},e}function _d(){let e=(0,ns._)(["\n .ant-dropdown-menu-item {\n .ant-dropdown-menu-title-content {\n strong {\n font-weight: normal;\n }\n\n > .enabled {\n strong {\n font-weight: bold;\n }\n }\n\n > .unexecuted {\n strong {\n font-style: italic;\n }\n }\n }\n }\n "]);return _d=function(){return e},e}function _u(){let e=(0,ns._)(["\n .ant-dropdown-menu-item {\n .id {\n flex-grow: 1;\n text-align: right;\n }\n }\n "]);return _u=function(){return e},e}function _p(){let e=(0,ns._)(["\n display: flex;\n position: relative;\n margin: 2em auto auto auto;\n\n :before {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n left: calc(50% - 0.5px);\n width: 1px;\n background-color: ",";\n }\n "]);return _p=function(){return e},e}function _m(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n min-width: 20em;\n padding: 0 2em;\n\n .workflow-node-list {\n flex-grow: 1;\n }\n\n .workflow-branch-lines {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n background-color: ",";\n }\n\n :before,\n :after {\n content: '';\n position: absolute;\n height: 1px;\n background-color: ",";\n }\n\n :before {\n top: 0;\n }\n\n :after {\n bottom: 0;\n }\n\n :not(:first-child):not(:last-child) {\n :before,\n :after {\n left: 0;\n width: 100%;\n }\n }\n\n :last-child:not(:first-child) {\n :before,\n :after {\n right: 50%;\n width: 50%;\n }\n }\n\n :first-child:not(:last-child) {\n :before,\n :after {\n left: 50%;\n width: 50%;\n }\n }\n\n .end-sign {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 0;\n height: 6em;\n border-left: 1px dashed ",";\n\n .anticon {\n font-size: 1.5em;\n line-height: 100%;\n }\n }\n "]);return _m=function(){return e},e}function _h(){let e=(0,ns._)(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n color: ",";\n "]);return _h=function(){return e},e}function _x(){let e=(0,ns._)(["\n position: relative;\n "]);return _x=function(){return e},e}function _f(){let e=(0,ns._)(["\n margin-bottom: 0.5em;\n\n .workflow-node-id {\n color: ",";\n\n &:before {\n content: '#';\n }\n }\n "]);return _f=function(){return e},e}function _v(){let e=(0,ns._)(["\n display: flex;\n align-items: center;\n font-weight: normal;\n .workflow-node-id {\n color: ",";\n }\n "]);return _v=function(){return e},e}function _g(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column-reverse;\n align-items: center;\n margin: auto;\n "]);return _g=function(){return e},e}function _y(){let e=(0,ns._)(["\n padding: 1em;\n background-color: ",";\n "]);return _y=function(){return e},e}function _b(){let e=(0,ns._)(["\n flex-shrink: 0;\n padding: 2em 0;\n\n > .ant-btn {\n &:disabled {\n visibility: hidden;\n }\n }\n "]);return _b=function(){return e},e}function _C(){let e=(0,ns._)(["\n position: relative;\n overflow: visible;\n\n > span {\n position: absolute;\n top: calc(1.5em - 1px);\n line-height: 1em;\n color: ",";\n background-color: ",";\n padding: 1px;\n }\n "]);return _C=function(){return e},e}function _S(){let e=(0,ns._)(["\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 2em;\n height: 6em;\n "]);return _S=function(){return e},e}function _w(){let e=(0,ns._)(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 4em;\n height: 4em;\n border-radius: 50%;\n background-color: ",";\n color: ",";\n\n .workflow-node-config-button {\n display: none;\n }\n "]);return _w=function(){return e},e}let _F=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{workflowPageClass:t(_s(),n.colorBgContainer,n.colorBorderSecondary,n.colorBgContainer),dropdownClass:t(_c()),workflowVersionDropdownClass:t(_d()),executionsDropdownRowClass:t(_u()),branchBlockClass:t(_p(),n.colorBgLayout),branchClass:t(_m(),n.colorBorder,n.colorBorder,n.colorBgLayout),nodeJobButtonClass:t(_h(),n.colorTextLightSolid),nodeHeaderClass:t(_x()),nodeMetaClass:t(_f(),n.colorTextDescription),nodeTitleClass:t(_v(),n.colorTextDescription),nodeSubtreeClass:t(_g()),nodeJobResultClass:t(_y(),n.colorBgContainer),addButtonClass:t(_b()),conditionClass:t(_C(),n.colorTextSecondary,n.colorBgLayout),loopLineClass:t(_S()),terminalClass:t(_w(),n.colorText,n.colorBgContainer)}});function _j(e){let{from:t=null,entry:n=null,branchIndex:o=null,controller:l=null,className:r,end:i}=e,{styles:a}=_F(),{getAriaLabel:s}=qU(t,o),c=[];for(let e=n;e;e=e.downstream)c.push(e);return(0,A.jsxs)("div",{className:(0,iS.cx)("workflow-branch",a.branchClass,r),children:[(0,A.jsx)("div",{className:"workflow-branch-lines"}),l,(0,A.jsx)(_e,{"aria-label":s(),upstream:t,branchIndex:o}),(0,A.jsx)("div",{className:"workflow-node-list",children:c.map(e=>(0,A.jsx)(_a,{data:e},e.id))}),i?(0,A.jsx)("div",{className:"end-sign",children:(0,A.jsx)(cp.A,{})}):null]})}function _A(){let e=(0,ns._)(["\n margin-bottom: 1.5em;\n padding: 1em;\n background-color: ",";\n\n > *:last-child {\n margin-bottom: 0;\n }\n\n dl {\n display: flex;\n align-items: baseline;\n\n dt {\n color: ",";\n &:after {\n content: ':';\n margin-right: 0.5em;\n }\n }\n }\n\n p {\n color: ",";\n }\n "]);return _A=function(){return e},e}let _k=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{container:t(_A(),n.colorFillAlter,n.colorText,n.colorTextDescription)}});function _I(e){let{label:t,title:n,description:o,workflowKey:l,createdAt:r,createdBy:i}=e,{styles:a}=_k(),{t:s}=qV();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:(0,iS.cx)(a.container,e.className),children:[(0,A.jsxs)("dl",{children:[(0,A.jsx)("dt",{children:t}),(0,A.jsx)("dd",{children:(0,A.jsx)(nz.A,{style:{background:"none"},children:n})})]}),o?(0,A.jsx)("p",{children:o}):null]}),l||r||i?(0,A.jsxs)("div",{className:(0,iS.cx)(a.container,e.className),children:[l?(0,A.jsx)("p",{children:"".concat(s("Key"),": ").concat(l)}):null,r?(0,A.jsx)("p",{children:"".concat(s("Created at"),": ").concat((0,eh.convertUTCToLocal)(r))}):null,i?(0,A.jsx)("p",{children:"".concat(s("Created by"),": ").concat(i)}):null]}):null]})}let _P="json-parse",_T="js-parse",_N="data-mapping",_M="deprecated";function _D(){let e=(0,ns._)(["\n margin-bottom: 1.5em;\n padding: 1em;\n background-color: ",";\n\n > *:last-child {\n margin-bottom: 0;\n }\n\n dl {\n display: flex;\n align-items: baseline;\n\n dt {\n color: ",";\n &:after {\n content: ':';\n margin-right: 0.5em;\n }\n }\n }\n\n p {\n color: ",";\n }\n "]);return _D=function(){return e},e}function _R(){let e=(0,ns._)(["\n background-color: yellow;\n "]);return _R=function(){return e},e}let _q=e=>{var t;let{className:n}=e,{t:o}=qV(),{styles:l}=__(),r=eB(),{instructions:i}=oc(LV),{nodes:a}=null!=(t=qX())?t:{},s=(0,es.useMemo)(()=>null==a?void 0:a.reduce((e,t)=>{let{group:n,title:l}=i.get(t.type),r=qQ.find(e=>e.key===n),a={key:n,title:l,groupLabel:(null==r?void 0:r.label)?null==r?void 0:r.label:o("Unkown group"),count:1,isDeprecated:n===_M},s=e.findIndex(e=>e.key===n);return s>0?e[s].count++:e.push(a),e},[]),[a]);return(0,A.jsxs)("div",{className:(0,iS.cx)(l.container,n),children:[(0,A.jsxs)("dl",{children:[(0,A.jsx)("dt",{children:o("Node list")}),(0,A.jsx)("dd",{children:o("group-title-count")})]}),s.map((e,t)=>{let{key:n,title:i,groupLabel:a,count:s,isDeprecated:c}=e;return(0,A.jsx)("p",{className:c?l.deprecated:"",children:"".concat(t+1,": ").concat(a,":").concat(r(i),"-").concat(s," ").concat(c?o("Deprecated, please do not use it"):"")},n)})]})},__=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{container:t(_D(),n.colorFillAlter,n.colorText,n.colorTextDescription),deprecated:t(_R())}});function _O(){let e=(0,ns._)(["\n position: absolute;\n top: 50%;\n right: -50px;\n transform: translateY(-50%);\n "]);return _O=function(){return e},e}function _B(){let e=(0,ns._)(["\n .ant-select.auto-width {\n width: auto;\n min-width: 6em;\n }\n "]);return _B=function(){return e},e}function _E(){var e;let t=(0,ec.useForm)(),n=eC(),{workflow:o}=null!=(e=qX())?e:{},l=co(),{refresh:r}=hn();return{async run(){o.executed?cg.Ay.error(qE("Trigger in executed workflow cannot be modified")):(await t.submit(),await n.resource("workflows").update({filterByTk:o.id,values:{config:t.values}}),l.setFormValueChanged(!1),cg.Ay.success("success"),r())}}}class _V{constructor(){(0,em._)(this,"sync",void 0),(0,em._)(this,"title",void 0),(0,em._)(this,"description",void 0),(0,em._)(this,"fieldset",void 0),(0,em._)(this,"view",void 0),(0,em._)(this,"scope",void 0),(0,em._)(this,"components",void 0),(0,em._)(this,"initializers",void 0),(0,em._)(this,"isActionTriggerable",void 0)}}let _z=()=>{let e=eB(),{workflow:t,execution:n}=qX(),{styles:o}=_F(),l=_K();return n?(0,A.jsx)(al,{schema:{type:"void",name:"execution","x-component":"Action","x-component-props":{title:(0,A.jsx)(i6,{type:"InfoOutlined"}),shape:"circle",size:"small",className:(0,iS.cx)(o.nodeJobButtonClass,(0,iS.css)(_O())),type:"primary"},properties:{[n.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:{...n,context:JSON.stringify(n.context||{},null,2)}},"x-component":"Action.Modal",title:(0,A.jsxs)("div",{className:(0,iS.cx)(o.nodeTitleClass),children:[(0,A.jsx)(nz.A,{children:e(l.title)}),(0,A.jsx)("strong",{children:t.title}),(0,A.jsxs)("span",{className:"workflow-node-id",children:["#",n.id]})]}),properties:{createdAt:{type:"string",title:'{{t("Triggered at", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"string",title:'{{t("Trigger variables", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"CodeMirror","x-component-props":{defaultLanguage:"json"},"x-read-pretty":!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{copy:{type:"void",title:'{{t("Duplicate")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){let{t:e}=(0,eT.useTranslation)();return{async run(){try{let t=JSON.stringify(n.context,null,2);await navigator.clipboard.writeText(t),cg.Ay.success(e("Copied"))}catch(t){cg.Ay.error(e("Copy failed"))}}}}}}}}}}}}}):null};function _L(){return{form:(0,ec.useForm)()}}let _G=()=>{var e;let t=eC(),{workflow:n,refresh:o}=qX(),[l,r]=(0,es.useState)(""),[i,a]=(0,es.useState)(!1),[s,c]=(0,es.useState)(!1),{styles:d}=_F(),u=eB(),p=_K(),m=u(p.title),{fieldset:h,scope:x,components:f}=p,v=n.executed?'{{t("View")}}':'{{t("Configure")}}',g=qE("Trigger");(0,es.useEffect)(()=>{if(n){var e,t;r(null!=(t=null!=(e=n.triggerTitle)?e:n.title)?t:m)}},[n]);let y=(0,es.useMemo)(()=>{let e=(0,ed.cloneDeep)(n.config);return(0,ec.createForm)({initialValues:e,disabled:n.executed})},[n]),b=(0,es.useCallback)(e=>{a(e),e||y.reset()},[y]);(0,es.useCallback)(async function(e){let l=e||m;r(l),l!==n.triggerTitle&&(await t.resource("workflows").update({filterByTk:n.id,values:{triggerTitle:l}}),o())},[n]);let C=(0,es.useCallback)(function(e){if(e.target===e.currentTarget)return void a(!0);let t=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let o=e.target;o&&o!==e.currentTarget;o=o.parentNode){var n;if(Array.from(null!=(n=o.classList)?n:[]).some(e=>t.has(e))){a(!0),e.stopPropagation();return}}},[]);return(0,A.jsxs)("div",{style:{position:"relative"},children:[(0,A.jsxs)("div",{role:"button","aria-label":"".concat(g,"-").concat(l),className:(0,iS.cx)(d.terminalClass),onClick:C,children:[qE("Start"),(0,A.jsx)(ct,{value:{visible:i,setVisible:b,formValueChanged:s,setFormValueChanged:c},children:(0,A.jsx)(ae,{form:y,children:(0,A.jsx)(al,{scope:{...x,useFormProviderProps:_L},components:f,schema:{name:"workflow-trigger-".concat(n.id),type:"void",properties:{config:{type:"void","x-content":v,"x-component":e3.Ay,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:g,"x-component":"Action.Area","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:{...p.description?{description:{type:"void","x-component":_I,"x-component-props":{label:qE("Trigger type"),title:p.title,description:p.description,workflowKey:n.key,createdAt:n.createdAt,createdBy:null==(e=n.createdBy)?void 0:e.nickname}}}:{},fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:(0,iS.css)(_B())},properties:h},actions:n.executed?{}:{type:"void","x-component":"ActionArea.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:_E}}}},showNodes:{type:"void","x-component":_q}}}}}})})})]}),(0,A.jsx)(_z,{})]})};function _K(){let e=oc(Lz),{workflow:t}=qX();return e.triggers.get(t.type)}function _$(){let e=(0,ns._)(["\n margin-top: 0 !important;\n "]);return _$=function(){return e},e}function _U(){let e=(0,ns._)(["\n margin-bottom: 1em;\n "]);return _U=function(){return e},e}function _W(){let e=(0,ns._)(["\n margin-top: 0 !important;\n "]);return _W=function(){return e},e}let _H="workflow-zoom";function _Y(e){let{entry:t}=e,{styles:n}=_F(),{workflow:o}=qX(),[l,r]=es.useState(100),i=eu().debounce(e=>{localStorage.setItem(_H,e)});return(0,es.useEffect)(()=>{let e=localStorage.getItem(_H);e&&Number(e)>0&&r(Number(e))},[]),(0,A.jsxs)("div",{className:"workflow-canvas-wrapper",children:[(0,A.jsx)("div",{className:"workflow-canvas",style:{zoom:l/100},children:(0,A.jsx)("div",{className:(0,iS.cx)(n.branchBlockClass,(0,iS.css)(_$())),children:(0,A.jsxs)("div",{className:n.branchClass,children:[(null==o?void 0:o.executed)?(0,A.jsx)(ov.A,{type:"warning",message:qE("Executed workflow cannot be modified"),showIcon:!0,className:(0,iS.css)(_U())}):null,(0,A.jsx)(_G,{}),(0,A.jsx)("div",{className:(0,iS.cx)(n.branchBlockClass,(0,iS.css)(_W())),children:(0,A.jsx)(_j,{entry:t})}),(0,A.jsx)("div",{className:n.terminalClass,children:qE("End")})]})})}),(0,A.jsx)("div",{className:"workflow-canvas-zoomer",children:(0,A.jsx)(Ax.A,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:l,onChange:e=>{r(e),i(e)}})})]})}let _X="workflow-splitter",_J=e=>{let{entry:t}=e,n=qX(),[o,l]=(0,es.useState)(600),r=eu().debounce(e=>{localStorage.setItem(_X,e)});return(0,es.useEffect)(()=>{let e=localStorage.getItem(_X);e&&Number(e)>0&&l(Number(e))},[n.workflow.key]),(0,A.jsx)(ca,{children:(0,A.jsxs)(q$.A,{onResize:e=>{l(e[1]),r(String(e[1]))},children:[(0,A.jsx)(q$.A.Panel,{collapsible:!0,children:(0,A.jsx)(_Y,{entry:t})}),(0,A.jsx)(q$.A.Panel,{size:o,min:"240",collapsible:!0,className:"workflow-operator-area",children:(0,A.jsx)(cc,{})})]})})},_Q=e=>{let t=(0,ep.useNavigate)();return(0,A.jsx)(e3.Ay,{type:"text",icon:(0,A.jsx)(i6,{type:"ArrowLeftOutlined"}),onClick:()=>{t(-1)},...e})};function _Z(){let e=(0,ns._)(["\n border: none;\n .ant-tag {\n display: inline-grid;\n place-items: center;\n width: 100%;\n height: 100%;\n padding: 0;\n margin-right: 0;\n border-radius: 50%;\n text-align: center;\n }\n "]);return _Z=function(){return e},e}function _0(){let e=(0,ns._)(["\n border-width: 2px;\n "]);return _0=function(){return e},e}let _1=(0,nu.rU)(e=>{let{css:t}=e;return{statusButtonClass:t(_Z()),noStatusButtonClass:t(_0())}});function _2(e){var t;let{styles:n}=_1(),o=null;if(void 0!==e.status&&(null==(t=e.statusMap)?void 0:t[e.status])){let{icon:t,color:n}=e.statusMap[e.status];o=(0,A.jsx)(nz.A,{color:n,children:t})}return(0,A.jsx)(e3.Ay,{...e,shape:"circle",size:"small",className:(0,iS.cx)(o?n.statusButtonClass:n.noStatusButtonClass,e.className),children:o})}var _6=n(83810),_3=n(10735),_5=n(71818),_4=n(33901);let _8=[{value:null,label:'{{t("Queueing", { ns: "'.concat(qB,'" })}}'),color:"blue",icon:(0,A.jsx)(_6.A,{}),description:'{{t("Triggered but still waiting in queue to execute.", { ns: "'.concat(qB,'" })}}')},{value:0,label:'{{t("On going", { ns: "'.concat(qB,'" })}}'),color:"gold",icon:(0,A.jsx)(tn.A,{}),description:'{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "'.concat(qB,'" })}}')},{value:1,label:'{{t("Resolved", { ns: "'.concat(qB,'" })}}'),color:"green",icon:(0,A.jsx)(jF.A,{}),description:'{{t("Successfully finished.", { ns: "'.concat(qB,'" })}}')},{value:-1,label:'{{t("Failed", { ns: "'.concat(qB,'" })}}'),color:"red",icon:(0,A.jsx)(_3.A,{}),description:'{{t("Failed to satisfy node configurations.", { ns: "'.concat(qB,'" })}}')},{value:-2,label:'{{t("Error", { ns: "'.concat(qB,'" })}}'),color:"red",icon:(0,A.jsx)(cp.A,{}),description:'{{t("Some node meets error.", { ns: "'.concat(qB,'" })}}')},{value:-3,label:'{{t("Aborted", { ns: "'.concat(qB,'" })}}'),color:"red",icon:(0,A.jsx)(_5.A,{rotate:90}),description:'{{t("Running of some node was aborted by program flow.", { ns: "'.concat(qB,'" })}}')},{value:-4,label:'{{t("Canceled", { ns: "'.concat(qB,'" })}}'),color:"volcano",icon:(0,A.jsx)(_5.A,{rotate:45}),description:'{{t("Manually canceled whole execution when waiting.", { ns: "'.concat(qB,'" })}}')},{value:-5,label:'{{t("Rejected", { ns: "'.concat(qB,'" })}}'),color:"volcano",icon:(0,A.jsx)(_5.A,{}),description:'{{t("Rejected from a manual node.", { ns: "'.concat(qB,'" })}}')},{value:-6,label:'{{t("Retry needed", { ns: "'.concat(qB,'" })}}'),color:"volcano",icon:(0,A.jsx)(_4.A,{}),description:'{{t("General failed but should do another try.", { ns: "'.concat(qB,'" })}}')}],_7=_8.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{}),_9=[{value:0,label:'{{t("Pending", { ns: "'.concat(qB,'" })}}'),color:"#FFD92D",icon:(0,A.jsx)(i6,{type:"HistoryOutlined"})},{value:1,label:'{{t("Resolved", { ns: "'.concat(qB,'" })}}'),color:"#2DCD22",icon:(0,A.jsx)(i6,{type:"CheckOutlined"})},{value:-1,label:'{{t("Failed", { ns: "'.concat(qB,'" })}}'),color:"#F45353",icon:(0,A.jsx)(i6,{type:"ExclamationOutlined"})},{value:-2,label:'{{t("Error", { ns: "'.concat(qB,'" })}}'),color:"#F45353",icon:(0,A.jsx)(i6,{type:"CloseOutlined"})},{value:-3,label:'{{t("Aborted", { ns: "'.concat(qB,'" })}}'),color:"#F45353",icon:(0,A.jsx)(i6,{type:"MinusOutlined",rotate:90})},{value:-4,label:'{{t("Canceled", { ns: "'.concat(qB,'" })}}'),color:"volcano",icon:(0,A.jsx)(i6,{type:"MinusOutlined",rotate:45})},{value:-5,label:'{{t("Rejected", { ns: "'.concat(qB,'" })}}'),color:"volcano",icon:(0,A.jsx)(i6,{type:"MinusOutlined"})},{value:-6,label:'{{t("Retry needed", { ns: "'.concat(qB,'" })}}'),color:"volcano",icon:(0,A.jsx)(i6,{type:"RedoOutlined"})}],Oe=_9.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{});function Ot(e){let t=new Map;for(let n of(e.forEach(e=>t.set(e.id,e)),t.values()))n.upstreamId&&(n.upstream=t.get(n.upstreamId)),n.downstreamId&&(n.downstream=t.get(n.downstreamId))}function On(e){let t=e.$and||e.$or;return!!t&&t.some(e=>{if(e.$and||e.$or)return On(e);let[t]=Object.keys(e);if(!t||!e[t])return!1;let[n]=Object.keys(e[t]);return!!n&&void 0!==e[t][n]})}function Oo(e,t){t(e),e.properties&&Object.keys(e.properties).forEach(n=>{Oo(e.properties[n],t)})}function Ol(e,t){return"/_admin/business-components/".concat(t||"workflow","/").concat(e,"/workflow")}function Or(e,t){return"/_admin/business-components/".concat(t||"workflow","/").concat(e,"/executions")}function Oi(){let{instructions:e}=oc(Lz),t=eB(),{viewJob:n,setViewJob:o}=qX();if(!n)return;n.cost=function(e){if(e>=0x5250a80)return"".concat(999," D");let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),l=e%60,r="";return t>0&&(r+="".concat(t," D ")),(n>0||t>0)&&(r+="".concat(n," h ")),(o>0||n>0||t>0)&&(r+="".concat(o," m ")),e>=60?r+="".concat(Math.floor(l)," s"):r+="".concat(l.toFixed(3)," s"),r.trim()}(n.cost/1e3);let{styles:l}=_F(),{node:r={}}=null!=n?n:{},i=e.get(r.type);return(0,A.jsx)(ct,{value:{visible:!!n,setVisible:o},children:(0,A.jsx)(al,{schema:{type:"void",properties:{["".concat(null==n?void 0:n.id,"-").concat(null==n?void 0:n.updatedAt,"-modal")]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:{...n,result:JSON.stringify(n.result,null,2)}},"x-component":"Action.Modal",title:(0,A.jsxs)("div",{className:l.nodeTitleClass,children:[(0,A.jsx)(nz.A,{children:t(null==i?void 0:i.title)}),(0,A.jsx)("strong",{children:r.title}),(0,A.jsxs)("span",{className:"workflow-node-id",children:["#",r.id]})]}),properties:{status:{type:"number",title:'{{t("Status", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Select",enum:_9,"x-read-pretty":!0},updatedAt:{type:"string",title:'{{t("Executed at", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},cost:{type:"string",title:'{{t("Executed time", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input","x-read-pretty":!0},result:{type:"string",title:'{{t("Node result", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"CodeMirror","x-component-props":{defaultLanguage:"json"},"x-read-pretty":!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{copy:{type:"void",title:'{{t("Duplicate")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){let{t:e}=(0,eT.useTranslation)();return{async run(){try{let t=JSON.stringify(n.result,null,2);await navigator.clipboard.writeText(t),cg.Ay.success(e("Copied"))}catch(t){cg.Ay.error(e("Copy failed"))}}}}}}}}}}}}})})}function Oa(e){var t;let{execution:n}=qX(),o=eC(),l=(0,ep.useNavigate)(),{styles:r}=_F(),[i,a]=(0,es.useState)([]),[s,c]=(0,es.useState)([]),d=null==(t=window.location.pathname.split("business-components/")[1])?void 0:t.split("/")[0];(0,es.useEffect)(()=>{n&&o.resource("executions").list({filter:{key:n.key,id:{$lt:n.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(e=>{let{data:t}=e;a(t.data)}).catch(()=>{})},[n]),(0,es.useEffect)(()=>{n&&o.resource("executions").list({filter:{key:n.key,id:{$gt:n.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(e=>{let{data:t}=e;c(t.data.reverse())}).catch(()=>{})},[n]);let u=(0,es.useCallback)(e=>{let{key:t}=e;t!==n.id&&l(Or(t,d))},[n]);return n?(0,A.jsx)(nX.A,{menu:{onClick:u,defaultSelectedKeys:["".concat(n.id)],className:(0,iS.cx)(r.dropdownClass,r.executionsDropdownRowClass),items:[...s,n,...i].map(e=>({key:e.id,label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{className:"id",children:"#".concat(e.id)}),(0,A.jsx)("time",{children:(0,eh.str2moment)(e.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:(0,A.jsx)("span",{children:(0,A.jsx)(_2,{statusMap:_7,status:e.status})})}))},children:(0,A.jsxs)(of.A,{children:[(0,A.jsx)("strong",{children:"#".concat(n.id)}),(0,A.jsx)(xm.A,{})]})}):null}function Os(){var e,t;let{t:n}=(0,eT.useTranslation)(),o=eB(),{data:l,loading:r,refresh:i}=hn(),{setTitle:a}=wT(),[s,c]=(0,es.useState)(null),d=os(),u=eC(),p=null==(e=window.location.pathname.split("business-components/")[1])?void 0:e.split("/")[0],m=d.systemSettingsManager.get("business-components.".concat(p))||{};(0,es.useEffect)(()=>{var e;let{workflow:t}=null!=(e=null==l?void 0:l.data)?e:{};null==a||a("".concat((null==t?void 0:t.title)?"".concat(t.title," - "):"").concat(qE("Execution history")))},[null==l?void 0:l.data]);let h=(0,es.useCallback)(()=>{ox.A.confirm({title:qE("Cancel the execution"),icon:(0,A.jsx)(x8.A,{}),content:qE("Are you sure you want to cancel the execution?"),onOk:()=>{u.resource("executions").cancel({filterByTk:null==l?void 0:l.data.id}).then(()=>{cg.Ay.success(n("Operation succeeded")),i()}).catch(e=>{console.error(e.data.error)})}})},[null==l?void 0:l.data]);if(!(null==l?void 0:l.data))return r?(0,A.jsx)(eD.A,{}):(0,A.jsx)(e6.Ay,{status:"404",title:"Not found"});let{jobs:x=[],workflow:{nodes:f=[],revisions:v=[],...g}={},...y}=null!=(t=null==l?void 0:l.data)?t:{};Ot(f),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map;e.forEach(e=>{e.jobs=[],n.set(e.id,e)}),t.forEach(e=>{let t=n.get(e.nodeId);t.jobs.push(e),e.node={id:t.id,key:t.key,title:t.title,type:t.type}}),e.forEach(e=>{e.jobs=e.jobs.sort((e,t)=>e.id-t.id)})}(f,x);let b=f.find(e=>!e.upstream),C=_7[y.status];return(0,A.jsxs)(qY.Provider,{value:{workflow:g.type?g:null,nodes:f,execution:y,viewJob:s,setViewJob:c},children:[(0,A.jsxs)("div",{className:"workflow-toolbar",children:[(0,A.jsxs)("header",{children:[(0,A.jsx)(_Q,{}),(0,A.jsx)(qK.A,{items:[{title:(0,A.jsx)(eN.Link,{to:d.systemSettingsManager.getRoutePath("business-components.".concat(p||"workflow")),children:o(m.label)})},{title:(0,A.jsx)(eN.Link,{to:Ol(g.id,p),children:g.title})},{title:(0,A.jsx)(Oa,{})}]})]}),(0,A.jsxs)("aside",{children:[(0,A.jsx)(nz.A,{color:C.color,children:o(C.label)}),y.status?null:(0,A.jsx)(iV.A,{title:qE("Cancel the execution"),children:(0,A.jsx)(e3.Ay,{type:"link",danger:!0,onClick:h,shape:"circle",size:"small",icon:(0,A.jsx)(qG.A,{})})}),(0,A.jsx)("time",{children:(0,eh.str2moment)(y.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),(0,A.jsx)(_J,{entry:b}),(0,A.jsx)(Oi,{})]})}let Oc=()=>{let e=(0,ep.useParams)(),{styles:t}=_F();return(0,A.jsx)("div",{className:(0,iS.cx)(t.workflowPageClass),children:(0,A.jsx)(al,{schema:{type:"void",properties:{["execution_".concat(e.id)]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:Os}})})};class Od{constructor(){(0,em._)(this,"title",void 0),(0,em._)(this,"type",void 0),(0,em._)(this,"group",void 0),(0,em._)(this,"icon",void 0),(0,em._)(this,"color",void 0),(0,em._)(this,"isHot",void 0),(0,em._)(this,"description",void 0),(0,em._)(this,"options",void 0),(0,em._)(this,"fieldset",void 0),(0,em._)(this,"view",void 0),(0,em._)(this,"scope",void 0),(0,em._)(this,"components",void 0),(0,em._)(this,"end",void 0)}}function Ou(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n "]);return Ou=function(){return e},e}function Op(e){return["hasMany","belongsToMany"].includes(e.type)}function Om(e){let t,{value:n,onChange:o,...l}=e,{setValuesIn:r}=(0,ec.useForm)(),{getCollection:i}=sO(),a=(t=eB(),[OR,Oq].map(e=>{var n;let o=null==(n=e.useOptions({types:[Op],appends:null,depth:4}))?void 0:n.filter(Boolean);return{label:t(e.label),value:e.value,key:e.value,children:t(o),disabled:o&&!o.length}})),[s,c]=(0,es.useState)(a),{associatedKey:d="",name:u}=null!=n?n:{},p=[],m=d.match(/^{{(.*)}}$/);m&&(p=[...m[1].trim().split(".").slice(0,-1),u]);let h=async e=>{var t;let n=e[e.length-1];(null==(t=n.children)?void 0:t.length)||n.isLeaf||!n.loadChildren||(await n.loadChildren(n),c(e=>[...e]))};(0,es.useEffect)(()=>{(async()=>{if(!p||s.length<=1)return;let e=null;for(let n=0;n<p.length;n++){let o=p[n];try{if(0===n)e=s.find(e=>e.value===o);else{var t;!e.loadChildren||(null==(t=e.children)?void 0:t.length)||await e.loadChildren(e),e=e.children.find(e=>e.value===o)}}catch(e){console.error(e)}}c([...s])})()},[n,s.length]);let x=(0,es.useCallback)((e,t)=>{if(!(null==e?void 0:e.length)){r("collection",null),o({});return}let{field:n}=t.pop();if(!n||!["hasMany","belongsToMany"].includes(n.type))return;let{collectionName:l,target:a,name:s,dataSourceKey:c}=n,d=i(l,c).fields.find(e=>e.primaryKey);r("collection","".concat(c,":").concat(a)),o({name:s,associatedKey:"{{".concat(e.slice(0,-1).join("."),".").concat(d.name,"}}"),associatedCollection:vw(c,l)})},[o]);return(0,A.jsx)(om.A,{...l,value:p,options:s,changeOnSelect:!0,onChange:x,loadData:h})}class Oh extends Od{useVariables(e,t){let{key:n,title:o}=e,{types:l,fieldNames:r=OD}=t;return l&&!l.some(e=>e in OB||Object.values(OB).some(t=>t.has(e)))?null:{[r.value]:n,[r.label]:o}}useInitializers(e){var t;let n=qE("Query result");return e.config.collection?{name:"#".concat(e.id),type:"item",title:null!=(t=e.title)?t:"#".concat(e.id),Component:O5.Initializer,node:e,resultTitle:n}:null}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Aggregate", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","aggregate"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","SearchOutlined"),(0,em._)(this,"color","#19e8aa"),(0,em._)(this,"description",'{{t("Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{aggregator:{type:"string",title:'{{t("Aggregator function", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"COUNT",value:"count"},{label:"SUM",value:"sum"},{label:"AVG",value:"avg"},{label:"MIN",value:"min"},{label:"MAX",value:"max"}],required:!0,default:"count"},associated:{type:"boolean",title:'{{t("Target type", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Data of collection", { ns: "'.concat(qB,'" })}}'),value:!1},{label:'{{t("Data of associated collection", { ns: "'.concat(qB,'" })}}'),value:!0}],required:!0,default:!1,"x-reactions":[{target:"collection",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"association",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},collectionField:{type:"void","x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{target:{type:"void","x-component":"Grid.Col",properties:{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader",title:'{{t("Data of collection", { ns: "'.concat(qB,'" })}}'),"x-reactions":[{dependencies:["associated"],fulfill:{state:{display:'{{$deps[0] ? "hidden" : "visible"}}'}}},{target:"params.field",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},association:{type:"object",title:'{{t("Data of associated collection", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"AssociatedConfig","x-component-props":{changeOnSelect:!0},"x-reactions":[{dependencies:["associated"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}],required:!0}}},field:{type:"void","x-component":"Grid.Col",properties:{"params.field":{type:"string",title:'{{t("Field to aggregate", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{filter:e=>!e.hidden&&e.interface&&!["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)},required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}}}}}},params:{type:"object",properties:{distinct:{type:"boolean",title:'{{t("Distinct", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":[{dependencies:["collection","aggregator"],fulfill:{state:{visible:'{{!!$deps[0] && ["count"].includes($deps[1])}}'}}}]},filter:{type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{let{values:e}=(0,ec.useForm)(),[t,n]=vS(null==e?void 0:e.collection);return{options:hm(n,t),className:(0,iS.css)(Ou())}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{SchemaComponentContext:eV,FilterDynamicComponent:OJ,FieldsSelect:OM,ValueBlock:O5,AssociatedConfig:Om})}}class Ox extends eR{async load(){this.app.pm.get("workflow").registerInstruction("aggregate",Oh)}}let Of=[{value:1e3,label:"{{t('Seconds', { ns: \"workflow\" })}}"},{value:6e4,label:"{{t('Minutes', { ns: \"workflow\" })}}"},{value:36e5,label:"{{t('Hours', { ns: \"workflow\" })}}"},{value:864e5,label:"{{t('Days', { ns: \"workflow\" })}}"},{value:6048e5,label:"{{t('Weeks', { ns: \"workflow\" })}}"}];function Ov(e){let{value:t=6e4,onChange:n}=e,o=eB(),l=Of.slice().reverse().find(e=>!(t%e.value)),r=Math.round(t/l.value);return(0,A.jsxs)("fieldset",{style:{display:"flex",gap:"0.5em"},children:[(0,A.jsx)(kw.A,{min:1,value:r,onChange:e=>n(Math.round(e*l.value)),className:"auto-width"}),(0,A.jsx)(oo.A,{role:"button","data-testid":"select-time-unit",popupMatchSelectWidth:!1,value:l.value,onChange:e=>n(Math.round(r*e)),className:"auto-width",options:Of.map(e=>({value:e.value,label:o(e.label)}))})]})}class Og extends Od{isAvailable(e){let{engine:t,workflow:n,upstream:o,branchIndex:l}=e;return!t.isWorkflowSync(n)}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Delay", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","delay"),(0,em._)(this,"group","control"),(0,em._)(this,"icon","ClockCircleOutlined"),(0,em._)(this,"color","#cf9247"),(0,em._)(this,"description",'{{t("Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{duration:{type:"number",title:'{{t("Duration", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Duration",default:6e4,required:!0},endStatus:{type:"number",title:'{{t("End status", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Succeed and continue", { ns: "'.concat(qB,'" })}}'),value:1},{label:'{{t("Fail and exit", { ns: "'.concat(qB,'" })}}'),value:-1}],required:!0,default:1}}),(0,em._)(this,"components",{Duration:Ov})}}class Oy extends eR{async load(){this.app.pm.get("workflow").registerInstruction("delay",Og)}}function Ob(e){var t;return!!["belongsTo","hasOne"].includes(e.type)&&((null==(t=this.getCollection(e.collectionName))?void 0:t.template)==="expression"||this.getCollectionFields(e.target).some(e=>"expression"===e.interface))}function OC(e){let{value:t,onChange:n}=e,{getCollectionFields:o,getCollection:l}=sO(),r=OG({types:[Ob.bind({getCollectionFields:o,getCollection:l})]});return(0,A.jsx)(P7.Input,{value:t,onChange:n,scope:r})}class OS extends Od{useVariables(e,t){let{key:n,title:o}=e,{types:l,fieldNames:r=OD}=t;return l&&!l.some(e=>e in OB||Object.values(OB).some(t=>t.has(e)))?null:{[r.value]:n,[r.label]:o}}useInitializers(e){var t;return{name:"#".concat(e.id),type:"item",title:null!=(t=e.title)?t:"#".concat(e.id),Component:O5.Initializer,node:e,resultTitle:qE("Calculation result")}}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Dynamic Calculation", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","dynamic-calculation"),(0,em._)(this,"group","extended"),(0,em._)(this,"icon","CalculatorOutlined"),(0,em._)(this,"color","#2f79b9"),(0,em._)(this,"description",'{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{expression:{type:"string",title:'{{t("Calculation expression", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"DynamicExpression",required:!0},scope:{type:"string",title:'{{t("Variable datasource", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0,variableOptions:{types:[{type:"reference",options:{collection:"*",entity:!0}}]}},"x-reactions":{dependencies:["expression"],fulfill:{state:{visible:"{{$deps[0]}}"}}}},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"components",{DynamicExpression:OC,WorkflowVariableInput:OW,ValueBlock:O5})}}let Ow=(0,ec.observer)(e=>{let{onChange:t}=e,n=(0,ec.useField)(),o=(0,ec.useForm)(),l=[...n.path.segments.slice(0,-1),"sourceCollection"].join("."),[r,i]=(0,es.useState)(o.getValuesIn(l)),a=eB(),{getCollectionFields:s}=sO();(0,ec.useFormEffects)(()=>{(0,ec.onFormInitialValuesChange)(e=>{i(e.getValuesIn(l))}),(0,ec.onFieldInputValueChange)(l,e=>{i(e.value),t(null)})});let c=OU({collection:r,compile:a,getCollectionFields:s});return(0,A.jsx)(P7.TextArea,{...e,scope:c})},{displayName:"InternalExpression"}),OF=(0,ec.connect)(Ow,(0,ec.mapReadPretty)(function(e){let{t}=(0,eT.useTranslation)(),n=m3(),o=eB(),{getCollectionFields:l}=sO(),r=(0,es.useMemo)(()=>OU({collection:n.sourceCollection,compile:o,getCollectionFields:l}),[n.sourceCollection,n.sourceCollection]);return e.value?(0,A.jsx)(P7.TextArea,{...e,scope:r}):(0,A.jsx)(nz.A,{children:t("Unconfigured",{ns:qB})})})),{defaultProps:Oj}=y;class OA extends tR{constructor(...e){super(...e),(0,em._)(this,"name","expression"),(0,em._)(this,"type","string"),(0,em._)(this,"group","advanced"),(0,em._)(this,"icon","FunctionOutlined"),(0,em._)(this,"order",1),(0,em._)(this,"title",'{{t("Expression", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"description",'{{t("Used to store expressions for use in workflows so that different expressions can be called for different data.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"sortable",!0),(0,em._)(this,"default",{type:"text",uiSchema:{"x-component":"DynamicExpression"}}),(0,em._)(this,"properties",{...Oj})}}class Ok extends eR{async load(){this.app.dataSourceManager.addFieldInterfaces([OA]),this.app.addComponents({DynamicExpression:OF});let e=this.app.pm.get("workflow"),t=new OS;e.instructions.register(t.type,t)}}function OI(e){let t,{collection:n,dataPath:o,...l}=e,{insert:r}=me(),{getTemplateSchemaByMode:i}=rg(),{getCollection:a}=sO(),s=p1("FormItem");if("string"==typeof n){let[e,o]=vS(n);t=a(o,e)}else t=n;async function c(e){let{item:a}=e,s=a.template?await i(a):null,c={type:"void",name:(0,ec.uid)(),title:t.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:n,dataPath:o},"x-component":"CardItem","x-component-props":{title:l.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:s||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};Oo(c,e=>{e["x-uid"]&&delete e["x-uid"]}),r(c)}return(0,A.jsx)(mf,{...l,onClick:c,items:s})}function OP(e){var t;let n,o,l=mn(),r=null!=(t=null==e?void 0:e.collection)?t:l.collection;if("string"==typeof r){let e=vS(r);n=e[0],o=e[1]}else o=r;return(0,A.jsx)(hH,{dataSource:n,collection:o,children:(0,A.jsx)(OI,{...l,...e})})}function OT(e){let t,n,{collection:o,dataPath:l,children:r}=e,i=(0,ec.useField)(),a=(0,es.useRef)(null),{getAssociationAppends:s}=pe(),{appends:c,updateAssociationValues:d}=s(),u=function(e){let{execution:t,nodes:n}=qX(),o=(0,es.useMemo)(()=>n.reduce((e,t)=>Object.assign(e,{[t.id]:t.key}),{}),[n]),l=(0,es.useMemo)(()=>{var e;return{$context:null==t?void 0:t.context,$jobsMapByNodeKey:(null!=(e=null==t?void 0:t.jobs)?e:[]).reduce((e,t)=>Object.assign(e,{[o[t.nodeId]]:t.result}),{})}},[null==t?void 0:t.context,null==t?void 0:t.jobs,o]);return(0,es.useMemo)(()=>(0,ed.get)(l,e),[l,e])}(l);if("string"==typeof o){let e=vS(o);t=e[0],n=e[1]}else n=o;let p=(0,es.useMemo)(()=>(0,ec.createForm)({values:u,readPretty:!0}),[u]),m={loading:!1,data:{data:u}},h=eC().resource(n),x=nj();return(0,A.jsx)(hH,{dataSource:t,collection:n,children:(0,A.jsx)(m1,{record:u,parent:null,children:(0,A.jsx)(nC.Provider,{value:{block:"form",field:i,service:m,resource:h,__parent:x},children:(0,A.jsx)(Ta.Provider,{value:{params:{appends:c},form:p,field:i,service:m,updateAssociationValues:d,formBlockRef:a},children:r})})})})}function ON(){return!0}let OM=(0,ec.observer)(e=>{let{filter:t=ON,...n}=e,o=eB(),{getCollectionFields:l}=sO(),{values:r}=(0,ec.useForm)(),[i,a]=vS(null==r?void 0:r.collection),s=l(a,i);return(0,A.jsx)(oo.A,{popupMatchSelectWidth:!1,...n,options:s.filter(t).map(e=>{var t;return{label:o(null==(t=e.uiSchema)?void 0:t.title),value:e.name}})})},{displayName:"FieldsSelect"}),OD={label:"label",value:"value",children:"children"},OR={label:'{{t("Node result", { ns: "'.concat(qB,'" })}}'),value:"$jobsMapByNodeKey",useOptions(e){let t=eB(),{instructions:n}=oc(Lz),o=_t(_l()),l=[];return o.forEach(o=>{var r;let i=n.get(o.type),a="<".concat(t(i.title),">").concat(o.title),s=null==(r=i.useVariables)?void 0:r.call(i,{...o,title:a},e);s&&l.push(s)}),l}},Oq={label:'{{t("Trigger variables", { ns: "'.concat(qB,'" })}}'),value:"$context",useOptions(e){var t,n;let{triggers:o}=oc(Lz),{workflow:l}=qX(),r=o.get(l.type);return null!=(n=null==r||null==(t=r.useVariables)?void 0:t.call(r,l.config,e))?n:null}},O_={label:'{{t("Scope variables", { ns: "'.concat(qB,'" })}}'),value:"$scopes",useOptions(e){let{fieldNames:t=OD,current:n}=e,{instructions:o}=oc(Lz),l=_l(),r=function(e){let t=[];if(!e)return[];for(let n=e;n;n=n.upstream)n.upstream&&null!=n.branchIndex&&t.push(n.upstream);return t}(null!=n?n:l),i=[];return r.forEach(n=>{var l,r;let a=o.get(n.type),s=null==(l=a.useScopeVariables)?void 0:l.call(a,n,e);s&&i.push({key:n.key,[t.value]:n.key,[t.label]:null!=(r=n.title)?r:"#".concat(n.id),[t.children]:s})}),i}},OO={label:'{{t("System variables", { ns: "'.concat(qB,'" })}}'),value:"$system",useOptions(e){let{types:t,fieldNames:n=OD}=e;return!t||t.includes("date")?[{key:"now",[n.label]:qE("System time"),[n.value]:"now"}]:[]}},OB={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function OE(e,t){var n,o,l,r,i,a;return"string"==typeof t?null==(n=OB[t])?void 0:n.has(e.interface):"object"==typeof t&&"reference"===t.type?OV(e)?(null==(o=t.options)?void 0:o.entity)&&(e.collectionName===(null==(l=t.options)?void 0:l.collection)||(null==(r=t.options)?void 0:r.collection)==="*"):!!e.isForeignKey&&(e.collectionName===(null==(i=t.options)?void 0:i.collection)&&"id"===e.name||e.target===(null==(a=t.options)?void 0:a.collection)):"function"==typeof t&&t(e)}function OV(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Oz(e,t){if(null==t)return null;let n="".concat(e.name,".");return t.filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))}function OL(e,t){var n,o;let l=eB(),r=null==(o=e.useOptions)||null==(n=o.call(e,t))?void 0:n.filter(Boolean),{fieldNames:i}=t;return{[i.label]:l(e.label),[i.value]:e.value,key:e[i.value],[i.children]:r,disabled:!r||!r.length}}function OG(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign({},OD,null!=(e=t.fieldNames)?e:{}),o=Object.assign(t,{fieldNames:n});return[OL(O_,o),OL(OR,o),OL(Oq,o),OL(OO,o),ou("$env")].filter(Boolean)}function OK(e,t){let{compile:n,getCollectionFields:o}=t,[l,r]=vS(e),i=o(r,l),a=[],s=[];i.forEach(e=>{e.isForeignKey?a.push(e):s.push(e)});for(let e=s.length-1;e>=0;e--){var c,d,u,p,m,h,x;let t=s[e];if("belongsTo"===t.type){let o=a.find(e=>e.name===t.foreignKey);o?s.splice(e,0,{...t,...o,uiSchema:{...t.uiSchema,title:(null==(c=t.uiSchema)?void 0:c.title)?"".concat(n(null==(d=t.uiSchema)?void 0:d.title)," ID"):o.name}}):s.splice(e,0,{...t,name:t.foreignKey,type:"bigInt",isForeignKey:!0,interface:t.interface,uiSchema:{...t.uiSchema,title:(null==(u=t.uiSchema)?void 0:u.title)?"".concat(n(null==(p=t.uiSchema)?void 0:p.title)," ID"):t.name}})}else if("context"===t.type&&"users"===t.collectionName){let o=null!=(x=s.find(e=>"belongsTo"===e.type&&"users"===e.target&&e.foreignKey===t.name))?x:{};s.splice(e,0,{...t,type:t.dataType,interface:o.interface,uiSchema:{...o.uiSchema,title:(null==(m=o.uiSchema)?void 0:m.title)?"".concat(n(null==(h=o.uiSchema)?void 0:h.title)," ID"):t.name}})}}return s.filter(e=>e.interface&&!e.hidden)}function O$(e){let t=Oz(e.field,e.appends),n=OU({collection:"".concat(e.field.dataSourceKey&&"main"!==e.field.dataSourceKey?"".concat(e.field.dataSourceKey,":"):"").concat(e.field.target),types:e.types,appends:t,depth:e.depth-1,...this});e.loadChildren=null,n.length?e.children=n:(e.isLeaf=!0,!e.types||e.types.some(t=>OE(e.field,t))||(e.disabled=!0))}function OU(e){let{fields:t,collection:n,types:o,appends:l=[],depth:r=1,compile:i,getCollectionFields:a,fieldNames:s=OD}=e,c=null!=t?t:OK(n,{compile:i,getCollectionFields:a}),d=O$.bind({compile:i,getCollectionFields:a,fieldNames:s});return(function e(t){let{fields:n,types:o,appends:l,depth:r=1,compile:i,getCollectionFields:a}=t;return n.filter(t=>{let n=null==o||!o.length||o.some(e=>OE(t,e));if(!OV(t))return n;{if(null===l)return!!r&&(n||e({fields:OK(t.target,{compile:i,getCollectionFields:a}),types:o,depth:r-1,appends:l,compile:i,getCollectionFields:a}));let s=Oz(t,l),c=l.includes(t.name);return n?c:((null==s?void 0:s.length)||c)&&e({fields:OK(t.target,{compile:i,getCollectionFields:a}),types:o,appends:s,compile:i,getCollectionFields:a}).length}})})({fields:c,types:o,depth:r,appends:l,compile:i,getCollectionFields:a}).map(e=>{var t;let n=i((null==(t=e.uiSchema)?void 0:t.title)||e.name),a=Oz(e,l),c=!OV(e)||a&&!a.length&&!l.includes(e.name)||!1;return{[s.label]:n,key:e.name,[s.value]:e.name,isLeaf:c,loadChildren:c?null:d,field:e,depth:r,appends:l,types:o}})}function OW(e){let{variableOptions:t,...n}=e,o=OG(t);return(0,A.jsx)(P7.Input,{scope:o,...n})}function OH(e){let{variableOptions:t,...n}=e,o=OG(t);return(0,A.jsx)(P7.TextArea,{scope:o,...n})}function OY(e){let{variableOptions:t,...n}=e,o=OG(t);return(0,A.jsx)(P7.RawTextArea,{scope:o,...n})}function OX(e){let{variableOptions:t,...n}=e,o=OG(t);return(0,A.jsx)(P7.JSON,{scope:o,...n})}function OJ(e){let{value:t,onChange:n,renderSchemaComponent:o}=e,l=OG();return(0,A.jsx)(P7.Input,{value:t,onChange:n,scope:l,children:o()})}var OQ=n(97950);function OZ(){let e=(0,ns._)(["\n & + .anticon {\n margin-left: 0.25em;\n }\n "]);return OZ=function(){return e},e}function O0(e){let{options:t=[],getOptions:n=()=>[],direction:o,...l}=e,r=eB(),i=n(),a=t.length>0?t:i;return(0,A.jsx)(sU.Ay.Group,{...l,children:(0,A.jsx)(of.A,{direction:o,children:a.map(e=>(0,A.jsxs)(sU.Ay,{value:e.value,children:[(0,A.jsx)("span",{className:(0,iS.css)(OZ()),children:r(e.label)}),e.tooltip&&(0,A.jsx)(iV.A,{title:r(e.tooltip),children:(0,A.jsx)(OQ.A,{style:{color:"#666"}})})]},e.value))})})}function O1(){let e=(0,ns._)(["\n & + .anticon {\n margin-left: 0.25em;\n }\n "]);return O1=function(){return e},e}function O2(e){let{options:t=[],direction:n,...o}=e,l=eB();return(0,A.jsx)(j0.A.Group,{...o,children:(0,A.jsx)(of.A,{direction:n,children:t.map(e=>(0,A.jsxs)(j0.A,{value:e.value,children:[(0,A.jsx)("span",{className:(0,iS.css)(O1()),children:l(e.label)}),e.tooltip&&(0,A.jsx)(iV.A,{title:l(e.tooltip),children:(0,A.jsx)(OQ.A,{style:{color:"#666"}})})]},e.value))})})}function O6(){let e=(0,ec.useFieldSchema)(),t=eB();return(0,A.jsxs)(sP,{title:t(e.title),children:[(0,A.jsx)(aZ,{}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}function O3(){let e=(0,ns._)(["\n margin: 0;\n "]);return O3=function(){return e},e}let O5=()=>null;O5.Initializer=function(){let{node:e,resultTitle:t,...n}=mn(),{insert:o}=me();return(0,A.jsx)(mf,{...n,onClick:()=>{var n;o({type:"void",name:e.id,title:e.title,"x-component":"CardItem","x-component-props":{title:null!=(n=e.title)?n:"#".concat(e.id)},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:t,"x-component":"ValueBlock.Result","x-component-props":{dataSource:"{{$jobsMapByNodeKey.".concat(e.key,"}}")}}}})}})},O5.Result=function(e){var t;let{dataSource:n}=e,o=(0,ec.useFieldSchema)(),{execution:l}=qX();if(!l)return o.title;let r=(0,eh.parse)(n)({$jobsMapByNodeKey:(null!=(t=l.jobs)?t:[]).reduce((e,t)=>Object.assign(e,{[t.nodeKey]:t.result}),{})});return(0,A.jsx)("pre",{className:(0,iS.css)(O3()),children:JSON.stringify(r,null,2)})},O5.Designer=O6;let O4=function(e){let{component:t="div",children:n,...o}=e,[l,r]=(0,es.useState)(!1),i=(0,ec.useFieldSchema)();return(0,A.jsxs)(ct,{value:{visible:l,setVisible:r,fieldSchema:i},children:[es.createElement(t,{...o,onClick(){r(!0)}},n),(0,A.jsx)(al,{schema:i,onlyRenderProperties:!0})]})};function O8(){let e=(0,ns._)(["\n display: flex;\n "]);return O8=function(){return e},e}function O7(e){var t;let n=eB()(e.label),o=(0,es.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),{color:l}=null!=(t=_7[e.value])?t:{};return(0,A.jsx)(nz.A,{color:l,onMouseDown:o,closable:e.closable,onClose:e.onClose,children:n})}function O9(e){let t=eB();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(O7,{...e}),e.description?(0,A.jsx)("span",{children:t(e.description)}):null]})}function Be(e){let{...t}=e,n=t.multiple?"multiple":null;return(0,A.jsx)(oo.A,{role:"button","data-testid":"select-".concat(n||"single"),...t,mode:n,optionLabelProp:"label",tagRender:O7,children:_8.filter(e=>!!e.value&&-3!==e.value).map(e=>(0,A.jsx)(oo.A.Option,{...e,children:(0,A.jsx)(O9,{...e})},e.value))})}function Bt(e){let{t}=(0,eT.useTranslation)(),{refresh:n}=t6(),o=nt(),l=tz(),r=(0,es.useCallback)(()=>{ox.A.confirm({title:qE("Cancel the execution"),icon:(0,A.jsx)(x8.A,{}),content:qE("Are you sure you want to cancel the execution?"),onOk:()=>{o.cancel({filterByTk:l.id}).then(()=>{cg.Ay.success(t("Operation succeeded")),n()}).catch(e=>{console.error(e.data.error)})}})},[l]);return(0,A.jsxs)("div",{className:(0,iS.css)(O8()),children:[e.children,l.status?null:(0,A.jsx)(iV.A,{title:qE("Cancel the execution"),children:(0,A.jsx)(e3.Ay,{type:"link",danger:!0,onClick:r,shape:"circle",size:"small",icon:(0,A.jsx)(qG.A,{})})})]})}let Bn=e=>{let{...t}=e,[n,o]=(0,es.useState)(30),l=(0,es.useRef)(null);return(0,es.useEffect)(()=>{o(l.current.offsetWidth+50)},[]),(0,A.jsxs)("div",{style:{display:"inline-block",position:"relative",height:"100%"},children:[(0,A.jsx)(nJ.A,{...t,onChange:e=>{var n;o(l.current.offsetWidth+50),null==(n=t.onChange)||n.call(t,e)},style:{width:"".concat(n,"px")}}),(0,A.jsx)("span",{ref:l,style:{position:"absolute",visibility:"hidden",whiteSpace:"pre",font:"inherit"},children:t.value||t.placeholder})]})};function Bo(){let{workflow:e}=qX();return!!(null==e?void 0:e.allExecuted)}let Bl=()=>{let{t:e}=(0,eT.useTranslation)(),{id:t}=m3(),{setVisible:n}=co();return(0,A.jsx)(eN.Link,{to:Or(t),onClick:()=>n(!1),children:e("View")})},Br=()=>{let e=tz(),t=nt(),n=t6(),o=(0,ep.useNavigate)();return{async onClick(){try{let{data:{data:r}}=await t.retry({filterByTk:e.id});if(r&&r.id){var l;let e=null==(l=window.location.pathname.split("business-components/")[1])?void 0:l.split("/")[0];o(Or(r.id,e))}else null==n||n.refresh()}catch(e){null==n||n.refresh()}}}},Bi=()=>{let e=tz().latestExecutedTime,t=e?P()(e).format("YYYY-MM-DD HH:mm:ss"):"-";return(0,A.jsx)("div",{style:{textAlign:"left"},children:t})},Ba=(0,ec.observer)(e=>{let{value:t}=e,n=eB();return t&&Array.isArray(t)&&0!==t.length?(0,A.jsx)(A.Fragment,{children:t.map(e=>{let t=(null==e?void 0:e.name)||(null==e?void 0:e.id),o=null==e?void 0:e.color;return(0,A.jsx)(nz.A,{color:o,children:n(t)},(null==e?void 0:e.id)||t)})}):(0,A.jsx)("span",{children:"-"})}),Bs=e=>{var t,n,o;if(e["category.id"])return Array.isArray(e["category.id"])?e["category.id"][0]:e["category.id"];if(null==(t=e.category)?void 0:t.id)return Array.isArray(e.category.id)?e.category.id[0]:e.category.id;if(null==(n=e.$and)?void 0:n.length)for(let t of e.$and){if(t["category.id"])return Array.isArray(t["category.id"])?t["category.id"][0]:t["category.id"];if(null==(o=t.category)?void 0:o.id)return Array.isArray(t.category.id)?t.category.id[0]:t.category.id}},Bc=(0,ec.observer)(()=>{let{t:e}=(0,eT.useTranslation)(),t=t6(),n=t7(),[o,l]=(0,es.useState)("all"),r=(0,es.useRef)(void 0),i=(0,es.useRef)(!1);(0,es.useEffect)(()=>{var e,a,s,c,d,u,p;if(i.current){i.current=!1;return}let m=((null==t||null==(e=t.params)?void 0:e[0])||{}).filter||{},h=(null==n||null==(a=n.params)?void 0:a.filter)||{},x=Bs(m)||Bs(h);if(r.current!==x&&(void 0!==r.current||void 0!==x)){r.current=x,l("all");let e=(null==t||null==(u=t.params)||null==(d=u[1])?void 0:d.filters)||{};if(e.statusFilter){delete e.statusFilter;let n=pA([...Object.values(e),h]);t.run({...null==(p=t.params)?void 0:p[0],page:1,filter:n},{filters:e})}return}r.current=x;let f=((null==t||null==(c=t.params)||null==(s=c[1])?void 0:s.filters)||{}).statusFilter,v=m.enabled,g="all";(null==f?void 0:f.enabled)===!0||!0===v?g="enabled":((null==f?void 0:f.enabled)===!1||!1===v)&&(g="disabled"),g!==o&&l(g)},[null==t?void 0:t.params,n]);let a=(0,es.useCallback)(e=>{var r,a,s,c;let d=e.target.value;if(d===o)return;i.current=!0,l(d);let u={...null==t||null==(a=t.params)||null==(r=a[1])?void 0:r.filters},p=(null==n||null==(s=n.params)?void 0:s.filter)||{};"all"===d?delete u.statusFilter:u.statusFilter={enabled:"enabled"===d};let m=pA([...Object.values(u),p]);t.run({...null==(c=t.params)?void 0:c[0],page:1,filter:m},{filters:u})},[t,n,o]);return(0,A.jsx)(sU.Ay.Group,{value:o,onChange:a,optionType:"button",buttonStyle:"solid",options:[{label:e("All statuses"),value:"all"},{label:e("On"),value:"enabled"},{label:e("Off"),value:"disabled"}]})});class Bd extends _V{useVariables(e,t){let n=eB(),{getCollectionFields:o}=sO(),l=OU({appends:["user"],...t,fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:qz("User acted")}}],compile:n,getCollectionFields:o}),r=[{label:qE("Parameters"),value:"params",children:function(e,t){let n=eB(),{getCollectionFields:o}=sO();return[{label:qE("ID"),value:"filterByTk"},..."destroy"!==e.action?[{label:qE("Values submitted"),value:"values",children:OU({...t,appends:null,depth:3,collection:e.collection,compile:n,getCollectionFields:o})}]:[]]}(e,t)}];return[...l,{label:qE("Role of user acted"),value:"roleName"},...r]}useInitializers(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:qz("Trigger data"),Component:OP,collection:e.collection,dataPath:"$context.params.values"}:null}constructor(...e){super(...e),(0,em._)(this,"sync",!0),(0,em._)(this,"title",qE("Interceptor")),(0,em._)(this,"description",qE('Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the "End process" node.')),(0,em._)(this,"fieldset",{collection:{type:"string",title:qz("Collection"),required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader","x-reactions":[{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},global:{type:"boolean",title:qz("Trigger mode"),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:qz("Local mode, triggered before executing the actions bound to this workflow"),value:!1},{label:qz("Global mode, triggered before executing the following actions"),value:!0}]},default:!1},actions:{type:"number",title:qz("Select actions"),"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:[{label:qz("Create record action"),value:"create"},{label:qz("Update record action"),value:"update"},{label:qz("Delete record action"),value:"destroy"}]},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{FieldsSelect:OM,RadioWithTooltip:O0,CheckboxGroupWithTooltip:O2}),(0,em._)(this,"isActionTriggerable",(e,t)=>{let{global:n}=e;return!n&&!t.direct})}}class Bu extends eR{async load(){this.app.pm.get(Lz).registerTrigger("request-interception",Bd)}}function Bp(){let e=(0,ns._)(["\n > *:not(:last-child) {\n margin-right: 0.5em;\n }\n button {\n padding: 0;\n }\n "]);return Bp=function(){return e},e}class Bm extends Od{useVariables(e,t){let{key:n,title:o,config:l}=e,{types:r,fieldNames:i}=t,a=l.model||[];return{[i.label]:o,[i.value]:n,[i.children]:a.map(e=>({[i.label]:e.label,[i.value]:e.alias||e.path}))}}isAvailable(){return!1}constructor(...e){super(...e),(0,em._)(this,"title",qz("JS Parse")),(0,em._)(this,"type",_T),(0,em._)(this,"group",_M),(0,em._)(this,"description",qz("Get specific data from JSON result of any node BY js code;")),(0,em._)(this,"fieldset",{source:{type:"string",title:qz("Data source"),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0},required:!0},JSCode:{type:"string",title:qz("JSCode expression"),"x-decorator":"FormItem","x-decorator-props":{tooltip:"ctx.data\nctx.body\n__ctx\nlib.JSON\nlib.qrcode\ncanvas\nlib.dayjs\nlib.log"},"x-component":"CodeMirror",required:!0},model:{type:"array",title:qz("Properties mapping"),description:qz("If the type of query result is object or array of object, could map the properties which to be accessed in subsequent nodes."),"x-decorator":"FormItem","x-component":"ArrayTable",items:{type:"object",properties:{path:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Property path")},properties:{path:{type:"string",name:"path",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},alias:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Alias")},properties:{alias:{type:"string",name:"alias","x-decorator":"FormItem","x-component":"Input"}}},label:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Label")},properties:{label:{type:"string",name:"label",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{dataIndex:"operations",fixed:"right",className:(0,iS.css)(Bp())},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:qz("Add property"),"x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{}}}}}}),(0,em._)(this,"components",{ArrayTable:eh.ArrayTable,WorkflowVariableInput:OW})}}let Bh=class extends eR{async load(){this.app.pm.get(Lz).registerInstruction(_T,Bm)}};function Bx(){let e=(0,ns._)(["\n > *:not(:last-child) {\n margin-right: 0.5em;\n }\n button {\n padding: 0;\n }\n "]);return Bx=function(){return e},e}class Bf extends Od{useVariables(e,t){let{key:n,title:o,config:l}=e,{types:r,fieldNames:i}=t,a=l.model||[];return{[i.label]:o,[i.value]:n,[i.children]:a.map(e=>({[i.label]:e.label,[i.value]:e.alias||e.path}))}}isAvailable(){return!1}constructor(...e){super(...e),(0,em._)(this,"title",qz("JSON Parse")),(0,em._)(this,"type",_P),(0,em._)(this,"group",_M),(0,em._)(this,"description",qz("Get specific data from JSON result of any node BY jsonata; https://jsonata.org/")),(0,em._)(this,"fieldset",{source:{type:"string",title:qz("Data source"),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0},required:!0},expression:{type:"string",title:qz("Query expression"),"x-decorator":"FormItem","x-component":"CodeMirror"},model:{type:"array",title:qz("Properties mapping"),description:qz("If the type of query result is object or array of object, could map the properties which to be accessed in subsequent nodes."),"x-decorator":"FormItem","x-component":"ArrayTable",items:{type:"object",properties:{path:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Property path")},properties:{path:{type:"string",name:"path",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},alias:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Alias")},properties:{alias:{type:"string",name:"alias","x-decorator":"FormItem","x-component":"Input"}}},label:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Label")},properties:{label:{type:"string",name:"label",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{dataIndex:"operations",fixed:"right",className:(0,iS.css)(Bx())},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:qz("Add property"),"x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{}}}}}}),(0,em._)(this,"components",{ArrayTable:eh.ArrayTable,WorkflowVariableInput:OW})}}let Bv=class extends eR{async load(){this.app.pm.get(Lz).registerInstruction(_P,Bf)}};var Bg=n(40309);function By(){let e=(0,ns._)(["\n padding-left: 20em;\n "]);return By=function(){return e},e}function Bb(){let e=(0,ns._)(["\n width: 100%;\n\n .variable {\n flex: 1;\n }\n\n .ant-input.null-value {\n width: 100%;\n }\n "]);return Bb=function(){return e},e}class BC extends Od{Component(e){var t;let{data:n}=e,{nodes:o}=qX(),{styles:l}=_F(),r=o.find(e=>e.upstreamId===n.id&&null!=e.branchIndex);return(0,A.jsx)(zd,{data:n,children:(0,A.jsx)("div",{className:l.nodeSubtreeClass,children:(0,A.jsxs)("div",{className:(0,iS.cx)(l.branchBlockClass,(0,iS.css)(By())),children:[(0,A.jsx)(_j,{from:n,entry:r,branchIndex:null!=(t=null==r?void 0:r.branchIndex)?t:0}),(0,A.jsxs)("div",{className:l.branchClass,children:[(0,A.jsx)("div",{className:"workflow-branch-lines"}),(0,A.jsx)("div",{className:(0,iS.cx)(l.addButtonClass,l.loopLineClass),children:(0,A.jsx)(Bg.A,{})})]})]})})})}useScopeVariables(e,t){let n=eB(),o=qE("Loop target"),l=qE("Loop index"),r=qE("Loop length"),{target:i}=e.config;if(!i)return null;let{fieldNames:a=OD}=t,s={key:"item",[a.value]:"item",[a.label]:o};if("string"==typeof i&&i.startsWith("{{")&&i.endsWith("}}")){let o=i.slice(2,-2).split(".").map(e=>e.trim());s=Object.assign({},function(e,t){let n=e,o=null;for(let e=0;e<t.length;e++){let l=t[e],r=n.find(e=>e.value===l);if(!r)return null;o=r,!r.isLeaf&&r.loadChildren&&r.loadChildren(r),r.children&&(n=r.children)}return o}([O_,OR,Oq].map(o=>{let l=o.useOptions({...t,current:e}).filter(Boolean);return{[a.label]:n(o.label),[a.value]:o.value,key:o.value,[a.children]:l,disabled:l&&!l.length}}),o),s)}return[s,{key:"index",[a.value]:"index",[a.label]:l},{key:"length",[a.value]:"length",[a.label]:r}]}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Loop", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","loop"),(0,em._)(this,"group","control"),(0,em._)(this,"icon","RetweetOutlined"),(0,em._)(this,"color","#0ed6ec"),(0,em._)(this,"description",'{{t("By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{target:{type:"string",title:'{{t("Loop target", { ns: "'.concat(qB,'" })}}'),description:'{{t("A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it.", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0,useTypedConstant:["string","number","null"],className:(0,iS.css)(Bb())},required:!0},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"components",{WorkflowVariableInput:OW})}}class BS extends eR{async load(){this.app.pm.get("workflow").registerInstruction("loop",BC)}}var Bw=n(62489);function BF(e){return e.isForeignKey?"users"===e.target:"users"===e.collectionName&&"id"===e.name}function Bj(e){let{multiple:t=!1,value:n=[],onChange:o}=e,l=OG({types:[BF]});return(0,A.jsx)(P7.Input,{scope:l,value:n[0],onChange:e=>{o([e])},children:(0,A.jsx)(wo,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1,value:n[0],onChange:e=>{o(null!=e?[e]:[])}})})}function BA(){let e=(0,ns._)(["\n .ant-radio-group {\n .anticon {\n margin-left: 0.5em;\n }\n }\n "]);return BA=function(){return e},e}function Bk(e){let{value:t,onChange:n}=e,o=(0,A.jsx)("fieldset",{children:(0,A.jsx)(eh.FormLayout,{layout:"vertical",children:(0,A.jsx)(pu,{label:qE("Negotiation"),children:(0,A.jsxs)(sU.Ay.Group,{value:t,onChange:n,children:[(0,A.jsx)(sU.Ay,{value:1,children:(0,A.jsxs)(iV.A,{title:qE("Everyone should pass"),placement:"bottom",children:[(0,A.jsx)("span",{children:qE("All pass")}),(0,A.jsx)(OQ.A,{style:{color:"#999"}})]})}),(0,A.jsx)(sU.Ay,{value:-1,children:(0,A.jsxs)(iV.A,{title:qE("Anyone pass"),placement:"bottom",children:[(0,A.jsx)("span",{children:qE("Any pass")}),(0,A.jsx)(OQ.A,{style:{color:"#999"}})]})})]})})})});return(0,A.jsxs)("fieldset",{className:(0,iS.css)(BA()),children:[(0,A.jsx)(MX.A.Item,{children:(0,A.jsxs)(sU.Ay.Group,{value:!!t,onChange:e=>{let{target:{value:t}}=e;console.log(t),n(Number(t))},children:[(0,A.jsx)(sU.Ay,{value:!0,children:(0,A.jsxs)(iV.A,{title:qE("Each user has own task"),placement:"bottom",children:[(0,A.jsx)("span",{children:qE("Separately")}),(0,A.jsx)(OQ.A,{style:{color:"#999"}})]})}),(0,A.jsx)(sU.Ay,{value:!1,children:(0,A.jsxs)(iV.A,{title:qE("Everyone shares one task"),placement:"bottom",children:[(0,A.jsx)("span",{children:qE("Collaboratively")}),(0,A.jsx)(OQ.A,{style:{color:"#999"}})]})})]})}),t?o:null]})}function BI(e){var t,n,o;let l=m3(),r=(0,ec.useFieldSchema)(),i=(0,ec.useField)(),a=(0,es.useRef)(null),s=e.dataSource||e9,{getAssociationAppends:c}=pe(s),{appends:d,updateAssociationValues:u}=c(),[p]=Object.keys(null!=(o=r.toJSON().properties)?o:{}),m=null==l||null==(t=l.result)?void 0:t[p],{findComponent:h}=eY(),x=h(null==(n=i.component)?void 0:n[0])||es.Fragment,f=(0,es.useMemo)(()=>(0,ec.createForm)({initialValues:m}),[m]),v=(0,es.useMemo)(()=>({appends:d,...e.params}),[d,e.params]),g=(0,es.useMemo)(()=>({loading:!1,data:{data:m}}),[m]),y=eC(),b=t$(s),C=y.resource(e.collection,void 0,b),S=nj(),w=(0,es.useMemo)(()=>({params:v,form:f,field:i,service:g,updateAssociationValues:u,formBlockRef:a}),[i,f,v,g,u]);return!l.status||m?(0,A.jsx)(tv,{dataSource:s,children:(0,A.jsx)(hH,{collection:e.collection,children:(0,A.jsx)(m1,{record:m,parent:null,children:(0,A.jsx)(uN,{name:"form",children:(0,A.jsx)(nC.Provider,{value:{block:"form",props:e,field:i,service:g,resource:C,__parent:S},children:(0,A.jsx)(Ta.Provider,{value:w,children:(0,A.jsxs)(x,{...i.componentProps,children:[(0,A.jsx)(S1.Templates,{style:{marginBottom:18},form:f}),(0,A.jsx)("div",{ref:a,children:(0,A.jsx)(ec.RecursionField,{schema:r,onlyRenderProperties:!0})})]})})})})})})}):null}function BP(e){let{schema:t,...n}=e,{getTemplateSchemaByMode:o}=rg(),{insert:l}=me(),r=p1("FormItem");async function i(e){var n;let{item:r}=e,i=r.template?await o(r):null,a=p3({actionInitializers:"workflowManual:form:configureActions",actions:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(qB,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:1},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner","x-designer-props":{}}},...t,template:i});delete a["x-acl-action-props"],delete a["x-acl-action"];let[s]=Object.keys(a.properties),c=(null==(n=Object.entries(a.properties[s].properties).find(e=>{let[t,n]=e;return"ActionBar"===n["x-component"]}))?void 0:n[0])||"actions";a.properties[s].properties[c]["x-decorator"]="ActionBarProvider",a.properties[s].properties[c]["x-component-props"].style={marginTop:"1.5em",flexWrap:"wrap"},Oo(a,e=>{e["x-uid"]&&delete e["x-uid"]}),l(a)}return(0,A.jsx)(mf,{...n,onClick:i,items:r})}function BT(){var e,t;let n=mn();return(0,A.jsx)(hH,{dataSource:null==(e=n.schema)?void 0:e.dataSource,collection:null==(t=n.schema)?void 0:t.collection,children:(0,A.jsx)(BP,{...n})})}function BN(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=[];return e&&(!t(e)||n&&e.properties?e.properties&&Object.keys(e.properties).forEach(n=>{o.push(...BN(e.properties[n],t))}):o.push(e)),o}function BM(e){var t,n,o,l;let[r,i]=(0,es.useState)(null!=(o=null==(t=e.collection)?void 0:t.fields)?o:[]),a=m3(),s=(0,ec.useField)(),[c]=Object.keys(null!=(l=(0,ec.useFieldSchema)().toJSON().properties)?l:{}),d=null==a||null==(n=a.result)?void 0:n[c],u=(0,es.useMemo)(()=>(0,ec.createForm)({initialValues:d}),[d]);return!a.status||d?(0,A.jsx)(hH,{collection:{...e.collection,fields:r},children:(0,A.jsx)(m1,{record:d,parent:null,children:(0,A.jsx)(Ta.Provider,{value:{form:u,field:s,setCollectionFields:i},children:e.children})})}):null}function BD(){let{insert:e}=me(),t=mn();return(0,A.jsx)(mf,{...t,onClick:()=>{e({type:"void","x-decorator":"CustomFormBlockProvider","x-decorator-props":{collection:{name:(0,eh.uid)(),fields:[]}},"x-component":"CardItem","x-component-props":{title:'{{t("Form")}}'},"x-designer":"SimpleDesigner","x-designer-props":{type:"customForm"},properties:{[(0,eh.uid)()]:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:customForm:configureFields"},actions:{type:"void","x-decorator":"ActionBarProvider","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:"1.5em",flexWrap:"wrap"}},"x-initializer":"workflowManual:form:configureActions",properties:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(qB,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:1},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner"}}}}}}})}})}let BR={basic:'{{t("Basic")}}',choices:'{{t("Choices")}}',media:'{{t("Media")}}',datetime:'{{t("Date & Time")}}',relation:'{{t("Relation")}}',advanced:'{{t("Advanced type")}}',systemInfo:'{{t("System info")}}',others:'{{t("Others")}}'},Bq=es.createContext({}),B_=new mL({name:"workflowManual:customForm:configureFields",wrap:pO,insertPosition:"beforeEnd",title:"{{t('Configure fields')}}",ItemsComponent:e=>{let[t,n]=(0,es.useState)(null),[o,l]=(0,es.useState)(),r=function(){let e,{interfaces:t}=sO();return(e={},Object.keys(t).forEach(n=>{let o=t[n],{group:l="others"}=o;e[l]=e[l]||{},(0,ed.set)(e,[l,n],o)}),Object.keys(BR).filter(e=>["basic","choices","datetime","media"].includes(e)).map(t=>({title:BR[t],children:Object.keys(e[t]||{}).map(n=>{let o=e[t][n];return{value:n,title:o.title,name:n,...e[t][n]}}).sort((e,t)=>e.order-t.order)}))).map(e=>({name:e.title,type:"itemGroup",title:e.title,children:e.children.map(e=>({name:e.name,type:"item",title:e.title,Component:BO,fieldInterface:e.name}))}))}(),i=tJ(),{setCollectionFields:a}=(0,es.useContext)(Ta),s=(0,es.useMemo)(()=>(0,ec.createForm)(),[t]);return(0,A.jsxs)(Bq.Provider,{value:{onAddField(e){let t=(0,ed.pick)(e,["name","group","title","default","validateSchema"]),{properties:{unique:o,type:l,layout:r,autoIncrement:i,...a}}=e;t.properties=a;let s=(0,ed.cloneDeep)(t);delete s.properties.name["x-disabled"],n(s)},setCallback:l},children:[(0,A.jsx)(mT,{...e,items:r}),(0,A.jsx)(ct,{value:{visible:!!t,setVisible(e){e||n(null)}},children:t?(0,A.jsx)(al,{schema:{type:"void",name:"drawer",title:'{{t("Configure field")}}',"x-decorator":"FormV2","x-decorator-props":{form:s},"x-component":"Action.Drawer",properties:{...t.properties,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction(){let e=(0,ec.useForm)();return{async run(){l(null),n(null),e.reset()}}}}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){let{values:e,query:r,reset:s}=(0,ec.useForm)(),c=[qE("Field name existed in form")];return{async run(){var d,u,p,m;let{default:h}=t,x=(0,eh.uid)();if(h.name=null!=(p=e.name)?p:x,h.uiSchema.title=null!=(m=null==(d=e.uiSchema)?void 0:d.title)?m:x,h.interface=t.name,null==(u=i.fields)?void 0:u.find(e=>e.name===h.name))return void r("name").take().setFeedback({type:"error",messages:c});let f=(0,eh.merge)(h,e);a([...i.fields,f]),o({name:h.name,type:h.uiSchema.type,"x-decorator":"FormItem","x-component":"CollectionField","x-component-props":{field:f},"x-collection-field":"".concat(i.name,".").concat(h.name),"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem"}),s(),l(null),n(null)}}}}}}}}},components:{ArrayTable:eh.ArrayTable}}):null})]})}});function BO(){let e=mn(),{insert:t,setVisible:n}=me(),{onAddField:o,setCallback:l}=(0,es.useContext)(Bq),{getInterface:r}=sO(),i=r(e.fieldInterface);return(0,A.jsx)(mf,{onClick:()=>{l(()=>t),o(i),n(!1)},...e},e.fieldInterface)}let BB={title:'{{t("Custom form", { ns: "'.concat(qB,'" })}}'),config:{useInitializer:()=>({name:"customForm",type:"item",title:'{{t("Custom form", { ns: "'.concat(qB,'" })}}'),Component:BD}),initializers:{},components:{CustomFormBlockProvider:BM},parseFormOptions(e){let t={};return BN(e,e=>"CustomFormBlockProvider"===e["x-decorator"]).forEach(e=>{var n,o;let[l]=Object.keys(e.properties),r=e.properties[l],i=BN(r.properties.grid,e=>"CollectionField"===e["x-component"],!0);e["x-decorator-props"].collection.fields=i.map(e=>{var t,n;return null!=(n=null==(t=e["x-component-props"])?void 0:t.field)?n:e["x-interface-options"]});let a=(null==(n=Object.entries(r.properties).find(e=>{let[t,n]=e;return"ActionBar"===n["x-component"]}))?void 0:n[0])||"actions";t[l]={type:"custom",title:(null==(o=e["x-component-props"])?void 0:o.title)||l,actions:BN(r.properties[a],e=>"Action"===e["x-component"]).map(e=>{var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{CustomFormBlockProvider:BM}}};function BE(){let e=(0,ns._)(["\n .ant-drawer-body {\n background: var(--tb-box-bg);\n }\n "]);return BE=function(){return e},e}let BV=new eh.Registry;BV.register("customForm",BB),BV.register("createForm",{title:'{{t("Create record form", { ns: "'.concat(qB,'" })}}'),config:{useInitializer(e){let{allCollections:t}=e,n=(0,es.useMemo)(()=>t.map(e=>{let{key:t,displayName:n,collections:o}=e;return{key:t,name:t,label:n,type:"subMenu",children:o.map(e=>({name:eu().camelCase("createRecordForm-child-".concat(e.name)),type:"item",title:e.title||e.tableName,schema:{collection:e.name,dataSource:t,title:'{{t("Create record", { ns: "'.concat(qB,'" })}}'),formType:"create","x-designer":"CreateFormDesigner"},Component:BT}))}}),[t]),[o,l]=(0,es.useState)([]),r=vO({data:n,openKeys:o});return{name:"createRecordForm",key:"createRecordForm",type:"subMenu",title:'{{t("Create record form", { ns: "'.concat(qB,'" })}}'),componentProps:{onOpenChange(e){l(e)}},children:r}},initializers:{},components:{CreateFormDesigner:function(){let{name:e,title:t}=tJ();return(0,A.jsxs)(sP,{title:t||e,children:[(0,A.jsx)(aZ,{}),(0,A.jsx)(a1,{collectionName:e}),(0,A.jsx)(a6,{collectionName:e}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}},parseFormOptions(e){let t={};return BN(e,e=>"FormBlockProvider"===e["x-decorator"]&&"create"===e["x-decorator-props"].formType).forEach(e=>{var n,o;let[l]=Object.keys(e.properties),r=e.properties[l],i=(null==(n=Object.entries(r.properties).find(e=>{let[t,n]=e;return"ActionBar"===n["x-component"]}))?void 0:n[0])||"actions";t[l]={type:"create",title:(null==(o=e["x-component-props"])?void 0:o.title)||l,actions:BN(r.properties[i],e=>"Action"===e["x-component"]).map(e=>{var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{}}}),BV.register("updateForm",{title:'{{t("Update record form", { ns: "'.concat(qB,'" })}}'),config:{useInitializer(e){let{allCollections:t}=e,n=(0,es.useMemo)(()=>t.map(e=>{let{key:t,displayName:n,collections:o}=e;return{key:t,name:t,label:n,type:"subMenu",children:o.map(e=>({name:eu().camelCase("updateRecordForm-child-".concat(e.name)),type:"item",title:e.title||e.tableName,schema:{collection:e.name,dataSource:t,title:'{{t("Update record", { ns: "'.concat(qB,'" })}}'),formType:"update","x-designer":"UpdateFormDesigner"},Component:BT}))}}),[t]),[o,l]=(0,es.useState)([]),r=vO({data:n,openKeys:o});return{name:"updateRecordForm",key:"updateRecordForm",type:"subMenu",title:'{{t("Update record form", { ns: "'.concat(qB,'" })}}'),componentProps:{onOpenChange(e){l(e)}},children:r}},initializers:{},components:{FilterDynamicComponent:OJ,UpdateFormDesigner:function(){let{name:e,title:t}=tJ(),n=(0,ec.useFieldSchema)(),{t:o}=(0,eT.useTranslation)(),{dn:l}=eY();return(0,A.jsxs)(sP,{title:t||e,children:[(0,A.jsx)(aZ,{}),(0,A.jsx)(aJ,{title:o("Filter settings",{ns:qB}),schema:{name:"filter",type:"object",title:'{{t("Filter")}}',"x-component":"Filter","x-use-component-props":()=>{var e;return{options:hm(null==n||null==(e=n["x-decorator-props"])?void 0:e.collection)}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},initialValues:null==n?void 0:n["x-decorator-props"],onSubmit:e=>{let{filter:t}=e;n["x-decorator-props"].filter=t,l.emit("patch",{schema:{"x-decorator-props":n["x-decorator-props"]}}),l.refresh()}}),(0,A.jsx)(a1,{collectionName:e}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}},parseFormOptions(e){let t={};return BN(e,e=>"FormBlockProvider"===e["x-decorator"]&&"update"===e["x-decorator-props"].formType).forEach(e=>{var n,o;let[l]=Object.keys(e.properties),r=e.properties[l],i=(null==(n=Object.entries(r.properties).find(e=>{let[t,n]=e;return"ActionBar"===n["x-component"]}))?void 0:n[0])||"actions";t[l]={...e["x-decorator-props"],type:"update",title:(null==(o=e["x-component-props"])?void 0:o.title)||l,actions:BN(r.properties[i],e=>"Action"===e["x-component"]).map(e=>{var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}})}}),t}},block:{scope:{},components:{}}}),BB.title;let Bz=new mL({name:"workflowManual:popup:configureUserInterface:addBlock",wrap:pO,title:'{{t("Add block")}}',items:[{type:"itemGroup",name:"dataBlocks",title:'{{t("Data blocks")}}',hideIfNoChildren:!0,useChildren(){let e=oc(Lz),t=_t(_l()),n=[function(){let{workflow:e}=qX(),t=_K();return t.useInitializers?t.useInitializers(e.config):null}()].filter(Boolean),o=t.map(t=>{var n;let o=e.instructions.get(t.type);return null==o||null==(n=o.useInitializers)?void 0:n.call(o,t)}).filter(Boolean);return[...n,...o.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "'.concat(qB,'" })}}'),children:o}]:[]].filter(Boolean)}},{type:"itemGroup",name:"form",title:'{{t("Form")}}',useChildren(){let e=tr().getAllCollections();return Array.from(BV.getValues()).map(t=>{let{useInitializer:n}=t.config;return n({allCollections:e})})}},{type:"itemGroup",name:"otherBlocks",title:'{{t("Other blocks")}}',children:[{name:"markdown",title:'{{t("Demonstration text")}}',Component:"MarkdownBlockInitializer"}]}]});function BL(){var e,t,n;let o=(0,es.useContext)(eV),{t:l}=(0,eT.useTranslation)(),r=(0,ec.useFieldSchema)(),i=OG(),[a,s]=(0,es.useState)(!1),[c,d]=(0,es.useState)(null!=(n=null==r||null==(t=r["x-action-settings"])||null==(e=t.assignedValues)?void 0:e.schema)?n:{type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields",properties:{}}),[u,p]=(0,es.useState)(null),{components:m}=i4();(0,es.useEffect)(()=>{p(new ec.Schema({properties:{grid:c}}))},[c]);let h=(0,es.useMemo)(()=>{var e,t;let n=null==r||null==(t=r["x-action-settings"])||null==(e=t.assignedValues)?void 0:e.values;return(0,ec.createForm)({initialValues:eu().cloneDeep(n),values:eu().cloneDeep(n)})},[r]),x=uM(),f=l("Assign field values");function v(){s(!1)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(az,{title:f,onClick:()=>s(!0),children:f}),(0,A.jsx)(ox.A,{width:"50%",title:f,open:a,onCancel:v,footer:(0,A.jsxs)(of.A,{children:[(0,A.jsx)(e3.Ay,{onClick:v,children:l("Cancel")}),(0,A.jsx)(e3.Ay,{type:"primary",onClick:function(){r["x-action-settings"]||(r["x-action-settings"]={}),r["x-action-settings"].assignedValues||(r["x-action-settings"].assignedValues={}),r["x-action-settings"].assignedValues.schema=c,r["x-action-settings"].assignedValues.values=h.values,s(!1),setTimeout(()=>{var e;null==(e=o.refresh)||e.call(o)},300)},children:l("Submit")})]}),children:(0,A.jsx)(sV,{isAllowToSetDefaultValue:()=>!1,children:(0,A.jsx)(P4,{scope:i,children:(0,A.jsx)(uN,{name:"form",getActiveFieldsName:null==x?void 0:x.getActiveFieldsName,children:(0,A.jsx)(ec.FormProvider,{form:h,children:(0,A.jsxs)(eh.FormLayout,{layout:"vertical",children:[(0,A.jsx)(ov.A,{message:qE("Values preset in this form will override user submitted ones when continue or reject.")}),(0,A.jsx)("br",{}),a&&u&&(0,A.jsx)(eV.Provider,{value:{...o,refresh(){d(eu().get(u.toJSON(),"properties.grid"))}},children:(0,A.jsx)(al,{schema:u,components:m})})]})})})})})})]})}function BG(e){return(0,A.jsxs)(sP,{...e,disableInitializer:!0,children:[(0,A.jsx)(dT.Designer.ButtonEditor,{}),(0,A.jsx)(BL,{}),(0,A.jsx)(aK,{}),(0,A.jsx)(a$,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"ActionBar"}})]})}function BK(){let e=mn(),{action:t,actionProps:n,...o}=e;return(0,A.jsx)(gQ,{...o,item:e,schema:{type:"void",title:o.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:t},"x-component":"Action","x-component-props":{...n,useAction:"{{ useSubmit }}"},"x-designer":"Action.Designer","x-action":"".concat(t)},type:"x-action"})}let B$=new mL({name:"workflowManual:form:configureActions",title:'{{t("Configure actions")}}',items:[{name:"jobStatusResolved",title:'{{t("Continue the process", { ns: "'.concat(qB,'" })}}'),Component:function(){let{action:e,actionProps:t,...n}=mn(),{insert:o}=me();return(0,A.jsx)(mf,{...n,onClick:()=>{o({type:"void",title:n.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:e},"x-component":"Action","x-component-props":{...t,useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner","x-action-settings":{}})}})},action:1,actionProps:{type:"primary"}},{name:"jobStatusRejected",title:'{{t("Terminate the process", { ns: "'.concat(qB,'" })}}'),Component:BK,action:-5,actionProps:{danger:!0}},{name:"jobStatusPending",title:'{{t("Save temporarily", { ns: "'.concat(qB,'" })}}'),Component:BK,action:0}]});function BU(){return{run(){}}}function BW(e){let{value:t,onChange:n}=e,o=oc(Lz),l=(0,es.useContext)(eV),r=_t(_l()),i=(0,ec.useForm)(),{workflow:a}=qX(),s={};r.forEach(e=>{Object.assign(s,o.instructions.get(e.type).components)});let c=(0,es.useMemo)(()=>new ec.Schema({properties:{drawer:{type:"void",title:'{{t("User interface", { ns: "'.concat(qB,'" })}}'),"x-decorator":"Form","x-component":"Action.Drawer","x-component-props":{className:(0,iS.css)(BE())},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab","x-initializer-props":{gridInitializer:"workflowManual:popup:configureUserInterface:addBlock"},properties:null!=t?t:{tab1:{type:"void",title:'{{t("Manual", { ns: "'.concat(qB,'" })}}'),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:popup:configureUserInterface:addBlock",properties:{}}}}}}}}}}),[]),d=(0,es.useCallback)(function(){let{tabs:e}=eu().get(c.toJSON(),"properties.drawer.properties"),t=Array.from(BV.getValues()).reduce((t,n)=>Object.assign(t,n.config.parseFormOptions(e)),{});i.setValuesIn("forms",t),n(e.properties)},[i,n,c]);return(0,A.jsx)(eV.Provider,{value:{...l,designable:!a.executed,refresh:d},children:(0,A.jsx)(al,{schema:c,components:{...s,...Array.from(BV.getValues()).reduce((e,t)=>Object.assign(e,t.config.components),{}),FormBlockProvider:BI,DetailsBlockProvider:ow,ManualActionStatusProvider:e=>e.children,ActionBarProvider:e=>e.children,SimpleDesigner:O6,ManualActionDesigner:BG},scope:{useSubmit:BU,useDetailsBlockProps:Tp}})})}function BH(e){let{workflow:t}=qX(),[n,o]=(0,es.useState)(!1);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(e3.Ay,{type:"primary",onClick:()=>o(!0),disabled:!1,children:qE(t.executed?"View user interface":"Configure user interface")}),(0,A.jsx)(ct,{value:{visible:n,setVisible:o,formValueChanged:!1},children:e.children})]})}Symbol("single"),Symbol("all"),Symbol("any"),Symbol("all percentage"),Symbol("any percentage");class BY extends Od{useVariables(e,t){var n;let{key:o,title:l,config:r}=e,{types:i,fieldNames:a=OD}=t,s=eB(),{getCollectionFields:c}=sO(),d=Object.keys(null!=(n=r.forms)?n:{});if(!d.length)return null;let u=d.map(e=>{var t;let n=r.forms[e],o=OU({fields:null==(t=n.collection)?void 0:t.fields,collection:n.collection,types:i,compile:s,getCollectionFields:c}),l=s(n.title)||e;return o.length?{key:e,value:e,label:l,title:l,children:o}:null}).filter(Boolean);return u.length?{[a.value]:o,[a.label]:l,[a.children]:u}:null}useInitializers(e){var t;let{getCollection:n}=sO(),o=Object.keys(null!=(t=e.config.forms)?t:{});if(!o.length||e.config.mode)return null;let l=o.map(t=>{var o,l;let r=e.config.forms[t],{fields:i=[]}=n(r.collection);return i.length?{name:null!=(o=r.title)?o:t,type:"item",title:null!=(l=r.title)?l:t,Component:OP,collection:r.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key,".").concat(t)}:null}).filter(Boolean);return l.length?{name:"#".concat(e.id),key:"forms",type:"subMenu",title:e.title,children:l}:null}isAvailable(e){let{engine:t,workflow:n,upstream:o,branchIndex:l}=e;return!t.isWorkflowSync(n)}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Manual", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","manual"),(0,em._)(this,"group","manual"),(0,em._)(this,"icon","CoffeeOutlined"),(0,em._)(this,"color","#a3243b"),(0,em._)(this,"description",'{{t("Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{assignees:{type:"array",title:'{{t("Assignees", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"AssigneesSelect","x-component-props":{},required:!0,default:[]},mode:{type:"number",title:'{{t("Mode", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"ModeConfig",default:1,"x-reactions":{dependencies:["assignees"],fulfill:{state:{visible:"{{$deps[0].length > 1}}"}}}},schema:{type:"void",title:'{{t("User interface", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"SchemaConfigButton",properties:{schema:{type:"object","x-component":"SchemaConfig",default:null}}},forms:{type:"object",default:{}}}),(0,em._)(this,"components",{SchemaConfigButton:BH,SchemaConfig:BW,ModeConfig:Bk,AssigneesSelect:Bj})}}function BX(){let e=(0,ns._)(["\n margin-right: 0.5em;\n "]);return BX=function(){return e},e}let BJ={title:'{{t("Task", { ns: "'.concat(qB,'" })}}'),name:"flow_nodes",fields:[{type:"bigInt",name:"id",interface:"m2o",uiSchema:{type:"number",title:"ID","x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"flow_nodes",params:{filter:{type:"manual"}}}}}},{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}}]},BQ={title:'{{t("Workflow", { ns: "'.concat(qB,'" })}}'),name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}}]},BZ={title:'{{t("Workflow todos", { ns: "'.concat(qB,'" })}}'),name:"users_jobs",fields:[{type:"belongsTo",name:"user",target:"users",foreignKey:"userId",interface:"m2o",uiSchema:{type:"number",title:'{{t("User")}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"}}}},{type:"belongsTo",name:"node",target:"flow_nodes",foreignKey:"nodeId",interface:"m2o",isAssociation:!0,uiSchema:{type:"number",title:'{{t("Task", { ns: "'.concat(qB,'" })}}'),"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"flow_nodes"}}}},{type:"belongsTo",name:"workflow",target:"workflows",foreignKey:"workflowId",interface:"m2o",uiSchema:{type:"number",title:'{{t("Workflow", { ns: "'.concat(qB,'" })}}'),"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"workflows"}}}},{type:"integer",name:"status",interface:"select",uiSchema:{type:"number",title:'{{t("Status", { ns: "'.concat(qB,'" })}}'),"x-component":"Select",enum:_9}},{name:"createdAt",type:"date",interface:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}}]},B0=(0,ec.observer)(()=>{var e,t,n;let o=(0,ec.useField)();return null!=(n=null==o||null==(e=o.value)?void 0:e.title)?n:"#".concat(null==(t=o.value)?void 0:t.id)},{displayName:"NodeColumn"}),B1=(0,ec.observer)(()=>{var e,t,n;let o=(0,ec.useField)();return null!=(n=null==o||null==(e=o.value)?void 0:e.title)?n:"#".concat(null==(t=o.value)?void 0:t.id)},{displayName:"WorkflowColumn"}),B2=(0,ec.observer)(()=>{var e,t,n;let o=(0,ec.useField)();return null!=(n=null==o||null==(e=o.value)?void 0:e.nickname)?n:null==(t=o.value)?void 0:t.id},{displayName:"UserColumn"});function B6(e){let t=m3(),n=qE("Unprocessed");return t.execution.status&&!t.status?(0,A.jsx)(nz.A,{children:n}):e.children}let B3=()=>(0,A.jsx)(al,{components:{NodeColumn:B0,WorkflowColumn:B1,UserColumn:B2,UserJobStatusColumn:B6},schema:{type:"void",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:refresh","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id"},properties:{actions:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:60},title:'{{t("Actions")}}',properties:{view:{type:"void","x-component":"Action.Link",title:'{{t("View")}}',properties:{drawer:{"x-component":"WorkflowTodo.Drawer"}}}}},node:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:null},title:'{{t("Task node", { ns: "'.concat(qB,'" })}}'),properties:{node:{"x-component":"NodeColumn","x-read-pretty":!0}}},workflow:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:null},title:'{{t("Workflow", { ns: "workflow" })}}',properties:{workflow:{"x-component":"WorkflowColumn","x-read-pretty":!0}}},status:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100},title:'{{t("Status", { ns: "workflow" })}}',properties:{status:{type:"number","x-decorator":"UserJobStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},user:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:140},title:'{{t("Assignee", { ns: "'.concat(qB,'" })}}'),properties:{user:{"x-component":"UserColumn","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:160},properties:{createdAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}}});function B5(e){let{data:t}=ub(),{userJob:n}=qX(),{status:o,result:l,userId:r}=n,{name:i}=(0,ec.useFieldSchema)().parent.toJSON(),{children:a}=e;if(o)l[i]||(a=null);else{var s;(null==t||null==(s=t.data)?void 0:s.id)!==r&&(a=null)}return a}let B4=(0,es.createContext)(null);function B8(e){let{value:t,children:n}=e,{userJob:o,execution:l}=qX(),r=(0,ec.useField)(),i=(0,ec.useFieldSchema)();return(0,es.useEffect)(()=>{(l.status||o.status)&&(r.disabled=!0,r.visible=o.status===t&&o.result._===i.name)},[l,o,t,r,i.name]),(0,A.jsx)(B4.Provider,{value:t,children:n})}function B7(){let e=eC(),{setVisible:t}=co(),{values:n,submit:o}=(0,ec.useForm)(),l=(0,ec.useFieldSchema)(),{service:r}=lz(),{userJob:i,execution:a}=qX(),{name:s}=l,{name:c}=l.parent.parent;return{async run(){a.status||i.status||(await o(),await e.resource("users_jobs").submit({filterByTk:i.id,values:{result:{[c]:n,_:s}}}),t(!1),r.refresh())}}}function B9(e){var t;let n=oc(Lz),o=eC(),{id:l}=m3(),[r,i]=(0,es.useState)(null),[a,s]=(0,es.useState)(null);(0,es.useEffect)(()=>{var e,t;l&&(null==(e=(t=o.resource("users_jobs")).get)||e.call(t,{filterByTk:l,appends:["node","job","workflow","workflow.nodes","execution","execution.jobs"]}).then(e=>{var t;let{data:n}=e,{node:o,workflow:{nodes:l=[],...r}={},execution:a,...c}=null!=(t=null==n?void 0:n.data)?t:{};Ot(l),s(o),i({userJob:c,workflow:r,nodes:l,execution:a})}))},[o,l]);let c=_t(null==r?void 0:r.nodes.find(e=>e.id===a.id)).reduce((e,t)=>{var o;let{type:l}=t;return Object.assign(e,null==(o=n.instructions.get(l))?void 0:o.components)},{});return a&&r?(0,A.jsx)(qY.Provider,{value:r,children:(0,A.jsx)(al,{components:{FormBlockProvider:BI,DetailsBlockProvider:OT,ActionBarProvider:B5,ManualActionStatusProvider:B8,...Array.from(BV.getValues()).reduce((e,t)=>Object.assign(e,t.block.components),{}),...c},scope:{useSubmit:B7,useFormBlockProps:Ee,useDetailsBlockProps:Et,...Array.from(BV.getValues()).reduce((e,t)=>Object.assign(e,t.block.scope),{})},schema:{type:"void",name:"tabs","x-component":"Tabs",properties:null==(t=a.config)?void 0:t.schema}})}):(0,A.jsx)(eD.A,{})}function Ee(){var e;let{userJob:t,execution:n}=qX(),o=m3(),{data:l}=ub(),{form:r}=Tp(),i=n.status||t.status?o?"readPretty":"disabled":(null==l||null==(e=l.data)?void 0:e.id)!==t.userId?"disabled":"editable";return(0,es.useEffect)(()=>{null==r||r.setPattern(i)},[i,r]),{form:r}}function Et(){let{form:e}=Tp();return{form:e}}function En(){let e=eB(),{status:t,updatedAt:n}=m3(),o=Oe[t];return t?(0,A.jsxs)(of.A,{children:[(0,A.jsx)("time",{className:(0,iS.css)(BX()),children:P()(n).format("YYYY-MM-DD HH:mm:ss")}),(0,A.jsx)(nz.A,{icon:o.icon,color:o.color,children:e(o.label)})]}):null}B4.displayName="ManualActionStatusContext",B3.Drawer=function(){var e;let t=(0,es.useContext)(eV),{id:n,node:o,workflow:l,status:r}=m3();return(0,A.jsx)(eV.Provider,{value:{...t,reset(){},designable:!1},children:(0,A.jsx)(al,{components:{FooterStatus:En,FlowContextProvider:B9},schema:{type:"void",name:"drawer-".concat(n,"-").concat(r),"x-component":"Action.Drawer","x-component-props":{className:"tb-action-popup"},title:"".concat(l.title," - ").concat(null!=(e=o.title)?e:"#".concat(o.id)),properties:{tabs:{type:"void","x-component":"FlowContextProvider"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{content:{type:"void","x-component":"FooterStatus"}}}}}})})},B3.Decorator=function(e){let{params:t={},children:n}=e,o={collection:"users_jobs",resource:"users_jobs",action:"list",params:{pageSize:20,sort:["-createdAt"],...t,appends:["user","node","workflow","execution.status"],except:["node.config","workflow.config","workflow.options"]},rowKey:"id",showIndex:!0,dragSort:!1};return(0,A.jsx)(tm,{collections:[BJ,BQ,BZ],children:(0,A.jsx)(lV,{name:"workflow-todo",...o,children:n})})};let Eo=()=>{let e=mn(),{insert:t}=me();return(0,A.jsx)(mf,{icon:(0,A.jsx)(vR.A,{}),...e,onClick:()=>{t({type:"void","x-decorator":"WorkflowTodo.Decorator","x-decorator-props":{},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{todos:{type:"void","x-component":"WorkflowTodo"}}})}})};class El extends eR{async load(){this.addComponents(),this.app.pm.get("workflow").registerInstruction("manual",BY),this.app.schemaInitializerManager.add(Bz),this.app.schemaInitializerManager.add(B$),this.app.schemaInitializerManager.add(B_),this.app.schemaInitializerManager.get("page:addBlock").add("otherBlocks.workflow",{name:"workflow",title:'{{t("Workflow", { ns: "'.concat(qB,'" })}}'),type:"subMenu",icon:(0,A.jsx)(Bw.A,{}),children:[{name:"common",title:'{{t("Common", { ns: "'.concat(qB,'" })}}'),type:"itemGroup",children:[{name:"todos",title:'{{t("Workflow todos", { ns: "'.concat(qB,'" })}}'),Component:"WorkflowTodoBlockInitializer",icon:"CheckSquareOutlined"}]}]})}addComponents(){this.app.addComponents({WorkflowTodo:B3,WorkflowTodoBlockInitializer:Eo})}}let Er="workflow";function Ei(){return{t:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fG.t(e,{ns:Er,...t})}}}let Ea=e=>fL(e,{ns:Er});function Es(){let{t:e}=(0,eT.useTranslation)(),t=nt(),n=nM();return{async run(){let{data:o}=await t.dump({filterByTk:n}),l=new Blob([JSON.stringify(o.data,null,2)],{type:"application/json"});(0,sp.saveAs)(l,o.data.title+"-"+o.data.key+".json"),cg.Ay.success(e("Operation succeeded"))}}}function Ec(){let{t:e}=(0,eT.useTranslation)(),{refresh:t}=t6(),n=nt(),{setVisible:o,visible:l}=co(),r=nM(),{values:i,setInitialValues:a}=(0,ec.useForm)(),s=tz();return(0,es.useEffect)(()=>{l&&(null==s?void 0:s.category)&&a({category:s.category})},[l,s,a]),{async run(){let l={...i};l.category&&Array.isArray(l.category)&&(l.category=l.category.map(e=>"object"==typeof e&&(null==e?void 0:e.id)!=null?e.id:e)),await n.revision({filterByTk:r,values:l}),cg.Ay.success(e("Operation succeeded")),t(),o(!1)}}}let Ed=()=>{let e=function(){let{workflow:e}=qX();return!!(null==e?void 0:e.executed)}(),t=eh.ArrayItems.useArray()||{field:[]},{t:n}=Ei(),[o,l]=(0,es.useState)(!1),r=(0,es.useCallback)(()=>{t.field.push(""),l(!1)},[t.field]),i=(0,es.useCallback)(()=>{t.field.push({filter:{}}),l(!1)},[t.field]);return(0,A.jsx)(dB.A,{open:!e&&o,onOpenChange:l,content:(0,A.jsx)(Eu,{onSlecet:r,onQuery:i}),children:(0,A.jsx)(e3.Ay,{className:"ant-formily-array-base-addition",type:"dashed",block:!0,disabled:e,children:n("Add Notified Person")})})},Eu=e=>{let{onSlecet:t,onQuery:n}=e,{t:o}=Ei();return(0,A.jsxs)(of.A,{direction:"vertical",size:"small",children:[(0,A.jsx)(e3.Ay,{type:"text",onClick:t,children:o("Select Notified Person")}),(0,A.jsx)(e3.Ay,{type:"text",onClick:n,children:o("Query Notified Person")})]})},Ep=e=>{let{t}=Ei(),[n,o]=(0,es.useState)(!1),l=(0,es.useCallback)(()=>{o(!0)},[o]);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(e3.Ay,{type:"primary",onClick:l,disabled:!1,children:t("Go to configure")}),(0,A.jsx)(ct,{value:{visible:n,setVisible:o,formValueChanged:!1},children:e.children})]})},Em=e=>e.value&&"object"==typeof e.value?(0,A.jsx)(Ex,{...e}):(0,A.jsx)(Eh,{...e}),Eh=e=>{let{value:t,onChange:n}=e,o=OG({types:[Ef]});return(0,A.jsx)(P7.Input,{scope:o,value:t,onChange:n,children:(0,A.jsx)(wo,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1,value:t,onChange:n})})},Ex=()=>{let e=(0,ec.useField)(),t=hm("users"),{token:n}=iF();return(0,A.jsx)("div",{style:{border:"1px dashed ".concat(n.colorBorder),padding:n.paddingSM},children:(0,A.jsx)(al,{basePath:e.address,schema:{type:"void",properties:{filter:{type:"object","x-component":"Filter","x-component-props":{options:t,dynamicComponent:OJ}}}}})})};function Ef(e){return e.isForeignKey?"users"===e.target:"users"===e.collectionName&&"id"===e.name}let Ev=new mL({name:"NoticeDetailInitializer",wrap:pO,title:"{{t('Add block')}}",items:[{name:"notice",type:"itemGroup",title:Ea("Notice blocks"),children:[{name:"detail",type:"item",title:'{{t("Details")}}',Component:()=>{var e;let{workflow:t}=qX(),[n,o]=vS(null==(e=t.config)?void 0:e.collection),l=mn(),{insert:r}=me(),{getTemplateSchemaByMode:i}=rg(),a=p1("FormItem"),s=async e=>{let{item:t}=e,l=p5({actionInitializers:null,resource:o,collection:o,dataSource:n,template:t.template?await i(t):null,settings:"blockSettings:details"});eu().unset(l,["x-acl-action","x-acl-action-props"]);let[a]=Object.keys(l.properties);eu().set(l.properties[a],"x-component-props.useProps","usePropsNoticeDetail"),r(l)};return(0,A.jsx)(mf,{...l,onClick:s,items:a})}}]},{type:"itemGroup",name:"dataBlocks",title:'{{t("Data blocks")}}',checkChildrenLength:!0,useChildren(){var e;let t=oc(LV),{workflow:n}=qX(),o=_K(),l=_t(_l()),r=[null==(e=o.useInitializers)?void 0:e.call(o,n.config)].filter(Boolean),i=l.map(e=>{var n;let o=t.instructions.get(e.type);return null==o||null==(n=o.useInitializers)?void 0:n.call(o,e)}).filter(Boolean);return[...r,...i.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "workflow" })}}',children:i}]:[]].filter(Boolean)}},{name:"others",type:"itemGroup",title:'{{t("Other blocks")}}',children:[{name:"markdown",type:"item",title:'{{t("Demonstration text")}}',component:"MarkdownBlockInitializer"}]}]});class Eg extends eR{async load(){this.app.schemaInitializerManager.add(Ev)}}let Ey=e=>{let{schemaData:t,loading:n,handleChange:o}=function(e){let{value:t,onChange:n}=e,o=eC(),{values:l,setValuesIn:r}=(0,ec.useForm)(),{data:i,loading:a}=ek(async()=>{if(t){let e=await Eb(o,t);if(e["x-uid"]===t)return e}let e=null!=t?t:(0,eh.uid)(),l={type:"void",name:e,"x-uid":e,"x-component":"Grid","x-initializer":"NoticeDetailInitializer"};return await EC(o,l),n(e),l});return{schemaData:i,loading:a,handleChange:e=>{}}}(e);return n?(0,A.jsx)(eD.A,{}):(0,A.jsx)(al,{memoized:!0,scope:{},components:{},schema:t,onChange:o})};async function Eb(e,t){var n;let{data:o}=await e.request({url:"uiSchemas:getJsonSchema/".concat(t)});return null!=(n=o.data)?n:{}}async function EC(e,t){await e.resource("uiSchemas").insert({values:t})}function ES(){let e=(0,ns._)(["\n .ant-drawer-body {\n background: var(--tb-box-bg);\n }\n "]);return ES=function(){return e},e}let Ew={ActionStyle:(0,iS.css)(ES())},EF=()=>{let e=(0,es.useContext)(eV),[,t]=(0,es.useState)((0,eh.uid)()),{workflow:n}=qX(),o=(0,es.useMemo)(()=>({...e,refresh:()=>t((0,eh.uid)()),designable:!n.executed}),[e,n.executed]);return(0,A.jsx)(eV.Provider,{value:o,children:(0,A.jsx)(al,{components:{NoticeDetail:Ey},schema:Ej})})},Ej={name:"drawer",type:"void",title:Ea("The interface of show notice detail"),"x-component":"Action.Drawer","x-component-props":{className:Ew.ActionStyle},properties:{showNoticeDetail:{type:"string","x-component":"NoticeDetail"}}};function EA(){let e=(0,ns._)(["\n &[disabled] {\n > .ant-formily-array-base-addition {\n display: none;\n }\n > .ant-formily-array-items-item .ant-space-item:not(:nth-child(2)) {\n display: none;\n }\n }\n "]);return EA=function(){return e},e}function Ek(){let e=(0,ns._)(["\n width: 100%;\n &.ant-space.ant-space-horizontal {\n flex-wrap: nowrap;\n }\n > .ant-space-item:nth-child(2) {\n flex-grow: 1;\n }\n "]);return Ek=function(){return e},e}(0,nu.rU)({});let EI={ArrayItemsStyle:(0,iS.css)(EA()),SpaceStyle:(0,iS.css)(Ek())};class EP extends Od{isAvailable(e){return!0}constructor(...e){super(...e),(0,em._)(this,"title",Ea("Notice")),(0,em._)(this,"type","notice"),(0,em._)(this,"group",_M),(0,em._)(this,"icon","MessageOutlined"),(0,em._)(this,"color","#82e29c"),(0,em._)(this,"description",Ea("In the workflow, notification messages can be viewed by the notified person in the notification center.")),(0,em._)(this,"components",{ArrayItems:eh.ArrayItems,SelectNotifiedPerson:Em,AdditionNotifiedPerson:Ed,ConfigButtonNotice:Ep,ShowNoticeDetail:EF}),(0,em._)(this,"fieldset",{notifiedPerson:{type:"array",title:Ea("The Notified Person"),"x-decorator":"FormItem","x-component":"ArrayItems","x-component-props":{className:EI.ArrayItemsStyle},items:{type:"void","x-component":"Space","x-component-props":{className:EI.SpaceStyle},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},input:{type:"string","x-decorator":"FormItem","x-component":"SelectNotifiedPerson"},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:Ea("Add Notified Person"),"x-component":"AdditionNotifiedPerson"}}},showNoticeDetail:{type:"void",title:Ea("Show Notice Detail"),required:!0,"x-decorator":"FormItem","x-component":"ConfigButtonNotice",properties:{showNoticeDetail:{type:"void","x-component":"ShowNoticeDetail"}}}})}}class ET extends eR{async afterAdd(){await this.app.pm.add(Eg)}async load(){this.app.pm.get(LV).registerInstruction("notice",EP),this.app.addComponents({ArrayItems:eh.ArrayItems})}}let EN="workflowNotice",EM={title:Ea("Node"),name:"flow_nodes",fields:[{type:"bigInt",name:"id",interface:"m2o",uiSchema:{type:"number",title:"ID","x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"flow_nodes",params:{filter:{type:"manual"}}}}}},{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}}]},ED=(0,ec.observer)(()=>{let{value:e}=(0,ec.useField)(),t=m3();return(0,A.jsx)(ER,{value:e,record:t})},{displayName:"ColumnStatus"}),ER=e=>{let{value:t,record:n}=e,o=eu().omit(e,["value","record"]),l=eB(),{t:r}=Ei(),{option:i=E_[t]}=o,{workflow:a,execution:s,job:c}=null!=n?n:{};return(!(null==a?void 0:a.enabled)||(null==s?void 0:s.stauts)||(null==c?void 0:c.status))&&[].includes(t)?(0,A.jsx)(nz.A,{children:r("Unprocessed")}):(0,A.jsx)(nz.A,{color:null==i?void 0:i.color,children:l(null==i?void 0:i.label)})},Eq=[{value:null,label:'{{t("Assigned", { ns: "'.concat(Er,'" })}}'),color:"blue"},{value:0,label:'{{t("Pending", { ns: "'.concat(Er,'" })}}'),color:"gold"},{value:2,label:'{{t("Approved", { ns: "'.concat(Er,'" })}}'),color:"green"},{value:-5,label:'{{t("Rejected", { ns: "'.concat(Er,'" })}}'),color:"red"}],E_=Eq.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{}),EO={title:Ea("Notice Center"),name:EN,fields:[{type:"bigInt",name:"id",interface:"number",uiSchema:{type:"number",title:"ID","x-component":"InputNumber"}},{type:"belongsTo",name:"user",target:"users",foreignKey:"userId",interface:"m2o",uiSchema:{type:"number",title:Ea("The Notified Person"),"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"}}}},{type:"belongsTo",name:"node",target:"flow_nodes",foreignKey:"nodeId",interface:"m2o",isAssociation:!0,uiSchema:{type:"number",title:'{{t("Task node", { ns: "'.concat(Er,'" })}}'),"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"flow_nodes"}}}},{type:"belongsTo",name:"workflow",target:"workflows",foreignKey:"workflowId",interface:"m2o",uiSchema:{type:"number",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"title",value:"id"},service:{resource:"workflows"}}}},{type:"integer",name:"status",interface:"select",uiSchema:{type:"number",title:'{{t("Status", { ns: "workflow" })}}',"x-component":"Select",enum:Eq}},{type:"text",name:"comment",interface:"markdown",uiSchema:{type:"string","x-component":"Markdown",title:'{{t("Comment", { ns: "'.concat(Er,'" })}}')}},{name:"createdAt",type:"date",interface:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}},{name:"updatedAt",type:"date",interface:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Updated at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"string",name:"summary",interface:"input",uiSchema:{type:"string",title:Ea("Summary"),"x-component":"ApprovalsSummary","x-component-props":{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}}]},EB={title:Ea("Workflow"),name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"boolean",name:"enabled",interface:"select",uiSchema:{type:"boolean",title:'{{t("Status", { ns: "workflow" })}}',"x-component":"Select",enum:[{label:'{{t("On", { ns: "workflow" })}}',value:!0},{label:'{{t("Off", { ns: "workflow" })}}',value:!1}]}}]},EE=e=>{let{children:t,...n}=e,{collection:o,params:l={filter:{}},action:r="list"}=n,i=m3(),a={collection:o,resource:o,action:r,params:{pageSize:20,sort:["-createdAt"],...l,filter:(null==i?void 0:i.id)?{dataKey:"".concat(i.id),...l.filter}:{...l.filter}},rowKey:"id",showIndex:!0,dragSort:!1};return(0,A.jsx)(tm,{collections:[EB,EM,EO],children:(0,A.jsx)(lV,{name:o,...a,children:t})})},EV=es.createContext({}),Ez=EV.Provider,EL=es.createContext({}),EG=EL.Provider;function EK(){let{snapshot:e}=es.useContext(EL),{form:t}=Tp();return(0,es.useEffect)(()=>{t.setValues(e)},[t,e]),{form:t}}function E$(e){let{children:t,workflow:n,execution:o,nodes:l}=e,r=oc(Lz),i=r.triggers.get(n.type).components,a=l.reduce((e,t)=>{var n;let{type:o}=t;return Object.assign(e,null==(n=r.instructions.get(o))?void 0:n.components)},{});return(0,A.jsx)(qY.Provider,{value:{workflow:n,nodes:l,execution:o},children:(0,A.jsx)(i8,{components:{...i,...a},children:t})})}let EU=e=>{let{children:t,...n}=e,o=SA(),{t:l}=Ei(),{id:r}=tz(),{loading:i,data:a}=function(e){let{loading:t,data:n}=ek({resource:EN,action:"get",params:{filterByTk:e,appends:["node","job","workflow","workflow.nodes","execution","execution.jobs","user"],except:["workflow.config","workflow.options","nodes.config"],sort:["-createdAt"]}},{refreshDeps:[e]});return{loading:t,data:n}}(r);if(i)return(0,A.jsx)(eD.A,{});if(!(null==a?void 0:a.data))return(0,A.jsx)(e6.Ay,{status:"error",title:l("Submission may be withdrawn, please try refresh the list.")});let s=a.data,{node:c,workflow:d,execution:u}=s,p=null==c?void 0:c.config.showNoticeDetail,{designable:m}=n;return(0,A.jsx)(E$,{workflow:d,nodes:d.nodes,execution:u,children:(0,A.jsx)(EG,{value:s,children:(0,A.jsx)(Ez,{value:{id:r,schemaId:p},children:(0,A.jsx)(eV.Provider,{value:{...o,designable:m},children:t})})})})},EW=()=>(0,A.jsx)(EU,{children:(0,A.jsx)(EH,{})}),EH=e=>{let{id:t,schemaId:n}=es.useContext(EV);return(0,A.jsx)(al,{components:{NoticeDetailProvider:EU,RemoteSchemaComponent:aa,SchemaComponentProvider:au,DetailsBlockProvider:OT},scope:{usePropsNoticeDetail:EK,useDetailsBlockProps:Tp},schema:{name:"content-".concat(t),type:"void","x-component":"Tabs",properties:{detail:{type:"void",title:Ea("Content Detail"),"x-component":"Tabs.TabPane",properties:{detail:{type:"void","x-decorator":"NoticeDetailProvider","x-decorator-props":{designable:!1},"x-component":"RemoteSchemaComponent","x-component-props":{uid:n,noForm:!0}}}}}}})},EY=()=>{let e=tz();return(0,A.jsx)(al,{components:{NoticeDetailContent:EW},schema:(e=>{let{record:t}=e,{id:n}=t;return{name:"notice-view-".concat(n),type:"void","x-component":"Action.Link",title:'{{t("View")}}',properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"tb-action-popup"},properties:{content:{type:"void","x-component":"NoticeDetailContent"}}}}}})({record:e})})},EX=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=null==e?void 0:e.value;return(null==t?void 0:t.title)?t.title:(null==t?void 0:t.id)?"#".concat(t.id):""},{displayName:"ColumnNode"}),EJ=(0,ec.observer)(()=>{let e=(0,ec.useField)(),t=null==e?void 0:e.value;return(null==t?void 0:t.nickname)?t.nickname:(null==t?void 0:t.id)!==void 0?t.id:""},{displayName:"ColumnUser"});function EQ(){let e=(0,ns._)(["\n text-decoration: line-through;\n "]);return EQ=function(){return e},e}let EZ=(0,ec.observer)(()=>{let{t:e}=Ei(),{value:t}=(0,ec.useField)(),n=(null==t?void 0:t.title)||"#".concat(null==t?void 0:t.id);return(null==t?void 0:t.enabled)?n:(0,A.jsx)("span",{className:(0,iS.css)(EQ()),title:e("Disabled"),children:n})},{displayName:"ColumnWorkflow"});function E0(){let e=(0,ns._)(["\n margin-bottom: 16px;\n "]);return E0=function(){return e},e}function E1(){let e=(0,ns._)(["\n .ant-table-cell {\n text-align: center;\n }\n "]);return E1=function(){return e},e}function E2(){let e=(0,ns._)(["\n .ant-table-cell {\n text-align: center;\n }\n "]);return E2=function(){return e},e}let E6={ActionbarStyle:(0,iS.css)(E0()),TableV2Style:(0,iS.css)(E1())},E3=()=>(0,A.jsx)(al,{components:{ColumnNode:EX,ColumnWorkflow:EZ,ColumnUser:EJ,ColumnStatus:ED,ColumnAction:EY},schema:E5}),E5={type:"void",name:"notice-center",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{className:E6.ActionbarStyle},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-designer":"Action.Designer","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",tableLayout:"fixed",className:(0,iS.css)(E2())},properties:{action:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:60},title:'{{t("Actions")}}',properties:{action:{"x-component":"ColumnAction"}}},id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:80},title:Ea("ID"),properties:{id:{type:"number","x-component":"Input","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:160},properties:{createdAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},summary:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:Ea("Summary"),properties:{summary:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},user:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:140},title:Ea("The Notified Person"),properties:{user:{"x-component":"ColumnUser","x-read-pretty":!0}}},workflow:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:null},title:'{{t("Workflow", { ns: "workflow" })}}',properties:{workflow:{"x-component":"ColumnWorkflow","x-read-pretty":!0}}},node:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:null},title:'{{t("Task node", { ns: "'.concat(Er,'" })}}'),properties:{node:{"x-component":"ColumnNode","x-read-pretty":!0}}}}}}};class E4 extends eR{async load(){this.app.addComponents({NoticeBlockProvider:EE,NoticeCenter:E3})}}function E8(){let e=(0,eh.uid)();return{type:"void",name:e,"x-uid":e,"x-decorator-props":{collection:EN,params:{appends:["user.id","user.nickname","node.id","node.title","job.id","job.status","job.result","workflow.id","workflow.title","workflow.enabled","execution.id","execution.status"]},action:"listCentralized"},"x-decorator":"NoticeBlockProvider","x-component":"CardItem","x-designer":"TableBlockDesigner","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{notice:{type:"void","x-component":"NoticeCenter"}}}}let E7=()=>{let{insert:e}=me(),t=mn(),n=(0,es.useCallback)(()=>{e(E8())},[e,E8]);return(0,A.jsx)(mf,{...t,onClick:n})};class E9 extends eR{async afterAdd(){await this.app.pm.add(E4)}async load(){this.app.addComponents({NoticeBlockInitializer:E7}),this.app.schemaInitializerManager.get("page:addBlock").add("otherBlocks.workflow.common.notice",{key:"noticeBlock",name:"noticeBlock",type:"item",title:Ea("Notice Center"),Component:"NoticeBlockInitializer",icon:"NotificationOutlined"})}}let Ve=class extends eR{async afterAdd(){await this.app.pm.add(ET),await this.app.pm.add(E9)}};class Vt extends _V{useVariables(e,t){var n;let o=eB(),{getCollectionFields:l}=sO(),r=OU({appends:["user"],...t,fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:qE("User acted")}}],compile:o,getCollectionFields:l});return[...OU({appends:["data",...(null==(n=e.appends)?void 0:n.map(e=>"data.".concat(e)))||[]],fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:qE("Trigger data")}}],compile:o,getCollectionFields:l}),...r,{label:qE("Role of user acted"),value:"roleName"}]}useInitializers(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:qz("Trigger data"),Component:OP,collection:e.collection,dataPath:"$context.data"}:null}constructor(...e){super(...e),(0,em._)(this,"title",qz("General event")),(0,em._)(this,"description",qz("Omni Trigger is a versatile trigger. You can use it to trigger workflows in a table, trigger it from another workflow, or trigger it with a form button.")),(0,em._)(this,"fieldset",{bindCollection:{type:"boolean",title:qz("Bind collection?"),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:qz("Yes"),value:!0},{label:qz("No"),value:!1}],required:!0,default:!1},collection:{type:"string",title:qz("Collection"),"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader",required:!0,"x-reactions":[{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{dependencies:["bindCollection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},appends:{type:"array",title:qz("Associations to use"),description:qz("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution."),"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{multiple:!0,useCollection(){var e;return null==(e=(0,ec.useForm)().values)?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{}),(0,em._)(this,"isActionTriggerable",function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{buttonAction:n}=t;return["customize:triggerWorkflows"===n,"submit"===n].some(e=>!0===e)})}}let Vn=()=>{let e=mn();return(0,A.jsx)(g6,{...e,schema:Vo,item:e})},Vo={type:"void",title:qz("Trigger workflow"),"x-component":"Action","x-use-component-props":"usePropsAPIRegular","x-align":"right","x-acl-action":"update","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0},"x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:APIRegular","x-action":"customize:triggerWorkflows","x-action-settings":{bindWorkflow:!1,updateMode:"selected",triggerWorkflows:[]},"x-component-props":{icon:"CarryOutOutlined"}},Vl=new or({name:"actionSettings:APIRegular",items:[{name:"editButton",Component:dA.ButtonEditor,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"workflowConfig",Component:dv,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.triggerWorkflows)}},{name:"remove",sort:100,Component:dA.RemoveButton,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),Vr=()=>{let{field:e,resource:t,__parent:n,service:o}=nj(),l=(0,ec.useFieldSchema)(),r=(0,es.useContext)(ec.SchemaExpressionScopeContext),i=lz(),{rowKey:a}=i,{t:s}=(0,eT.useTranslation)();(0,ep.useNavigate)(),eB();let c=(0,ec.useField)(),{modal:d,notification:u}=eX.A.useApp(),p=lN(),{name:m,getField:h}=tJ(),x=lT(),{run:f}=ek({resource:"workflows",action:"trigger"},{manual:!0});return TO("workflow:regular",e=>{if("start"===e.msg)u.info({key:"workflow:regular",message:s("Start"),description:(0,A.jsx)(gp.A,{percent:0}),duration:0});else if("progress"===e.msg){var t,n;let o=e.current+1,l=3*(100===Math.floor(o/e.total*100)),r="[".concat((null==(t=e.loopData)?void 0:t.loopIndex)||"","/").concat((null==(n=e.loopData)?void 0:n.loopLength)||"","]");u.info({key:"workflow:regular",message:"".concat(s("Processing")).concat(e.loopData?r:"","..."),description:(0,A.jsx)(gp.A,{percent:Math.floor(o/e.total*100)}),duration:l})}else"done"===e.msg&&(u.success({key:"workflow:regular",message:s("Done"),description:(0,A.jsx)(gp.A,{percent:100}),duration:3}),o.refresh())}),{async onClick(){var n,s,u,m,v,g,y;let b=null!=(v=null!=(m=null==(s=i.field)||null==(n=s.data)?void 0:n.selectedRowKeys)?m:null==r?void 0:r.selectedRecordKeys)?v:[],{filter:C}=null!=(g=null==(u=o.params)?void 0:u[0])?g:{},{bindWorkflow:S=!1,triggerWorkflows:w=!1,assignedValues:F={},updateMode:j}=null!=(y=null==l?void 0:l["x-action-settings"])?y:{},A="selected"===j,k={primaryKey:a||"id",targetKeys:b};if(c.data=e.data||{},c.data.loading=!0,!w&&!S)return d.info({title:qE("Not bind workflow!")});let I={},P=Object.keys(F).map(async e=>{let t=F[e],n=h(e);if(oY(t)){let o=await (null==p?void 0:p.parseVariable(t,x));o&&(I[e]=lM(o,{targetCollectionField:n}))}else null!=t&&""!==t&&(I[e]=t)});await Promise.all(P),d.confirm({title:qE("Confirm",{ns:"core"}),content:qE("Trigger workflow?"),async onOk(){S?f({filterByTk:S,updateData:encodeURIComponent(JSON.stringify(k))}):w&&(A?await t.trigger({filterByTk:b,triggerWorkflows:uz(w),beforeWorkflows:uL(w)}):await t.trigger({filter:C,triggerWorkflows:uz(w),beforeWorkflows:uL(w)})),c.data.loading=!1},async onCancel(){c.data.loading=!1}})}}};class Vi extends eR{async load(){this.app.addComponents({APIRegularInitializer:Vn}),this.app.addScopes({usePropsAPIRegular:Vr}),this.app.schemaSettingsManager.add(Vl),["table","details"].forEach(e=>{this.app.schemaInitializerManager.addItem("".concat(e,":configureActions"),"customize.APIRegular",{title:qz("Trigger workflow"),Component:"APIRegularInitializer",name:"apiRegular",useVisible(){let e=tS();return("view"!==e.template||(null==e?void 0:e.writableView))&&"file"!==e.template&&"sql"!==e.template}})})}}function Va(){let e=(0,ec.useForm)(),{field:t,__parent:n,resource:o}=nj(),{setVisible:l}=co(),r=nM(),i=(0,ep.useNavigate)(),a=(0,ec.useFieldSchema)(),s=(0,ec.useField)(),c=eB(),{modal:d}=eX.A.useApp(),u=u_();return s.componentProps.filterKeys,{async onClick(){let{onSuccess:p,skipValidator:m,triggerWorkflows:h}=(null==a?void 0:a["x-action-settings"])||{};m||await e.submit();let x=await u();s.data=t.data||{},s.data.loading=!0;try{var f,v;let t=await o.trigger({values:x,filterByTk:r,triggerWorkflows:uz(h),beforeWorkflows:uL(h)});if(s.data.data=t,null==n||null==(v=n.service)||null==(f=v.refresh)||f.call(v),null==l||l(!1),!(null==p?void 0:p.successMessage))return;null!=p&&p.manualClose?d.success({title:c(null==p?void 0:p.successMessage),onOk:async()=>(await e.reset(),(null==p?void 0:p.redirecting)&&(null==p?void 0:p.redirectTo)&&((0,eh.isURL)(p.redirectTo)?window.location.href=p.redirectTo:i(p.redirectTo)))}):cg.Ay.success(c(null==p?void 0:p.successMessage))}catch(e){console.error(e)}finally{s.data.loading=!1}}}}function Vs(){let e=eB(),t=nM(),n=(0,ec.useField)(),o=(0,ec.useFieldSchema)(),{field:l,resource:r}=nj(),{setVisible:i,setSubmitted:a}=co(),{modal:s}=eX.A.useApp(),c=(0,ep.useNavigate)(),{onSuccess:d,triggerWorkflows:u}=(null==o?void 0:o["x-action-settings"])||{};return{async onClick(o,p){n.data=l.data||{},n.data.loading=!0;try{if(await r.trigger({filterByTk:t,triggerWorkflows:uz(u),beforeWorkflows:uL(u)}),null==p||p(),null==i||i(!1),null==a||a(!0),!(null==d?void 0:d.successMessage))return;(null==d?void 0:d.manualClose)?s.success({title:e(null==d?void 0:d.successMessage),onOk(){(null==d?void 0:d.redirecting)&&(null==d?void 0:d.redirectTo)&&((0,eh.isURL)(d.redirectTo)?window.location.href=d.redirectTo:c(d.redirectTo))}}):cg.Ay.success(e(null==d?void 0:d.successMessage))}catch(e){console.error(e)}finally{n.data.loading=!1}}}}let Vc={name:"triggerWorkflow",title:qz("Trigger workflow"),Component:"CustomizeActionInitializer",schema:{title:qz("Trigger workflow"),"x-component":"Action","x-use-component-props":"useFormWorkflowCustomActionProps","x-designer":"Action.Designer","x-action-settings":{skipValidator:!1,onSuccess:{manualClose:!0,redirecting:!1,successMessage:qz("Submitted successfully")},triggerWorkflows:[]},"x-action":"customize:triggerWorkflows"}},Vd={name:"triggerWorkflow",title:qz("Trigger workflow"),Component:"CustomizeActionInitializer",schema:{title:qz("Trigger workflow"),"x-component":"Action","x-use-component-props":"useRecordWorkflowCustomTriggerActionProps","x-designer":"Action.Designer","x-action-settings":{onSuccess:{manualClose:!0,redirecting:!1,successMessage:qz("Submitted successfully")},triggerWorkflows:[]},"x-action":"customize:triggerWorkflows"}},Vu={...Vd,schema:{...Vd.schema,"x-component":"Action.Link"}};class Vp extends eR{async afterAdd(){await this.app.pm.add(Vi)}async load(){this.app.pm.get("workflow").registerTrigger("general-action",Vt),this.app.addScopes({useFormWorkflowCustomActionProps:Va,useRecordWorkflowCustomTriggerActionProps:Vs}),this.app.schemaInitializerManager.get("FormActionInitializers").add("customize.triggerWorkflow",Vc),this.app.schemaInitializerManager.get("createForm:configureActions").add("customize.triggerWorkflow",Vc),this.app.schemaInitializerManager.get("editForm:configureActions").add("customize.triggerWorkflow",Vc),this.app.schemaInitializerManager.get("detailsWithPaging:configureActions").add("customize.triggerWorkflow",Vd),this.app.schemaInitializerManager.get("details:configureActions").add("customize.triggerWorkflow",Vd),this.app.schemaInitializerManager.get("table:configureItemActions").add("customize.triggerWorkflow",Vu),this.app.schemaInitializerManager.get("gridCard:configureItemActions").add("customize.triggerWorkflow",Vu),this.app.schemaInitializerManager.get("list:configureItemActions").add("customize.triggerWorkflow",Vu)}}function Vm(){let e=(0,ns._)(["\n padding-top: 2em;\n\n > button {\n .anticon {\n transform: rotate(45deg);\n }\n }\n "]);return Vm=function(){return e},e}function Vh(){let e=(0,ns._)(["\n visibility: ",";\n "]);return Vh=function(){return e},e}function Vx(){let e=(0,ns._)(["\n position: relative;\n top: 1em;\n transform-origin: center;\n transform: rotate(45deg);\n\n .anticon {\n transform-origin: center;\n transform: rotate(-45deg);\n }\n "]);return Vx=function(){return e},e}class Vf extends Od{Component(e){let{data:t}=e,{styles:n}=_F(),{id:o,config:{mode:l}}=t,{workflow:r,nodes:i}=qX(),a=i.reduce((e,t)=>t.upstreamId===o&&null!=t.branchIndex?e.concat(t):e,[]).sort((e,t)=>e.branchIndex-t.branchIndex),[s,c]=(0,es.useState)(Math.max(2,a.length)),{getAriaLabel:d}=qU(t),u=qE("Add branch"),p=Array(Math.max(0,s-a.length)).fill(null),m=a[a.length-1];return(0,A.jsx)(zd,{data:t,children:(0,A.jsxs)("div",{className:n.nodeSubtreeClass,children:[(0,A.jsxs)("div",{className:n.branchBlockClass,children:[a.map(e=>(0,A.jsx)(_j,{from:t,entry:e,branchIndex:e.branchIndex},e.id)),p.map((e,n)=>(0,A.jsx)(_j,{from:t,branchIndex:(m?m.branchIndex:0)+n+1,controller:a.length+n>1?(0,A.jsx)("div",{className:(0,iS.css)(Vm()),children:(0,A.jsx)(e3.Ay,{shape:"circle",icon:(0,A.jsx)(sF.A,{}),onClick:()=>c(s-1),disabled:r.executed})}):null},"temp_".concat(a.length+n)))]}),(0,A.jsx)(iV.A,{title:u,className:(0,iS.css)(Vh(),r.executed?"hidden":"visible"),children:(0,A.jsx)(e3.Ay,{"aria-label":d("add-branch"),icon:(0,A.jsx)(sF.A,{}),className:(0,iS.css)(Vx()),onClick:()=>c(s+1),disabled:r.executed})})]})})}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Parallel branch", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","parallel"),(0,em._)(this,"group","control"),(0,em._)(this,"icon","MergeOutlined"),(0,em._)(this,"color","#6e93e8"),(0,em._)(this,"description",'{{t("Run multiple branch processes in parallel.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{mode:{type:"string",title:'{{t("Mode", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{value:"all",label:"{{t('All succeeded', { ns: \"".concat(qB,'" })}}'),tooltip:"{{t('Continue after all branches succeeded', { ns: \"".concat(qB,'" })}}')},{value:"allSettled",label:"{{t('All settled', { ns: \"".concat(qB,'" })}}'),tooltip:"{{t('Continue after all branches finished', { ns: \"".concat(qB,'" })}}')},{value:"any",label:"{{t('Any succeeded', { ns: \"".concat(qB,'" })}}'),tooltip:"{{t('Continue after any branch succeeded', { ns: \"".concat(qB,'" })}}')},{value:"race",label:"{{t('Any succeeded or failed', { ns: \"".concat(qB,'" })}}'),tooltip:"{{t('Continue after any branch succeeded, or exit after any branch failed.', { ns: \"".concat(qB,'" })}}')}]},default:"all"},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"components",{RadioWithTooltip:O0})}}class Vv extends eR{async load(){this.app.pm.get(Lz).registerInstruction("parallel",Vf)}}class Vg extends Od{useVariables(e,t){let{key:n,title:o}=e,{types:l,fieldNames:r=OD}=t;return{[r.value]:n,[r.label]:o}}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("HTTP request", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","request"),(0,em._)(this,"group","extended"),(0,em._)(this,"icon","ApiOutlined"),(0,em._)(this,"color","#e1ed5b"),(0,em._)(this,"description",'{{t("Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{method:{type:"string",required:!0,title:'{{t("HTTP method", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Select","x-component-props":{showSearch:!1,allowClear:!1,className:"auto-width"},enum:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}],default:"POST"},url:{type:"string",required:!0,title:'{{t("URL", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"WorkflowVariableTextArea","x-component-props":{placeholder:"https://www.tachybase.com"}},needAuthorization:{type:"string",required:!0,title:'{{t("needAuthorization", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Select","x-component-props":{showSearch:!1,allowClear:!1,className:"auto-width"},enum:[{label:"是",value:!0},{label:"否",value:!1}],default:!0},headers:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{t("Headers", { ns: "'.concat(qB,'" })}}'),description:'{{t(\'"Content-Type" only support "application/json and mutipart/form-data" \', { ns: "'.concat(qB,'" })}}'),items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add request header", { ns: "'.concat(qB,'" })}}'),"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{t("Parameters", { ns: "'.concat(qB,'" })}}'),items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add parameter", { ns: "'.concat(qB,'" })}}'),"x-component":"ArrayItems.Addition"}}},data:{type:"string",title:'{{t("Body", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"WorkflowVariableJSON","x-component-props":{changeOnSelect:!0,autoSize:{minRows:10},placeholder:'{{t("Input request data", { ns: "'.concat(qB,'" })}}')},description:'{{t("Only support standard JSON data", { ns: "'.concat(qB,'" })}}')},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}},timeout:{type:"number",title:'{{t("Timeout config", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:'{{t("ms", { ns: "'.concat(qB,'" })}}'),min:1,step:1e3,defaultValue:5e3}},ignoreFail:{type:"boolean",title:'{{t("Ignore failed request and continue workflow", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox"}}),(0,em._)(this,"components",{ArrayItems:eh.ArrayItems,WorkflowVariableInput:OW,WorkflowVariableTextArea:OH,WorkflowVariableJSON:OX})}}class Vy extends eR{async load(){this.app.pm.get("workflow").registerInstruction("request",Vg)}}class Vb extends Od{isAvailable(e){let{workflow:t}=e;return"request-interception"===t.type||["action","general-action"].includes(t.type)&&t.sync}constructor(...e){super(...e),(0,em._)(this,"title",qz("Response message")),(0,em._)(this,"type","response-message"),(0,em._)(this,"group","extended"),(0,em._)(this,"icon","SunOutlined"),(0,em._)(this,"color","#07d629"),(0,em._)(this,"description",qz("Add response message, will be send to client when process of request ends.")),(0,em._)(this,"fieldset",{message:{type:"string",title:qz("Message content"),description:qz("Supports variables in template.",{name:"{{name}}"}),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea"},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"scope",{}),(0,em._)(this,"components",{RadioWithTooltip:O0,WorkflowVariableTextArea:OH,WorkflowVariableInput:OW})}}class VC extends eR{async load(){this.app.pm.get("workflow").registerInstruction("response-message",Vb)}}function VS(){let e=(0,ns._)(["\n display: flex;\n flex-direction: column;\n height: ",";\n "]);return VS=function(){return e},e}function Vw(){let e=(0,ns._)(["\n margin-bottom: 8px;\n "]);return Vw=function(){return e},e}function VF(){let e=(0,ns._)(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: ",";\n color: #999;\n "]);return VF=function(){return e},e}let{TextArea:Vj}=nJ.A,VA=(0,ec.connect)(e=>{var t;let{value:n,onChange:o,...l}=e,r=(0,ec.useForm)(),i=(0,es.useRef)(null),[a,s]=(0,es.useState)(null),[c,d]=(0,es.useState)(!1),[u,p]=(0,es.useState)(null),m=null==(t=r.values)?void 0:t.codeSource,h="remote"===m;(0,es.useEffect)(()=>{let e=setTimeout(()=>{i.current||c||(console.warn("[ScriptCodeEditor] Monaco Editor failed to load within timeout, using fallback TextArea"),d(!0))},5e3);return p(e),()=>{e&&clearTimeout(e)}},[c]);let x=(0,es.useCallback)(e=>{u&&(clearTimeout(u),p(null)),i.current=e,s(null),d(!1)},[u]),f=(0,es.useMemo)(()=>({lineNumbers:"on",minimap:{enabled:!1},readOnly:h,quickSuggestions:!h&&{other:!0,comments:!0,strings:!0},suggestOnTriggerCharacters:!h,acceptSuggestionOnCommitCharacter:!h,acceptSuggestionOnEnter:h?"off":"on",tabCompletion:h?"off":"on",wordBasedSuggestions:h?"off":"allDocuments",snippetSuggestions:h?"none":"top",autoIndent:h?"none":"full",formatOnPaste:!h,formatOnType:!h,codeLens:!h,folding:!0,bracketPairColorization:{enabled:!h},suggest:{showKeywords:!h,showSnippets:!h,showClasses:!h,showFunctions:!h,showVariables:!h,showModules:!h,showProperties:!h,showReferences:!h,showValues:!h,showEnums:!h,showEnumMembers:!h,showEvents:!h,showOperators:!h,showUnits:!h,showColors:!h,showFiles:!h,showTypeParameters:!h,showIssues:!h,showUsers:!h,showFolders:!h}}),[h]);(0,es.useEffect)(()=>{let e=i.current;if(e)if("function"==typeof e.updateOptions)e.updateOptions(f);else{var t;let n=(null==(t=e.getEditor)?void 0:t.call(e))||e;n&&"function"==typeof n.updateOptions&&n.updateOptions(f)}},[m,h,f]);let v=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";h||o(e)};if((0,es.useCallback)(e=>{console.error("[ScriptCodeEditor] Monaco Editor error:",e),s(e),d(!0)},[]),c||a){let e=l.height||"50vh",t="string"==typeof e?e:"".concat(e,"px");return(0,A.jsxs)("div",{className:(0,iS.css)(VS(),t),children:[a&&(0,A.jsx)(ov.A,{message:qz("Code editor failed to load"),description:qz("Monaco Editor failed to load, downgraded to basic text editor. Some features may be limited."),type:"warning",showIcon:!0,closable:!0,onClose:()=>s(null),className:(0,iS.css)(Vw())}),(0,A.jsx)(Vj,{value:n||"",onChange:e=>v(e.target.value),readOnly:h,placeholder:qz("Please enter code..."),style:{height:"calc(".concat(t," - ").concat(a?"60px":"0px",")"),fontFamily:'Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace',fontSize:"14px",lineHeight:"1.5",resize:"none"},...l})]})}return(0,es.useEffect)(()=>{let e=e=>{var t,n,o,l,r;((null==(t=e.message)?void 0:t.includes("monaco"))||(null==(n=e.message)?void 0:n.includes("Monaco"))||(null==(o=e.filename)?void 0:o.includes("monaco"))||(null==(l=e.filename)?void 0:l.includes("vs/"))||(null==(r=e.filename)?void 0:r.includes("loader.js")))&&(console.warn("[ScriptCodeEditor] Detected Monaco Editor error, will use fallback:",e.message),d(!0))},t=e=>{let t=e.reason,n=(null==t?void 0:t.message)||String(t);(n.includes("monaco")||n.includes("Monaco")||n.includes("loader"))&&(console.warn("[ScriptCodeEditor] Detected Monaco Editor promise rejection, will use fallback:",n),d(!0))};return window.addEventListener("error",e),window.addEventListener("unhandledrejection",t),()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",t)}},[]),(0,A.jsx)(eh.CodeEditor,{defaultLanguage:"typescript",value:n,onChange:v,options:f,height:l.height||"50vh",onMount:x,loading:(0,A.jsx)("div",{className:(0,iS.css)(VF(),"string"==typeof l.height?l.height:l.height||"50vh"),children:qz("Loading editor...")}),...l})}),{Text:Vk}=e2.A,VI="#52c41a",VP="#73d13d",VT=()=>{var e,t,n,o,l;let r=(0,ec.useForm)(),i=eC(),a=_l(),[s,c]=(0,es.useState)(!1),[d,u]=(0,es.useState)(!1),p=(0,es.useRef)(null),m=null==(e=r.values)?void 0:e.codeSource,h=null==(t=r.values)?void 0:t.codeType;null==(n=r.values)||n.codeUrl;let x=(null==(o=r.values)?void 0:o.code)||"",f=(null==(l=r.values)?void 0:l.lastSyncTime)?new Date(r.values.lastSyncTime):null,v=es.useCallback(async function(){var e,t,n,o,l,s;let d=arguments.length>0&&void 0!==arguments[0]&&arguments[0],{codeSource:m,codeType:h,codeUrl:x,codeBranch:f="main",codeAuthType:v="token",codeAuthToken:g,codeAuthUsername:y}=r.values||{};if("remote"===m&&h&&x){d||c(!0);try{let o=await i.request({resource:"flow_nodes",action:"syncRemoteCode",params:{values:{codeUrl:x,codeType:h,codeBranch:"git"===h?f:void 0,codeAuthType:v,codeAuthToken:g,codeAuthUsername:y,nodeId:null==a?void 0:a.id}}}),l=(null==o||null==(e=o.data)?void 0:e.code)||(null==o||null==(n=o.data)||null==(t=n.data)?void 0:t.code);l?(r.setValues({...r.values,code:l,lastSyncTime:new Date().toISOString()}),p.current=l,u(!0),d||cg.Ay.success(qE("Code synced successfully"))):d||cg.Ay.error(qE("No code returned from remote source"))}catch(e){if(!d){let t=(null==e||null==(s=e.response)||null==(l=s.data)||null==(o=l.error)?void 0:o.message)||(null==e?void 0:e.message)||qE("Failed to sync remote code");cg.Ay.error(t)}}finally{d||c(!1)}}},[r,i,null==a?void 0:a.id]),g=async()=>{let e=r.values||{},t=e.codeSource,n=e.codeType,o=e.codeUrl;"remote"!==t?cg.Ay.warning(qE("Please select remote code source first")):n?o&&o.trim()?await v(!1):cg.Ay.warning(qE("Code URL is required for Git")):cg.Ay.warning(qE("Please select code type first"))};return((0,es.useEffect)(()=>{null!==p.current?u(x===p.current):u(!1)},[x]),"remote"===m&&h)?(0,A.jsxs)("div",{style:{marginBottom:8},children:[(0,A.jsx)(e3.Ay,{type:"primary",icon:(0,A.jsx)(i6,{type:"SyncOutlined"}),loading:s,onClick:g,style:{backgroundColor:VI,borderColor:VI,marginBottom:4},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=VP,e.currentTarget.style.borderColor=VP},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=VI,e.currentTarget.style.borderColor=VI},children:qE("Sync remote code")}),(0,A.jsx)("div",{children:(0,A.jsxs)(Vk,{type:"secondary",style:{fontSize:12},children:[qE("Last sync time"),":"," ",f?(0,A.jsx)(Vk,{type:"success",children:P()(f).format("YYYY-MM-DD HH:mm:ss")}):(0,A.jsx)(Vk,{type:"secondary",children:"-"})]})})]}):null};function VN(){let e=(0,ns._)(["\n > *:not(:last-child) {\n margin-right: 0.5em;\n }\n button {\n padding: 0;\n }\n "]);return VN=function(){return e},e}function VM(){let e=(0,ns._)(["\n > *:not(:last-child) {\n margin-right: 0.5em;\n }\n button {\n padding: 0;\n }\n "]);return VM=function(){return e},e}class VD extends Od{useVariables(e,t){let{key:n,title:o,config:l}=e,{types:r,fieldNames:i}=t,a=l.model||[];return{[i.label]:o,[i.value]:n,[i.children]:a.map(e=>({[i.label]:e.label,[i.value]:e.alias||e.path}))}}constructor(...e){super(...e),(0,em._)(this,"title",qz("Data Mapping")),(0,em._)(this,"type",_N),(0,em._)(this,"group","extended"),(0,em._)(this,"icon","FunctionOutlined"),(0,em._)(this,"color","#d93a13"),(0,em._)(this,"isHot",!0),(0,em._)(this,"description",qz("Get specific data from JSON result of any node BY js code or json code;")),(0,em._)(this,"fieldset",{sourceArray:{type:"array",title:qz("Data source map"),description:qz("Data source map"),"x-decorator":"FormItem","x-component":"ArrayTable",items:{type:"object",properties:{keyName:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("keyName")},properties:{keyName:{type:"string",name:"keyName","x-decorator":"FormItem","x-component":"Input"}}},sourcePath:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Property path")},properties:{sourcePath:{type:"string",name:"sourcePath",required:!0,"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0}}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{dataIndex:"operations",fixed:"right",className:(0,iS.css)(VN())},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:qz("Add property"),"x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{}}}}},type:{type:"string",title:qz("type"),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:qz("Cloud Component"),value:"ts"},{label:qz("JSONata"),value:"jsonata"}],default:"ts"},codeSource:{type:"string",title:qz("Code source"),"x-decorator":"FormItem","x-component":"Radio.Group",default:"local",enum:[{label:qz("Local code"),value:"local"},{label:qz("Remote code"),value:"remote"}]},codeType:{type:"string",title:qz("Code type"),"x-decorator":"FormItem","x-component":"Radio.Group",default:"git",enum:[{label:qz("Git"),value:"git"},{label:qz("CDN"),value:"cdn"}],"x-reactions":[{dependencies:["codeSource"],fulfill:{state:{visible:'{{$deps[0] === "remote"}}'}}}]},codeUrl:{type:"string",title:qz("Code URL"),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:qz("Code URL placeholder")},"x-reactions":[{dependencies:["codeSource","codeType"],fulfill:{state:{visible:'{{$deps[0] === "remote"}}',required:'{{$deps[0] === "remote" && $deps[1] === "git"}}'},schema:{"x-validator":'{{$deps[0] === "remote" && $deps[1] === "git" ? [{ required: true, message: tval("Code URL is required for Git") }] : []}}'}}}]},codeBranch:{type:"string",title:qz("Code branch"),"x-decorator":"FormItem","x-component":"Input",default:"main","x-component-props":{placeholder:qz("Code branch placeholder")},"x-reactions":[{dependencies:["codeSource","codeType"],fulfill:{state:{visible:'{{$deps[0] === "remote" && $deps[1] === "git"}}'}}}]},syncRemoteCodeButton:{type:"void","x-component":"SyncRemoteCodeButton","x-reactions":[{dependencies:["codeSource","codeType"],fulfill:{state:{visible:'{{$deps[0] === "remote" && $deps[1]}}'}}}]},codeAuthType:{type:"string",title:qz("Authentication type"),"x-decorator":"FormItem","x-component":"Radio.Group",default:"token",enum:[{label:qz("No authentication"),value:"none"},{label:qz("Bearer Token"),value:"token"},{label:qz("Basic Auth"),value:"basic"}],"x-reactions":[{dependencies:["codeSource"],fulfill:{state:{visible:'{{$deps[0] === "remote"}}'}}}]},codeAuthToken:{type:"string",title:qz("Auth token"),"x-decorator":"FormItem","x-component":"Input.Password","x-component-props":{placeholder:qz("Auth token placeholder")},"x-reactions":[{dependencies:["codeSource","codeAuthType"],fulfill:{state:{visible:'{{$deps[0] === "remote" && ($deps[1] === "token" || $deps[1] === "basic")}}'}}}]},codeAuthUsername:{type:"string",title:qz("Auth username"),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:qz("Auth username placeholder")},"x-reactions":[{dependencies:["codeSource","codeAuthType"],fulfill:{state:{visible:'{{$deps[0] === "remote" && $deps[1] === "basic"}}'}}}]},code:{type:"string",title:qz("expression"),"x-decorator":"FormItem","x-component":"ScriptCodeEditor","x-component-props":{defaultLanguage:"typescript",height:"50vh",defaultValue:"\nimport { Context, MagicAttributeModel, Transactionable } from '@tego/server';\n\nexport default async function (\n _data: any | Array<any>,\n {\n httpContext: ctx,\n dbModel: model,\n dbOptions: options,\n transaction,\n }: { httpContext?: Context; dbModel?: MagicAttributeModel; dbOptions?: any } & Transactionable,\n) {\n return {};\n}\n ".trim()}},model:{type:"array",title:qz("Properties mapping"),description:qz("If the type of query result is object or array of object, could map the properties which to be accessed in subsequent nodes."),"x-decorator":"FormItem","x-component":"ArrayTable",items:{type:"object",properties:{path:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Property path")},properties:{path:{type:"string",name:"path",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},alias:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Alias")},properties:{alias:{type:"string",name:"alias","x-decorator":"FormItem","x-component":"Input"}}},label:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Label")},properties:{label:{type:"string",name:"label",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{dataIndex:"operations",fixed:"right",className:(0,iS.css)(VM())},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:qz("Add property"),"x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{}}}}}}),(0,em._)(this,"components",{ArrayTable:eh.ArrayTable,WorkflowVariableInput:OW,SyncRemoteCodeButton:VT,ScriptCodeEditor:VA})}}let VR=class extends eR{async load(){this.app.pm.get(Lz).registerInstruction(_N,VD)}};function Vq(){let e=(0,ns._)(["\n font-size: 80%;\n font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n "]);return Vq=function(){return e},e}class V_ extends Od{useVariables(e,t){let{key:n,title:o}=e,{types:l,fieldNames:r=OD}=t;return{[r.value]:n,[r.label]:o}}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("SQL action", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","sql"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","ConsoleSqlOutlined"),(0,em._)(this,"color","#e9bf36"),(0,em._)(this,"description",'{{t("Execute a SQL statement in database.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{dataSource:{type:"string",required:!0,title:'{{t("Data source")}}',description:'{{t("Select a data source to execute SQL.", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"DataSourceSelect","x-component-props":{className:"auto-width",filter:e=>e.options.isDBInstance},default:"main"},sql:{type:"string",required:!0,title:"SQL","x-decorator":"FormItem","x-component":"WorkflowVariableRawTextArea","x-component-props":{rows:20,className:(0,iS.css)(Vq())}},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"components",{WorkflowVariableRawTextArea:OY})}}class VO extends eR{async load(){this.app.pm.get("workflow").registerInstruction("sql",V_)}}function VB(){let e=(0,ns._)(["\n > *:not(:last-child) {\n margin-right: 0.5em;\n }\n button {\n padding: 0;\n }\n "]);return VB=function(){return e},e}function VE(){let e=(0,ns._)(["\n > *:not(:last-child) {\n margin-right: 0.5em;\n }\n button {\n padding: 0;\n }\n "]);return VE=function(){return e},e}let VV=()=>{let{workflow:e}=qX();return{filterSync:null==e?void 0:e.sync,filterKey:(null==e?void 0:e.key)?{$ne:null==e?void 0:e.key}:void 0}};class Vz extends Od{useVariables(e,t){var n;let{key:o,title:l,config:r}=e,{types:i,fieldNames:a}=t;if(r.model&&Array.isArray(r.model)&&r.model.length>0)return{[a.label]:l,[a.value]:o,[a.children]:r.model.map(e=>({[a.label]:e.label,[a.value]:e.alias||e.path}))};let s=eB(),{getCollectionFields:c}=sO(),[d]=OU({appends:[o,...(null==(n=r.appends)?void 0:n.map(e=>"".concat(o,".").concat(e)))||[]],...t,fields:[{collectionName:r.collection,name:o,type:"hasOne",target:r.collection,uiSchema:{title:l}}],compile:s,getCollectionFields:c});return d}constructor(...e){super(...e),(0,em._)(this,"title",qz("Workflow")),(0,em._)(this,"type","trigger-instruction"),(0,em._)(this,"group","extended"),(0,em._)(this,"icon","NodeIndexOutlined"),(0,em._)(this,"color","#0a72e9"),(0,em._)(this,"fieldset",{sourceArray:{type:"array",title:qz("Data source map"),description:qz("Data source map"),"x-decorator":"FormItem","x-component":"ArrayTable",items:{type:"object",properties:{keyName:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("keyName")},properties:{keyName:{type:"string",name:"keyName","x-decorator":"FormItem","x-component":"Input"}}},sourcePath:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Property path")},properties:{sourcePath:{type:"string",name:"sourcePath",required:!0,"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0}}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{dataIndex:"operations",fixed:"right",className:(0,iS.css)(VB())},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:qz("Add property"),"x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{}}}}},workflowKey:{type:"string",title:qz("Workflow"),name:"workflowKey","x-decorator":"FormItem","x-component":"WorkflowSelect","x-component-props":{buttonAction:"customize:triggerWorkflows",noCollection:!0,label:"title",value:"key"},"x-use-component-props":VV,required:!0},bindCollection:{type:"boolean",title:qz("Bind collection?"),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:qz("Yes"),value:!0},{label:qz("No"),value:!1}],required:!0,default:!1},collection:{type:"string",title:qz("Collection"),"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader",required:!0,"x-reactions":[{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{dependencies:["bindCollection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},appends:{type:"array",title:qz("Associations to use"),description:qz("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution."),"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{multiple:!0,useCollection(){var e;return null==(e=(0,ec.useForm)().values)?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},model:{type:"array",title:qz("Properties mapping"),description:qz("If the type of query result is object or array of object, could map the properties which to be accessed in subsequent nodes."),"x-decorator":"FormItem","x-component":"ArrayTable",items:{type:"object",properties:{path:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Property path")},properties:{path:{type:"string",name:"path",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},alias:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Alias")},properties:{alias:{type:"string",name:"alias","x-decorator":"FormItem","x-component":"Input"}}},label:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:qz("Label")},properties:{label:{type:"string",name:"label",required:!0,"x-decorator":"FormItem","x-component":"Input"}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{dataIndex:"operations",fixed:"right",className:(0,iS.css)(VE())},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:qz("Add property"),"x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{}}}}}}),(0,em._)(this,"components",{ArrayTable:eh.ArrayTable,WorkflowVariableInput:OW})}}class VL extends eR{async load(){this.app.pm.get("workflow").registerInstruction("trigger-instruction",Vz)}}function VG(){let e=(0,ns._)(["\n color: ",";\n\n &:before {\n content: '#';\n }\n "]);return VG=function(){return e},e}let VK=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{nodeIdClass:t(VG(),n.colorTextDescription)}});function V$(e){let{value:t,onChange:n}=e,o=null==t,l=_t(_l(),e=>"variable"===e.type&&!e.config.target),{styles:r}=VK(),i=(0,es.useCallback)(e=>{let{target:t}=e;if(t.value)return n(null);l.length&&n(l[0].key)},[n,l]),a=(0,es.useCallback)((e,t)=>t.label.toLowerCase().indexOf(e.toLowerCase())>=0||"#".concat(t.data.id).indexOf(e)>=0,[]);return(0,A.jsx)("fieldset",{children:(0,A.jsx)(sU.Ay.Group,{value:o,onChange:i,children:(0,A.jsxs)(IB,{direction:"vertical",children:[(0,A.jsx)(sU.Ay,{value:!0,children:qE("Declare a new variable")}),(0,A.jsxs)(IB,{children:[(0,A.jsx)(sU.Ay,{value:!1,disabled:!l.length,children:qE("Assign value to an existing variable")}),!o&&(0,A.jsx)(oo.A,{options:l.map(e=>({label:e.title,value:e.key,data:e})),value:t,onChange:n,allowClear:!0,showSearch:!0,filterOption:a,optionRender:e=>{let{label:t,data:n}=e;return(0,A.jsxs)(IB,{children:[(0,A.jsx)("span",{children:t}),(0,A.jsx)("span",{className:r.nodeIdClass,children:n.data.id})]})}})]})]})})})}class VU extends Od{useVariables(e,t){let{key:n,title:o,config:l}=e,{types:r,fieldNames:i=OD}=t;return l.target?null:{[i.value]:n,[i.label]:o}}constructor(...e){super(...e),(0,em._)(this,"title",qz("Variable")),(0,em._)(this,"type","variable"),(0,em._)(this,"group","control"),(0,em._)(this,"icon","StrikethroughOutlined"),(0,em._)(this,"color","#a35ae8"),(0,em._)(this,"description",qz("Assign value to a variable, for later use.")),(0,em._)(this,"fieldset",{target:{type:"string",title:qz("Mode"),"x-decorator":"FormItem","x-component":"VariableTargetSelect"},value:{type:"string",title:qz("Value"),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:!0,changeOnSelect:!0},default:""},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{WorkflowVariableInput:OW,VariableTargetSelect:V$})}}class VW extends eR{async load(){this.app.pm.get("workflow").registerInstruction("variable",VU)}}function VH(){let e=(0,ns._)(["\n &:after {\n content: ':';\n }\n & + a {\n margin-left: 0.25em;\n }\n "]);return VH=function(){return e},e}let VY=e=>{let t=eh.evaluators.get(e);return t&&t.link?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{className:(0,iS.css)(VH()),children:fG.t("Syntax references")}),(0,A.jsx)("a",{href:t.link,target:"_blank",rel:"noreferrer",children:t.label})]}):null};class VX extends Od{useVariables(e,t){let{key:n,title:o}=e,{types:l,fieldNames:r=OD}=t;return l&&!l.some(e=>e in OB||Object.values(OB).some(t=>t.has(e)))?null:{[r.value]:n,[r.label]:o}}useInitializers(e){var t,n;return{name:null!=(t=e.title)?t:"#".concat(e.id),type:"item",title:null!=(n=e.title)?n:"#".concat(e.id),Component:O5.Initializer,node:e,resultTitle:qE("Calculation result")}}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Calculation", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","calculation"),(0,em._)(this,"group","control"),(0,em._)(this,"icon","PlusOutlined"),(0,em._)(this,"color","#c3e584"),(0,em._)(this,"description",'{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{engine:{type:"string",title:'{{t("Calculation engine", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{getOptions:eh.getOptions},required:!0,default:"formula.js"},expression:{type:"string",title:'{{t("Calculation expression", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(e,t,n){let{form:o}=n,{values:l}=o,{evaluate:r}=eh.evaluators.get(l.engine),i=e.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return r(i),""}catch(e){return qE("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0},transString:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":"解析字符串公式","x-reactions":[{dependencies:["engine"],fulfill:{state:{visible:"{{$deps[0] == `formula.js`}}"}}}]},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"scope",{renderEngineReference:VY}),(0,em._)(this,"components",{WorkflowVariableTextArea:OH,RadioWithTooltip:O0,ValueBlock:O5})}}let VJ=e=>{let{editingConfig:t,setEditingConfig:n,data:o,workflow:l,children:r}=e,[i,a]=(0,es.useState)(!1),s=(0,es.useMemo)(()=>{let e=(0,ed.cloneDeep)(o.config);return(0,ec.createForm)({initialValues:e,disabled:l.executed})},[o,l]),c=(0,es.useCallback)(e=>{n(e),e||s.reset()},[s]);return(0,A.jsx)(ct,{value:{visible:t,setVisible:c,formValueChanged:i,setFormValueChanged:a},children:(0,A.jsx)(ae,{form:s,children:r})})};function VQ(){return{form:(0,ec.useForm)()}}function VZ(){let e=(0,ec.useForm)(),t=eC(),n=co(),{refresh:o}=hn(),l=_l(),{workflow:r}=qX();return{async run(){var i,a;r.executed?cg.Ay.error(qE("Node in executed workflow cannot be modified")):(await e.submit(),await (null==(i=(a=t.resource("flow_nodes")).update)?void 0:i.call(a,{filterByTk:l.id,values:{config:e.values}})),n.setFormValueChanged(!1),cg.Ay.success("success"),o())}}}function V0(){let e=(0,ns._)(["\n display: flex;\n justify-content: space-between;\n\n strong {\n font-weight: bold;\n }\n\n .ant-tag {\n margin-inline-end: 0;\n }\n\n code {\n font-weight: normal;\n }\n "]);return V0=function(){return e},e}let V1=e=>{let{data:t,instruction:n}=e,o=(null==n?void 0:n.group)===_M;return(0,A.jsxs)("div",{className:(0,iS.css)(V0()),children:[(0,A.jsxs)("strong",{children:[o&&(0,A.jsxs)("span",{className:"deprecated-tag",children:["(",qE("Deprecated"),") "]}),t.title]}),(0,A.jsxs)(iV.A,{title:qE("Variable key of node"),children:[(0,A.jsx)(nz.A,{children:(0,A.jsx)("code",{children:"id: ".concat(t.id)})}),(0,A.jsx)(nz.A,{children:(0,A.jsx)("code",{children:"key: ".concat(t.key)})})]})]})};function V2(){let e=(0,ns._)(["\n .ant-input,\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper {\n &.auto-width {\n width: auto;\n min-width: 6em;\n }\n }\n "]);return V2=function(){return e},e}let V6=e=>{let{instruction:t,data:n,detailText:o,workflow:l}=e,r=(0,es.useMemo)(()=>(e=>{let{instruction:t,data:n,detailText:o,workflow:l}=e;return{type:"void",properties:{...t.view?{view:t.view}:{},button:{type:"void","x-content":o,"x-component":"Button","x-component-props":{type:"link",className:"workflow-node-config-button"}},[n.id]:{type:"void",title:(0,A.jsx)(V1,{data:n,instruction:t}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Area","x-component-props":{stickyFooter:!0},properties:{actions:l.executed?null:{type:"void","x-component":"ActionArea.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},dump:{type:"void",title:'{{ t("Dump") }}',"x-component":"Action","x-component-props":{useAction(){let{t:e}=(0,eT.useTranslation)();return{async run(){let t=new Blob([JSON.stringify(n,(e,t)=>{if("upstream"!==e&&"downstream"!==e)return t},2)],{type:"application/json"});sm()(t,n.title+"-"+n.key+".json"),cg.Ay.success(e("Operation succeeded"))}}}}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:VZ}}}},...t.description?{description:{type:"void","x-component":_I,"x-component-props":{label:qE("Node type"),title:t.title,description:t.description}}}:{},fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:(0,iS.css)(V2())},properties:t.fieldset}}}}}})({instruction:t,data:n,detailText:o,workflow:l}),[t,n,o,l]);return(0,A.jsx)(al,{schema:r,components:t.components,scope:{...t.scope,useFormProviderProps:VQ}})},V3=e=>{let{instruction:t,data:n,detailText:o,workflow:l,editingConfig:r,setEditingConfig:i}=e;return(0,A.jsx)(VJ,{editingConfig:r,setEditingConfig:i,data:n,workflow:l,children:(0,A.jsx)(V6,{instruction:t,data:n,detailText:o,workflow:l})})};function V5(){let e=(0,ns._)(["\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n "]);return V5=function(){return e},e}function V4(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n\n margin: 0 50px;\n padding: 0;\n border-radius: 12px;\n cursor: pointer;\n\n .workflow-node-remove-button {\n color: ",";\n\n &:hover {\n color: ",";\n }\n }\n\n .ant-input {\n font-weight: bold;\n background-color: transparent;\n border: none;\n box-shadow: none;\n }\n\n .workflow-node-config-button {\n padding: 0;\n display: none;\n }\n "]);return V4=function(){return e},e}let V8=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{nodeClass:t(V5()),nodeCardClass:t(V4(),n.colorText,n.colorErrorHover)}});var V7=n(26552);let V9=()=>{var e;let t=eC(),{workflow:n,nodes:o,refresh:l}=null!=(e=qX())?e:{},r=_l();if(!n)return null;let i=t.resource("flow_nodes");async function a(){var e;await (null==(e=i.moveUp)?void 0:e.call(i,{filterByTk:r.id})),l()}return(0,A.jsx)(e3.Ay,{className:"workflow-node-drag-button",type:"text",shape:"circle",icon:(0,A.jsx)(V7.A,{}),onClick:a})};function ze(){let e=(0,ns._)(["\n background-color: red;\n max-height: 50vh;\n overflow-y: auto;\n .ant-dropdown-menu-item {\n justify-content: flex-end;\n .ant-dropdown-menu-title-content {\n display: flex;\n align-items: baseline;\n justify-content: flex-end;\n text-align: right;\n\n time {\n width: 14em;\n font-size: 80%;\n }\n }\n }\n "]);return ze=function(){return e},e}function zt(){let e=(0,ns._)(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n "]);return zt=function(){return e},e}let zn=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{dropdownClass:t(ze()),nodeJobButtonClass:t(zt())}}),zo=()=>{var e;let{execution:t,setViewJob:n}=qX(),{jobs:o}=null!=(e=_l())?e:{},{styles:l}=zn();return t?o.length?o.length>1?(0,A.jsx)(nX.A,{menu:{items:o.map(e=>({key:e.id,label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(_2,{statusMap:Oe,status:e.status}),(0,A.jsx)("time",{children:(0,eh.str2moment)(e.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),className:l.dropdownClass,onClick:e=>{let{key:t}=e;n(o.find(e=>e.id===+t))}},children:(0,A.jsx)(_2,{statusMap:Oe,status:o[o.length-1].status,className:l.nodeJobButtonClass})}):(0,A.jsx)(_2,{statusMap:Oe,status:o[0].status,onClick:()=>n(o[0]),className:l.nodeJobButtonClass}):(0,A.jsx)(_2,{className:l.nodeJobButtonClass,disabled:!0}):null},zl=()=>{var e;let{t}=(0,eT.useTranslation)(),n=eC(),{workflow:o,nodes:l,refresh:r}=null!=(e=qX())?e:{},i=_l(),{modal:a}=eX.A.useApp();if(!o)return null;let s=n.resource("flow_nodes");async function c(){async function e(){var e;await (null==(e=s.destroy)?void 0:e.call(s,{filterByTk:i.id})),r()}let n=l.filter(e=>e!==i&&(0,eh.parse)(e.config).parameters.filter(e=>{let{key:t}=e;return t.startsWith("$jobsMapByNodeKey.".concat(i.key,"."))||t==="$jobsMapByNodeKey.".concat(i.key)}).length);if(n.length)return void a.error({title:qE("Can not delete"),content:qE("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:n.map(e=>"#".concat(e.id)).join(", ")})});let o=l.find(e=>e.upstream===i&&null!=e.branchIndex)?qE("This node contains branches, deleting will also be preformed to them, are you sure?"):t("Are you sure you want to delete it?");a.confirm({title:t("Delete"),content:o,onOk:e})}return(0,A.jsx)(e3.Ay,{className:"workflow-node-remove-button",type:"text",shape:"circle",icon:(0,A.jsx)(x7.A,{}),onClick:c})};function zr(){let e=(0,ns._)(["\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n align-items: center;\n box-sizing: border-box;\n height: 100%;\n border-radius: 50px;\n background-color: #fff;\n\n &.deprecated {\n background-color: ",";\n .workflow-node-edit {\n background-color: transparent;\n }\n }\n\n /* 控制节点选中态的背景样式 */\n &.configuring {\n background-color: var(--colorPrimaryText);\n .workflow-node-edit {\n background-color: transparent;\n color: #fff;\n }\n }\n\n .workflow-node-prefix {\n display: inline-flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n\n box-sizing: border-box;\n height: 100%;\n /* 微调, 遮挡背景色溢出 */\n margin-left: -5px;\n padding: 17px 0;\n padding-left: 12px;\n padding-right: 12px;\n border-right: solid 1px;\n border-top-left-radius: 50px;\n border-bottom-left-radius: 50px;\n\n background-color: #5a84ff;\n color: white;\n\n /* 微调节点的 icon 样式 */\n span {\n display: inline-block;\n padding-left: 12px;\n svg {\n /* width: 100%;\n height: 100%; */\n width: 20px;\n height: 20px;\n }\n }\n }\n\n .workflow-node-edit {\n box-sizing: border-box;\n height: 100%;\n padding: 17px 20px;\n border-top-right-radius: 50px;\n border-bottom-right-radius: 50px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n background-color: #fff;\n font-weight: 400;\n font-size: 14px;\n color: #1d2129;\n cursor: pointer;\n\n :focus {\n cursor: text;\n }\n\n &.node-executed {\n :focus {\n cursor: pointer;\n }\n }\n }\n\n .workflow-node-suffix {\n position: absolute;\n top: 50%;\n right: 0;\n /* 居中, 且始终和左边元素保持 20px的间距 */\n transform: translateX(calc(100% + 20px)) translateY(-50%);\n display: inline-flex;\n gap: 10px;\n box-sizing: border-box;\n margin-left: 12px;\n border-top-right-radius: 12px;\n border-bottom-right-radius: 12px;\n\n background-color: transparent;\n color: #fff;\n\n .icon-button {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n\n .workflow-node-remove-button {\n background-color: #fff;\n color: #ff7c87;\n }\n .workflow-node-drag-button {\n background-color: #fff;\n cursor: grab;\n }\n }\n }\n "]);return zr=function(){return e},e}let zi=(0,nu.rU)(e=>{let{css:t,token:n}=e;return{nodePoint:t(zr(),n.colorTextDisabled)}}),za=e=>{let{color:t,icon:n,workflow:o,editingTitle:l,configuring:r,setEditingTitle:i,onChangeTitle:a}=e,s=_l(),{styles:c}=zi(),[d,u]=(0,es.useState)(!1),p=o.executed||!d,m=(null==s?void 0:s.group)===_M;return(0,A.jsxs)("div",{className:(0,iS.cx)(c.nodePoint,{deprecated:m,configuring:r}),children:[(0,A.jsx)(zs,{color:t,icon:n}),(0,A.jsx)(Bn,{className:"workflow-node-edit ".concat(p?"node-executed":""),readOnly:p,value:l,onChange:e=>i(e.target.value),onBlur:e=>{a(e.target.value),u(!1)},onClick:()=>{r&&u(!0)}}),(0,A.jsx)(zc,{isExecuted:o.executed})]})},zs=e=>{let{color:t,icon:n}=e;return(0,A.jsx)("div",{className:"workflow-node-prefix",style:{backgroundColor:t},children:(0,A.jsx)(i6,{type:null!=n?n:"dispatcher"})})},zc=e=>{let{isExecuted:t}=e;return(0,A.jsx)("div",{className:"workflow-node-suffix",children:t?(0,A.jsx)("div",{className:"icon-button",children:(0,A.jsx)(zo,{})}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"icon-button",children:(0,A.jsx)(zl,{})}),(0,A.jsx)("div",{className:"icon-button",children:(0,A.jsx)(V9,{})})]})})},zd=e=>{var t,n;let{data:o,children:l}=e,r=eB(),i=eC(),{workflow:a,refresh:s}=null!=(t=qX())?t:{},{styles:c}=V8(),d=oc(Lz).instructions.get(o.type),u=a.executed?'{{t("View")}}':'{{t("Configure")}}',p=r(d.title),{color:m,icon:h}=d,[x,f]=(0,es.useState)(null!=(n=o.title)?n:p),[v,g]=(0,es.useState)(!1),y=(0,es.useCallback)(async function(e){var t,n;let l=e||p;f(l),l!==o.title&&(await (null==(t=(n=i.resource("flow_nodes")).update)?void 0:t.call(n,{filterByTk:o.id,values:{title:l}})),s())},[o]),b=(0,es.useCallback)(function(e){var t,n;if(e.target===e.currentTarget)return void g(!0);(null==(n=e.target)||null==(t=n.classList)?void 0:t.contains("workflow-node-edit"))&&g(!0);let o=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let t=e.target;t&&t!==e.currentTarget&&t!==document.documentElement;t=t.parentNode)if(Array.from(t.classList).some(e=>o.has(e))){g(!0),e.stopPropagation();return}},[]);return(0,A.jsxs)("div",{className:(0,iS.cx)(c.nodeClass,"workflow-node-type-".concat(o.type)),children:[(0,A.jsxs)("div",{className:(0,iS.cx)(c.nodeCardClass),role:"button","aria-label":"".concat(p,"-").concat(x),onClick:b,children:[(0,A.jsx)(za,{color:m,icon:h,workflow:a,editingTitle:x,configuring:v,setEditingTitle:f,onChangeTitle:y}),(0,A.jsx)(V3,{instruction:d,data:o,detailText:u,workflow:a,editingConfig:v,setEditingConfig:g})]}),l]})};function zu(){let e=(0,ns._)(["\n display: flex;\n gap: 0.5em;\n align-items: center;\n flex-wrap: wrap;\n "]);return zu=function(){return e},e}function zp(){let e=(0,ns._)(["\n display: flex;\n position: relative;\n margin: 0.5em 0;\n "]);return zp=function(){return e},e}function zm(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n .node-type-condition-group {\n padding: 0.5em 1em;\n border: 1px dashed #ddd;\n }\n + button {\n position: absolute;\n right: 0;\n }\n "]);return zm=function(){return e},e}function zh(){let e=(0,ns._)(["\n display: flex;\n align-items: center;\n gap: 0.5em;\n .ant-select {\n width: auto;\n min-width: 6em;\n }\n "]);return zh=function(){return e},e}function zx(){let e=(0,ns._)(["\n button {\n padding: 0;\n &:not(:last-child) {\n margin-right: 1em;\n }\n }\n "]);return zx=function(){return e},e}let zf=new eh.Registry;zf.register("equal",{name:"=",type:"boolean",group:"boolean"}),zf.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),zf.register("gt",{name:">",type:"boolean",group:"boolean"}),zf.register("gte",{name:"≥",type:"boolean",group:"boolean"}),zf.register("lt",{name:"<",type:"boolean",group:"boolean"}),zf.register("lte",{name:"≤",type:"boolean",group:"boolean"}),zf.register("add",{name:"+",type:"number",group:"number"}),zf.register("minus",{name:"-",type:"number",group:"number"}),zf.register("multiple",{name:"*",type:"number",group:"number"}),zf.register("divide",{name:"/",type:"number",group:"number"}),zf.register("mod",{name:"%",type:"number",group:"number"}),zf.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),zf.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),zf.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),zf.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),zf.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),zf.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),zf.register("concat",{name:'{{t("concat", { ns: "'.concat(qB,'" })}}'),type:"string",group:"string"}),zf.register("isEmpty",{name:'{{t("is empty", { ns: "'.concat(qB,'" })}}'),type:"boolean",group:"existence"}),zf.register("isNotEmpty",{name:'{{t("is not empty", { ns: "'.concat(qB,'" })}}'),type:"boolean",group:"existence"}),zf.register("isTrue",{name:'{{t("is true", { ns: "'.concat(qB,'" })}}'),type:"boolean",group:"existence"}),zf.register("isFalse",{name:'{{t("is false", { ns: "'.concat(qB,'" })}}'),type:"boolean",group:"existence"});let zv=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:'{{t("Arithmetic calculation", { ns: "'.concat(qB,'" })}}')},{value:"string",title:'{{t("String operation", { ns: "'.concat(qB,'" })}}')},{value:"date",title:'{{t("Date", { ns: "'.concat(qB,'" })}}')},{value:"existence",title:'{{t("Existence check", { ns: "'.concat(qB,'" })}}')}];function zg(e){return Array.from(zf.getEntities()).filter(t=>{let[n,o]=t;return o.group===e})}function zy(e){let t,{calculator:n,operands:o=[],onChange:l}=e,[r,i]=(0,es.useState)(n),a=eB(),s=OG();return(0,A.jsxs)("fieldset",{className:(0,iS.css)(zu()),children:[(0,A.jsx)(P7.Input,{value:o[0],onChange:e=>l({calculator:r,operands:[e,o[1]]}),scope:s,useTypedConstant:!0}),(0,A.jsx)(oo.A,{role:"button","aria-label":"select-operator-calc",value:r,onChange:e=>{i(e),l({operands:o,calculator:e})},placeholder:qE("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:zv.filter(e=>!!zg(e.value).length).map(e=>(0,A.jsx)(oo.A.OptGroup,{label:a(e.title),children:zg(e.value).map(e=>{let[t,{name:n}]=e;return(0,A.jsx)(oo.A.Option,{value:t,children:a(n)},t)})},e.value))}),(null==(t=zf.get(r))?void 0:t.group)!=="existence"&&(0,A.jsx)(P7.Input,{value:o[1],onChange:e=>l({calculator:r,operands:[o[0],e]}),scope:s,useTypedConstant:!0})]})}function zb(e){let{value:t,onChange:n,onRemove:o}=e;if(!t)return null;let{calculator:l,operands:r=[]}=t;return(0,A.jsxs)("div",{className:(0,iS.css)(zp()),children:[t.group?(0,A.jsx)(zC,{value:t.group,onChange:e=>n({...t,group:e})}):(0,A.jsx)(zy,{operands:r,calculator:l,onChange:n}),(0,A.jsx)(e3.Ay,{"aria-label":"icon-close",onClick:o,type:"link",icon:(0,A.jsx)(iE.A,{})})]})}function zC(e){let{value:t,onChange:n}=e,{t:o}=(0,eT.useTranslation)(),{type:l="and",calculations:r=[]}=t;function i(e,o){r.splice(e,1,o),n({...t,calculations:[...r]})}return(0,A.jsxs)("div",{className:(0,iS.cx)("node-type-condition-group",(0,iS.css)(zm())),children:[(0,A.jsx)("div",{className:(0,iS.css)(zh()),children:(0,A.jsxs)(eT.Trans,{children:["Meet ",(0,A.jsxs)(oo.A,{role:"button","data-testid":"filter-select-all-or-any",value:l,onChange:e=>n({...t,type:e}),children:[(0,A.jsx)(oo.A.Option,{value:"and",children:"All"}),(0,A.jsx)(oo.A.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),(0,A.jsx)("div",{className:"calculation-items",children:r.map((e,o)=>(0,A.jsx)(zb,{value:e,onChange:i.bind(this,o),onRemove:()=>{r.splice(o,1),n({...t,calculations:[...r]})}},"".concat(e.calculator,"_").concat(o)))}),(0,A.jsxs)("div",{className:(0,iS.css)(zx()),children:[(0,A.jsx)(e3.Ay,{type:"link",onClick:function(){n({...t,calculations:[...r,{not:!1,calculator:"equal"}]})},children:o("Add condition")}),(0,A.jsx)(e3.Ay,{type:"link",onClick:function(){n({...t,calculations:[...r,{not:!1,group:{type:"and",calculations:[]}}]})},children:o("Add condition group")})]})]})}function zS(e){let{value:t,onChange:n}=e,o=t&&Object.keys(t).length?t:{group:{type:"and",calculations:[]}};return(0,A.jsx)(zC,{value:o.group,onChange:e=>n({...o,group:e})})}class zw extends Od{Component(e){let{data:t}=e,{t:n}=(0,eT.useTranslation)(),{nodes:o}=qX(),{styles:l}=_F(),{id:r,config:{rejectOnFalse:i}}=t,a=o.find(e=>e.upstreamId===r&&1===e.branchIndex),s=o.find(e=>e.upstreamId===r&&0===e.branchIndex);return(0,A.jsx)(zd,{data:t,children:i?null:(0,A.jsxs)("div",{className:l.nodeSubtreeClass,children:[(0,A.jsxs)("div",{className:l.branchBlockClass,children:[(0,A.jsx)(_j,{from:t,entry:a,branchIndex:1}),(0,A.jsx)(_j,{from:t,entry:s,branchIndex:0})]}),(0,A.jsxs)("div",{className:l.conditionClass,children:[(0,A.jsx)("span",{style:{right:"4em",display:"inline-block",padding:"0.5em",textAlign:"center",backgroundColor:"white",borderRadius:"50%",color:"black",fontSize:"1em",lineHeight:"1em"},children:n("Yes")}),(0,A.jsx)("span",{style:{left:"4em",display:"inline-block",padding:"0.5em",textAlign:"center",backgroundColor:"white",borderRadius:"50%",color:"black",fontSize:"1em",lineHeight:"1em"},children:n("No")})]})]})})}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Condition", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","condition"),(0,em._)(this,"group","control"),(0,em._)(this,"icon","QuestionOutlined"),(0,em._)(this,"color","#1ab287"),(0,em._)(this,"description",'{{t(\'Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".\', { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{rejectOnFalse:{type:"boolean",title:'{{t("Mode", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:'{{t(\'Continue when "Yes"\', { ns: "'.concat(qB,'" })}}')},{value:!1,label:'{{t(\'Branch into "Yes" and "No"\', { ns: "'.concat(qB,'" })}}')}]},engine:{type:"string",title:'{{t("Calculation engine", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:'{{t("Basic", { ns: "'.concat(qB,'" })}}')}],...Array.from(eh.evaluators.getEntities()).filter(e=>{let[t]=e;return["math.js","formula.js"].includes(t)})].reduce((e,t)=>{let[n,o]=t;return e.concat({value:n,...o})},[])},required:!0,default:"basic"},calculation:{type:"string",title:'{{t("Condition", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:'{{t("Condition expression", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-validator"(e,t,n){let{form:o}=n,{values:l}=o,{evaluate:r}=eh.evaluators.get(l.engine),i=e.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return r(i),""}catch(e){return qE("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"options",[{label:'{{t(\'Continue when "Yes"\', { ns: "'.concat(qB,'" })}}'),key:"rejectOnFalse",value:{rejectOnFalse:!0}},{label:'{{t(\'Branch into "Yes" and "No"\', { ns: "'.concat(qB,'" })}}'),key:"branch",value:{rejectOnFalse:!1}}]),(0,em._)(this,"scope",{renderEngineReference:VY,useWorkflowVariableOptions:OG}),(0,em._)(this,"components",{CalculationConfig:zS,WorkflowVariableTextArea:OH,RadioWithTooltip:O0})}}function zF(){let e=(0,ns._)(["\n margin-top: 0.5em;\n\n > .ant-formily-item {\n flex-direction: column;\n\n > .ant-formily-item-label {\n line-height: 32px;\n }\n }\n "]);return zF=function(){return e},e}function zj(){let e=(0,ns._)(["\n .ant-form-item-control-input-content {\n display: flex;\n }\n "]);return zj=function(){return e},e}function zA(e){let{getCollectionFields:t}=sO(),{path:n}=(0,ec.useField)(),o=n.segments[n.segments.length-1],{values:l}=(0,ec.useForm)(),[r,i]=vS(null==l?void 0:l.collection),{type:a}=t(i,r).find(e=>e.name===o),s=Array.isArray(e.value)?e.value.join(","):e.value;return(0,A.jsx)(nJ.A,{...e,value:s,onChange:function(t){let n=t.target.value.trim();e.onChange(["belongsTo","hasOne"].includes(a)?n:n.split(/[,\s]+/))}})}let zk=(0,ec.observer)(e=>{let{value:t,disabled:n,onChange:o,filter:l}=e,{token:r}=iF(),{t:i}=(0,eT.useTranslation)(),a=eB(),s=(0,ec.useForm)(),{getCollectionFields:c}=sO(),d=OG(),{values:u}=s,[p,m]=vS(null==u?void 0:u.collection),h=c(m,p).filter(e=>e.uiSchema),x=l?h.filter(l.bind(u)):h,f=(0,es.useMemo)(()=>x.filter(e=>!t||!(e.name in t)),[x,t]),v=n||s.disabled,g=(0,es.useMemo)(()=>({onClick:e=>{let{key:n}=e;o({...t,[n]:null})},style:{maxHeight:300,overflowY:"auto"},items:f.map(e=>{var t,n;return{key:e.name,label:a(null!=(n=null==(t=e.uiSchema)?void 0:t.title)?n:e.name)}})}),[o,f,t]);return(0,A.jsx)("fieldset",{className:(0,iS.css)(zF()),children:x.length?(0,A.jsxs)(hH,{name:m,dataSource:p,children:[x.filter(e=>t&&e.name in t).map(e=>{var n,l;let r=["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)?zA:Tv;return(0,A.jsxs)(MX.A.Item,{label:a(null!=(l=null==(n=e.uiSchema)?void 0:n.title)?l:e.name),labelAlign:"left",className:(0,iS.css)(zj()),children:[(0,A.jsx)(P7.Input,{scope:d,value:t[e.name],changeOnSelect:!0,onChange:n=>{o({...t,[e.name]:n})},children:(0,A.jsx)(al,{schema:{type:"void",properties:{[e.name]:{"x-component":r,"x-validator":()=>""}}}})}),v?null:(0,A.jsx)(e3.Ay,{"aria-label":"icon-close",type:"link",icon:(0,A.jsx)(iE.A,{}),onClick:()=>{let{[e.name]:n,...l}=t;o(l)}})]},e.name)}),f.length?(0,A.jsx)(nX.A,{menu:g,children:(0,A.jsx)(e3.Ay,{icon:(0,A.jsx)(sF.A,{}),children:i("Add field")})}):null]}):(0,A.jsx)("p",{style:{color:r.colorText},children:qE("Please select collection first")})})},{displayName:"CollectionFieldSet"});function zI(){let e=(0,ns._)(["\n flex-direction: column;\n "]);return zI=function(){return e},e}function zP(){let e=(0,ns._)(["\n position: relative;\n width: 100%;\n "]);return zP=function(){return e},e}let zT={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},zN={type:"object",title:'{{t("Fields values")}}',description:'{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:(0,iS.css)(zI())},"x-component":"CollectionFieldset"},zM={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{let{values:e}=(0,ec.useForm)(),[t,n]=vS(null==e?void 0:e.collection);return{options:hm(n,t),className:(0,iS.css)(zP())}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},zD={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},zR={type:"void",properties:{paginate:{type:"boolean",title:qz("Pagination"),"x-decorator":"FormItem","x-component":"Checkbox","x-content":qz("Custom pagination(page number and count cannot be empty)"),default:!1},pagination:{type:"void","x-decorator":"FormItem","x-component":"Grid","x-reactions":[{dependencies:[".paginate"],fulfill:{state:{hidden:"{{ !$deps[0] }}"}}}],properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:100},default:20}}}}}}}}},zq={type:"array",title:'{{t("Preload associations", { ns: "'.concat(qB,'" })}}'),description:'{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){let{values:e}=(0,ec.useForm)();return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]};class z_ extends Od{useVariables(e,t){var n,o;let{key:l,title:r,config:i}=e,a=eB(),{getCollectionFields:s}=sO(),[c]=OU({appends:[l,...(null==(o=i.params)||null==(n=o.appends)?void 0:n.map(e=>"".concat(l,".").concat(e)))||[]],...t,fields:[{collectionName:i.collection,name:l,type:"hasOne",target:i.collection,uiSchema:{title:r}}],compile:a,getCollectionFields:s});return c}useInitializers(e){var t,n;return e.config.collection?{name:null!=(t=e.title)?t:"#".concat(e.id),type:"item",title:null!=(n=e.title)?n:"#".concat(e.id),Component:OP,collection:e.config.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key)}:null}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Create record", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","create"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","FileAddOutlined"),(0,em._)(this,"color","#07fa0f"),(0,em._)(this,"description",'{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{collection:{...zT,"x-reactions":[...zT["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]},params:{type:"object",properties:{values:zN,appends:zq}}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{CollectionFieldset:zk})}}class zO extends Od{constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Delete record")}}'),(0,em._)(this,"type","destroy"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","ClockCircleOutlined"),(0,em._)(this,"color","#fa0b07"),(0,em._)(this,"description",'{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{collection:{...zT,"x-reactions":[...zT["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]},params:{type:"object",properties:{filter:{...zM,"x-validator":e=>On(e)?"":qE("Please add at least one condition")}}}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{FilterDynamicComponent:OJ})}}class zB extends Od{constructor(...e){super(...e),(0,em._)(this,"title",'{{t("End process", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","end"),(0,em._)(this,"group","control"),(0,em._)(this,"icon","LogoutOutlined"),(0,em._)(this,"color","#2659a1"),(0,em._)(this,"description",'{{t("End the process immediately, with set status.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{endStatus:{type:"number",title:'{{t("End status", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Succeeded", { ns: "'.concat(qB,'" })}}'),value:1},{label:'{{t("Failed", { ns: "'.concat(qB,'" })}}'),value:-1}],required:!0,default:1},remarks:{type:"string",title:'{{t("Remarks", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{autoSize:{minRows:3},placeholder:'{{t("Input remarks", { ns: "'.concat(qB,'" })}}')}}}),(0,em._)(this,"end",!0)}}class zE extends Od{useVariables(e,t){var n,o;let{key:l,title:r,config:i}=e,a=eB(),{getCollectionFields:s}=sO(),[c]=OU({appends:[l,...(null==(o=i.params)||null==(n=o.appends)?void 0:n.map(e=>"".concat(l,".").concat(e)))||[]],...t,fields:[{collectionName:i.collection,name:l,type:"hasOne",target:i.collection,uiSchema:{title:r}}],compile:a,getCollectionFields:s});return c}useInitializers(e){var t,n;return!e.config.collection||e.config.multiple?null:{name:null!=(t=e.title)?t:"#".concat(e.id),type:"item",title:null!=(n=e.title)?n:"#".concat(e.id),Component:OP,collection:e.config.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key)}}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Query record", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","query"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","FileSearchOutlined"),(0,em._)(this,"color","#55e2d1"),(0,em._)(this,"description",'{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{collection:{...zT,"x-reactions":[...zT["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]},multiple:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Allow multiple records as result", { ns: "'.concat(qB,'" })}}'),description:'{{t("If checked, when there are multiple records in the query result, an array will be returned as the result, which can be operated on one by one using a loop node. Otherwise, only one record will be returned.", { ns: "'.concat(qB,'" })}}')},isTree:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Allow query for tree data", { ns: "'.concat(qB,'" })}}')},params:{type:"object","x-component":"fieldset",properties:{filter:zM,sort:zD,pagination:zR,appends:zq},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Exit when query result is null", { ns: "'.concat(qB,'" })}}')}}),(0,em._)(this,"scope",{useCollectionDataSource:hX,useSortableFields(){let e=eB(),{getCollectionFields:t,getInterface:n}=sO(),{values:o}=(0,ec.useForm)();return t(o.collection).filter(e=>{if(!e.interface)return!1;let t=n(e.interface);return null!=t&&!!t.sortable}).map(t=>{var n,o;return{value:t.name,label:(null==t||null==(n=t.uiSchema)?void 0:n.title)?e(null==t||null==(o=t.uiSchema)?void 0:o.title):t.name}})}}),(0,em._)(this,"components",{ArrayItems:eh.ArrayItems,FilterDynamicComponent:OJ,SchemaComponentContext:eV,WorkflowVariableInput:OW})}}class zV extends Od{useVariables(e,t){var n,o;let{key:l,title:r,config:i}=e,a=eB(),{getCollectionFields:s}=sO(),[c]=OU({appends:[l,...(null==(o=i.params)||null==(n=o.appends)?void 0:n.map(e=>"".concat(l,".").concat(e)))||[]],...t,fields:[{collectionName:i.collection,name:l,type:"hasOne",target:i.collection,uiSchema:{title:r}}],compile:a,getCollectionFields:s});return c}useInitializers(e){var t,n;return!e.config.collection||e.config.multiple?null:{name:null!=(t=e.title)?t:"#".concat(e.id),type:"item",title:null!=(n=e.title)?n:"#".concat(e.id),Component:OP,collection:e.config.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key)}}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Select record", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","select"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","SelectOutlined"),(0,em._)(this,"color","#a47cef"),(0,em._)(this,"description",'{{t("Select records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{collection:{...zT,"x-reactions":[...zT["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]},multiple:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Allow multiple records as result", { ns: "'.concat(qB,'" })}}'),description:'{{t("If checked, when there are multiple records in the query result, an array will be returned as the result, which can be operated on one by one using a loop node. Otherwise, only one record will be returned.", { ns: "'.concat(qB,'" })}}')},isTree:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Allow query for tree data", { ns: "'.concat(qB,'" })}}')},params:{type:"object","x-component":"fieldset",properties:{filter:zM,sort:zD,pagination:zR,summary:{type:"array",title:'{{t("Select fields to display in the collection", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"CollectionTreeSelect","x-component-props":{title:"Preload associations",needLeaf:!0,useCollection(){let{values:e}=(0,ec.useForm)();return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Exit when query result is null", { ns: "'.concat(qB,'" })}}')}}),(0,em._)(this,"scope",{useCollectionDataSource:hX,useSortableFields(){let e=eB(),{getCollectionFields:t,getInterface:n}=sO(),{values:o}=(0,ec.useForm)();return t(o.collection).filter(e=>{if(!e.interface)return!1;let t=n(e.interface);return null!=t&&!!t.sortable}).map(t=>{var n,o;return{value:t.name,label:(null==t||null==(n=t.uiSchema)?void 0:n.title)?e(null==t||null==(o=t.uiSchema)?void 0:o.title):t.name}})}}),(0,em._)(this,"components",{ArrayItems:eh.ArrayItems,FilterDynamicComponent:OJ,SchemaComponentContext:eV,WorkflowVariableInput:OW})}}function zz(e){let{onChange:t,...n}=e,{getCollectionFields:o}=sO(),l=(0,ec.useForm)(),{collection:r}=l.values,i=o(r),a=(0,ec.useField)();return(0,A.jsx)(O0,{...n,onChange:function(e){let{target:n}=e,o=a.query(".values").take();if(!o)return;let r=i.reduce((e,t)=>(t.name in o.value&&(n.value||![].includes(t.type))&&(e[t.name]=o.value[t.name]),e),{});l.setValuesIn("params.values",r),t(n.value)}})}class zL extends Od{constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Update record", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","update"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","SignatureOutlined"),(0,em._)(this,"color","#f4952f"),(0,em._)(this,"description",'{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{collection:{...zT,"x-reactions":[...zT["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]},params:{type:"object",properties:{individualHooks:{type:"boolean",title:'{{t("Update mode", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"IndividualHooksRadioWithTooltip","x-component-props":{options:[{label:'{{t("Update in a batch", { ns: "'.concat(qB,'" })}}'),value:!1,tooltip:'{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.", { ns: "'.concat(qB,'" })}}')},{label:'{{t("Update one by one", { ns: "'.concat(qB,'" })}}'),value:!0,tooltip:'{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "'.concat(qB,'" })}}')}]},default:!1},filter:{...zM,title:'{{t("Only update records matching conditions", { ns: "'.concat(qB,'" })}}'),"x-validator":e=>On(e)?"":qE("Please add at least one condition")},values:{...zN,"x-component-props":{filter(e){var t;return(null==(t=this.params)?void 0:t.individualHooks)||![].includes(e.type)}}}}}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{FilterDynamicComponent:OJ,CollectionFieldset:zk,IndividualHooksRadioWithTooltip:zz})}}function zG(e){let{onChange:t,...n}=e,{getCollectionFields:o}=sO(),l=(0,ec.useForm)(),{collection:r}=l.values,i=o(r),a=(0,ec.useField)();return(0,A.jsx)(O0,{...n,onChange:function(e){let{target:n}=e,o=a.query(".values").take();if(!o)return;let r=i.reduce((e,t)=>(t.name in o.value&&(n.value||![].includes(t.type))&&(e[t.name]=o.value[t.name]),e),{});l.setValuesIn("params.values",r),t(n.value)}})}class zK extends Od{constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Update or create record", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"type","updateorcreate"),(0,em._)(this,"group","collection"),(0,em._)(this,"icon","FileSyncOutlined"),(0,em._)(this,"color","#f6f66a"),(0,em._)(this,"description",'{{t("Update or create record, if no matching record is found, a new record will be created, with the ability to assign values to fields using variables from upstream nodes.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{collection:{...zT,"x-reactions":[...zT["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]},params:{type:"object",properties:{individualHooks:{type:"boolean",title:'{{t("Update mode", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"IndividualHooksRadioWithTooltip","x-component-props":{options:[{label:'{{t("Update in a batch", { ns: "'.concat(qB,'" })}}'),value:!1,tooltip:'{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.", { ns: "'.concat(qB,'" })}}')},{label:'{{t("Update one by one", { ns: "'.concat(qB,'" })}}'),value:!0,tooltip:'{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "'.concat(qB,'" })}}')}]},default:!1},filter:{...zM,title:'{{t("Only update records matching conditions", { ns: "'.concat(qB,'" })}}'),"x-validator":e=>On(e)?"":qE("Please add at least one condition")},values:{...zN,"x-component-props":{filter(e){var t;return(null==(t=this.params)?void 0:t.individualHooks)||![].includes(e.type)}}}}}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{FilterDynamicComponent:OJ,CollectionFieldset:zk,IndividualHooksRadioWithTooltip:zG})}}let z$=new or({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:dc,useComponentProps(){let{buttonEditorProps:e}=sw();return e}},{name:"secondConfirmation",Component:dC},{name:"assignFieldValues",Component:dd},{name:"skipRequiredValidation",Component:dp},{name:"afterSuccessfulSubmission",Component:dh,useVisible(){var e;let t=(0,ec.useFieldSchema)();return(0,ec.isValid)(null==t||null==(e=t["x-action-settings"])?void 0:e.onSuccess)}},{name:"bindWorkflow",Component:dv},{name:"delete",sort:100,Component:dx,useComponentProps(){let{removeButtonProps:e}=sw();return e}}]}),zU=[{label:'{{t("After record added", { ns: "'.concat(qB,'" })}}'),value:1},{label:'{{t("After record updated", { ns: "'.concat(qB,'" })}}'),value:2},{label:'{{t("After record added or updated", { ns: "'.concat(qB,'" })}}'),value:3},{label:'{{t("After record deleted", { ns: "'.concat(qB,'" })}}'),value:4}];class zW extends _V{useVariables(e,t){var n;let o=eB(),{getCollectionFields:l}=sO(),r=[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:qE("Trigger data")}}];return OU({appends:["data",...(null==(n=e.appends)?void 0:n.map(e=>"data.".concat(e)))||[]],...t,fields:r,compile:o,getCollectionFields:l})}useInitializers(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "'.concat(qB,'" })}}'),Component:OP,collection:e.collection,dataPath:"$context.data"}:null}constructor(...e){super(...e),(0,em._)(this,"title",'{{t("Collection event", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"description",'{{t("Event will be triggered on collection data row created, updated or deleted.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{collection:{...zT,"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter:e=>"main"===e.options.key||e.options.isDBInstance},"x-reactions":[...zT["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"blacklist",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},mode:{type:"number",title:'{{t("Trigger on", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:'{{t("Trigger on", { ns: "'.concat(qB,'" })}}'),className:"auto-width"},enum:zU,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},blacklist:{type:"array",title:'{{t("Changed fields - blacklist", { ns: "'.concat(qB,'" })}}'),description:'{{t("Triggered only if none of the selected fields changes. When record is added or deleted, this field has no effect.", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter:e=>!e.hidden&&(!e.uiSchema||!e.uiSchema["x-read-pretty"])&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(e.type)},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:"{{!!$deps[0] && ($deps[1] & ".concat(2,")}}")}}}]},changed:{type:"array",title:'{{t("Changed fields", { ns: "'.concat(qB,'" })}}'),description:'{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter:e=>!e.hidden&&(!e.uiSchema||!e.uiSchema["x-read-pretty"])&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(e.type)},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:"{{!!$deps[0] && ($deps[1] & ".concat(2,")}}")}}}]},condition:{...zM,title:'{{t("Only triggers when match conditions", { ns: "'.concat(qB,'" })}}'),"x-component-props":{},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},appends:{...zq,"x-reactions":[...zq["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:"{{!($deps[0] & ".concat(4,")}}")}}}]}}),(0,em._)(this,"scope",{useCollectionDataSource:hX,useWorkflowAnyExecuted:Bo}),(0,em._)(this,"components",{FieldsSelect:OM})}}function zH(){let e=(0,ns._)(["\n display: flex;\n gap: 0.5em;\n "]);return zH=function(){return e},e}function zY(e){return!e.hidden&&!!e.uiSchema&&"date"===e.type}function zX(e){let{value:t,onChange:n}=e,o=null!=t?t:{},{t:l}=(0,eT.useTranslation)(),[r,i]=(0,es.useState)(o.offset?o.offset/Math.abs(o.offset):0);return(0,A.jsxs)("fieldset",{className:(0,iS.css)(zH()),children:[(0,A.jsx)(OM,{value:o.field,onChange:e=>n({...o,field:e}),filter:zY,placeholder:l("Select field"),className:"auto-width"}),o.field?(0,A.jsx)(oo.A,{value:r,onChange:e=>{i(e),n({...o,offset:Math.abs(o.offset)*e})},options:[{value:0,label:qE("Exactly at")},{value:-1,label:l("Before")},{value:1,label:l("After")}],className:"auto-width"}):null,r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(kw.A,{value:Math.abs(o.offset),onChange:e=>n({...o,offset:(null!=e?e:0)*r})}),(0,A.jsx)(oo.A,{value:o.unit||864e5,onChange:e=>n({...o,unit:e}),options:[{value:864e5,label:qE("Days")},{value:36e5,label:qE("Hours")},{value:6e4,label:qE("Minutes")},{value:1e3,label:qE("Seconds")}],className:"auto-width"})]}):null]})}function zJ(){let e=(0,ns._)(["\n display: flex;\n gap: 0.5em;\n "]);return zJ=function(){return e},e}function zQ(e){let{value:t,onChange:n}=e,{t:o}=qV(),l=null!=t?"object"!=typeof t||t instanceof Date?"date":"field":null;return(0,A.jsxs)("fieldset",{className:(0,iS.css)(zJ()),children:[(0,A.jsxs)(oo.A,{value:l,onChange:e=>{n(e?"field"===e?{}:new Date:null)},className:"auto-width",children:[(0,A.jsx)(oo.A.Option,{value:null,children:o("No end")}),(0,A.jsx)(oo.A.Option,{value:"field",children:o("By field")}),(0,A.jsx)(oo.A.Option,{value:"date",children:o("By custom date")})]}),"field"===l?(0,A.jsx)(zX,{value:t,onChange:n}):null,"date"===l?(0,A.jsx)(AA.A,{showTime:!0,value:P()(t),onChange:e=>{n(e?e.toDate():null)}}):null]})}function zZ(){let e=(0,ns._)(["\n display: flex;\n flex-direction: ",";\n align-items: flex-start;\n gap: 0.5em;\n\n .react-js-cron {\n width: 100%;\n padding: 0.5em 0.5em 0 0.5em;\n border: 1px dashed #ccc;\n\n .react-js-cron-field {\n margin-bottom: 0.5em;\n\n > span {\n margin: 0 0.5em 0 0;\n }\n\n > .react-js-cron-select {\n margin: 0 0.5em 0 0;\n }\n }\n\n .react-js-cron-week-days {\n > span {\n min-width: 2em;\n }\n }\n }\n "]);return zZ=function(){return e},e}let z0={"zh-CN":{everyText:"每",emptyMonths:"每月",emptyMonthDays:"每日(月)",emptyMonthDaysShort:"每日",emptyWeekDays:"每天(周)",emptyWeekDaysShort:"每天(周)",emptyHours:"每小时",emptyMinutes:"每分钟",emptyMinutesForHourPeriod:"每",yearOption:"年",monthOption:"月",weekOption:"周",dayOption:"天",hourOption:"小时",minuteOption:"分钟",rebootOption:"重启",prefixPeriod:"每",prefixMonths:"的",prefixMonthDays:"的",prefixWeekDays:"的",prefixWeekDaysForMonthAndYearPeriod:"或者",prefixHours:"的",prefixMinutes:":",prefixMinutesForHourPeriod:"的",suffixMinutesForHourPeriod:"分钟",errorInvalidCron:"不符合 cron 规则的表达式",clearButtonText:"清空",weekDays:["周日","周一","周二","周三","周四","周五","周六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],altWeekDays:["周日","周一","周二","周三","周四","周五","周六"],altMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},z1=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function z2(e){return z1.filter(e=>"number"==typeof e.value).reverse().find(t=>!(e%t.value))}function z6(e){let{value:t,onChange:n}=e,{t:o}=qV(),l=z2(t);return(0,A.jsx)(kw.A,{value:t/l.value,onChange:e=>n(e*l.value),min:1,addonBefore:o("Every"),addonAfter:o(l.unitText),className:"auto-width"})}function z3(e){let{value:t=null,onChange:n}=e,{t:o}=qV(),l=function(e){let t;switch(typeof e){case"number":return(t=z2(e))?t.value:"none";case"string":return"cron"}return"none"}(t),r=z0[localStorage.getItem("TACHYBASE_LOCALE")||"en-US"];return(0,A.jsxs)("fieldset",{className:(0,iS.css)(zZ(),"cron"===l?"column":"row"),children:[(0,A.jsx)(oo.A,{value:l,onChange:function(e){"none"===e?n(null):"cron"===e?n("0 * * * * *"):n(e)},className:"auto-width",children:z1.map(e=>(0,A.jsx)(oo.A.Option,{value:e.value,children:o(e.text)},e.value))}),"number"==typeof l?(0,A.jsx)(z6,{value:t,onChange:n}):null,"cron"===l?(0,A.jsx)(Ac.l4,{value:t.trim().split(/\s+/).slice(1).join(" "),setValue:e=>n("0 ".concat(e)),clearButton:!1,locale:r}):null]})}function z5(){let e=(0,ns._)(["\n .ant-input-number {\n width: auto;\n min-width: 6em;\n }\n\n .ant-picker {\n width: auto;\n }\n "]);return z5=function(){return e},e}let z4={0:{startsOn:{type:"datetime",title:'{{t("Starts on", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:'{{t("Repeat mode", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:'{{t("Ends on", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:'{{t("Repeat limit", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:'{{t("No limit", { ns: "'.concat(qB,'" })}}'),min:0}}},1:{collection:{...zT,"x-component-props":{dataSourceFilter:e=>"main"===e.options.key||e.options.isDBInstance},"x-reactions":[...zT["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]},startsOn:{type:"object",title:'{{t("Starts on", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:'{{t("Repeat mode", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:'{{t("Ends on", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:'{{t("Repeat limit", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:'{{t("No limit", { ns: "'.concat(qB,'" })}}'),min:0}},appends:{...zq,"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:"{{$deps[0] === ".concat(1," && $deps[1]}}")}}}]}}},z8=[{value:0,label:'{{t("Based on certain date", { ns: "'.concat(qB,'" })}}')},{value:1,label:'{{t("Based on date field of collection", { ns: "'.concat(qB,'" })}}')}],z7=()=>{let{values:e={},clearFormGraph:t}=(0,ec.useForm)(),[n,o]=(0,es.useState)(e.mode);return(0,ec.useFormEffects)(()=>{(0,ec.onFieldValueChange)("mode",e=>{o(e.value),t("collection"),t("startsOn"),t("repeat"),t("endsOn"),t("limit")})}),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(al,{schema:{type:"number",title:'{{t("Trigger mode", { ns: "'.concat(qB,'" })}}'),name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:z8},required:!0,default:0}}),(0,A.jsx)(al,{schema:{type:"void",properties:{["mode-".concat(n)]:{type:"void","x-component":"fieldset","x-component-props":{className:(0,iS.css)(z5())},properties:z4[n]}}},components:{OnField:zX,RepeatField:z3,EndsByField:zQ}})]})};class z9 extends _V{useVariables(e,t){let n=eB(),{getCollectionFields:o}=sO(),l=[];if((!(null==t?void 0:t.types)||t.types.includes("date"))&&l.push({key:"date",value:"date",label:qE("Trigger time")}),1===e.mode){var r;let[i]=OU({appends:["data",...(null==(r=e.appends)?void 0:r.map(e=>"data.".concat(e)))||[]],...t,fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:qE("Trigger data")}}],compile:n,getCollectionFields:o});i&&l.push(i)}return l}useInitializers(e){return e.collection?{name:"triggerData",type:"item",title:'{{t("Trigger data", { ns: "'.concat(qB,'" })}}'),Component:OP,collection:e.collection,dataPath:"$context.data"}:null}constructor(...e){super(...e),(0,em._)(this,"sync",!1),(0,em._)(this,"title",'{{t("Schedule event", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"description",'{{t("Event will be scheduled and triggered base on time conditions.", { ns: "'.concat(qB,'" })}}')),(0,em._)(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}}),(0,em._)(this,"scope",{useCollectionDataSource:hX}),(0,em._)(this,"components",{ScheduleConfig:z7})}}var Le=n(36969);let Lt={name:"executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:'{{t("Triggered at", { ns: "'.concat(qB,'" })}}'),"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"bigInt",type:"bigInt",name:"executionCost",uiSchema:{type:"bigInt",title:'{{t("Execution time", { ns: "'.concat(qB,'" })}}'),"x-component":e=>{let{value:t}=e,n=function(e,t){let n=()=>Date.now()-new Date(t.createdAt).getTime(),[o,l]=(0,es.useState)(e||n());return(0,es.useEffect)(()=>{let o;return 0===t.status?o=setInterval(()=>{l(n())},1e3):l(e),()=>{o&&clearInterval(o)}},[e,t.status]),function(e){if(!e)return;let t=e/1e3;if(t>=0x5250a80)return"".concat(999," D");if(e<6e5){let n=Math.floor(t/60),o=Math.floor(t%60),l=e%1e3,r="".concat(l," ms");return n>0?r="".concat(n," m ").concat(o," s ").concat(l," ms"):o>0&&(r="".concat(o," s ").concat(l," ms")),r}let n=Math.floor(t/86400),o=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),r=t%60,i="";return n>0&&(i+="".concat(n," D ")),(o>0||n>0)&&(i+="".concat(o," h ")),(l>0||o>0||n>0)&&(i+="".concat(l," m ")),t>=60?i+="".concat(Math.floor(r)," s"):i+="".concat(r," s"),i.trim()}(o)}(t,tz());return(0,A.jsx)(gd,{type:"text",value:n})},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:'{{t("Version", { ns: "'.concat(qB,'" })}}'),"x-component"(e){let{value:t}=e,{setVisible:n}=co();return(0,A.jsx)(eN.Link,{to:Ol(t),onClick:()=>n(!1),children:"#".concat(t)})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:'{{t("Status", { ns: "'.concat(qB,'" })}}'),type:"string","x-component":"Select","x-decorator":"FormItem",enum:_8}}]},Ln=(e=>{let{isShowActionClear:t=!0}=e||{};return{type:"void",name:"executionHistoryDrawer",title:'{{t("Execution history", { ns: "'.concat(qB,'" })}}'),"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:Lt,dataSource:"main",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-designer":"Action.Designer","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{isShow:t,useAction(){let{t:e}=qV(),{refresh:t,params:n}=t6(),o=nt(),{setVisible:l}=co();return{async run(){await o.destroy({filter:null==n?void 0:n.filter}),cg.Ay.success(e("Operation succeeded")),t(),l(!1)}}},confirm:{title:'{{t("Clear all executions", { ns: "'.concat(qB,'" })}}'),content:'{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "'.concat(qB,'" })}}')}}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id"},properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"TableV2.Column","x-component-props":{width:50},properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"},retry:{type:"void",title:'{{t("Retry", { ns: "'.concat(qB,'" })}}'),"x-component":"Action.Link","x-use-component-props":"ExecutionRetryAction"}}}}},id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:50},properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100},properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},executionCost:{type:"void",title:'{{t("Executed time", { ns: "'.concat(qB,'" })}}'),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:50},properties:{executionCost:{type:"bigInt","x-component":"CollectionField","x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:50},properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void",title:'{{t("Status", { ns: "'.concat(qB,'" })}}'),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:50},properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}}}}}}}}})();function Lo(e){let{params:t,filter:n={},...o}=e,{workflow:l}=qX(),r={...o,params:{...t,filter:{...null==t?void 0:t.filter,key:l.key}}};return(0,A.jsx)(lV,{...r})}function Ll(){var e,t;let n=(0,ep.useNavigate)(),{t:o}=(0,eT.useTranslation)(),l=os(),{data:r,refresh:i,loading:a}=hn(),{resource:s}=hl(),{setTitle:c}=wT(),[d,u]=(0,es.useState)(!1),[p,m]=(0,es.useState)(!1),[h,x]=(0,es.useState)(null),{styles:f}=_F(),{modal:v}=eX.A.useApp(),g=null==(e=window.location.pathname.split("business-components/")[1])?void 0:e.split("/")[0],y=l.systemSettingsManager.get("business-components.".concat(g))||{},b=eB();if((0,es.useEffect)(()=>{var e;let{title:t}=null!=(e=null==r?void 0:r.data)?e:{};null==c||c("".concat(qE("Workflow")).concat(t?": ".concat(t):""))},[null==r?void 0:r.data]),!(null==r?void 0:r.data))return a?(0,A.jsx)(eD.A,{}):(0,A.jsx)(e6.Ay,{status:"404",title:"Not found"});let{nodes:C=[],revisions:S=[],...w}=null!=(t=null==r?void 0:r.data)?t:{};Ot(C);let F=C.find(e=>!e.upstream);async function j(e){await s.update({filterByTk:w.id,values:{enabled:e}}),i()}async function k(){let{data:{data:e}}=await s.retry({filterByTk:w.id,filter:{key:w.key}});n(Or(e.id,g))}async function I(){try{let{data:{data:e}}=await s.test({filterByTk:w.id,filter:{key:w.key},values:{data:{}}});if(!e||!e.id)return void cg.Ay.error(qE("Failed to create execution"));n(Or(e.id,g))}catch(n){var e,t;console.error("Test execution failed:",n),cg.Ay.error((null==n||null==(t=n.response)||null==(e=t.data)?void 0:e.message)||(null==n?void 0:n.message)||qE("Test execution failed"))}}async function P(){let{data:{data:e}}=await s.revision({filterByTk:w.id,filter:{key:w.key},values:{color:w.color}});cg.Ay.success(o("Operation succeeded")),n(Ol(e.id,g))}async function T(){let e=w.current?qE("Delete a main version will cause all other revisions to be deleted too."):"";v.confirm({title:o("Are you sure you want to delete it?"),content:e,async onOk(){var e;await s.destroy({filterByTk:w.id}),cg.Ay.success(o("Operation succeeded")),n(w.current?l.systemSettingsManager.getRoutePath("workflow"):Ol(null==(e=S.find(e=>e.current))?void 0:e.id,g))}})}let N=async()=>{h?(await s.moveWorkflow({id:w.id,targetKey:h}),cg.Ay.success(qE("Move success")),m(!1),w.key=h,i()):cg.Ay.error(qE("Select target workflow"))};async function M(e){let{key:t}=e;switch(t){case"history":u(!0);return;case"test":return I();case"Retry":return k();case"revision":return P();case"delete":return T();case"move":x(null),m(!0);return}}let D=w.executed&&!S.find(e=>!e.executed&&new Date(e.createdAt)>new Date(w.createdAt));return(0,A.jsxs)(qY.Provider,{value:{workflow:w,nodes:C,refresh:i},children:[(0,A.jsxs)("div",{className:"workflow-toolbar",children:[(0,A.jsxs)("header",{children:[(0,A.jsx)(_Q,{}),(0,A.jsx)(qK.A,{items:[{title:(0,A.jsx)(eN.Link,{to:l.systemSettingsManager.getRoutePath("business-components.".concat(g)),children:b(y.label)})},{title:(0,A.jsx)("strong",{children:w.title})}]})]}),(0,A.jsxs)("aside",{children:[(0,A.jsx)("div",{className:"workflow-versions",children:(0,A.jsx)(nX.A,{trigger:["click"],menu:{onClick:function(e){let{key:t}=e;t!==w.id&&n(Ol(t,g))},defaultSelectedKeys:["".concat(w.id)],className:(0,iS.cx)(f.dropdownClass,f.workflowVersionDropdownClass),items:S.sort((e,t)=>t.id-e.id).map((e,t)=>({role:"button","aria-label":"version-".concat(t),key:"".concat(e.id),icon:e.current?(0,A.jsx)(ma.A,{}):null,className:(0,iS.cx)({executed:e.executed,unexecuted:!e.executed,enabled:e.enabled}),label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("strong",{children:"#".concat(e.id)}),(0,A.jsx)("time",{children:(0,eh.str2moment)(e.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:(0,A.jsxs)(e3.Ay,{type:"text","aria-label":"version",children:[(0,A.jsx)("label",{children:qE("Version")}),(0,A.jsx)("span",{children:(null==w?void 0:w.id)?"#".concat(w.id):null}),(0,A.jsx)(xm.A,{})]})})}),(0,A.jsx)(oh.A,{checked:w.enabled,onChange:j,checkedChildren:qE("On"),unCheckedChildren:qE("Off")}),(0,A.jsx)(nX.A,{menu:{items:[{role:"button","aria-label":"history",key:"history",label:qE("Show execution history"),disabled:!w.allExecuted},{role:"button","aria-label":"test",key:"test",label:qE("Execute empty test")},{role:"button","aria-label":"Retry",key:"Retry",label:qE("Retry"),disabled:!w.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:qE("Copy to new version"),disabled:!D},{role:"button","aria-label":"delete",key:"delete",label:o("Delete")},{role:"button","aria-label":"move",key:"move",label:qE("Move"),disabled:w.current}],onClick:M},children:(0,A.jsx)(e3.Ay,{"aria-label":"more",type:"text",icon:(0,A.jsx)(Le.A,{})})}),(0,A.jsx)(ct,{value:{visible:d,setVisible:u},children:(0,A.jsx)(al,{schema:Ln,components:{ExecutionResourceProvider:Lo,ExecutionLink:Bl,ExecutionStatusColumn:Bt},scope:{ExecutionRetryAction:Br}})})]})]}),(0,A.jsx)(_J,{entry:F}),(0,A.jsxs)(ox.A,{title:qE("Move workflow"),visible:p,onOk:N,onCancel:()=>{m(!1)},children:[(0,A.jsx)("p",{children:qE("Move current version to another workflow")}),(0,A.jsx)(df,{buttonAction:"submit",noCollection:!0,label:"title",actionType:"update",value:h,filterType:w.type,filterSync:w.sync,filterKey:{$ne:w.key},onChange:e=>x(e)})]})]})}let Lr=()=>{let e=(0,ep.useParams)(),{styles:t}=_F();return(0,A.jsx)("div",{className:(0,iS.cx)(t.workflowPageClass),children:(0,A.jsx)(al,{schema:{type:"void",properties:{["provider_".concat(e.id)]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["createdBy","nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:Ll}})})},Li=(0,es.createContext)({data:[],refresh:()=>{},activeKey:"",setActiveKey:()=>{},categoriesLoaded:!1}),La=()=>(0,es.useContext)(Li),Ls=(0,ec.observer)(e=>{let{value:t}=e,n=eB();return(0,A.jsx)(A.Fragment,{children:null==t?void 0:t.map(e=>(0,A.jsx)(nz.A,{color:e.color,children:n(null==e?void 0:e.name)},e.name))})},{displayName:"WorkflowCategory"}),Lc=()=>{let e=(0,ec.useForm)(),t=co(),{refresh:n}=La(),o=eC();return{async run(){await e.submit();let l=(0,ed.cloneDeep)(e.values);await o.resource("workflowCategories").create({values:{...l,type:null==t?void 0:t.categoryType}}),t.setVisible(!1),await e.reset(),n()}}},Ld=e=>(0,A.jsx)(Lu,{...e}),Lu=e=>{let{scope:t,getContainer:n,children:o,categoryType:l}=e,[r,i]=(0,es.useState)(!1),{t:a}=qV(),s=Lp(l);return(0,A.jsxs)(ct,{value:{visible:r,setVisible:i,categoryType:l},children:[(0,A.jsx)("div",{onClick:()=>i(!0),title:a("Add category"),children:o||(0,A.jsx)(sF.A,{})}),(0,A.jsx)(al,{schema:s,components:{CollectionCategory:Ls},scope:{getContainer:n,useCancelAction:hr,createOnly:!0,useCreateworkflowCategry:Lc,...t}})]})},Lp=e=>({type:"object",properties:{form:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:'{{ t("Add category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",categoryType:e,useAction:"{{ useCreateworkflowCategry }}",style:{marginLeft:"8px"}}}}}}}}}),Lm=()=>{var e;let t=tz(),n=tg(),o=null==(e=t.config)?void 0:e.collection,l=n.getCollection(o),r=o?"".concat(null==l?void 0:l.options.title,"(").concat(o,")"):"-";return(0,A.jsx)("div",{style:{textAlign:"center"},children:r})},Lh=()=>{let e=tz().eventSourceName||"-";return(0,A.jsx)("div",{style:{textAlign:"left"},children:e})},Lx=()=>{let e=tz(),t=eB(),n=oc("workflow").getTriggersOptions(),{type:o,title:l}=e,r=n.find(e=>e.value===o);return(0,A.jsx)(iV.A,{title:t(r.label),placement:"right",color:"cyan",style:{},children:(0,A.jsx)("span",{style:{display:"inline-block",maxWidth:300,textAlign:"left",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})})},Lf=()=>{let e=(0,ec.useForm)(),t=co(),{refresh:n}=La(),o=eC(),{id:l}=m3();return{async run(){await e.submit();let r=(0,ed.cloneDeep)(e.values);await o.resource("workflowCategories").update({filter:{id:l},values:{...r}}),t.setVisible(!1),await e.reset(),n()}}},Lv=e=>{let t=m3(),n=ek(()=>Promise.resolve({data:(0,ed.cloneDeep)(t)}),{...e,manual:!0}),o=co();return(0,es.useEffect)(()=>{o.visible&&n.run()},[o.visible]),n},Lg=e=>(0,A.jsx)(Ly,{...e}),Ly=e=>{let{scope:t,getContainer:n,item:o,children:l}=e,[r,i]=(0,es.useState)(!1),a=eB();return(0,A.jsx)(m1,{record:o,children:(0,A.jsxs)(ct,{value:{visible:r,setVisible:i},children:[(0,A.jsx)(A.Fragment,{children:l||(0,A.jsx)("span",{onClick:()=>i(!0),children:a('{{ t("Edit category") }}')})}),(0,A.jsx)(al,{schema:Lb,scope:{getContainer:n,useCancelAction:hr,createOnly:!0,useEditCategry:Lf,useValuesFromRecord:Lv,...t}})]})})},Lb={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},"x-component":"Action.Modal",title:'{{ t("Edit category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useEditCategry }}",style:{marginLeft:"8px"}}}}}}}}},LC=e=>{let{params:t,filter:n={},...o}=e,l=tz(),r={...o,params:{...t,filter:{...null==t?void 0:t.filter,key:l.key}}};return(0,A.jsx)(lV,{...r})},LS=(0,ec.observable)({value:"",item:{}}),Lw={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Trigger type", { ns: "'.concat(qB,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:"{{getTriggersOptions()}}"},required:!0}},{type:"belongsToMany",name:"category",target:"workflowCategories",sourceKey:"key",foreignKey:"workflowKey",otherKey:"categoryId",targetKey:"id",sortBy:"sort",through:"workflowCategory",collectionName:"workflows",interface:"m2m",uiSchema:{title:'{{t("Category", { ns: "'.concat(qB,'" })}}'),type:"array","x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"name"}}}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:'{{t("Status", { ns: "'.concat(qB,'" })}}'),type:"string",enum:[{label:'{{t("On", { ns: "'.concat(qB,'" })}}'),value:!0,color:"#52c41a"},{label:'{{t("Off", { ns: "'.concat(qB,'" })}}'),value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:'{{t("Executed", { ns: "'.concat(qB,'" })}}'),type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"},{name:"updatedAt",type:"date",interface:"updatedAt",uiSchema:{type:"datetime",title:qz("Updated at"),"x-component":"DatePicker","x-component-props":{showTime:!0}}},{name:"updatedBy",type:"belongsTo",interface:"updatedBy",target:"users",targetKey:"id",foreignKey:"updatedById",collectionName:"workflows",uiSchema:{type:"object",title:'{{t("Last updated by")}}',"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{value:"id",label:"nickname"}}}}]},LF={name:"workflowCategories",fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"input",uiSchema:{title:'{{t("Type")}}',type:"string","x-component":"Input"}}]},Lj={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem",default:"general-action","x-hidden":!0},sync:{type:"boolean",title:'{{ t("Execute mode", { ns: "'.concat(qB,'" }) }}'),"x-decorator":"FormItem","x-component":"SyncOptionSelect",default:!0,"x-component-props":{options:[{label:'{{ t("Queue Mode", { ns: "'.concat(qB,'" }) }}'),value:!1,tooltip:'{{ t("Will be executed in the background as a queued task.", { ns: "'.concat(qB,'" }) }}')},{label:'{{ t("Transactional Mode", { ns: "'.concat(qB,'" }) }}'),value:!0,tooltip:'{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "'.concat(qB,'" }) }}')}]}},category:{"x-collection-field":"workflows.category","x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{multiple:!0,service:{params:{filter:{$and:[{type:{$ne:"approval"}}]}}}}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:'{{ t("Auto delete history when execution is on end status", { ns: "'.concat(qB,'" }) }}'),"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},LA=()=>{let{form:e}=Tm();return LS.value&&(e.values.category=[LS.item]),{form:e}},Lk={type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{body:{type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"".concat(Lw.name,":create"),"x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:Lw},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{assignedValues:{},triggerWorkflows:[],pageMode:!1}}}},title:Lj.title,category:Lj.category,type:Lj.type,sync:Lj.sync,description:Lj.description,options:Lj.options}}}}}}}},LI={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"".concat(Lw.name,":update"),"x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:Lw,params:{appends:["category"]}},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"},"x-action-settings":{isDeltaChanged:!0}}}},title:Lj.title,category:Lj.category,type:Lj.type,enabled:Lj.enabled,sync:Lj.sync,description:Lj.description,options:Lj.options}}}}}}}},LP={type:"void",title:'{{t("Duplicate", { ns: "'.concat(qB,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Duplicate to new workflow", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},category:{"x-collection-field":"workflows.category","x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{multiple:!0,service:{params:{filter:{$and:[{type:{$ne:"approval"}}]}}}}},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useRevisionAction }}"}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"}}}}}}},LT={type:"void",title:'{{t("Test", { ns: "'.concat(qB,'" })}}'),"x-component":"Action.Link",properties:{modal:{type:"void",title:'{{t("Test workflow", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal",properties:{params:{type:"string",title:'{{t("Input")}}',description:'{{t("Data is the trigger variable, it can be { data: 0 }, or { data: { id: 0 }}", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormItem",default:'{ "data":{} }',"x-component":"CodeMirror","x-component-props":{height:"50vh",defaultLanguage:"json"}},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){let{t:e}=(0,eT.useTranslation)(),{refresh:t}=t6(),n=nt(),{setVisible:o}=co(),l=nM(),{values:r}=(0,ec.useForm)();return{async run(){try{let e=JSON.parse(r.params);await n.test({filterByTk:l,values:e}),t(),o(!1)}catch(e){console.error(e)}}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"}}}}}}};function LN(e){let{isOver:t,setNodeRef:n}=(0,eq.useDroppable)({id:e.id,data:e.data});return(0,A.jsx)("div",{ref:n,style:t?{color:"green"}:void 0,children:e.children})}function LM(e){let{attributes:t,listeners:n,setNodeRef:o}=(0,eq.useDraggable)({id:e.id,data:e.data});return(0,A.jsx)("div",{ref:o,...n,...t,children:(0,A.jsx)("div",{children:e.children})})}let LD=(0,ec.observer)(e=>{let{item:t}=e;return(0,A.jsx)(LN,{id:t.id.toString(),data:t,children:(0,A.jsx)("div",{children:(0,A.jsx)(LM,{id:t.id.toString(),data:t,children:(0,A.jsx)(LR,{item:t})})})})},{displayName:"TabTitle"}),LR=e=>{let{item:t}=e,{t:n}=(0,eT.useTranslation)(),o=eB();return(0,A.jsxs)(of.A,{children:[(0,A.jsx)(r1.A,{color:t.color}),n(o(t.name))]})},Lq=(0,ec.observer)(e=>{let[t,n]=(0,es.useState)(null),{refresh:o}=La(),l=eC(),r=async e=>{let{active:t,over:r}=e;setTimeout(()=>{n(null)}),r&&r.id!==t.id&&(await l.resource("workflowCategories").move({sourceId:t.id,targetId:r.id}),o())},i=(0,eq.useSensor)(eq.MouseSensor,{activationConstraint:{distance:10}}),a=(0,eq.useSensors)(i);return(0,A.jsxs)(eq.DndContext,{sensors:a,onDragEnd:r,onDragStart:function(e){var t;n(null==(t=e.active)?void 0:t.data.current)},children:[e.children,(0,A.jsx)(eq.DragOverlay,{children:t?(0,A.jsx)("span",{style:{whiteSpace:"nowrap"},children:(0,A.jsx)(LR,{item:t})}):null})]})},{displayName:"DndProvider"}),L_={type:"void",properties:{provider:{type:"void","x-decorator":(0,ec.observer)(e=>{let{params:t={}}=e,{filter:n}=lD({filterOption:null==t?void 0:t.filter}),o=(0,es.useMemo)(()=>{let e=n&&Object.keys(n).length>0?{...n}:{};return LS.value?e["category.id"]=[LS.value]:delete e["category.id"],{collection:Lw,action:"listExtended",params:{...t,filter:{...e}},rowKey:"id"}},[t,n,LS.value]),l=(null==t?void 0:t.filter)&&Object.keys(t.filter).length>0,r=n&&Object.keys(n).length>0;return(!l||r)&&(r||(null==t?void 0:t.filter)&&Object.keys(t.filter).length>0)?(0,A.jsx)(lV,{...e,...o}):null}),"x-decorator-props":{params:{filter:{current:!0,type:{$not:"approval"}},sort:["-initAt"]}},"x-component":e=>{let{children:t,params:n,type:o}=e,l=eC(),[r,i]=(0,es.useState)([]),[a,s]=(0,es.useState)(!1),[c,d]=(0,es.useState)({tab:LS.value,item:LS.item}),u=eB(),{modal:p}=eX.A.useApp(),m=(0,es.useCallback)(async()=>{let{data:e}=await l.request({url:"workflowCategories:list",params:n});i(e.data),LS.value&&!e.data.find(e=>e.id===LS.value)&&(LS.value="",LS.item={},d({tab:"",item:{}})),s(!0)},[l,n]);(0,es.useEffect)(()=>{m()},[m]);let h=eu().memoize(e=>({items:[{key:"edit",label:(0,A.jsx)(al,{schema:{type:"void",properties:{[(0,ec.uid)()]:{"x-component":"EditWorkflowCategory","x-component-props":{item:e}}}}})},{key:"delete",label:u("{{t('Delete category')}}"),onClick:()=>{var t;return t=e.id,void p.confirm({title:u("{{t('Delete category')}}"),content:u("{{t('Are you sure you want to delete it?')}}"),onOk:async()=>{await l.resource("workflowCategories").destroy({filter:{id:t}}),d({tab:"",item:{}}),LS.value="",LS.item={},m()}})}}]}));return(0,A.jsx)(Li.Provider,{value:{data:r,refresh:m,activeKey:c.tab,setActiveKey:e=>d({tab:e,item:r.find(t=>t.id===e)}),categoriesLoaded:a},children:(0,A.jsx)(Lq,{children:(0,A.jsx)(wd.A,{addIcon:(0,A.jsx)(al,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddWorkflowCategory","x-component-props":{type:"primary",categoryType:o}}}}}),type:"editable-card",activeKey:c.tab,onChange:e=>{let t=r.find(t=>t.id===e);d({tab:e,item:t}),LS.value=e,LS.item=t,""===e&&m()},defaultActiveKey:c.tab||"",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:[{id:"",name:qE("All"),closable:!1}].concat(r).filter(e=>e&&null!=e.name&&null!=e.id).map(e=>({label:""!==e.id?(0,A.jsx)("div",{"data-no-dnd":"true",children:(0,A.jsx)(LD,{item:e})}):u(e.name),key:e.id,closable:e.closable,closeIcon:(0,A.jsx)(nX.A,{menu:h(e),children:(0,A.jsx)(ss.A,{role:"button","aria-label":u(e.name),style:{padding:8,margin:"-8px"}})}),children:(0,A.jsx)(jY,{children:t})}))})})})},"x-component-props":{params:{paginate:!1,sort:["sort"],filter:{type:{$ne:"approval"}}},type:"workflow"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},fuzzySearch:{type:"void","x-component":"FuzzySearchInput","x-align":"left"},statusFilter:{type:"void","x-component":"EnabledStatusFilter","x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},delete:{type:"void",title:'{{t("Delete")}}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},load:{type:"void",title:'{{t("Load", { ns: "'.concat(qB,'" })}}'),"x-component":"Action","x-component-props":{icon:"UploadOutlined",openSize:"small"},properties:{modal:{type:"void",title:'{{t("Load a workflow", { ns: "'.concat(qB,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal",properties:{file:{type:"object",title:'{{ t("File") }}',required:!0,"x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{action:"attachments:create",multiple:!1}},title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input","x-reactions":{dependencies:["file"],fulfill:{state:{value:'{{$deps[0]?.title || $deps[0]?.filename || ""}}'}}}},category:{"x-collection-field":"workflows.category","x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{multiple:!0,service:{params:{filter:{$and:[{type:{$ne:"approval"}}]}}}}},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){let{t:e}=(0,eT.useTranslation)(),t=eC(),{refresh:n}=t6(),o=nt(),l=nM(),{setVisible:r}=co(),i=(0,ec.useForm)();return LS.value&&LS.item&&(i.setInitialValues({category:[LS.item]}),i.setValues({category:[LS.item]})),{async run(){let{values:a}=i,{data:s}=await t.request({url:a.file.url,baseURL:"/"});await o.load({filterByTk:l,values:{...a,workflow:s}}),cg.Ay.success(e("Operation succeeded")),n(),r(!1)}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"}}}}}}},create:Lk}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:100},title:'{{t("Name")}}',properties:{title:{type:"string","x-component":"ColumnShowTitle"}}},category:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,align:"center"},title:'{{t("Category", { ns: "'.concat(qB,'" })}}'),properties:{category:{type:"array","x-component":"WorkflowCategoryColumn","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center"},title:'{{t("Status", { ns: "'.concat(qB,'" })}}'),properties:{enabled:{type:"void","x-component":"EnabledToggle","x-component-props":{resource:"workflows"}}}},allExecuted:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(e){let t=tz();return es.createElement("a",{"aria-label":"executed-".concat(t.title),...e})}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:Ln}}}},executedTime:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:qz("Finally executed on"),"x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{executedTime:{type:"string","x-component":"ColumnExecutedTime"}}},showCollection:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:qz("Collection"),properties:{showCollection:{type:"string","x-component":"ColumnShowCollection"}}},showEventSource:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:qz("Event source"),properties:{showEventSource:{type:"string","x-component":"ColumnShowEventSource"}}},description:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0}}},updatedAt:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{sorter:!0,width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{updatedAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},updatedBy:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,align:"center",style:{display:"grid",placeItems:"center"}},properties:{updatedBy:{type:"string","x-collection-field":"workflows.updatedBy","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"TableV2.Column","x-component-props":{fixed:"right"},properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:LI,revision:LP,test:LT,delete:{type:"void",title:'{{t("Delete")}}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},dump:{type:"void",title:'{{ t("Dump") }}',"x-component":"Action.Link","x-component-props":{useAction:"{{ useDumpAction }}"}}}}}}}}}}}},LO=()=>{let{t:e}=(0,eT.useTranslation)(),{id:t}=m3(),{setVisible:n}=co(),{getAriaLabel:o}=dP("Configure");return(0,A.jsx)(eN.Link,{"aria-label":o(),to:Ol(t),onClick:()=>n(!1),children:e("Configure")})};function LB(e){let t=(0,ec.useField)(),n=oc(Lz);return(0,ec.useFormEffects)(()=>{(0,ec.onFieldChange)("type",e=>{let o=!e.value;if(e.value){let l=n.triggers.get(e.value);null!=l.sync&&(o=!0,t.setValue(l.sync))}t.setPattern(o?"disabled":"editable")})}),(0,A.jsx)(O0,{...e})}function LE(e){let{schema:t=L_,components:n,scopes:o}=e,l=(0,es.useContext)(eV),{getTriggersOptions:r}=oc(Lz);return(0,A.jsx)(tm,{collections:[Lw,Lt,LF],children:(0,A.jsx)(eV.Provider,{value:{...l,designable:!1},children:(0,A.jsx)(al,{schema:t,components:{WorkflowLink:LO,ExecutionResourceProvider:LC,ExecutionLink:Bl,OpenDrawer:O4,ExecutionStatusSelect:Be,SyncOptionSelect:LB,ExecutionStatusColumn:Bt,ColumnShowTitle:Lx,ColumnShowCollection:Lm,AddWorkflowCategory:Ld,AddWorkflowCategoryAction:Lu,EditWorkflowCategory:Lg,EditWorkflowCategoryAction:Ly,ColumnShowEventSource:Lh,ColumnExecutedTime:Bi,WorkflowCategoryColumn:Ba,EnabledStatusFilter:Bc,...n},scope:{getTriggersOptions:r,ExecutionRetryAction:Br,useCreateFormBlockProps:LA,useDumpAction:Es,useRevisionAction:Ec,...o}})})})}class LV extends eR{isWorkflowSync(e){var t;return null!=(t=this.triggers.get(e.type).sync)?t:e.sync}registerTrigger(e,t){if("function"==typeof t)this.triggers.register(e,new t);else if(t)this.triggers.register(e,t);else throw TypeError("invalid trigger type to register")}registerInstruction(e,t){if("function"==typeof t)this.instructions.register(e,new t);else if(t instanceof Od)this.instructions.register(e,t);else throw TypeError("invalid instruction type to register")}async afterAdd(){await this.pm.add(VO),await this.pm.add(Vy),await this.pm.add(Vv),await this.pm.add(El),await this.pm.add(BS),await this.pm.add(Ok),await this.pm.add(Oy),await this.pm.add(Ox),await this.pm.add(VR),await this.pm.add(Bu),await this.pm.add(VW),await this.pm.add(VC),await this.pm.add(Vp),await this.pm.add(VL),await this.pm.add(Ve),await this.pm.add(Bv),await this.pm.add(Bh)}async load(){this.addComponents(),this.app.systemSettingsManager.add("business-components.".concat(qB),{icon:"workflow",title:'{{t("Workflow", { ns: "'.concat(qB,'" })}}'),Component:LE,aclSnippet:"pm.workflow.workflows",sort:-80}),this.app.systemSettingsManager.add("business-components.".concat(qB,"/:id"),{icon:"workflow",title:'{{t("Workflow", { ns: "'.concat(qB,'" })}}')}),this.app.systemSettingsManager.add("business-components.".concat(qB,"/:id.workflow"),{icon:"workflow",title:'{{t("Workflow", { ns: "'.concat(qB,'" })}}'),Component:Lr,fullscreen:!0,groupKey:"business-components.".concat(qB)}),this.app.systemSettingsManager.add("business-components.".concat(qB,"/:id.executions"),{icon:"workflow",title:'{{t("Workflow", { ns: "'.concat(qB,'" })}}'),Component:Oc,fullscreen:!0,groupKey:"business-components.".concat(qB)}),this.app.schemaSettingsManager.add(z$),this.registerTrigger("collection",zW),this.registerTrigger("schedule",z9),this.registerInstruction("calculation",VX),this.registerInstruction("condition",zw),this.registerInstruction("end",zB),this.registerInstruction("updateorcreate",zK),this.registerInstruction("query",zE),this.registerInstruction("select",zV),this.registerInstruction("create",z_),this.registerInstruction("update",zL),this.registerInstruction("destroy",zO)}addComponents(){this.app.addComponents({WorkflowLink:qL,WorkflowPage:Lr,ExecutionPage:Oc,CollectionTreeSelect:qO})}constructor(...e){super(...e),(0,em._)(this,"triggers",new eh.Registry),(0,em._)(this,"instructions",new eh.Registry),(0,em._)(this,"getTriggersOptions",()=>Array.from(this.triggers.getEntities()).map(e=>{let[t,{title:n,...o}]=e;return{value:t,label:n,color:"gold",options:o}}))}}let Lz=LV;async function LL(e){return null}n(86760);let LG=new Nf({apiClient:{baseURL:window.__tachybase_api_base_url__||"/api/"},publicPath:window.__tachybase_public_path__||"/",plugins:[class extends eR{async afterAdd(){let e,t;this.router.setType("browser"),this.router.setBasename((e=this.app.getPublicPath(),(t=location.pathname.match(new RegExp("^".concat(e,"apps/([^/]*)/"))))?t[0]:e)),this.app.apiClient.axios.interceptors.request.use(e=>{var t,n;let o,l;return e.headers["X-Hostname"]=null==(n=window)||null==(t=n.location)?void 0:t.hostname,e.headers["X-Timezone"]=(l=String(Math.abs(o=-(new Date().getTimezoneOffset()/60))).padStart(2,"0")+":00",(o>0?"+":"-")+l),e}),await this.app.pm.add(qA)}}],ws:{url:window.__tachybase_ws_url__||"",basename:window.__tachybase_ws_path__||"/ws"},loadRemotePlugins:!0,devDynamicImport:LL}).getRootComponent(),LK=document.getElementById("root");LK&&k.createRoot(LK).render((0,A.jsx)(LG,{}))},32087:function(){"function"!=typeof Promise.withResolvers&&(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}})},48488:function(){},65708:function(){},91081:function(){},12003:function(){},54655:function(){},5552:function(){},35405:function(){}},s={};function c(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={id:e,loaded:!1,exports:{}};return a[e].call(n.exports,n,n.exports,c),n.loaded=!0,n.exports}c.m=a,c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(n,o){if(1&o&&(n=this(n)),8&o||"object"==typeof n&&n&&(4&o&&n.__esModule||16&o&&"function"==typeof n.then))return n;var l=Object.create(null);c.r(l);var r={};e=e||[null,t({}),t([]),t(t)];for(var i=2&o&&n;("object"==typeof i||"function"==typeof i)&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach(e=>{r[e]=()=>n[e]});return r.default=()=>n,c.d(l,r),l},c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,n)=>(c.f[n](e,t),t),[])),c.u=e=>"assets/async/"+e+"."+({1138:"cfe1f631",1172:"88cbb928",1182:"8f2d2f16",1199:"47f2bd4d",1202:"30ca28be",1284:"94e13e3f",1455:"2eaf90fc",1508:"d2e50b8d",1648:"c6e4b183",176:"f51cb97a",1832:"b5e1954d",1881:"517d46da",2043:"0f1aad1d",2123:"f354610d",2197:"a83e7584",2248:"de7e4743",226:"05e16e95",228:"5ce9eced",2287:"5095ac52",2339:"dcebeeac",2351:"6e886747",2381:"9d77b41f",2465:"3b6fdb5f",2502:"71a44e8b",2556:"b11fe631",2744:"3b44bb9d",2765:"f7ccff44",2769:"bec9a73d",2848:"87328c7f",2852:"c058e630",2951:"29538af5",3018:"069a46c5",3081:"81e5ea4c",3237:"520aced7",327:"e6bd1130",3386:"63466788",3448:"3a42658f",3693:"6af22124",3834:"df7f64e2",4006:"d6e11878",4026:"04858a93",4176:"f4781a6c",4248:"e2936c43",4268:"30780c48",4275:"adc79ed0",4297:"b377676e",4325:"1bb6ebd9",446:"de0d9ad3",4461:"9961a64d",4519:"2a988460",4521:"58196cf3",4594:"c64fdebd",4624:"e81dd415",4689:"66e7700f",4780:"a487d29a",4885:"1d2a3318",5019:"01513475",5043:"343699bd",505:"7d67810e",5133:"9ed72166",5195:"4ed64bf5",5221:"dfba0809",5246:"4f2abac0",5324:"794152e1",5593:"deda668b",5604:"bce3a93b",5621:"c26eccae",564:"f6d7cf79",5655:"fa2a36e2",5701:"fe3b09a9",5999:"0ee04040",602:"f010a114",6265:"988a1dd5",6335:"c7c58592",6339:"af6b544d",6422:"7d68bab5",6509:"26908636",6621:"a93ad48e",6644:"eeca0466",6647:"2878e0fd",6867:"3f618013",7091:"783bb037",7130:"f5791dee",7147:"e4db1072",7156:"3022eff3",7284:"16955956",7301:"f887f1f6",7385:"3a279b1e",7417:"ba1f62d1",7421:"bb8ec679",7487:"26ecec06",7625:"70e52d16",7633:"d2d4dac4",7660:"ac6a08d2",7682:"eb2bdf23",773:"c4bc5a4e",7765:"2d562394",792:"d8dd2807",7962:"f9d16d04",7973:"2876e356",8040:"092c4512",8090:"1ad8c1c6",81:"c304bf8b",8125:"c30582d5",823:"4ab8dfb2",8332:"35c95cf2",8377:"4b4d66ea",8381:"eb5cb5ef",8598:"07a662f4",8625:"58dbf2b7",8637:"a9b1434c",8650:"4eb3d6bd",8706:"bd5c53c2",8769:"f01afed1",8806:"5a06887a",8839:"053e2906",8875:"cc1a62fb",8890:"311b581f",9011:"03edce16",9130:"0adedd1d",9171:"53b206cd",9191:"9876d97e",9226:"af1bf751",9242:"c43f1fe9",9249:"f0b68f64",9270:"f3727fa9",9288:"bf60f304",9291:"4accb4ff",9330:"feff1dd9",9344:"59994ae6",9370:"9be8e3db",938:"8c08f1b1",9458:"9523bdf1",9507:"b1da2ea9",9556:"f3122530",9592:"01694fad",9646:"766c7014",9708:"01475dbe",9716:"476f3e02",9843:"eadc2d9d",9844:"dd777018",9854:"2036e5ff"})[e]+".js",c.miniCssF=e=>""+e+".css",c.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},c.l=function(e,t,o,l){if(n[e])return void n[e].push(t);if(void 0!==o)for(var r,i,a=document.getElementsByTagName("script"),s=0;s<a.length;s++){var d=a[s];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")=="@tego/web:"+o){r=d;break}}r||(i=!0,(r=document.createElement("script")).timeout=120,c.nc&&r.setAttribute("nonce",c.nc),r.setAttribute("data-webpack","@tego/web:"+o),r.src=e),n[e]=[t];var u=function(t,o){r.onerror=r.onload=null,clearTimeout(p);var l=n[e];if(delete n[e],r.parentNode&&r.parentNode.removeChild(r),l&&l.forEach(function(e){return e(o)}),t)return t(o)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=u.bind(null,r.onerror),r.onload=u.bind(null,r.onload),i&&document.head.appendChild(r)},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o=[],c.O=(e,t,n,l)=>{if(t){l=l||0;for(var r=o.length;r>0&&o[r-1][2]>l;r--)o[r]=o[r-1];o[r]=[t,n,l];return}for(var i=1/0,r=0;r<o.length;r++){for(var[t,n,l]=o[r],a=!0,s=0;s<t.length;s++)(!1&l||i>=l)&&Object.keys(c.O).every(e=>c.O[e](t[s]))?t.splice(s--,1):(a=!1,l<i&&(i=l));if(a){o.splice(r--,1);var d=n();void 0!==d&&(e=d)}}return e},c.p="/",l={8410:0},c.f.j=function(e,t){var n=c.o(l,e)?l[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=l[e]=[t,o]);t.push(n[2]=o);var r=c.p+c.u(e),i=Error();c.l(r,function(t){if(c.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),r=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+o+": "+r+")",i.name="ChunkLoadError",i.type=o,i.request=r,n[1](i)}},"chunk-"+e,e)}},c.O.j=e=>0===l[e],r=(e,t)=>{var n,o,[r,i,a]=t,s=0;if(r.some(e=>0!==l[e])){for(n in i)c.o(i,n)&&(c.m[n]=i[n]);if(a)var d=a(c)}for(e&&e(t);s<r.length;s++)o=r[s],c.o(l,o)&&l[o]&&l[o][0](),l[o]=0;return c.O(d)},(i=self.webpackChunk_tego_web=self.webpackChunk_tego_web||[]).forEach(r.bind(null,0)),i.push=r.bind(null,i.push.bind(i));var d=c.O(void 0,["9783","9535","354","9283"],function(){return c(87375)});d=c.O(d)})();