import{d as W,Z as U,r as Ue,w as N,W as y,ah as F,M as Y,n as X,F as on,am as ce,$ as Q,C as Ct,b as un,o as ie,c as ae,f as je,a as oe,R as sn,at as ln,h as fn,I as cn,G as dn,a0 as Ze,H as pn,i as hn,E as mn,a1 as vn,ap as gn}from"./@vue.340249d8.js";import{d as yn}from"./index.ae42b2c0.js";import"./element-plus.ab0703f2.js";import"./lodash-es.edba6135.js";import"./@vueuse.e3650918.js";import"./@element-plus.558a564d.js";import"./@popperjs.36402333.js";import"./@ctrl.b082b0c1.js";import"./dayjs.9886411c.js";import"./axios.45058a27.js";import"./async-validator.fb49d0f5.js";import"./memoize-one.4ee5c96d.js";import"./normalize-wheel-es.8aeb3683.js";import"./@floating-ui.0f9ce7c3.js";import"./lodash.3d784a58.js";import"./vue-router.9ddb0e92.js";import"./pinia.97fe9b12.js";import"./css-color-function.5c1c877d.js";import"./color.97e03886.js";import"./clone.cfa55f7b.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./ms.564e106c.js";import"./nprogress.8c276ac9.js";import"./vue-clipboard3.44194d32.js";import"./clipboard.47836ecb.js";import"./echarts.8535e5a6.js";import"./zrender.3eba8991.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.309a94da.js";/*! * @form-create/element-ui v3.2.0 * (c) 2018-2024 xaboy * Github https://github.com/xaboy/form-create * Released under the MIT License. */function et(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function _(n){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Cn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function wn(n,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cn(n)}function Sn(n){var t=$n();return function(){var r=_e(n),i;if(t){var a=_e(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return wn(this,i)}}function R(n){return On(n)||Vn(n)||Rn(n)||En()}function On(n){if(Array.isArray(n))return De(n)}function Vn(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function Rn(n,t){if(!!n){if(typeof n=="string")return De(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);if(e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set")return Array.from(n);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return De(n,t)}}function De(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e-1?[]:[n]}var Fn="fcCheckbox",An=W({name:Fn,inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:Array,default:function(){return[]}},type:String,input:Boolean,inputValue:String},emits:["update:modelValue","fc.el"],setup:function(t,e){var r=U(t.formCreateInject,"options",[]),i=U(t,"modelValue"),a=U(t,"inputValue",""),o=Ue(a.value),u=U(t,"input",!1),s=function(d){var p=R(L(i.value)),m=p.indexOf(o.value);o.value=d,m>-1&&(p.splice(m,1),p.push(d),f(p))};N(a,function(c){if(!u.value){o.value=c;return}s(c)});var l=function(){return Array.isArray(r.value)?r.value:[]},f=function(d){e.emit("update:modelValue",d)};return{options:l,value:i,onInput:f,updateCustomValue:s,makeInput:function(d){if(!!u.value)return y(d,{value:o.value,label:o.value},{default:function(){return[y(F("ElInput"),{modelValue:o.value,"onUpdate:modelValue":s},null)]}})}}},render:function(){var t,e,r=this,i=this.type==="button"?"ElCheckboxButton":"ElCheckbox",a=F(i);return y(F("ElCheckboxGroup"),Y(this.$attrs,{modelValue:this.value,"onUpdate:modelValue":this.onInput,ref:"el"}),_({default:function(){return[r.options().map(function(u,s){var l=_({},u),f=l.value,c=l.label;return delete l.value,delete l.label,y(a,Y(l,{label:f,value:f,key:i+s+"-"+f}),{default:function(){return[c||f||""]}})}),(t=(e=r.$slots).default)===null||t===void 0?void 0:t.call(e),r.makeInput(a)]}},Ce(this.$slots,["default"])))},mounted:function(){this.$emit("fc.el",this.$refs.el)}});function wt(n){n=n||new Map;var t={$on:function(r,i){var a=n.get(r),o=a&&a.push(i);o||n.set(r,[i])},$once:function(r,i){i._once=!0,t.$on(r,i)},$off:function(r,i){var a=n.get(r);a&&a.splice(a.indexOf(i)>>>0,1)},$emit:function(r){for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",e==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n))}}var In="._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame._fc-disabled ._fc-upload-btn,._fc-frame._fc-disabled .el-button{color:#999;cursor:not-allowed!important}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";we(In);var St={name:"IconCircleClose"},Pn={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},jn=oe("path",{fill:"currentColor",d:"M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z"},null,-1),kn=oe("path",{fill:"currentColor",d:"M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"},null,-1),Dn=[jn,kn];function Bn(n,t,e,r,i,a){return ie(),ae("svg",Pn,Dn)}St.render=Bn;var Ot={name:"IconDocument"},xn={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Tn=oe("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"},null,-1),Mn=[Tn];function Nn(n,t,e,r,i,a){return ie(),ae("svg",xn,Mn)}Ot.render=Nn;var Vt={name:"IconDelete"},Ln={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Un=oe("path",{fill:"currentColor",d:"M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z"},null,-1),Hn=[Un];function zn(n,t,e,r,i,a){return ie(),ae("svg",Ln,Hn)}Vt.render=zn;var Rt={name:"IconView"},Gn={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Yn=oe("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1),qn=[Yn];function Wn(n,t,e,r,i,a){return ie(),ae("svg",Gn,qn)}Rt.render=Wn;var Et={name:"IconFolderOpened"},Jn={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Kn=oe("path",{fill:"currentColor",d:"M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z"},null,-1),Xn=[Kn];function Qn(n,t,e,r,i,a){return ie(),ae("svg",Jn,Xn)}Et.render=Qn;function tt(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!Ct(n)}var Zn="fcFrame",er=W({name:Zn,props:{type:{type:String,default:"input"},field:String,helper:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},src:{type:String,required:!0},icon:{type:String,default:"IconFolderOpened"},width:{type:String,default:"500px"},height:{type:String,default:"370px"},maxLength:{type:Number,default:0},okBtnText:{type:String,default:"\u786E\u5B9A"},closeBtnText:{type:String,default:"\u5173\u95ED"},modalTitle:String,handleIcon:{type:[String,Boolean],default:void 0},title:String,allowRemove:{type:Boolean,default:!0},onOpen:{type:Function,default:function(){}},onOk:{type:Function,default:function(){}},onCancel:{type:Function,default:function(){}},onLoad:{type:Function,default:function(){}},onBeforeRemove:{type:Function,default:function(){}},onRemove:{type:Function,default:function(){}},onHandle:Function,modal:{type:Object,default:function(){return{}}},srcKey:[String,Number],modelValue:[Array,String,Number,Object],previewMask:void 0,footer:{type:Boolean,default:!0},reload:{type:Boolean,default:!0},closeBtn:{type:Boolean,default:!0},okBtn:{type:Boolean,default:!0},formCreateInject:Object},emits:["update:modelValue","change"],components:{IconFolderOpened:Et,IconView:Rt},data:function(){return{fileList:L(this.modelValue),previewVisible:!1,frameVisible:!1,previewImage:"",bus:new wt}},watch:{modelValue:function(t){this.fileList=L(t)}},methods:{close:function(){this.closeModel(!0)},closeModel:function(t){this.bus.$emit(t?"$close":"$ok"),this.reload&&(this.bus.$off("$ok"),this.bus.$off("$close")),this.frameVisible=!1},handleCancel:function(){this.previewVisible=!1},showModel:function(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},input:function(){var t=this.fileList,e=this.maxLength===1?t[0]||"":t;this.$emit("update:modelValue",e),this.$emit("change",e)},makeInput:function(){var t=this;return y(F("ElInput"),Y({type:"text",modelValue:this.fileList.map(function(e){return t.getSrc(e)}).toString(),readonly:!0},{key:1}),{append:function(){return y(F("ElButton"),{icon:F(t.icon),onClick:function(){return t.showModel()}},null)},suffix:function(){return t.fileList.length&&!t.disabled?y(F("ElIcon"),{class:"el-input__icon _fc-upload-icon",onClick:function(){t.fileList=[],t.input()}},{default:function(){return[y(St,null,null)]}}):null}})},makeGroup:function(t){return(!this.maxLength||this.fileList.length0},Function:function(t){var e=this.getType(t);return e==="Function"||e==="AsyncFunction"},getType:function(t){var e=Object.prototype.toString.call(t);return/^\[object (.*)\]$/.exec(e)[1]},empty:function(t){return t==null||Array.isArray(t)&&Array.isArray(t)&&!t.length?!0:typeof t=="string"&&!t}};["Date","Object","String","Boolean","Array","Number"].forEach(function(n){h[n]=function(t){return h.type(t,n)}});function k(n,t){return{}.hasOwnProperty.call(n,t)}var rr="fcSelect",ir=W({name:rr,inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},type:String},emits:["update:modelValue","fc.el"],setup:function(t){var e=U(t.formCreateInject,"options",[]),r=U(t,"modelValue"),i=function(){return Array.isArray(e.value)?e.value:[]};return{options:i,value:r}},render:function(){var t=this,e,r,i=function(s,l){return y(F("ElOption"),Y(s,{key:""+l+"-"+s.value}),null)},a=function(s,l){return y(F("ElOptionGroup"),{label:s.label,key:""+l+"-"+s.label},{default:function(){return[h.trueArray(s.options)&&s.options.map(function(c,d){return i(c,d)})]}})},o=this.options();return y(F("ElSelect"),Y(this.$attrs,{modelValue:this.value,"onUpdate:modelValue":function(s){return t.$emit("update:modelValue",s)},ref:"el"}),_({default:function(){return[o.map(function(s,l){return k(s||"","options")?a(s,l):i(s,l)}),(e=(r=t.$slots).default)===null||e===void 0?void 0:e.call(r)]}},Ce(this.$slots,["default"])))},mounted:function(){this.$emit("fc.el",this.$refs.el)}}),ar="fcTree",or=W({name:ar,inheritAttrs:!1,formCreateParser:{mergeProp:function(t){var e=t.prop.props;e.nodeKey||(e.nodeKey="id"),e.props||(e.props={label:"title"})}},props:{type:String,modelValue:{type:[Array,String,Number],default:function(){return[]}}},emits:["update:modelValue","fc.el"],watch:{modelValue:function(){this.setValue()}},methods:{updateValue:function(){if(!!this.$refs.tree){var t;this.type==="selected"?t=this.$refs.tree.getCurrentKey():t=this.$refs.tree.getCheckedKeys(),this.$emit("update:modelValue",t)}},setValue:function(){if(!!this.$refs.tree){var t=this.type;t==="selected"?this.$refs.tree.setCurrentKey(this.modelValue):this.$refs.tree.setCheckedKeys(L(this.modelValue))}}},render:function(){return y(F("ElTree"),Y(this.$attrs,{ref:"tree",onCheck:this.updateValue,"onNode-click":this.updateValue}),this.$slots)},mounted:function(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}}),ur="._fc-exceed .el-upload{display:none}.el-upload-list.is-disabled .el-upload{cursor:not-allowed!important}";we(ur);var Ft={name:"IconUpload"},sr={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},lr=oe("path",{fill:"currentColor",d:"M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"},null,-1),fr=[lr];function cr(n,t,e,r,i,a){return ie(),ae("svg",sr,fr)}Ft.render=cr;function nt(n,t){return{url:n,name:dr(n),uid:t}}function dr(n){return(""+n).split("/").pop()}var pr="fcUpload",hr=W({name:pr,inheritAttrs:!1,formCreateParser:{toFormValue:function(t){return L(t)},toValue:function(t,e){return e.prop.props.limit===1?t[0]||"":t}},props:{previewMask:void 0,onPreview:Function,modalTitle:String,modelValue:[Array,String]},emits:["update:modelValue","change","remove","fc.el"],data:function(){return{previewVisible:!1,previewImage:"",fileList:[]}},created:function(){this.fileList=L(this.modelValue).map(nt)},watch:{modelValue:function(t){this.fileList=L(t).map(nt)}},methods:{handlePreview:function(t){this.onPreview?this.onPreview.apply(this,arguments):(this.previewImage=t.url,this.previewVisible=!0)},update:function(t){var e=t.map(function(r){return r.url}).filter(function(r){return r!==void 0});this.$emit("update:modelValue",e)},handleCancel:function(){this.previewVisible=!1},handleChange:function(t,e){this.$emit.apply(this,["change"].concat(Array.prototype.slice.call(arguments))),t.status==="success"&&this.update(e)},handleRemove:function(t,e){this.$emit.apply(this,["remove"].concat(Array.prototype.slice.call(arguments))),this.update(e)}},render:function(){var t,e,r=this,i=L(this.modelValue).length;return y(on,null,[y(F("ElUpload"),Y({key:i,"list-type":"picture-card"},this.$attrs,{class:{"_fc-exceed":this.$attrs.limit?this.$attrs.limit<=i:!1},onPreview:this.handlePreview,onChange:this.handleChange,onRemove:this.handleRemove,fileList:this.fileList,ref:"upload"}),_({default:function(){return[((t=(e=r.$slots).default)===null||t===void 0?void 0:t.call(e))||y(F("ElIcon"),null,{default:function(){return[y(Ft,null,null)]}})]}},Ce(this.$slots,["default"]))),y(F("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,modelValue:this.previewVisible,onClose:this.handleCancel},{default:function(){return[y("img",{style:"width: 100%",src:r.previewImage},null)]}})])},mounted:function(){this.$emit("fc.el",this.$refs.upload)}});function z(n,t,e){n[t]=e}function ue(n,t){delete n[t]}function ge(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2?arguments[2]:void 0,r=!1;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a=t[i];if((r=Array.isArray(a))||h.Object(a)){var o=n[i]===void 0;if(r)r=!1,o&&z(n,i,[]);else if(a._clone&&e!==void 0)if(e)a=a.getRule(),o&&z(n,i,{});else{z(n,i,a._clone());continue}else o&&z(n,i,{});n[i]=ge(n[i],a,e)}else z(n,i,a),h.Undef(a)||(h.Undef(a.__json)||(n[i].__json=a.__json),h.Undef(a.__origin)||(n[i].__origin=a.__origin))}return e!==void 0&&Array.isArray(n)?n.filter(function(u){return!u||!u.__ctrl}):n}function Z(n){return ge({},{value:n}).value}var mr=Object.assign||function(n){for(var t,e=1;e0&&this.expandRule(e)},modelValue:{handler:function(t){var e=this;t=t||[];var r=Object.keys(this.sort),i=r.length,a=i-t.length;if(a<0){for(var o=a;o<0;o++)this.addRule(t.length+o,!0);for(var u=0;u0)for(var s=0;sthis.min&&a.push(this.delIcon(e,r)),this.sortBtn&&e&&a.push(this.sortUpIcon(e)),this.sortBtn&&e!==t-1&&a.push(this.sortDownIcon(e)),a},emitEvent:function(t,e,r,i){this.$emit.apply(this,[t].concat(R(e),[this.cacheRule[i].$f,r]))},expandRule:function(t){for(var e=0;e0&&this.expandRule(e)},render:function(){var t=this,e=this.sort,r=this.button,i=this.form,a=this.disabled,o=e.length===0?this.$slots.default?this.$slots.default({vm:this,add:this.add}):y("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",onClick:this.add},null):e.map(function(u,s){var l=t.cacheRule[u],f=l.rule,c=l.options,d=r&&!a?t.makeIcon(e.length,s,u):[];return y("div",{class:"_fc-group-container",key:u},[y(i,Y({key:u},{disabled:a,"onUpdate:modelValue":function(m){return t.formData(u,m)},"onEmit-event":function(m){for(var C=arguments.length,w=new Array(C>1?C-1:0),E=1;E4){var e=n.trim(),r=!1;try{if(e.indexOf(xe)>0&&e.indexOf(Be)===0)e=e.replace(xe,"").replace(Be,""),r=!0;else if(e.indexOf(it)===0)e=e.replace(it,""),r=!0;else if(e.indexOf(ot)===0){var i=e.replace(ot,"");return e=function(){for(var u=arguments.length,s=new Array(u),l=0;l-1&&A.splice(P,1)}else V.subForm()},S=null;return pn(function(){var b="",V=i.option&&i.option.globalClass||{};Object.keys(V).forEach(function(A){var P="";V[A].style&&Object.keys(V[A].style).forEach(function(G){P+=me(G)+":"+V[A].style[G]+";"}),V[A].content&&(P+=V[A].content+";"),P&&(b+=".".concat(A,"{").concat(P,"}"))}),i.option&&i.option.style&&(b+=i.option.style),b&&(S=document.createElement("style"),S.type="text/css",S.innerHTML=b,document.head.appendChild(S))}),hn(function(){p.mounted()}),mn(function(){S&&document.head.removeChild(S),E(),d.destroyed=!0,p.unmount()}),vn(function(){p.updated()}),N(f,function(b){b?w():E()},{immediate:!0}),N(function(){return R(s.value)},function(b){p.$handle.isBreakWatch()||b.length===d.renderRule.length&&b.every(function(V){return d.renderRule.indexOf(V)>-1})||(p.$handle.reloadRule(s.value),a.setupState.renderRule())}),N(function(){return i.option},function(){p.initOptions(),m.refresh()},{deep:!0}),N(function(){return[i.disabled,i.preview]},function(){m.refresh()}),N(l,function(b){JSON.stringify(b||{})!==d.updateValue&&(m.config.forceCoverValue?m.coverValue(b||{}):m.setValue(b||{}))},{deep:!0}),_(_({fc:ce(p),parent:o&&ce(o),fapi:ce(m)},Ze(d)),{},{refresh:function(){++d.unique},renderRule:function(){d.renderRule=R(s.value||[])},updateValue:function(V){if(!d.destroyed){var A=JSON.stringify(V);d.updateValue!==A&&(d.updateValue=A,a.emit("update:modelValue",V))}}})},created:function(){var i=je();i.emit("update:api",i.setupState.fapi),i.setupState.fc.init()}})}var kt=["props"],Dt=["class","style","directives"],Bt=["on"],ne=function n(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=[].concat(kt,R(r.normal||[])),a=[].concat(Dt,R(r.array||[])),o=[].concat(Bt,R(r.functional||[])),u=r.props||[];return t.reduce(function(s,l){for(var f in l)if(s[f])if(u.indexOf(f)>-1)s[f]=n([l[f]],s[f]);else if(i.indexOf(f)>-1)s[f]=_(_({},s[f]),l[f]);else if(a.indexOf(f)>-1){var c=s[f]instanceof Array?s[f]:[s[f]],d=l[f]instanceof Array?l[f]:[l[f]];s[f]=[].concat(R(c),R(d))}else if(o.indexOf(f)>-1)for(var p in l[f])if(s[f][p]){var m=s[f][p]instanceof Array?s[f][p]:[s[f][p]],C=l[f][p]instanceof Array?l[f][p]:[l[f][p]];s[f][p]=[].concat(R(m),R(C))}else s[f][p]=l[f][p];else if(f==="hook")for(var w in l[f])s[f][w]?s[f][w]=Ir(s[f][w],l[f][w]):s[f][w]=l[f][w];else s[f]=l[f];else i.indexOf(f)>-1||o.indexOf(f)>-1||u.indexOf(f)>-1?s[f]=_({},l[f]):a.indexOf(f)>-1?s[f]=l[f]instanceof Array?R(l[f]):T(l[f])==="object"?_({},l[f]):l[f]:s[f]=l[f];return s},e)},Ir=function(t,e){return function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)}},Te=["type","slot","emitPrefix","value","name","native","hidden","display","inject","options","emit","link","prefix","suffix","update","sync","optionsTo","key","slotUpdate","computed","preview","component","cache","modelEmit"],be=["validate","children","control"],$e=["effect"];function xt(){return[].concat(Te,R(kt),R(Dt),R(Bt),be,$e)}function Tt(n,t){return{value:n,enumerable:!1,configurable:!1,writable:!!t}}function ze(n,t){return Mt([n],t||!1)[0]}function Mt(n,t){return ge([],R(n),t||!1)}function re(n,t){return ne(Array.isArray(t)?t:[t],n,{array:be,normal:$e}),n}function lt(n){var t=h.Function(n.getRule)?n.getRule():n;return t.type||(t.type="input"),t}function Pr(n,t){return n?(Object.keys(t||{}).forEach(function(e){t[e]&&(n[e]=re(n[e]||{},t[e]))}),n):t}function Nt(n,t){Object.defineProperties(n,Object.keys(t).reduce(function(e,r){return e[r]={get:function(){return t[r]()}},e},{}))}function he(n){return n.__fc__||(n.__origin__?n.__origin__.__fc__:null)}function B(n,t){try{t=n()}catch(e){Rr(e)}return t}function Ve(){var n={},t=function(r){return r||"default"};return{setSlot:function(r,i){r=t(r),!(!i||Array.isArray(i)&&i.length)&&(n[r]||(n[r]=[]),n[r].push(i))},getSlot:function(r,i){r=t(r);var a=[];return(n[r]||[]).forEach(function(o){if(Array.isArray(o))a.push.apply(a,R(o));else if(h.Function(o)){var u=o.apply(void 0,R(i||[]));Array.isArray(u)?a.push.apply(a,R(u)):a.push(u)}else h.Undef(o)||a.push(o)}),a},getSlots:function(){var r=this,i={};return Object.keys(n).forEach(function(a){i[a]=function(){for(var o=arguments.length,u=new Array(o),s=0;s":function(t,e){return t>e},">=":function(t,e){return t>=e},"<":function(t,e){return t-1},notOn:function(t,e){return!se.on(t,e)},in:function(t,e){return e&&e.indexOf&&e.indexOf(t)>-1},notIn:function(t,e){return!se.in(t,e)},between:function(t,e){return t>e[0]&&te[1]},empty:function(t){return h.empty(t)},notEmpty:function(t){return!h.empty(t)},pattern:function(t,e){return new RegExp(e,"g").test(t)}};function Lt(){return{props:{},on:{},options:[],children:[],hidden:!1,display:!0,value:void 0}}function M(n,t){return function(e,r,i){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=new Ge(n,e,r,i,a);return t&&(h.Function(t)?t(o):o.props(t)),o}}function Ge(n,t,e,r,i){this._data=$(Lt(),{type:n,title:t,field:e,value:r,props:i||{}}),this.event=this.on}$(Ge.prototype,{getRule:function(){return this._data},setProp:function(t,e){return z(this._data,t,e),this},modelField:function(t){return this._data.modelField=t,this},_clone:function(){var t=new this.constructor;return t._data=ze(this._data),t}});function Ut(n){n.forEach(function(t){Ge.prototype[t]=function(e){return re(this._data,D({},t,arguments.length<2?e:D({},e,arguments[1]))),this}})}Ut(xt());var kr=M("");function Dr(n,t,e){var r=kr("",t);return r._data.type=n,r._data.title=e,r}function Br(){return{create:Dr,factory:M}}function xr(n,t,e){var r="fail to ".concat(n," ").concat(e.status,"'"),i=new Error(r);return i.status=e.status,i.url=n,i}function dt(n){var t=n.responseText||n.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}function Ht(n){if(!(typeof XMLHttpRequest>"u")){var t=new XMLHttpRequest,e=n.action;t.onerror=function(o){n.onError(o)},t.onload=function(){if(t.status<200||t.status>=300)return n.onError(xr(e,n,t),dt(t));n.onSuccess(dt(t))},t.open(n.method||"get",e,!0);var r;n.data&&((n.dataType||"").toLowerCase()!=="json"?(r=new FormData,Object.keys(n.data).map(function(a){r.append(a,n.data[a])})):(r=JSON.stringify(n.data),t.setRequestHeader("content-type","application/json"))),n.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);var i=n.headers||{};Object.keys(i).forEach(function(a){i[a]!==null&&t.setRequestHeader(a,i[a])}),t.send(r)}}function Tr(n){return new Promise(function(t,e){Ht(_(_({},n),{},{onSuccess:function(i){var a=function(s){return s},o=te(n.parse);h.Function(o)?a=o:o&&h.String(o)&&(a=function(s){return o.split(".").forEach(function(l){s&&(s=s[l])}),s}),t(a(i))},onError:function(i){e(i)}}))})}function de(n){return Z(n)}function Mr(n){function t(a){return h.Undef(a)?a=n.fields():Array.isArray(a)||(a=[a]),a}function e(a,o,u){t(a).forEach(function(s){n.getCtxs(s).forEach(function(l){z(l.rule,o,u),n.$render.clearCache(l)})})}function r(){var a=n.subForm;return Object.keys(a).reduce(function(o,u){var s=a[u];return s&&(Array.isArray(s)?o.push.apply(o,R(s)):o.push(s)),o},[])}var i={get config(){return n.options},set config(a){n.fc.options.value=a},get options(){return n.options},set options(a){n.fc.options.value=a},get form(){return n.form},get rule(){return n.rules},get parent(){return n.vm.setupState.parent&&n.vm.setupState.parent.setupState.fapi},get top(){return i.parent?i.parent.top:i},get children(){return r()},formData:function(o){return t(o).reduce(function(u,s){var l=n.getFieldCtx(s);return l&&(u[l.field]=de(l.rule.value)),u},n.options.appendValue!==!1?de(n.appendData):{})},getValue:function(o){var u=n.getFieldCtx(o);if(!!u)return de(u.rule.value)},coverValue:function(o){var u=_({},o||{});n.deferSyncValue(function(){i.fields().forEach(function(s){var l=n.fieldCtx[s];if(l){var f=k(o,s);l.forEach(function(c){c.rule.value=f?o[s]:void 0}),delete u[s]}}),$(n.appendData,u)})},setValue:function(o){var u=o;arguments.length>=2&&(u=D({},o,arguments[1])),n.deferSyncValue(function(){Object.keys(u).forEach(function(s){var l=n.fieldCtx[s];if(!l)return n.appendData[s]=u[s];l.forEach(function(f){f.rule.value=u[s]})})})},removeField:function(o){var u=n.getCtx(o);return n.deferSyncValue(function(){n.getCtxs(o).forEach(function(s){s.rm()})},!0),u?u.origin:void 0},removeRule:function(o){var u=o&&he(o);if(!!u)return u.rm(),u.origin},fields:function(){return n.fields()},append:function(o,u,s){var l=n.sort.length-1,f,c=n.getCtx(u);if(c)if(s){if(f=c.getPending("children",c.rule.children),!Array.isArray(f))return;l=c.rule.children.length-1}else l=c.root.indexOf(c.origin),f=c.root;else f=n.rules;f.splice(l+1,0,o)},prepend:function(o,u,s){var l=0,f,c=n.getCtx(u);if(c)if(s){if(f=c.getPending("children",c.rule.children),!Array.isArray(f))return}else l=c.root.indexOf(c.origin),f=c.root;else f=n.rules;f.splice(l,0,o)},hidden:function(o,u){e(u,"hidden",!!o),n.refresh()},hiddenStatus:function(o){var u=n.getCtx(o);if(!!u)return!!u.rule.hidden},display:function(o,u){e(u,"display",!!o),n.refresh()},displayStatus:function(o){var u=n.getCtx(o);if(!!u)return!!u.rule.display},disabled:function(o,u){t(u).forEach(function(s){n.getCtxs(s).forEach(function(l){z(l.rule.props,"disabled",!!o)})}),n.refresh()},all:function(o){return Object.keys(n.ctxs).map(function(u){var s=n.ctxs[u];return o?s.origin:s.rule})},model:function(o){return n.fields().reduce(function(u,s){var l=n.fieldCtx[s][0];return u[s]=o?l.origin:l.rule,u},{})},component:function(o){return Object.keys(n.nameCtx).reduce(function(u,s){var l=n.nameCtx[s].map(function(f){return o?f.origin:f.rule});return u[s]=l.length===1?l[0]:l,u},{})},bind:function(){return i.form},reload:function(o){n.reloadRule(o)},updateOptions:function(o){n.fc.updateOptions(o),i.refresh()},onSubmit:function(o){i.updateOptions({onSubmit:o})},sync:function(o){if(Array.isArray(o)){o.forEach(function(s){return i.sync(s)});return}var u=h.Object(o)?he(o):n.getCtxs(o);!u||(u=Array.isArray(u)?u:[u],u.forEach(function(s){if(!s.deleted){var l=n.subForm[s.id];l&&(Array.isArray(l)?l.forEach(function(f){f.refresh()}):l&&l.refresh()),n.$render.clearCache(s)}}),n.refresh())},refresh:function(){r().forEach(function(o){o.refresh()}),n.$render.clearCacheAll(),n.refresh()},refreshOptions:function(){n.$manager.updateOptions(n.options),i.refresh()},hideForm:function(o){n.vm.setupState.isShow=!o},changeStatus:function(){return n.changeStatus},clearChangeStatus:function(){n.changeStatus=!1},updateRule:function(o,u){n.getCtxs(o).forEach(function(s){$(s.rule,u)})},updateRules:function(o){Object.keys(o).forEach(function(u){i.updateRule(u,o[u])})},mergeRule:function(o,u){n.getCtxs(o).forEach(function(s){re(s.rule,u)})},mergeRules:function(o){Object.keys(o).forEach(function(u){i.mergeRule(u,o[u])})},getRule:function(o,u){var s=n.getCtx(o);if(s)return u?s.origin:s.rule},getRenderRule:function(o){var u=n.getCtx(o);if(u)return u.prop},getRefRule:function(o){var u=n.getCtxs(o);if(u){var s=u.map(function(l){return l.rule});return s.length===1?s[0]:s}},setEffect:function(o,u,s){var l=n.getCtx(o);l&&u&&(u[0]==="$"&&(u=u.substr(1)),k(l.rule,"$"+u)&&z(l.rule,"$"+u,s),k(l.rule,"effect")||(l.rule.effect={}),z(l.rule.effect,u,s))},clearEffectData:function(o,u){var s=n.getCtx(o);s&&(u&&u[0]==="$"&&(u=u.substr(1)),s.clearEffectData(u),i.sync(o))},updateValidate:function(o,u,s){s?i.mergeRule(o,{validate:u}):e(o,"validate",u)},updateValidates:function(o,u){Object.keys(o).forEach(function(s){i.updateValidate(s,o[s],u)})},refreshValidate:function(){i.refresh()},resetFields:function(o){t(o).forEach(function(u){n.getCtxs(u).forEach(function(s){n.$render.clearCache(s),s.rule.value=de(s.defaultValue)})})},method:function(o,u){var s=i.el(o);if(!s||!s[u])throw new Error(Pt("err","".concat(u,"\u65B9\u6CD5\u4E0D\u5B58\u5728")));return function(){return s[u].apply(s,arguments)}},exec:function(o,u){for(var s=arguments.length,l=new Array(s>2?s-2:0),f=2;f2?l-2:0),c=2;c1?s-1:0),f=1;f0?this.$render.render():(this.vm.setupState.unique=1,[])}})}function qr(n){Object.defineProperties(n.origin,{__fc__:Tt(ce(n),!0)})}function Gt(n,t,e){var r=Se(),i=!!t.field;$(this,{id:r,ref:r,wrapRef:r+"fi",rule:t,origin:t.__origin__||t,name:t.name,pending:{},none:!1,watch:[],linkOn:[],root:[],ctrlRule:[],children:[],parent:null,group:t.subRule?this:null,cacheConfig:null,prop:_({},t),computed:{},payload:{},refRule:{},input:i,el:void 0,exportEl:void 0,defaultValue:i?Z(e):void 0,field:t.field||void 0}),this.updateType(),this.updateKey(),qr(this),this.update(n,!0)}$(Gt.prototype,{getParentGroup:function(){for(var t=this.parent;t;){if(t.group)return t;t=t.parent}},loadChildrenPending:function(){var t=this,e=this.rule.children||[];return Array.isArray(e)?e:this.loadPending({key:"children",origin:e,def:[],onLoad:function(i){t.$handle&&t.$handle.loadChildren(i,t)},onUpdate:function(i,a){t.$handle&&(i===a?t.$handle.loadChildren(i,t):t.$handle.updateChildren(t,i,a))},onReload:function(i){t.$handle?t.$handle.updateChildren(t,[],i):delete t.pending.children}})},loadPending:function(t){var e=this,r=t.key,i=t.origin,a=t.def,o=t.onLoad,u=t.onReload,s=t.onUpdate;if(this.pending[r]&&this.pending[r].origin===i)return this.getPending(r,a);delete this.pending[r];var l=i;if(h.Function(i)){var f=B(function(){return i({rule:e.rule,api:e.$api,update:function(d){var p=d||a,m=e.getPending(r,a);e.setPending(r,i,p),s&&s(p,m)},reload:function(){var d=e.getPending(r,a);delete e.pending[r],u&&u(d),e.$api&&e.$api.sync(e.rule)}})});f&&h.Function(f.then)?(f.then(function(c){var d=c||a;e.setPending(r,i,d),o&&o(d),e.$api&&e.$api.sync(e.rule)}).catch(function(c){console.error(c)}),l=a,this.setPending(r,i,l)):(l=f||a,this.setPending(r,i,l),o&&o(l))}return l},getPending:function(t,e){return this.pending[t]&&this.pending[t].value||e},setPending:function(t,e,r){this.pending[t]={origin:e,value:Q(r)}},effectData:function(t){return this.payload[t]||(this.payload[t]={}),this.payload[t]},clearEffectData:function(t){t===void 0?this.payload={}:delete this.payload[t]},updateKey:function(t){this.key=Se(),t&&this.parent&&this.parent.updateKey(t)},updateType:function(){this.originType=this.rule.type,this.type=ee(this.rule.type)},setParser:function(t){this.parser=t,t.init(this)},initProp:function(){var t=this,e=_({},this.rule);delete e.children,this.prop=re({},[e].concat(R(Object.keys(this.payload).map(function(r){return t.payload[r]})),[this.computed]))},initNone:function(){this.none=!(h.Undef(this.prop.display)||!!this.prop.display)},injectValidate:function(){var t=this;return L(this.prop.validate).map(function(e){if(h.Function(e.validator)){var r=_({},e),i=t;return r.validator=function(){for(var a,o=arguments.length,u=new Array(o),s=0;s>>0,1),$(this,{deleted:!0,prop:_({},this.rule),computed:{},el:t,$handle:t,$render:t,$api:t,vm:t,vNode:t,parent:null,children:[],cacheConfig:null,none:!1})},rmCtrl:function(){this.ctrlRule.forEach(function(t){return t.__fc__&&t.__fc__.rm()}),this.ctrlRule=[]},rm:function(){var t=this,e=function(){var i=t.root.indexOf(t.origin);i>-1&&(t.root.splice(i,1),t.$handle&&t.$handle.refresh())};if(this.deleted){e();return}this.$handle.noWatch(function(){t.$handle.deferSyncValue(function(){t.rmCtrl(),e(),t.$handle.rmCtx(t),$(t,{root:[]})},t.input)})},update:function(t,e){$(this,{deleted:!1,$handle:t,$render:t.$render,$api:t.api,vm:t.vm,trueType:t.getType(this.originType),vNode:t.$render.vNode,updated:!1,cacheValue:this.rule.value}),!e&&this.unwatch(),this.watchTo(),this.link()}});function Wr(n){$(n.prototype,{nextRefresh:function(e){var r=this,i=this.loadedId;X(function(){i===r.loadedId&&(e?e():r.refresh())})},parseRule:function(e){var r=this,i=lt(e);return Object.defineProperties(i,{__origin__:Tt(e,!0)}),Jr(i),this.appendValue(i),[i,i.prefix,i.suffix].forEach(function(a){!a||r.loadFn(a,i)}),this.loadCtrl(i),i.update&&(i.update=te(i.update)),i},loadFn:function(e,r){var i=this;["on","props","deep"].forEach(function(a){e[a]&&i.parseInjectEvent(r,e[a])})},loadCtrl:function(e){e.control&&e.control.forEach(function(r){r.handle&&(r.handle=te(r.handle))})},syncProp:function(e){var r=this,i=e.rule;h.trueArray(i.sync)&&ne([{on:i.sync.reduce(function(a,o){return a["update:".concat(o)]=function(u){i.props[o]=u,r.vm.emit("sync",o,u,i,r.fapi)},a},{})}],e.computed)},loadRule:function(){var e=this;this.cycleLoad=!1,this.loading=!0,this.pageEnd&&this.bus.$emit("load-start"),this.deferSyncValue(function(){if(e._loadRule(e.rules),e.loading=!1,e.cycleLoad&&e.pageEnd)return e.loadRule();e.syncForm(),e.pageEnd&&e.bus.$emit("load-end"),e.vm.setupState.renderRule()})},loadChildren:function(e,r){if(this.cycleLoad=!1,this.loading=!0,this.bus.$emit("load-start"),this._loadRule(e,r),this.loading=!1,this.cycleLoad)return this.loadRule();this.syncForm(),this.bus.$emit("load-end"),this.$render.clearCache(r)},_loadRule:function(e,r){var i=this,a=function s(l){var f=e[l-1];if(!f||!f.__fc__)return l>0?s(l-1):-1;var c=i.sort.indexOf(f.__fc__.id);return c>-1?c:s(l-1)},o=function(l,f){h.trueArray(l)&&i._loadRule(l,f)},u=e.map(function(s,l){if(!(r&&!h.Object(s))&&!(!i.pageEnd&&!r&&l>=i.first)){if(s.__fc__&&s.__fc__.root===e&&i.ctxs[s.__fc__.id])return o(s.__fc__.loadChildrenPending(),s.__fc__),s.__fc__;var f=lt(s),c=function(){return!!(f.field&&i.fieldCtx[f.field]&&i.fieldCtx[f.field][0]!==s.__fc__)};i.ruleEffect(f,"init",{repeat:c()}),c()&&i.vm.emit("repeat-field",s,i.api);var d,p=!1,m=!!s.__fc__,C=f.value;if(m){d=s.__fc__,C=d.defaultValue;var w=!d.check(i);if(d.deleted){if(w){if(ht(d))return;d.update(i)}}else if(w){if(ht(d))return;e[l]=s=s._clone?s._clone():ze(s),d=null,p=!0}}if(d)d.originType!==d.rule.type&&(d.updateType(),i.bindParser(d)),i.appendValue(d.rule),d.parent&&d.parent!==r&&i.rmSubRuleData(d);else{var E=i.parseRule(s);d=new Gt(i,E,C),i.bindParser(d)}i.parseEmit(d),i.syncProp(d),d.parent=r||null,d.root=e,i.setCtx(d),!p&&!m&&i.effect(d,"load"),i.effect(d,"created");var S=d.loadChildrenPending();if(d.parser.loadChildren===!1||o(S,d),!r){var b=a(l);b>-1||!l?i.sort.splice(b+1,0,d.id):i.sort.push(d.id)}var V=d.rule;return d.updated||(d.updated=!0,h.Function(V.update)&&i.bus.$once("load-end",function(){i.refreshUpdate(d,V.value,"init")}),i.effect(d,"loaded")),i.refreshControl(d)&&(i.cycleLoad=!0),d}}).filter(function(s){return!!s});r&&(r.children=u)},refreshControl:function(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl:function(e){var r=this,i=Kr(e),a=[],o=this.api;if(!i.length)return!1;for(var u=function(p){var m=i[p],C=m.handle||function(E){return(se[m.condition||"=="]||se["=="])(E,m.value)};if(!h.trueArray(m.rule))return"continue";var w=_(_({},m),{},{valid:B(function(){return C(e.rule.value,o)}),ctrl:Xr(e,m.rule),isHidden:h.String(m.rule[0])});if(w.valid&&w.ctrl||!w.valid&&!w.ctrl&&!w.isHidden)return"continue";a.push(w)},s=0;s>>0,1).length>0;return o.length||delete this[a][r],u},getFieldCtx:function(e){return(this.fieldCtx[e]||[])[0]},getNameCtx:function(e){return this.nameCtx[e]||[]},setCtx:function(e){var r=e.id,i=e.field,a=e.name,o=e.rule;this.ctxs[r]=e,a&&this.setIdCtx(e,a,"name"),e.input&&(this.setIdCtx(e,i,"field"),this.setFormData(e,e.parser.toFormValue(o.value,e)),this.isMounted&&!this.reloading&&this.vm.emit("change",e.field,o.value,e.origin,this.api))},getParser:function(e){var r=this.fc.parsers;return r[e.originType]||r[ee(e.type)]||r[e.trueType]||Me},bindParser:function(e){e.setParser(this.getParser(e))},getType:function(e){var r=this.fc.CreateNode.aliasMap,i=r[e]||r[ee(e)]||e;return ee(i)},noWatch:function(e){this.noWatchFn||(this.noWatchFn=e),B(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx:function(e){var r=this,i=xt();if(i.filter(function(o){return o[0]!=="_"&&o[0]!=="$"&&Zr.indexOf(o)===-1}).forEach(function(o){var u=U(e.rule,o),s=o==="children";e.refRule[o]=u,e.watch.push(N(s?function(){return h.Function(u.value)?u.value:R(u.value||[])}:function(){return u.value},function(l,f){var c=u.value;if(!r.isBreakWatch()){if(s&&e.parser.loadChildren===!1){r.$render.clearCache(e),r.nextRefresh();return}if(r.watching=!0,o==="link"){e.link();return}else["props","on","deep"].indexOf(o)>-1?(r.parseInjectEvent(e.rule,c||{}),o==="props"&&e.input&&r.setFormData(e,e.parser.toFormValue(e.rule.value,e))):o==="emit"?r.parseEmit(e):o==="hidden"&&Boolean(c)!==Boolean(f)?r.$render.clearCacheAll():["prefix","suffix"].indexOf(o)>-1?c&&r.loadFn(c,e.rule):o==="type"?(e.updateType(),r.bindParser(e)):s&&(h.Function(f)&&(f=e.getPending("children",[])),h.Function(c)&&(c=e.loadChildrenPending()),r.updateChildren(e,c,f));r.$render.clearCache(e),r.refresh(),r.watching=!1}},{deep:!s,sync:s}))}),e.input){var a=U(e.rule,"value");e.watch.push(N(function(){return a.value},function(){var o=e.parser.toFormValue(a.value,e);r.isChange(e,o)&&r.setValue(e,a.value,o,!0)}))}this.bus.$once("load-end",function(){var o=e.rule.computed;!o||(T(o)!=="object"&&(o={value:o}),Object.keys(o).forEach(function(u){e.watch.push(N(function(){var s=o[u];if(!!s){var l;if(T(s)==="object"){var f=e.getParentGroup(),c=function p(m){if(m=Array.isArray(m)?{mode:"AND",group:m}:m,!h.trueArray(m.group))return!0;for(var C=m.mode==="OR",w=!0,E=0;E-1&&this.sort.splice(l,1),this.$render.clearCache(e),e.delete(),this.effect(e,"deleted"),o&&!this.fieldCtx[a]&&this.vm.emit("remove-field",a,e.rule,this.api),e.rule.__ctrl||this.vm.emit("remove-rule",e.rule,this.api),e}}})}function ti(n){$(n.prototype,{mounted:function(){var e=this,r=function(){e.isMounted=!0,e.lifecycle("mounted")};this.pageEnd?r():this.bus.$once("page-end",r)},lifecycle:function(e){this.vm.emit(e,this.api),this.emitEvent(e,this.api)},emitEvent:function(e){for(var r,i=arguments.length,a=new Array(i>1?i-1:0),o=1;o-1||(i.push(o),r.bus.$on("p:".concat(e.name,":").concat(o,":").concat(e.input?1:0),function(u,s){e[u]&&e[u].apply(e,R(s))}))}),e._used=i},watchEffect:function(e){var r=this,i={required:function(){var o,u;return(k(e.rule,"$required")?e.rule.$required:(o=e.rule)===null||o===void 0||(u=o.effect)===null||u===void 0?void 0:u.required)||!1}};Object.keys(e.rule.effect||{}).forEach(function(a){i[a]=function(){return e.rule.effect[a]}}),Object.keys(e.rule).forEach(function(a){a[0]==="$"&&(i[a.substr(1)]=function(){return e.rule[a]})}),Object.keys(i).forEach(function(a){e.watch.push(N(i[a],function(o){r.effect(e,"watch",D({},a,o))},{deep:!0}))})},ruleEffect:function(e,r,i){this.emitEffect({rule:e,input:!!e.field,type:this.getType(e.type)},r,i)},effect:function(e,r,i){this.emitEffect({rule:e.rule,input:e.input,type:e.trueType,ctx:e,custom:i},r)},getEffect:function(e,r){if(k(e,"$"+r))return e["$"+r];if(k(e,"effect")&&k(e.effect,r))return e.effect[r]},emitEffect:function(e,r,i){var a=this,o=e.ctx,u=e.rule,s=e.input,l=e.type,f=e.custom;if(!(!l||["fcFragment","fragment"].indexOf(l)>-1)){var c=f||Object.keys(u).reduce(function(d,p){return p[0]==="$"&&(d[p.substr(1)]=u[p]),d},_({},u.effect||{}));Object.keys(c).forEach(function(d){var p=a.providers[d];if(!(!p||p.input&&!s)){var m;if(!p._c)m="*";else if(p._used.indexOf(l)>-1)m=l;else return;var C=_({value:c[d],getValue:function(){return a.getEffect(u,d)}},i||{});o&&(C.getProp=function(){return o.effectData(d)},C.clearProp=function(){return o.clearEffectData(d)},C.mergeProp=function(w){return re(C.getProp(),[w])},C.id=o.id),a.bus.$emit("p:".concat(d,":").concat(m,":").concat(p.input?1:0),r,[C,u,a.api])}})}}})}function ri(n){return n.filter(function(t,e,r){return r.indexOf(t,0)===e})}function ii(n){var t=n.components;if(Array.isArray(t)){var e=ri(t.filter(function(r){return r!=="*"}));return e.length?e:!1}else return h.String(t)?[t]:!1}function J(n){var t=this;Nt(this,{options:function(){return n.options.value||{}},bus:function(){return n.bus}}),$(this,{fc:n,vm:n.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:Q({}),subRuleData:Q({}),subForm:{},form:Q({}),appendData:{},providers:{},cycleLoad:null,loadedId:1,nextTick:null,changeStatus:!1,pageEnd:!0,nextReload:function(){t.lifecycle("reload")}}),this.initData(n.rules),this.$manager=new n.manager(this),this.$render=new Ye(this),this.api=n.extendApiFn.reduce(function(e,r){return $(e,B(function(){return r(e,t)},{})),e},Mr(this))}$(J.prototype,{initData:function(t){$(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:t})},init:function(){this.appendData=_(_(_({},this.options.formData||{}),this.fc.vm.props.modelValue||{}),this.appendData),this.useProvider(),this.usePage(),this.loadRule(),this.$manager.__init(),this.lifecycle("created")},isBreakWatch:function(){return this.loading||this.noWatchFn||this.reloading},beforeFetch:function(t){var e=this;return new Promise(function(r){var i=e.options.beforeFetch&&B(function(){return e.options.beforeFetch(t,{api:e.api})});i&&h.Function(i.then)?i.then(r):r()})}});Hr(J);zr(J);Yr(J);Wr(J);Qr(J);ei(J);ti(J);ni(J);var ai="fcFragment",Re=W({name:ai,inheritAttrs:!1,props:["vnode"],render:function(){return this.vnode}});function oi(n){return Object.keys(n).map(function(t){var e=n[t],r=gn(t);if(!!r)return[r,e.value,e.arg,e.modifiers]}).filter(function(t){return!!t})}function vt(n,t){var e=n.directives;return e?(Array.isArray(e)||(e=[e]),sn(t,e.reduce(function(r,i){return r.concat(oi(i))},[]))):t}function ui(){var n={};function t(){}return $(t.prototype,{make:function(r,i,a){return vt(i,this.h(r,ft(i),a))},makeComponent:function(r,i,a){try{return vt(i,y(r,ft(i),a))}catch(o){return console.error(o),y("")}},h:function(r,i,a){var o=je().appContext.config.isNativeTag(r);o&&delete i.formCreateInject;try{return y(o?r:F(r),i,a)}catch(u){return console.error(u),y("")}},aliasMap:n}),$(t,{aliasMap:n,alias:function(r,i){n[r]=i},use:function(r){Object.keys(r).forEach(function(i){var a=me(i),o=It(i).toLocaleLowerCase(),u=r[i];[i,a,o].forEach(function(s){t.alias(i,u),t.prototype[s]=function(l,f){return this.make(u,l,f)}})})}}),t}function si(n){var t=function(e){bn(i,e);var r=Sn(i);function i(){return _n(this,i),r.apply(this,arguments)}return i}(Yt);return Object.assign(t.prototype,n),t}function Yt(n){$(this,{$handle:n,vm:n.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}$(Yt.prototype,{__init:function(){var t=this;this.$render=this.$handle.$render,this.$r=function(){var e;return(e=t.$render).renderRule.apply(e,arguments)}},updateKey:function(){this.key=Se()},init:function(){},update:function(){},beforeRender:function(){},form:function(){return this.vm.refs[this.ref]},getSlot:function(t){var e=function r(i){if(i){var a=i.slots[t];return a||r(i.setupState.parent)}};return e(this.vm)},mergeOptions:function(t,e){var r=this;return ne(t.map(function(i){return r.tidyOptions(i)}),e,this.mergeOptionsRule)},updateOptions:function(t){this.options=this.mergeOptions([t],this.getDefaultOptions()),this.update()},tidyOptions:function(t){return t},tidyRule:function(t){},mergeProp:function(t){},getDefaultOptions:function(){return{}},render:function(t){}});var li=function(t){var e={name:"loadData",_fn:[],created:function(i,a,o){this.deleted(i);var u=L(i.getValue()),s=[];u.forEach(function(l){if(l){var f=function c(){l.watch!==!1&&(t.bus.$off("p.loadData."+l.attr,c),t.bus.$once("p.loadData."+l.attr,c));var d=void 0;l.attr&&(d=t.loadData[l.attr]||l.default,l.copy!==!1&&(d=Z(d))),ve(i.getProp(),l.to||"options",d),o.sync(a)};s.push(function(){return t.bus.$off("p.loadData."+l.attr,f)}),f()}}),this._fn[i.id]=s},deleted:function(i){this._fn[i.id]&&this._fn[i.id].forEach(function(a){a()}),i.clearProp()}};return e.watch=e.created,e},Ne={name:"componentValidate",load:function(t,e,r){var i=t.getValue();i?t.getProp().validate=[{validator:function(){var o=he(e);if(o){for(var u=arguments.length,s=new Array(u),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};return q(rn,an)};Xe(fe),O.config.globalProperties.$formCreate=fe;var ye=P();O.component(ye.name,ye),a.forEach(function(Qe){B(function(){return Qe(v,O)})})}}})}if(Xe(q),nn(q),d.use({fragment:"fcFragment"}),n.install&&q.use(n),w(function(v,g){g.mixin({props:["formCreateInject"]})}),V(pi),n.inherit){var j=n.inherit;j.components&&$(t,j.components),j.parsers&&$(e,j.parsers),j.directives&&$(r,j.directives),j.modelFields&&$(i,j.modelFields),j.providers&&$(s,j.providers),j.useApps&&$(a,j.useApps),j.maker&&$(l,j.maker),j.loadData&&$(c,j.loadData),j.formulas&&$(p,j.formulas)}return q}var gt={date:"YYYY-MM-DD",month:"YYYY-MM",datetime:"YYYY-MM-DD HH:mm:ss",timerange:"HH:mm:ss",daterange:"YYYY-MM-DD",monthrange:"YYYY-MM",datetimerange:"YYYY-MM-DD HH:mm:ss",year:"YYYY"},yt="datePicker",gi={name:yt,maker:function(){return["year","month","date","dates","week","datetime","datetimeRange","dateRange","monthRange"].reduce(function(n,t){return n[t]=M(yt,{type:t.toLowerCase()}),n},{})}(),mergeProp:function(t){var e=t.prop.props;e.valueFormat||(e.valueFormat=gt[e.type]||gt.date)}},Fe="hidden",yi={name:Fe,maker:D({},Fe,function(n,t){return M(Fe)("",n,t)}),render:function(){return[]}},Ae="input",_i={name:Ae,maker:function(){var n=["password","url","email","text","textarea"].reduce(function(t,e){return t[e]=M(Ae,{type:e}),t},{});return n.idate=M(Ae,{type:"date"}),n}(),mergeProp:function(t){var e=t.prop.props;e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},_t="slider",bi={name:_t,maker:{sliderRange:M(_t,{range:!0})},toFormValue:function(t,e){var r=Array.isArray(t),i=e.prop.props,a=i.min||0,o;return i.range===!0?o=r?t:[a,parseFloat(t)||a]:o=r?parseFloat(t[0])||a:parseFloat(t),o}},Ie="timePicker",$i={name:Ie,maker:{time:M(Ie,function(n){return n.props.isRange=!1}),timeRange:M(Ie,function(n){return n.props.isRange=!0})},mergeProp:function(t){var e=t.prop.props;e.valueFormat||(e.valueFormat="HH:mm:ss")}},Ci={name:"FcRow",render:function(t,e){return e.vNode.col({props:{span:24}},{default:function(){return[e.vNode.row(e.prop,t)]}})}},wi="select",Si={name:wi,toFormValue:function(t,e){return e.prop.props.multiple&&!Array.isArray(t)?L(t):t}},Oi=[gi,yi,_i,bi,$i,Ci,Si],I="el",Vi={button:I+"-button",icon:I+"-icon",slider:I+"-slider",rate:I+"-rate",upload:"fc-upload",cascader:I+"-cascader",popover:I+"-popover",tooltip:I+"-tooltip",colorPicker:I+"-colorPicker",timePicker:I+"-time-picker",timeSelect:I+"-time-select",datePicker:I+"-date-picker",switch:I+"-switch",select:"fc-select",checkbox:"fc-checkbox",radio:"fc-radio",inputNumber:I+"-input-number",number:I+"-input-number",input:I+"-input",formItem:I+"-form-item",form:I+"-form",frame:"fc-frame",col:I+"-col",row:I+"-row",tree:"fc-tree",autoComplete:I+"-autocomplete",auto:I+"-autocomplete",group:"fc-group",object:"fc-sub-form",subForm:"fc-sub-form"};function Ri(){return{form:{inline:!1,labelPosition:"right",labelWidth:"125px",disabled:!1,size:void 0},row:{show:!0,gutter:0},submitBtn:{type:"primary",loading:!1,disabled:!1,innerText:"\u63D0\u4EA4",show:!0,col:void 0,click:void 0},resetBtn:{type:"default",loading:!1,disabled:!1,innerText:"\u91CD\u7F6E",show:!1,col:void 0,click:void 0}}}function Ei(n){return n.type==="tooltip"}function bt(n,t){if(!!k(n,t)&&h.String(n[t])){var e;n[t]=(e={},D(e,t,n[t]),D(e,"show",!0),e)}}function K(n){return n===!1}function Fi(n,t){k(n,t)&&!h.Object(n[t])&&(n[t]={show:!!n[t]})}function Pe(n){var t=_({},n);return delete t.children,t}var Ai={validate:function(){var t=this.form();return t?t.validate():new Promise(function(e){return e()})},validateField:function(t){var e=this;return new Promise(function(r,i){var a=e.form();a?a.validateField(t,function(o,u){u?i(u):r(o)}):r()})},clearValidateState:function(t){var e=this.vm.refs[t.wrapRef];e&&e.clearValidate()},tidyOptions:function(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(function(e){Fi(t,e)}),t},tidyRule:function(t){var e=t.prop;return bt(e,"title"),bt(e,"info"),e},mergeProp:function(t){t.prop=ne([{info:this.options.info||{},wrap:this.options.wrap||{},col:this.options.col||{},title:this.options.title||{}},t.prop],{info:{trigger:"hover",placement:"top-start",icon:!0},title:{},col:{span:24},wrap:{}},{normal:["title","info","col","wrap"]})},getDefaultOptions:function(){return Ri()},update:function(){var t=this.options.form;this.rule={props:_({},t),on:{submit:function(r){r.preventDefault()}},class:[t.className,t.class,"form-create",this.options.preview?"is-preview":""],style:t.style,type:"form"}},beforeRender:function(){var t=this.key,e=this.ref,r=this.$handle;$(this.rule,{key:t,ref:e}),$(this.rule.props,{model:r.formData})},render:function(t){var e=this;return t.slotLen()&&!this.options.preview&&t.setSlot(void 0,function(){return e.makeFormBtn()}),this.$r(this.rule,K(this.options.row.show)?t.getSlots():[this.makeRow(t)])},makeWrap:function(t,e){var r=this,i=t.prop,a="".concat(this.key).concat(t.key),o=i.col,u=this.isTitle(i),s=!o.labelWidth&&!u?0:o.labelWidth,l=this.rule.props,f=l.inline,c=l.col,d=K(i.wrap.show)?e:this.$r(ne([i.wrap,{props:_(_({labelWidth:s===void 0?s:It(s),label:u?i.title.title:void 0},Pe(i.wrap||{})),{},{prop:t.id,rules:t.injectValidate()}),class:i.className,key:"".concat(a,"fi"),ref:t.wrapRef,type:"formItem"}]),_({default:function(){return e}},u?{label:function(){return r.makeInfo(i,a,t)}}:{}));return f===!0||K(c)||K(o.show)?d:this.makeCol(i,a,[d])},isTitle:function(t){if(this.options.form.title===!1)return!1;var e=t.title;return!(!e.title&&!e.native||K(e.show))},makeInfo:function(t,e,r){var i=this,a=_({},t.title),o=_({},t.info),u=Ei(o),s=this.options.form,l=this.getSlot("title"),f=[l?l({title:a.title||"",rule:r.rule,options:this.options}):(a.title||"")+(s.labelSuffix||s["label-suffix"]||"")];if(!K(o.show)&&(o.info||o.native)&&!K(o.icon)){var c={type:o.type||"popover",props:Pe(o),key:"".concat(e,"pop")};delete c.props.icon,delete c.props.show,delete c.props.info,delete c.props.align,delete c.props.native;var d="content";o.info&&!k(c.props,d)&&(c.props[d]=o.info),f[o.align!=="left"?"unshift":"push"](this.$r(ne([o,c]),D({},a.slot||(u?"default":"reference"),function(){return i.$r({type:"ElIcon",style:"top:2px",key:"".concat(e,"i")},{default:function(){return i.$r({type:o.icon===!0?"icon-warning":o.icon})}},!0)})))}var p=ne([a,{props:Pe(a),key:"".concat(e,"tit"),type:a.type||"span"}]);return delete p.props.show,delete p.props.title,delete p.props.native,this.$r(p,f)},makeCol:function(t,e,r){var i=t.col;return this.$r({class:i.class,type:"col",props:i||{span:24},key:"".concat(e,"col")},r)},makeRow:function(t){var e=this.options.row||{};return this.$r({type:"row",props:e,class:e.class,key:"".concat(this.key,"row")},t)},makeFormBtn:function(){var t=[];if(K(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),K(this.options.resetBtn.show)||t.push(this.makeResetBtn()),!!t.length){var e=this.$r({type:"formItem",key:"".concat(this.key,"fb")},t);return this.rule.props.inline===!0?e:this.$r({type:"col",props:{span:24},key:"".concat(this.key,"fc")},[e])}},makeResetBtn:function(){var t=this,e=_({},this.options.resetBtn),r=e.innerText;return delete e.innerText,delete e.click,delete e.col,delete e.show,this.$r({type:"button",props:e,class:"_fc-reset-btn",style:{width:e.width},on:{click:function(){var a=t.$handle.api;t.options.resetBtn.click?t.options.resetBtn.click(a):a.resetFields()}},key:"".concat(this.key,"b2")},[r])},makeSubmitBtn:function(){var t=this,e=_({},this.options.submitBtn),r=e.innerText;return delete e.innerText,delete e.click,delete e.col,delete e.show,this.$r({type:"button",props:e,class:"_fc-submit-btn",style:{width:e.width},on:{click:function(){var a=t.$handle.api;t.options.submitBtn.click?t.options.submitBtn.click(a):a.submit().catch(function(){})}},key:"".concat(this.key,"b1")},[r])}},le={};Ii(le);Pi(le);ji(le);ki(le);Di(le);function Ii(n){["group","tree","switch","upload","autoComplete","checkbox","cascader","colorPicker","datePicker","frame","inputNumber","radio","rate"].forEach(function(t){n[t]=M(t)}),n.auto=n.autoComplete,n.number=n.inputNumber,n.color=n.colorPicker}function Pi(n){var t="select",e="multiple";n.selectMultiple=M(t,D({},e,!0)),n.selectOne=M(t,D({},e,!1))}function ji(n){var t="tree",e={treeSelected:"selected",treeChecked:"checked"};Object.keys(e).reduce(function(r,i){return r[i]=M(t,{type:e[i]}),r},n)}function ki(n){var t="upload",e={image:["image",0],file:["file",0],uploadFileOne:["file",1],uploadImageOne:["image",1]};Object.keys(e).reduce(function(r,i){return r[i]=M(t,function(a){return a.props({uploadType:e[i][0],maxLength:e[i][1]})}),r},n),n.uploadImage=n.image,n.uploadFile=n.file}function Di(n){var t={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};return Object.keys(t).reduce(function(e,r){return e[r]=M("frame",function(i){return i.props({type:t[r][0],maxLength:t[r][1]})}),e},n),n.frameInput=n.frameInputs,n.frameFile=n.frameFiles,n.frameImage=n.frameImages,n}var Bi=".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before,.form-create.is-preview .fc-clock{display:none!important}";we(Bi);function $t(n,t){return h.Boolean(n)?n={show:n}:!h.Undef(n)&&!h.Object(n)&&(n={show:t}),n}function xi(n,t){return{formEl:function(){return t.$manager.form()},wrapEl:function(r){var i=t.getFieldCtx(r);if(!!i)return t.vm.refs[i.wrapRef]},validate:function(r){return new Promise(function(i,a){var o=n.children,u=[t.$manager.validate()];o.forEach(function(s){u.push(s.validate())}),Promise.all(u).then(function(){i(!0),r&&r(!0)}).catch(function(s){a(s),r&&r(s),t.vm.emit("validate-fail",s,{api:n})})})},validateField:function(r,i){return new Promise(function(a,o){var u=t.getFieldCtx(r);if(!!u){var s=t.subForm[u.id],l=[t.$manager.validateField(u.id)];L(s).forEach(function(f){l.push(f.validate())}),Promise.all(l).then(function(){a(null),i&&i(null)}).catch(function(f){o(f),i&&i(f),t.vm.emit("validate-field-fail",f,{field:r,api:n})})}})},clearValidateState:function(r){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.helper.tidyFields(r).forEach(function(o){a&&i.clearSubValidateState(o),t.getCtxs(o).forEach(function(u){t.$manager.clearValidateState(u)})})},clearSubValidateState:function(r){n.helper.tidyFields(r).forEach(function(i){t.getCtxs(i).forEach(function(a){var o=t.subForm[a.id];!o||(Array.isArray(o)?o.forEach(function(u){u.clearValidateState()}):o&&o.clearValidateState())})})},btn:{loading:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;n.submitBtnProps({loading:!!r})},disabled:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;n.submitBtnProps({disabled:!!r})},show:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;n.submitBtnProps({show:!!r})}},resetBtn:{loading:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;n.resetBtnProps({loading:!!r})},disabled:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;n.resetBtnProps({disabled:!!r})},show:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;n.resetBtnProps({show:!!r})}},submitBtnProps:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=$t(t.options.submitBtn,!0);$(i,r),t.options.submitBtn=i,n.refreshOptions()},resetBtnProps:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=$t(t.options.resetBtn,!1);$(i,r),t.options.resetBtn=i,n.refreshOptions()},submit:function(r,i){return new Promise(function(a,o){n.validate().then(function(){var u=n.formData();h.Function(r)&&B(function(){return r(u,n)}),h.Function(t.options.onSubmit)&&B(function(){return t.options.onSubmit(u,n)}),t.vm.emit("submit",u,n),a(u)}).catch(function(){for(var u=arguments.length,s=new Array(u),l=0;li.formData=u),api:i.fApi,"onUpdate:api":t[1]||(t[1]=u=>i.fApi=u),rule:i.rule,option:i.option},null,8,["modelValue","api","rule","option"])])}const Ca=yn(Li,[["render",Ui]]);export{Ca as default};